⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datastruct.hpp

📁 jpeg and mpeg 编解码技术源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
	// ztscanUtil.cpp
	Void clear_ZTR_D(COEFFINFO **coeffinfo, Int width, 
					Int height);
	Void probModelInitSQ(Int col);  // hjlee 0901
	Void probModelFreeSQ(Int col); // hjlee 0901
	Void setProbModelsSQ(Int col); // hjlee 0901
	Void probModelInitMQ(Int col); // hjlee 0901
	Void probModelFreeMQ(Int col); // hjlee 0901
	Void setProbModelsMQ(Int col); // hjlee 0901
	Void init_acm_maxf_enc(); // hjlee 0901
	Void init_acm_maxf_dec(); // hjlee 0901

	//ac.cpp
	Void mzte_update_model(ac_model *acm,Int sym); // hjlee 0901
	Void mzte_ac_model_init(ac_model *acm,Int nsym,
							UShort *ifreq,Int adapt,Int inc);
	Void mzte_ac_model_done(ac_model *acm);

	/* other */
	char *check_startcode (unsigned char *stream, long len);
	void one_bit_to_buffer (char bit, char *outbuffer);
	void undo_startcode_check (unsigned char *data, long len);

	/* for bilevel mode: added by Jie Liang */
    /* from PEZW_utils.c */
    PEZW_SPATIAL_LAYER *Init_PEZWdata (int color, int levels, int w, int h);
    void restore_PEZWdata (PEZW_SPATIAL_LAYER **SPlayer);
    int lshift_by_NBit (unsigned char *data, int len, int N);
	//computePSNR.cpp, added by U. Benzler 981117 
    Void ComputePSNR(UChar *orgY, UChar *recY, 
                UChar *maskY,
                UChar *orgU, UChar *recU, 
                UChar *maskU,
                UChar *orgV, UChar *recV, 
                UChar *maskV,
                Int width, Int height, Int stat);
};

