#ifndef _ENTROPYENC_H #define _ENTROPYENC_H #include class EntropyEncoder{ public: EntropyEncoder(const char filename[],int parity); ~EntropyEncoder(void); void send_frame(pel_t ** (*frame_data)[3],int gq_vals[], int *mq_vals[],int pic_prop[], int **mb_prop[],int ** (*mot_vec)[2]); private: // PICTURE LAYER void picture_layer(void); void psc(void); void tr(int num); void ptype(int split_screen,int doc_camera,int freeze_pic, int format,int still_image,int spare); void pei(int sparebits); void pspare(int which); // GROUP OF BLOCKS LAYER void gob_layer(pel_t **gob[3],int num); void gbsc(void); void gn(int num); void gquant(int stepsize); void gei(int sparebits); void gspare(int which); // MACROBLOCK LAYER void mb_layer(pel_t *mb_Y[],pel_t *mb_U[],pel_t *mb_V[], int mode,int mc_present,int fil_present, int q_stepsize,int mv_dx,int mv_dy,int mb); void mba(int mb); void mtype(int pred,int mc_present,int fil_present, int mquant_present,int tcoeff_present); void mquant(int stepsize); void mvd(int dx,int dy,int mb,int mb_mc); void cbp(int p[6]); // BLOCK LAYER void block_layer(pel_t *block[]); void tcoeff(pel_t *tc[]); void send_eob(void); // TRANSMISSION BUFFER void buffer_bits(const char bits[]); void flush_frames(); void calc_parity(); void flush_buffer(); // *************************************************************** // Pointers to Data // // gquant_vals[{GOB #}]: GOB quantization vals // mquant_vals[{GOB #}][{MB #}]: MB quantization vals (-1 if no change) // motion_vectors[{_DX_,_DY_}][row][col] // pic_properties[{bit-1}]: ptype options // mb_properties[{gob #}][{mb #}][{MODE,MC_PRESENT,FIL_PRESENT}] // *************************************************************** pel_t **data[3]; int *pic_properties; int ***mb_properties; int *gquant_vals; int **mquant_vals; int **motion_vectors[2]; int num_pspare; int num_gspare; //options int use_parity; //MB variables int prev_dx,prev_dy,prev_mb,prev_mb_mc; //bit-stream output file handle ofstream outstream; //*************************************************************** // 'buffer' holds encoded data and parity check code. // 8 buffers make up one transmission frame. // for one buffer: // // Si(1) Data(BUFFER_DATA_WIDTH) // |----|-----|-----------...---------|---------------------------| // Fi(1) Parity(BUFFER_PARITY_WIDTH) //*************************************************************** unsigned char buffer[BUFFER_FRAME_WIDTH/8+1]; //*************************************************************** // COUNTERS // -------- // bit_counter: [0,BUFFER_FRAME_WIDTH-1] // 'bit_counter' starts at its max value for each // of the 8 frames in the multiframe buffer. It // keeps track of which bit the buffer has been // filled to, including Si, Fi, Data, and Parity // // s_counter: [0,7] 's_counter' keeps track of which frame is // currently being buffered //*************************************************************** int bit_counter; int s_counter; int frame_num; }; #endif /* ENTROPYENC_H */