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

📄 vopseenc.cpp

📁 《Visual C++小波变换技术与工程实践》靳济芳编著的光盘程序。
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		m_statsVOL.nBitsHead += NUMBITS_SPRITE_VDIM;
		m_pbitstrmOut -> putBits (MARKER_BIT, 1, "Marker_Bit");
		m_statsVOL.nBitsStuffing ++;
		if (m_rctSpt.left >= 0) {
			m_pbitstrmOut -> putBits (m_rctSpt.left, NUMBITS_SPRITE_LEFT_EDGE, "SPRT_Left_Edge");
		} else {
			m_pbitstrmOut -> putBits (m_rctSpt.left & 0x00001FFFF, NUMBITS_SPRITE_LEFT_EDGE, "SPRT_Left_Edge");
		}
		m_statsVOL.nBitsHead += NUMBITS_SPRITE_LEFT_EDGE;
		m_pbitstrmOut -> putBits (MARKER_BIT, 1, "Marker_Bit");
		m_statsVOL.nBitsStuffing += 1;
		if (m_rctSpt.top >= 0) {
			m_pbitstrmOut -> putBits (m_rctSpt.top, NUMBITS_SPRITE_TOP_EDGE, "SPRT_Top_Edge");
		} else {
			m_pbitstrmOut -> putBits (m_rctSpt.top & 0x00001FFFF, NUMBITS_SPRITE_TOP_EDGE, "SPRT_Top_Edge");
		}
		m_statsVOL.nBitsHead += NUMBITS_SPRITE_TOP_EDGE; 
		m_pbitstrmOut -> putBits (MARKER_BIT, 1, "Marker_Bit");
		m_statsVOL.nBitsStuffing += 1;