Class CVTCEncoder : public CVTCCommon, 
					public VTCIMAGEBOX,
					public VTCDWT,
					public VTCDWTMASK // hjlee 0901
{
public:
	// Constructor and Deconstructor
	~CVTCEncoder ();
	CVTCEncoder ();

	// input/output 
	Char *m_cImagePath;
	Char *m_cOutBitsFile;
	Char *m_cSegImagePath;

	Void init(		
		Char* cImagePath,
	    UInt uiAlphaChannel,
		Char* cSegImagePath,
		UInt uiAlphaTh,
		UInt uiChangeCRDisable,
		Char* cOutBitsFile,
		UInt uiColors,
		UInt uiFrmWidth,
		UInt uiFrmHeight,
		UInt uiWvtType,
		UInt uiWvtDownload,  // hjlee 0901
		UInt uiWvtDecmpLev,
		UInt uiWvtUniform, // hjlee 0901
		Int* iWvtFilters,  // hjlee 0901
		UInt uiQuantType,
		UInt uiScanDirection,
		Bool bStartCodeEnable,
		UInt uiTargetSpatialLev,
		UInt uiTargetSNRLev,
		UInt uiQdcY,
		UInt uiQdcUV,
		UInt uiSpatialLev ,
		UInt defaultSpatialScale, // hjlee 0901
		Int  *lastWvtDecompInSpaLayer, // hjlee 0901
		SNR_PARAM** Qinfo);


	// attribute
	Int GetcurSpatialLev() { 
		return mzte_codec.m_iCurSpatialLev; }
	Int GetDCHeight() { 
		return mzte_codec.m_iHeight>>mzte_codec.m_iWvtDecmpLev; }
	Int GetDCWidth() { 
		return mzte_codec.m_iWidth>>mzte_codec.m_iWvtDecmpLev; }

	// operation
	Void encode();


protected:

	// vtcenc.cpp
	Void flush_buffer_file();
	Void close_buffer_file(FILE *fp);
	Void header_Enc(FILTER **wvtfilter); // hjlee 0901
	Void Put_Quant_and_Max(SNR_IMAGE *snr_image, Int spaLayer, Int color); // hjlee0901
	Void Put_Quant_and_Max_SQBB(SNR_IMAGE *snr_image, Int spaLayer,Int color); // hjlee0901

	Void textureLayerDC_Enc();
	Void TextureSpatialLayerSQNSC_enc(Int spa_lev);
	Void TextureSpatialLayerSQ_enc(Int spa_lev, FILE *bitfile);
	Void textureLayerSQ_Enc(FILE *bitfile);
	Void TextureObjectLayer_enc(FILTER **wvtfilter); // hjlee 0901
	Void textureLayerMQ_Enc(FILE *bitfile);
	Void TextureSNRLayerMQ_encode(Int spa_lev, Int snr_lev, FILE *fp);


	// read_image.cpp
	Void read_image(Char *img_path, 
					Int img_width, 
					Int img_height, 
					Int img_colors, 
					Int img_bit_depth,
					PICTURE *img);	

	Int read_segimage(Char *seg_path, Int seg_width, Int seg_height, 
		  Int img_colors,
		  PICTURE *MyImage);

	Void get_virtual_image(PICTURE *MyImage, Int wvtDecompLev, 
		       Int usemask, Int colors, Int alphaTH, 
		       Int change_CR_disable, FILTER *Filter);


	// wavelet.cpp
	Void perform_DWT(FILTER **wvtfilter); // hjlee 0901

	// ac.cpp
	Void mzte_output_bit(ac_encoder *ace,Int bit);
	Void mzte_bit_plus_follow(ac_encoder *ace,Int bit);
	Void mzte_ac_encoder_init(ac_encoder *ace);
	Int  mzte_ac_encoder_done(ac_encoder *ace);
	Int  mzte_ac_encode_symbol(ac_encoder *ace, ac_model *acm, Int sym); // hjlee 0901

	// ztscan_enc.cpp
	SInt DC_pred_pix(Int i, Int j);
	Void DC_predict(Int color);
	Void wavelet_dc_encode(Int c);
	Void cacll_encode();
	Void wavelet_higher_bands_encode_SQ_band(Int col);
	Void cachb_encode_SQ_band(SNR_IMAGE *snr_image);
//	Void encode_pixel_SQ_band(Int h,Int w);
	Void wavelet_higher_bands_encode_SQ_tree();
	Void cachb_encode_SQ_tree();  // hjlee 0928
//	Void encode_pixel_SQ_tree(Int h,Int w);  // hjlee 0928
	Void encode_pixel_SQ(Int h,Int w);  // 1124
	Void mag_sign_encode_SQ(Int h,Int w);
	Void wavelet_higher_bands_encode_MQ(Int scanDirection);
	Void mark_ZTR_D(Int h,Int w);
	Void cachb_encode_MQ_band();
//	Void encode_pixel_MQ_band(Int h,Int w);
	Void cachb_encode_MQ_tree(); // hjlee 0928
//	Void encode_pixel_MQ_tree(Int h,Int w);  // hjlee 0928
	Void encode_pixel_MQ(Int h,Int w);  // 1124
	Void mag_sign_encode_MQ(Int h,Int w);
	Void bitplane_encode(Int val,Int l,Int max_bplane); // hjlee 0901
	Void bitplane_res_encode(Int val,Int l,Int max_bplane); // hjlee 0901
//	Void encodeBlocks(Int y, Int x, Int n);  // 1124
	Void encodeSQBlocks(Int y, Int x, Int n);
	Void encodeMQBlocks(Int y, Int x, Int n);


	// encQM.cpp
	Void quantizeCoeff(Int x, Int y, Int c);
	Int quantizeAndMarkCoeffs(Int x, Int y, Int c);
	Int encQuantizeDC(Int c);
	Int encQuantizeAndMarkAC(Int c);
	Int encUpdateStateAC(Int c);


	// quant.cpp
	Int quantSingleStage(Int Q, quantState *state, 
			Int *statePrevQ,Int updatePrevQ);
	
	// bitpack.cpp
	Int get_total_bit_rate();
	Int get_total_bit_rate_dec();
	Int get_total_bit_rate_junk();
	Void flush_bytes();
	Void flush_bits1 ();
	Void flush_bits ();
	Void flush_bits_zeros ();
	Int put_param(Int value, Int nbits);
	UInt LookBitsFromStream (Int n);
	Void emit_bits_checksc(UInt code, Int size);
	Void emit_bits_checksc_init();
	Void write_to_bitstream(UChar *bitbuffer,Int total_bits);

	/* for bilevel mode: added by Jie Liang */
    /* from PEZW_textureBQ.c */
    void textureLayerBQ_Enc(FILE *bitfile);

    /* from PEZW_utils.c */
    void PEZW_bitpack (PEZW_SPATIAL_LAYER **SPlayer);
    void PEZW_freeEnc (PEZW_SPATIAL_LAYER **SPlayer);
};

