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

📄 datastruct.hpp

📁 《Visual C++小波变换技术与工程实践》靳济芳编著的光盘程序。
💻 HPP
📖 第 1 页 / 共 3 页
字号:
	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);

	// computePSNR.cpp
	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);

	/* 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);
	//begin added by SL@Sarnoff (03/03/99)
	//ShapeBaseCommon.cpp
	Int	GetContext ( Char a, Char b, Char c, Char d, Char e, Char f, Char g, Char h );
	Char GetShapeVL ( Char a, Char b, Char c, Char d, Char e, Char f, 
					   Char g, Char h, Char i, Char j, Char k, Char l, Int t );
	Void  	UpSampling_Still (	Int x,
			Int y,
			Int blkn,
			Int cr,
			Int blkx,
			UChar **buff,
			UChar **data,
			UChar **shape);
	Void  	AdaptiveUpSampling_Still (	UChar **BABdown,
			UChar **BABresult,
			Int sub_size	);
	Void  	DownSampling_Still (	UChar **buff,
			UChar **data,
			Int b_size,
			Int s_size	);
	Void  	AddBorderToBAB (	Int blkx,
			Int blky,
			Int blksize,
			Int cr_size,
			Int MAX_blkx,
			UChar **BABinput,
			UChar **BABresult,
			UChar **shape,
			Int flag	);
	//ShapeEnhCommon.hpp
	Int  	GetContextEnhBAB_XOR (	UChar *curr_bab_data,
			Int x2,
			Int y2,
			Int width2,
			Int pixel_type);
	Int  	GetContextEnhBAB_FULL (	UChar *lower_bab_data,
			UChar *curr_bab_data,
			Int x2,
			Int y2,
			Int width,
			Int width2	);
	Void  	AddBorderToBABs (	UChar *LowShape,
			UChar *HalfShape,
			UChar *CurShape,
			UChar *lower_bab,
			UChar *half_bab,
			UChar *curr_bab,
			UChar *bordered_lower_bab,
			UChar *bordered_half_bab,
			UChar *bordered_curr_bab,
			Int object_width,
			Int object_height,
			Int blkx,
			Int blky,
			Int mblksize,
			Int max_blkx	);
	Int		DecideScanOrder(UChar *bordered_lower_bab, Int mbsize);

	//ShapeUtil.cpp
	Void * 	mymalloc (	size_t size	);
	UChar ** 	malloc_2d_Char (	Int d1,
			Int d2	);
	Void  	free_2d_Char (	UChar **array_2d,
			Int d1	);
	Int ** 	malloc_2d_Int (	Int d1,
			Int d2	);
	Void  	free_2d_Int (	Int **array_2d,
			Int d1	);

	//end added by SL@Sarnoff (03/03/99)
};

class CVTCEncoder : public CVTCCommon, 
					public VTCIMAGEBOX,
					public VTCDWT,
					public VTCDWTMASK, // hjlee 0901
					public VTCIDWTMASK //added by SL@Sarnoff (03/03/99)
{
public:
	// Constructor and Deconstructor
	~CVTCEncoder ();
	CVTCEncoder ();

	// input/output 
	Char *m_cImagePath;
	Char *m_cOutBitsFile;
	Char *m_cSegImagePath;
	Int used_bits; // added by Sharp (99/2/16)
//added by SL@Sarnoff (03/03/99)

	BSS *ShapeBitstream;
	Int ShapeBitstreamLength;
//end: added by SL@Sarnoff (03/03/99)
	Void init(		
		UInt uiVerID, // added by Sharp (99/11/18)
		Char* cImagePath,
	    UInt uiAlphaChannel,
		Char* cSegImagePath,
		UInt uiAlphaTh,
		UInt uiChangeCRDisable,
// FPDAM begin: deleted by Sharp
//		UInt uiShapeScalable, //added by SL@Sarnoff (03/02/99)
// FPDAM end: deleted by Sharp
		UInt uiSTOConstAlpha, //added by SL@Sarnoff (03/03/99)
		UInt uiSTOConstAlphaValue, //added by SL@Sarnoff (03/02/99)
		Char* cOutBitsFile,
		UInt uiColors,
		UInt uiFrmWidth,
		UInt uiFrmHeight,
// begin: added by Sharp (99/2/16)
    UInt uiTilingEnable,
    UInt uiTilingJump,
    UInt uiTileWidth,
    UInt uiTileHeight,
// end: added by Sharp (99/2/16)
		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 uiTargetShapeLev, //added by SL@Sarnoff (03/02/99)
		UInt uiFullSizeOut, //added by SL@Sarnoff (03/02/99)
// begin: added by Sharp (99/2/16)
    UInt uiTargetTileFrom,
    UInt uiTargetTileTo,
// end: added by Sharp (99/2/16)
		UInt uiQdcY,
		UInt uiQdcUV,
		UInt uiSpatialLev ,
		UInt defaultSpatialScale, // hjlee 0901
		Int  lastWvtDecompInSpaLayer[MAXDECOMPLEV], // hjlee 0901
		SNR_PARAM* Qinfo[],
//Added by Sarnoff for error resilience, 3/5/99
		Int uiErrResiDisable,  
		Int uiPacketThresh,  
		Int uiSegmentThresh
//Added by Sarnoff for error resilience, 3/5/99
);

	// 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();

// begin: added by Sharp (99/2/16)
  Int emit_bits_local( UShort data, Int size, FILE *fp );
  Void tile_header_Enc(FILTER **filter, Int tile_id);
  Void get_orgval(DATA **Dst, Int TileID);
  Void perform_DWT_Tile(FILTER **wvtfilter, PICTURE *SrcImg, Int TileID);
  Void init_tile(Int tile_width, Int tile_height);
  long current_fp();
  Int current_put_bits();
// end: added by Sharp (99/2/16)

// FPDAM begin: modified by Sharp
	Void cut_tile_image(PICTURE *DstImage, PICTURE *SrcImage, Int iTile, Int colors, Int tile_width, Int tile_height, FILTER *filter);
	// added by Sharp (99/5/10)
// FPDAM end: modified by Sharp
 

protected:

	// vtcenc.cpp
	Void flush_buffer_file();
	Void close_buffer_file(FILE *fp);
	Void header_Enc_V1(FILTER **wvtfilter); // hjlee 0901
	Void texture_packet_header_Enc(FILTER **wvtfilter); // added by Sharp (99/4/7)
	long header_Enc(FILTER **wvtfilter); // hjlee 0901, modified by Sharp (99/2/16)
	Void header_Enc_Common(FILTER **wvtfilter, Int SkipShape = 0); // added by Sharp (99/2/16) //  @@@@@@
	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(FILE *bitfile); // hjlee 0901, Modified by Sharp (99/2/16)
	Void TextureObjectLayer_enc_V1(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); //modified by SL 03/03/99
// FPDAM begin: added by Sharp
	Void get_real_image(PICTURE *MyImage, Int wvtDecompLev, 
		       Int usemask, Int colors, Int alphaTH, 
		       FILTER *Filter);
// FPDAM end: added by Sharp
	Void get_virtual_image_V1(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);
//Added by Sarnoff for error resilience, 3/5/99
	Void init_arith_encoder_model(Int color);
	Void close_arith_encoder_model(Int color, Int mode);
	Void check_end_of_packet(Int color);
	Void force_end_of_packet();
	Void check_end_of_DC_packet(Int numBP);
	Void check_segment_size(Int col);
	Void encodeSQBlocks_ErrResi(Int y, Int x, Int n, Int c);
//End added by Sarnoff for error resilience, 3/5/99

	// 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);

	Void emit_bits_checksc(UInt code, Int size);
	Void emit_bits_checksc_init();
	Void write_to_bitstream(UChar *bitbuffer,Int total_bits);
//Added by Sarnoff for error resilience, 3/5/99
	Void write_packet_header_to_file();
//End Added by Sarnoff for error resilience, 3/5/99

	/* 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);
	// begin: added by SL@Sarnoff (03/03/99)
	// ShapeEncoding.cpp
	Int ShapeEnCoding(UChar *inmask, Int width, Int height, 
		  Int levels,  
		  Int constAlpha,
		  UChar constAlphaValue,
		  Int change_CR_disable,
		  Int shapeScalable,
		  Int startCodeEnable,
		  FILTER **filter);
	Int EncodeShapeHeader( Int constAlpha, UChar constAlphaValue, Int change_CR_disable /*, Int shapeScalable*/ ); // FPDAM : deleted by Sharp
	Int EncodeShapeBaseLayer(UChar *outmask, 
			 Int change_CR_disable,
			 Int coded_width, Int coded_height, 
			 Int levels);
	Int EncodeShapeEnhancedLayer(UChar *outmask, 
			     Int coded_width, Int coded_height, 
			     Int k, FILTER * filter, Int startCodeEnable);
	Int QuantizeShape(UChar *inmask, Int object_width, Int object_height, Int alphaTH);
	Int ByteAlignmentEnc_Still();
	Void PutBitstoStream_Still(Int bits,UInt code);

	 /* ShapeBaseEncoding.c */
	Int  	ShapeBaseEnCoding (UChar *InShape, 
	    Int object_width, Int object_height,
	    Int alphaTH, Int change_CR_disable
	);
	Void  MergeShapeBaseBitstream();
	Int
	ShapeBaseContentEncode(Int i,Int j,Int bsize,UChar **BAB,SBI *infor);
	Int
	CheckBABstatus(Int blkn,UChar **BAB1,UChar **BAB2,Int alphaTH);
	Int
	ShapeBaseHeaderEncode(Int i,Int j,Int blkx,SBI *infor);

	Int
	decide_CR(Int x,Int y,Int blkn,Int blkx, UChar **BAB_org,UChar **BAB_dwn,Int change_CR_disable,Int alphaTH,UChar **shape);


	/* ShapeEnhEncode.cpp */
	Int ShapeEnhEnCoding(UChar *LowShape, UChar *HalfShape, UChar *CurShape, 
			Int object_width, Int object_height, FILTER *filter);

//	Int DecideBABtype(UChar *bordered_lower_bab, UChar *bordered_half_bab,
//		  UChar *bordered_curr_bab,
//		  Int mbsize);
	Int DecideBABtype(UChar *bordered_lower_bab, UChar *bordered_half_bab,
		  UChar *bordered_curr_bab,
		  Int mbsize, 
		  Int scan_order // SAIT_PDAM : added by Samsung AIT 
		  );


	/*Int ShapeEnhHeaderEncode(UChar *bab_mode,
				Int blky,
				Int blkx,
			 FILTER *filter,
				BSS *bitstream,
				ArCoder *ar_coder);
	*/
//	Int ShapeEnhContentEncode(UChar *bordered_lower_bab,

⌨️ 快捷键说明

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