// GMC
	}
	if (m_uiSprite == 1 || m_uiSprite == 2) {
// ~GMC
		m_pbitstrmOut -> putBits (m_iNumOfPnts, NUMBITS_NUM_SPRITE_POINTS, "SPRT_Num_Pnt");
		m_statsVOL.nBitsHead += NUMBITS_NUM_SPRITE_POINTS;
		m_pbitstrmOut -> putBits (m_uiWarpingAccuracy, NUMBITS_WARPING_ACCURACY, "SPRT_Warping_Accuracy");
		m_statsVOL.nBitsHead += NUMBITS_WARPING_ACCURACY;
		Bool bLightChange = 0;
		m_pbitstrmOut -> putBits (bLightChange, 1, "SPRT_Brightness_Change");
		m_statsVOL.nBitsHead++;
// GMC
	}
	if (m_uiSprite == 1) {
// ~GMC

// Begin: modified by Hughes	  4/9/98
		if (m_sptMode == BASIC_SPRITE)
			m_pbitstrmOut -> putBits (FALSE, 1, "Low_latency_sprite_enable");
		else
			m_pbitstrmOut -> putBits (TRUE, 1, "Low_latency_sprite_enable");
		m_statsVOL.nBitsHead++;
// End: modified by Hughes	  4/9/98
	}

	// HHI Schueuer sadct_disable flag inserted
	// HHI Suehring 991022 only if bitstream version=2
    if(m_volmd.uiVerID == 2) {
		if (m_volmd.fAUsage != RECTANGLE)
		{
			if (m_volmd.bSadctDisable)
				m_pbitstrmOut -> putBits (TRUE, 1, "sadct_disable");
			else
				m_pbitstrmOut -> putBits (FALSE, 1, "sadct_disable");
		}
	}
	// end sadct

	// NBIT
	m_pbitstrmOut -> putBits ((Int) m_volmd.bNot8Bit, 1, "VOL_NOT_8_BIT_VIDEO");
	m_statsVOL.nBitsHead++;
	if (m_volmd.bNot8Bit) {
		m_pbitstrmOut->putBits ((Int) m_volmd.uiQuantPrecision, 4, "QUANT_PRECISION");
		m_pbitstrmOut->putBits ((Int) m_volmd.nBits, 4, "BITS_PER_PIXEL");
		m_statsVOL.nBitsHead+=8;
	}

	if (m_volmd.fAUsage == EIGHT_BIT)	{
		m_pbitstrmOut -> putBits (m_volmd.bNoGrayQuantUpdate, 1, "VOL_Disable_Gray_Q_Update");
		m_pbitstrmOut -> putBits (0, 1, "Composition_Method");
		m_pbitstrmOut -> putBits (1, 1, "Linear_Composition");
		m_statsVOL.nBitsHead+=3;
	}
	m_pbitstrmOut -> putBits ((Int) m_volmd.fQuantizer, 1, "VOL_Quant_Type"); 
	m_statsVOL.nBitsHead++;
	if (m_volmd.fQuantizer == Q_MPEG) {
		m_pbitstrmOut -> putBits (m_volmd.bLoadIntraMatrix, 1, "VOL_Load_Q_Matrix (intra)");
		m_statsVOL.nBitsHead++;
		if (m_volmd.bLoadIntraMatrix) {
			UInt i = 0;
			do {
				m_pbitstrmOut -> putBits (m_volmd.rgiIntraQuantizerMatrix [grgiStandardZigzag[i]], NUMBITS_QMATRIX, "VOL_Quant_Matrix(intra)");
				m_statsVOL.nBitsHead += NUMBITS_QMATRIX;
			} while (m_volmd.rgiIntraQuantizerMatrix [grgiStandardZigzag[i]] != 0 && ++i < BLOCK_SQUARE_SIZE);
			for (UInt j = i; j < BLOCK_SQUARE_SIZE; j++) {
				m_volmd.rgiIntraQuantizerMatrix [grgiStandardZigzag[j]] = m_volmd.rgiIntraQuantizerMatrix [grgiStandardZigzag[i - 1]];
			}
		}
		m_pbitstrmOut -> putBits (m_volmd.bLoadInterMatrix, 1, "VOL_Load_Q_Matrix (inter)");
		m_statsVOL.nBitsHead++;
		if (m_volmd.bLoadInterMatrix) {
			UInt i = 0;
			do {
				m_pbitstrmOut -> putBits (m_volmd.rgiInterQuantizerMatrix [grgiStandardZigzag[i]], NUMBITS_QMATRIX, "VOL_Quant_Matrix(intra)");
				m_statsVOL.nBitsHead += NUMBITS_QMATRIX;
			} while (m_volmd.rgiInterQuantizerMatrix [grgiStandardZigzag[i]] != 0 && ++i < BLOCK_SQUARE_SIZE);
			for (UInt j = i; j < BLOCK_SQUARE_SIZE; j++) {
				m_volmd.rgiInterQuantizerMatrix [grgiStandardZigzag[j]] = m_volmd.rgiInterQuantizerMatrix [grgiStandardZigzag[i - 1]];
			}
		}
		if (m_volmd.fAUsage == EIGHT_BIT)	{
      for(Int iAuxComp=0; iAuxComp<m_volmd.iAuxCompCount; iAuxComp++ ) { // MAC (SB) 2-Dec-99
        m_pbitstrmOut -> putBits (m_volmd.bLoadIntraMatrixAlpha, 1, "VOL_Load_Alpha_Q_Matrix (intra)");
        m_statsVOL.nBitsHead++;
        if (m_volmd.bLoadIntraMatrixAlpha) {
          for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {
            m_pbitstrmOut -> putBits (m_volmd.rgiIntraQuantizerMatrixAlpha[0] [grgiStandardZigzag[i]], NUMBITS_QMATRIX, "VOL_Alpha_Quant_Matrix(intra)");
            m_statsVOL.nBitsHead += NUMBITS_QMATRIX;
          }
        }
        m_pbitstrmOut -> putBits (m_volmd.bLoadInterMatrixAlpha, 1, "VOL_Load_Alpha_Q_Matrix (inter)");
        m_statsVOL.nBitsHead++;
        if (m_volmd.bLoadInterMatrixAlpha) {
          for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {
            m_pbitstrmOut -> putBits (m_volmd.rgiInterQuantizerMatrixAlpha[0] [grgiStandardZigzag[i]], NUMBITS_QMATRIX, "VOL_Alpha_Quant_Matrix(inter)");
            m_statsVOL.nBitsHead += NUMBITS_QMATRIX;
          }
        }
			}
		}
	}

  if(m_volmd.uiVerID == 2){ // GMC for Version ID
    // m_volmd.uiVerID is added for compatibility with version 1 video
    // this is tentative integration
    // please change codes if there is any problems
    // Quarter Sample
	m_pbitstrmOut -> putBits (m_volmd.bQuarterSample, 1, "VOL_Quarter_Sample");
	m_statsVOL.nBitsHead += 1;
    // ~Quarter Sample
  }

	// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 16 Jun 1998
	m_pbitstrmOut -> putBits (m_volmd.bComplexityEstimationDisable,
							  1, "complexity_estimation_disable");
	m_statsVOL.nBitsHead += 1;
	if (! m_volmd.bComplexityEstimationDisable) {

		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999
		assert ((m_volmd.iEstimationMethod == 0) || (m_volmd.iEstimationMethod == 1));
		// Replaced line: m_volmd.iEstimationMethod = 0; // only known estimation method at now (18 Jun 1998)
		// iEstimationMethod is now initialized in CSessionEncoder::CSessionEncoder(...)
		// END: Complexity Estimation syntax support - Update version 2

		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 11 Nov 1999
		// Following lines not necessary: redundant flags to avoid start code emulation
		//  are already computed in sesenc.cpp

		/*
		m_volmd.bShapeComplexityEstimationDisable =
		  !(m_volmd.bOpaque ||
			m_volmd.bTransparent ||
			m_volmd.bIntraCAE ||
			m_volmd.bInterCAE ||
			m_volmd.bNoUpdate ||
			m_volmd.bUpsampling);

		m_volmd.bTextureComplexityEstimationSet1Disable =
		  !(m_volmd.bIntraBlocks ||
			m_volmd.bInterBlocks ||
			m_volmd.bInter4vBlocks ||
			m_volmd.bNotCodedBlocks);

		m_volmd.bTextureComplexityEstimationSet2Disable =
		  !(m_volmd.bDCTCoefs ||
			m_volmd.bDCTLines ||
			m_volmd.bVLCSymbols ||
			m_volmd.bVLCBits);

		m_volmd.bMotionCompensationComplexityDisable =
		  !(m_volmd.bAPM ||
			m_volmd.bNPM ||
			m_volmd.bInterpolateMCQ ||
			m_volmd.bForwBackMCQ ||
			m_volmd.bHalfpel2 ||
			m_volmd.bHalfpel4);

		if (m_volmd.iEstimationMethod == 1) {
			m_volmd.bVersion2ComplexityEstimationDisable =
			  !(m_volmd.bSadct ||
				m_volmd.bQuarterpel);
		}
		*/
		// END: Complexity Estimation syntax support - Update version 2

		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999
		// line: assert ((m_volmd.iEstimationMethod == 0) || (m_volmd.iEstimationMethod == 1));
		//  changed and moved at the beginning of this block
		// END: Complexity Estimation syntax support - Update version 2

		m_pbitstrmOut -> putBits (m_volmd.iEstimationMethod, 2, "estimation_method");
		m_statsVOL.nBitsHead += 2;

		m_pbitstrmOut -> putBits (m_volmd.bShapeComplexityEstimationDisable,
								  1, "shape_complexity_estimation_disable");
		m_statsVOL.nBitsHead += 1;
		if (! m_volmd.bShapeComplexityEstimationDisable) {
			m_pbitstrmOut -> putBits (m_volmd.bOpaque, 1, "opaque");
			m_pbitstrmOut -> putBits (m_volmd.bTransparent, 1, "transparent");
			m_pbitstrmOut -> putBits (m_volmd.bIntraCAE, 1, "intra_cae");
			m_pbitstrmOut -> putBits (m_volmd.bInterCAE, 1, "inter_cae");
			m_pbitstrmOut -> putBits (m_volmd.bNoUpdate, 1, "no_update");
			m_pbitstrmOut -> putBits (m_volmd.bUpsampling, 1, "upsampling");
			m_statsVOL.nBitsHead += 6;
		}

		m_pbitstrmOut -> putBits (m_volmd.bTextureComplexityEstimationSet1Disable,
								  1, "texture_complexity_estimation_set_1_disable");
		m_statsVOL.nBitsHead += 1;
		if (! m_volmd.bTextureComplexityEstimationSet1Disable) {
			m_pbitstrmOut -> putBits (m_volmd.bIntraBlocks, 1, "intra_blocks");
			m_pbitstrmOut -> putBits (m_volmd.bInterBlocks, 1, "inter_blocks");
			m_pbitstrmOut -> putBits (m_volmd.bInter4vBlocks, 1, "inter4v_blocks");
			m_pbitstrmOut -> putBits (m_volmd.bNotCodedBlocks, 1, "not_coded_blocks");
			m_statsVOL.nBitsHead += 4;
		}

		m_pbitstrmOut -> putBits (1, 1, "Marker_Bit");
		m_statsVOL.nBitsStuffing ++;

		m_pbitstrmOut -> putBits (m_volmd.bTextureComplexityEstimationSet2Disable,
								  1, "texture_complexity_estimation_set_2_disable");
		m_statsVOL.nBitsHead += 1;
		if (! m_volmd.bTextureComplexityEstimationSet2Disable) {
			m_pbitstrmOut -> putBits (m_volmd.bDCTCoefs, 1, "dct_coefs");
			m_pbitstrmOut -> putBits (m_volmd.bDCTLines, 1, "dct_lines");
			m_pbitstrmOut -> putBits (m_volmd.bVLCSymbols, 1, "vlc_symbols");
			m_pbitstrmOut -> putBits (m_volmd.bVLCBits, 1, "vlc_bits");
			m_statsVOL.nBitsHead += 4;
		}

		m_pbitstrmOut -> putBits (m_volmd.bMotionCompensationComplexityDisable,
								  1, "motion_compensation_complexity_disable");
		m_statsVOL.nBitsHead += 1;
		if (! m_volmd.bMotionCompensationComplexityDisable) {
			m_pbitstrmOut -> putBits (m_volmd.bAPM, 1, "apm");
			m_pbitstrmOut -> putBits (m_volmd.bNPM, 1, "npm");
			m_pbitstrmOut -> putBits (m_volmd.bInterpolateMCQ, 1, "interpolate_mc_q");
			m_pbitstrmOut -> putBits (m_volmd.bForwBackMCQ, 1, "forw_back_mc_q");
			m_pbitstrmOut -> putBits (m_volmd.bHalfpel2, 1, "halfpel2");
			m_pbitstrmOut -> putBits (m_volmd.bHalfpel4, 1, "halfpel4");
			m_statsVOL.nBitsHead += 6;
		}

		m_pbitstrmOut -> putBits (1, 1, "Marker_Bit");
		m_statsVOL.nBitsStuffing ++;

		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999
		if (m_volmd.iEstimationMethod == 1) {
			m_pbitstrmOut -> putBits (m_volmd.bVersion2ComplexityEstimationDisable,
									  1, "version2_complexity_estimation_disable");
			m_statsVOL.nBitsHead += 1;
			if (! m_volmd.bVersion2ComplexityEstimationDisable) {
				m_pbitstrmOut -> putBits (m_volmd.bSadct, 1, "sadct");
				m_pbitstrmOut -> putBits (m_volmd.bQuarterpel, 1, "quarterpel");
				m_statsVOL.nBitsHead += 2;
			}
		}
		// END: Complexity Estimation syntax support - Update version 2
	}
	// END: Complexity Estimation syntax support