Class CVTCDecoder : public CVTCCommon, 
					public VTCIMAGEBOX,
					public VTCIDWT,
					public VTCDWTMASK
{
public:
	// Constructor and Deconstructor
	~CVTCDecoder ();
	CVTCDecoder ();

	Char *m_cInBitsFile;
	Char *m_cRecImageFile;
	
	// vtcdec.cpp
	Void header_Dec(FILTER ***wvtfilter, PICTURE **Image); // hjlee 0901
	Void Get_Quant_and_Max(SNR_IMAGE *snr_image, Int spaLayer, 
					Int color); // hjlee 0901
	Void Get_Quant_and_Max_SQBB(SNR_IMAGE *snr_image, Int spaLayer, 
				   Int color); // hjlee 0901
	Void textureLayerDC_Dec();
	Void TextureSpatialLayerSQNSC_dec(Int spa_lev);
	Void TextureSpatialLayerSQ_dec(Int spa_lev, FILE *bitfile);
	Void textureLayerSQ_Dec(FILE *bitfile);
	Void TextureSNRLayerMQ_decode(Int spa_lev, Int snr_lev,FILE *fp);
// hjlee 0901
	Void textureLayerMQ_Dec(FILE *bitfile, 
			       Int  target_spatial_levels,
			       Int  target_snr_levels,
			       FILTER **wvtfilter); // hjlee 0901
				   
// hjlee 0901
	Void TextureObjectLayer_dec(Int  target_spatial_levels,
				   Int  target_snr_levels, FILTER ***pwvtfilter); // hjlee 0901


	Void decode(Char *InBitsFile, Char *RecImageFile,
				Int TargetSpaLev, Int TargetSNRLev); 

	// seg.cpp
// hjlee 0901
	Void get_virtual_mask(PICTURE *MyImage,  Int wvtDecompLev,
		      Int w, Int h, Int usemask, Int colors, FILTER **filters) ;

			  
	// decQM.c
	Void iQuantizeCoeff(Int x, Int y, Int c);
	Void iQuantizeCoeffs(Int x, Int y, Int c);
	Int decIQuantizeDC(Int c);
	Int decIQuantizeAC(Int c);
	Int decIQuantizeAC_spa(Int spa_lev,Int c);
	Int decUpdateStateAC(Int c);
	Int markCoeffs(Int x, Int y, Int c);
	Int decMarkAC(Int c);
	Int decUpdateStateAC_spa(Int c);  // hjlee 0901

	// ac.cpp
	Int mzte_input_bit(ac_decoder *acd);
	Void mzte_ac_decoder_done(ac_decoder *acd);
	Void mzte_ac_decoder_init(ac_decoder *acd);
	Int mzte_ac_decode_symbol(ac_decoder *acd,ac_model *acm); // hjlee 0901

	//ztscan_dec.cpp
	Short  iDC_pred_pix(Int i, Int j);
	Void   iDC_predict(Int color);
	Void wavelet_dc_decode(Int c);
	Void callc_decode();
	Void wavelet_higher_bands_decode_SQ_band(Int col);
	Void cachb_decode_SQ_band(SNR_IMAGE *snr_image);
//	Void decode_pixel_SQ_band(Int h,Int w); // 1124
	Void wavelet_higher_bands_decode_SQ_tree();
	Void cachb_decode_SQ_tree(); // hjlee 0901
//	Void decode_pixel_SQ_tree(Int h0,Int w0); // hjlee 0901
	Void decode_pixel_SQ(Int h,Int w); // 1124
	Void mag_sign_decode_SQ(Int h,Int w);
	Void wavelet_higher_bands_decode_MQ(Int scanDirection);
	Void cachb_decode_MQ_band();
//	Void decode_pixel_MQ_band(Int h,Int w);
	Void decode_pixel_MQ(Int h,Int w);
	Void cachb_decode_MQ_tree();
//	Void decode_pixel_MQ_tree(Int h,Int w);
	Void mark_ZTR_D(Int h,Int w);
	Void mag_sign_decode_MQ(Int h,Int w);

	Int bitplane_decode(Int l,Int max_bplane); // hjlee 0901
	Int bitplane_res_decode(Int l,Int max_bplane);  // hjlee 0901
//	Void decodeBlocks(Int y, Int x, Int n);   //1124
	Void decodeSQBlocks(Int y, Int x, Int n);
	Void decodeMQBlocks(Int y, Int x, Int n);

	// bitpack.cpp
	Int align_byte ();
	Int get_param(Int nbits);
	Void restore_arithmetic_offset(Int bits_to_go);

	// wavelet.cpp
	Void perform_IDWT(FILTER **wvtfilter,
		  Char *recImgFile); // hjlee 0901

	// write_image.cpp 
	Void write_image(Char *recImgFile, Int colors,
		 Int width, Int height,
		 Int real_width, Int real_height,
		 Int rorigin_x, Int rorigin_y,
		 UChar *outimage[3], UChar *outmask[3],
		 Int usemask, Int fullsize, Int MinLevel);

	/* for bilevel mode: added by Jie Liang */
    /* from PEZW_textureBQ.c */
    void textureLayerBQ_Dec(FILE *bitfile);
    void PEZW_decode_ratecontrol (PEZW_SPATIAL_LAYER **SPlayer, int bytes_decoded);

    /* from PEZW_utils.c */
    void PEZW_bit_unpack (PEZW_SPATIAL_LAYER **SPlayer);
    void PEZW_freeDec (PEZW_SPATIAL_LAYER **SPlayer);

	/* bitpack.cpp */
	Int get_allbits (Char *buffer);
	Int Is_startcode (long startcode);
	int align_byte1 ();
	Int get_X_bits_checksc(Int nbits);
	Void get_X_bits_checksc_init();
	int get_allbits_checksc (unsigned char *buffer);
	Int align_byte_checksc ();
    int decoded_bytes_from_bitstream ();
};

#endif /* __VTCENC_HPP_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -