#ifndef YUV_FRAME_H_ #define YUV_FRAME_H_ #include #include "datatypes.h" #define YROWS 288 #define YCOLS 352 #define UROWS 144 #define UCOLS 176 #define VROWS 144 #define VCOLS 176 class yuv_frame { /* functions */ public: /* constructor will create an empty yuv frame with given size * or otherwise with default cif size * note that this function will allocate space for the yuv arrays */ yuv_frame::yuv_frame(int yrows = YROWS, int ycols = YCOLS); /* constructor will create yuv frame of given size and initialize * the yuv components to the arrays given */ yuv_frame::yuv_frame(uint8* the_y_component, uint8* the_u_component, uint8* the_v_component, int yrows = YROWS, int ycols = YCOLS); /* constructor builds a yuv_frame by reading frame from file * returns on status variable either true for successful read * or false on empty file * if file contains partial data, function will terminate with error */ yuv_frame(FILE*& fp, uint8& status, int yrows = YROWS, int ycols = YCOLS); /* destructor: clear memory */ yuv_frame::~yuv_frame(); void write_ycomponent_to_file(char* filename, char* comment); /* return the number of rows */ int get_num_rows(); /* return the number of columns */ int get_num_cols(); /* variables */ public: /* y_component, u_component and v_component arrays begin from top * left of image, first along cols and then along rows * 1 -> 2 -> 3 -> 4 * 5 -> 6 -> ... */ //uint8* y_component; //uint8* u_component; //uint8* v_component; uint8 y_component[25344]; uint8 u_component[6336]; uint8 v_component[6336]; /* number of rows and columns for y component. u and v components * will contains num_rows/2 and num_cols/2 rows and columns * respectively. */ uint32 num_rows; uint32 num_cols; }; #endif