//RESYNC_MARKER_FIX
	m_pbitstrmOut -> putBits (m_volmd.bResyncMarkerDisable , 1, "VOL_resync_marker_disable");
//	m_pbitstrmOut -> putBits (0, 1, "VOL_resync_marker_disable");
//~RESYNC_MARKER_FIX
	m_statsVOL.nBitsHead ++;

	//	Modified by Toshiba(1998-4-7)
	m_pbitstrmOut -> putBits (m_volmd.bDataPartitioning, 1, "VOL_data_partitioning");
	m_statsVOL.nBitsHead ++;
	if( m_volmd.bDataPartitioning )
	{
		m_pbitstrmOut -> putBits (m_volmd.bReversibleVlc, 1, "VOL_reversible_vlc");
		m_statsVOL.nBitsHead ++;
	}
	//	End Toshiba

// NEWPRED
	if(m_volmd.uiVerID != 1) { 
		m_pbitstrmOut -> putBits(m_volmd.bNewpredEnable, NUMBITS_NEWPRED_ENABLE, "*VOL_newpred_enable");
		m_statsVOL.nBitsHead += NUMBITS_NEWPRED_ENABLE;
		if(m_volmd.bNewpredEnable) {
			m_volmd.iRequestedBackwardMessegeType = NP_REQUESTED_BACKWARD_MESSAGE_TYPE;
			m_pbitstrmOut -> putBits(m_volmd.iRequestedBackwardMessegeType, NUMBITS_REQUESTED_BACKWARD_MESSAGE_TYPE, "*VOL_requested_backward_message_type");
			m_statsVOL.nBitsHead += NUMBITS_REQUESTED_BACKWARD_MESSAGE_TYPE;
			m_pbitstrmOut -> putBits(m_volmd.bNewpredSegmentType, NUMBITS_NEWPRED_SEGMENT_TYPE, "*VOL_newpred_segment_type");
			m_statsVOL.nBitsHead += NUMBITS_NEWPRED_SEGMENT_TYPE;
		}
// RRV insertion
		m_pbitstrmOut -> putBits (m_volmd.breduced_resolution_vop_enable, 1, "reduced_resolution_vop_enable");
		m_statsVOL.nBitsHead ++;
// ~RRV
	}
// ~NEWPRED

	m_pbitstrmOut -> putBits (m_volmd.volType == ENHN_LAYER, 1, "VOL_Scalability");
	m_statsVOL.nBitsHead++;
	if (m_volmd.volType == ENHN_LAYER)	{
//#ifdef _Scalable_SONY_
		m_pbitstrmOut -> putBits (m_volmd.iHierarchyType, 1, "VOL_Hierarchy_Type");
//#endif _Scalable_SONY_
		m_pbitstrmOut -> putBits (0, 4, "VOL_Ref_Layer_Id");
		m_pbitstrmOut -> putBits (0, 1, "VOL_Ref_Layer_Sampling_Dir");
/*Added*/
		m_pbitstrmOut -> putBits (m_volmd.ihor_sampling_factor_n, 5, "VOL_Horizontal_Sampling_Factor");			//The vm is not very clear about this.
		m_pbitstrmOut -> putBits (m_volmd.ihor_sampling_factor_m, 5, "VOL_Horizontal_Sampling_Factor_Ref");		//Always 1

		m_pbitstrmOut -> putBits (m_volmd.iver_sampling_factor_n, 5, "VOL_Vertical_Sampling_Factor");			//The vm is not very clear about this.
		m_pbitstrmOut -> putBits (m_volmd.iver_sampling_factor_m, 5, "VOL_Vertical_Sampling_Factor_Ref");		//Always 1
//OBSS_SAIT_991015		//for OBSS partial enhancement mode
//OBSSFIX_MODE3
		m_pbitstrmOut -> putBits (m_volmd.iEnhnType!=0?1:0, 1, "VOL_Ehnancement_Type"); // enhancement_type for scalability
//		if ( m_volmd.fAUsage == ONE_BIT && m_volmd.iHierarchyType==0)	
//			m_pbitstrmOut -> putBits (m_volmd.iEnhnTypeSpatial!=0?1:0, 1, "VOL_Ehnancement_Type"); // enhancement_type for scalability // modified by Sharp (98/3/24)
//		else
//			m_pbitstrmOut -> putBits (m_volmd.iEnhnType!=0?1:0, 1, "VOL_Ehnancement_Type"); // enhancement_type for scalability // modified by Sharp (98/3/24)
//~OBSSFIX_MODE3
//~OBSS_SAIT_991015
		m_statsVOL.nBitsHead += 26;
//OBSS_SAIT_991015
		if ( m_volmd.fAUsage == ONE_BIT && m_volmd.iHierarchyType==0)	{
			m_pbitstrmOut -> putBits (m_volmd.iuseRefShape, 1, "VOL_Use_Ref_Shape");
			m_pbitstrmOut -> putBits (m_volmd.iuseRefTexture, 1, "VOL_Use_Ref_Texture");
			m_pbitstrmOut -> putBits (m_volmd.ihor_sampling_factor_n_shape, 5, "VOL_Horizontal_Sampling_Factor_SHAPE");		
			m_pbitstrmOut -> putBits (m_volmd.ihor_sampling_factor_m_shape, 5, "VOL_Horizontal_Sampling_Factor_Ref_SHAPE");	
			m_pbitstrmOut -> putBits (m_volmd.iver_sampling_factor_n_shape, 5, "VOL_Vertical_Sampling_Factor_SHAPE");	
			m_pbitstrmOut -> putBits (m_volmd.iver_sampling_factor_m_shape, 5, "VOL_Vertical_Sampling_Factor_Ref_SHAPE");
			m_statsVOL.nBitsHead += 22;
		}
//~OBSS_SAIT_991015
	}
// Begin: modified by Hughes	  4/9/98	  per clause 2.1.7. in N2171 document
//	m_pbitstrmOut -> putBits ((Int) 0, 1, "VOL_Random_Access");		//isn't this a system level flg?
//	m_statsVOL.nBitsHead++;
// End

⌨️ 快捷键说明

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