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

📄 sys_decoder_vopsedec.cpp

📁 完整的RTP RTSP代码库
💻 CPP
📖 第 1 页 / 共 5 页
字号:
				  m_volmd.bForwBackMCQ ||				  m_volmd.bHalfpel2 ||				  m_volmd.bHalfpel4)) {				fatal_error("Motion complexity estimation is enabled,\nbut no corresponding flag is enabled.");			}		}		else			m_volmd.bAPM =			m_volmd.bNPM =			m_volmd.bInterpolateMCQ =			m_volmd.bForwBackMCQ =			m_volmd.bHalfpel2 =			m_volmd.bHalfpel4 = false;				uiMark = m_pbitstrmIn -> getBits (1);		ASSERT (uiMark == 1);		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999		if (m_volmd.iEstimationMethod == 1) {			m_volmd.bVersion2ComplexityEstimationDisable = m_pbitstrmIn -> getBits (1);			if (! m_volmd.bVersion2ComplexityEstimationDisable) {				m_volmd.bSadct = m_pbitstrmIn -> getBits (1);				m_volmd.bQuarterpel = m_pbitstrmIn -> getBits (1);				if (!(m_volmd.bSadct ||					  m_volmd.bQuarterpel)) {					fatal_error("Version 2 complexity estimation is enabled,\nbut no corresponding flag is enabled.");				}			}			else				m_volmd.bSadct =				m_volmd.bQuarterpel = false;				} else {			m_volmd.bVersion2ComplexityEstimationDisable = true;			m_volmd.bSadct =			m_volmd.bQuarterpel = false;		}		// END: Complexity Estimation syntax support - Update version 2				// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 11 Nov 1999		// Main complexity estimation flag test		if (m_volmd.bShapeComplexityEstimationDisable &&		    m_volmd.bTextureComplexityEstimationSet1Disable &&		    m_volmd.bTextureComplexityEstimationSet2Disable &&		    m_volmd.bMotionCompensationComplexityDisable &&			m_volmd.bVersion2ComplexityEstimationDisable) {			fatal_error("Complexity estimation is enabled,\nbut no correponding flag is enabled.");		}		// END: Complexity Estimation syntax support - Update version 2	}	// END: Complexity Estimation syntax support	/*UInt uiResyncMarkerDisable = */m_pbitstrmIn -> getBits (1);	//	Modified by Toshiba(1998-4-7)	m_volmd.bDataPartitioning = m_pbitstrmIn -> getBits (1);	if( m_volmd.bDataPartitioning )		m_volmd.bReversibleVlc = m_pbitstrmIn -> getBits (1);	else		m_volmd.bReversibleVlc = FALSE;	//	End Toshiba// NEWPRED    if(m_volmd.uiVerID == 1)		m_volmd.bNewpredEnable = FALSE;    else if(m_volmd.uiVerID != 1)		m_volmd.bNewpredEnable = m_pbitstrmIn -> getBits (1);	if (m_volmd.bNewpredEnable) {		ASSERT (m_volmd.fAUsage == RECTANGLE);		ASSERT (m_vopmd.bInterlace == 0);		ASSERT (m_uiSprite == 0);		m_volmd.iRequestedBackwardMessegeType = m_pbitstrmIn -> getBits (2);		m_volmd.bNewpredSegmentType = m_pbitstrmIn -> getBits (1);		// generate NEWPRED object		g_pNewPredDec = new CNewPredDecoder();	}// ~NEWPRED// RRV insertion	if(m_volmd.uiVerID != 1)	{		m_volmd.breduced_resolution_vop_enable = m_pbitstrmIn -> getBits (1);	}	else	{		m_volmd.breduced_resolution_vop_enable = 0;	}	m_vopmd.RRVmode.iOnOff	= m_volmd.breduced_resolution_vop_enable;// ~RRV	//wchen: wd changes	m_volmd.volType = (m_pbitstrmIn -> getBits (1) == 0) ? BASE_LAYER : ENHN_LAYER;// NEWPRED	if (m_volmd.bNewpredEnable)		ASSERT (m_volmd.volType == BASE_LAYER);// ~NEWPRED// GMC	if(m_uiSprite == 2) ASSERT(m_volmd.volType == BASE_LAYER);// ~GMC	m_volmd.ihor_sampling_factor_n = 1;	m_volmd.ihor_sampling_factor_m = 1;	m_volmd.iver_sampling_factor_n = 1;	m_volmd.iver_sampling_factor_m = 1;	//OBSS_SAIT_991015	m_volmd.ihor_sampling_factor_n_shape = 1;	m_volmd.ihor_sampling_factor_m_shape = 1;	m_volmd.iver_sampling_factor_n_shape = 1;	m_volmd.iver_sampling_factor_m_shape = 1;	//~OBSS_SAIT_991015	if (m_volmd.volType == ENHN_LAYER)	{//#ifdef _Scalable_SONY_		m_volmd.iHierarchyType = m_pbitstrmIn->getBits (1); // 		if(m_volmd.iHierarchyType == 0)			fprintf(stdout,"Hierarchy_Type == 0 (Spatial scalability)\n");		else if(m_volmd.iHierarchyType == 1)			fprintf(stdout,"Hierarchy_type == 1 (Temporal scalability)\n");//#endif _Scalable_SONY_		m_pbitstrmIn->getBits (4);						// ref_layer_id		m_pbitstrmIn->getBits (1);						// ref_layer_samping_director		m_volmd.ihor_sampling_factor_n = m_pbitstrmIn->getBits (5);		m_volmd.ihor_sampling_factor_m = m_pbitstrmIn->getBits (5);		m_volmd.iver_sampling_factor_n = m_pbitstrmIn->getBits (5);		m_volmd.iver_sampling_factor_m = m_pbitstrmIn->getBits (5);		m_volmd.iEnhnType     = m_pbitstrmIn->getBits (1);			//enhancement_type//OBSS_SAIT_991015		if (m_volmd.fAUsage == ONE_BIT && m_volmd.iHierarchyType == 0) {						m_volmd.iuseRefShape = m_pbitstrmIn->getBits (1);						// use_ref_shape			m_volmd.iuseRefTexture = m_pbitstrmIn->getBits (1);						// use_ref_texture			m_volmd.ihor_sampling_factor_n_shape = m_pbitstrmIn->getBits (5);			m_volmd.ihor_sampling_factor_m_shape = m_pbitstrmIn->getBits (5);			m_volmd.iver_sampling_factor_n_shape = m_pbitstrmIn->getBits (5);			m_volmd.iver_sampling_factor_m_shape = m_pbitstrmIn->getBits (5);		}//~OBSS_SAIT_991015			}	m_volmd.bDeblockFilterDisable = TRUE;							//no deblocking filter}Void CVideoObjectDecoder::FakeOutVOVOLHead (int h, int w, int fr, Bool *pbSpatialScalability){  m_volmd.iClockRate = fr;  Int iClockRate = m_volmd.iClockRate;  assert (iClockRate >= 1 && iClockRate < 65536);  for (m_iNumBitsTimeIncr = 1; m_iNumBitsTimeIncr < NUMBITS_TIME_RESOLUTION; m_iNumBitsTimeIncr++)	{	    if (iClockRate == 1)			      break;    iClockRate = (iClockRate >> 1);  }  m_volmd.bShapeOnly = FALSE;  m_volmd.fAUsage = RECTANGLE;  m_ivolWidth = w;  m_ivolHeight = h;  m_vopmd.bInterlace = 0;  m_volmd.bAdvPredDisable = 1;  m_uiSprite = 0;  m_volmd.bNot8Bit = 0;  m_volmd.uiQuantPrecision = 5;  m_volmd.nBits = 8;  m_volmd.fQuantizer = Q_H263;#if 0  m_volmd.bLoadIntraMatrix = 0;  memcpy (m_volmd.rgiIntraQuantizerMatrix, rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));  m_volmd.bLoadInterMatrix = 0;  memcpy (m_volmd.rgiInterQuantizerMatrix, rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));#endif  m_volmd.bComplexityEstimationDisable = 1; // huh ?  m_volmd.bDataPartitioning = 0;  m_volmd.bReversibleVlc = FALSE;  m_volmd.volType = BASE_LAYER;  m_volmd.ihor_sampling_factor_n = 1;  m_volmd.ihor_sampling_factor_m = 1;  m_volmd.iver_sampling_factor_n = 1;  m_volmd.iver_sampling_factor_m = 1;	  m_volmd.bDeblockFilterDisable = TRUE;  m_volmd.bNewpredEnable = FALSE;  m_vopmd.RRVmode.iOnOff = m_volmd.breduced_resolution_vop_enable = 0;  m_volmd.bQuarterSample = 0;  m_volmd.bSadct = m_volmd.bQuarterpel = 0;			m_volmd.bAPM =			m_volmd.bNPM =			m_volmd.bInterpolateMCQ =			m_volmd.bForwBackMCQ =			m_volmd.bHalfpel2 =			m_volmd.bHalfpel4 = false;			m_volmd.bDCTCoefs =			m_volmd.bDCTLines =			m_volmd.bVLCSymbols =			m_volmd.bVLCBits = false;  postVO_VOLHeadInit(w, h, pbSpatialScalability);}//OBSSFIX_MODE3 //TPS_FIX_BGC//Int BGComposition; // added by Sharp (98/3/24)//~OBSSFIX_MODE3 //~TPS_FIX_BGCBool CVideoObjectDecoder::decodeVOPHead (){	// Start code	UInt uiVopStartCode = m_pbitstrmIn -> getBits (NUMBITS_VOP_START_CODE);	if (uiVopStartCode == GOV_START_CODE) {/*Added by SONY (98/03/30)*/		m_bUseGOV = TRUE;		m_bLinkisBroken = FALSE;/*Added by SONY (98/03/30) End */		Int timecode;		timecode = m_pbitstrmIn -> getBits (5) * 3600;		timecode += m_pbitstrmIn -> getBits (6) * 60;		m_pbitstrmIn -> getBits (1);		timecode += m_pbitstrmIn -> getBits (6);		m_tModuloBaseDecd = timecode;		m_tModuloBaseDisp = timecode;#ifdef DEBUG_OUTPUT		cout << "GOV Header (t=" << timecode << ")\n\n";#endif		Int closed_gov = m_pbitstrmIn -> getBits (1);		Int broken_link = m_pbitstrmIn -> getBits (1);/*modified by SONY (98/03/30)*/		if ((closed_gov == 0)&&(broken_link == 1))			m_bLinkisBroken = TRUE;/*modified by SONY (98/03/30) End*/				findStartCode();/*		m_pbitstrmIn -> getBits (4);		Int uiPrefix = m_pbitstrmIn -> getBits (NUMBITS_START_CODE_PREFIX);		ASSERT(uiPrefix == START_CODE_PREFIX);*/		uiVopStartCode = m_pbitstrmIn -> getBits (NUMBITS_VOP_START_CODE);	}//980212	ASSERT(uiVopStartCode == VOP_START_CODE);	m_vopmd.vopPredType = (VOPpredType) m_pbitstrmIn -> getBits (NUMBITS_VOP_PRED_TYPE);// NEWPRED	if (m_volmd.bNewpredEnable)		ASSERT (m_vopmd.vopPredType != BVOP);// ~NEWPRED	// Time reference and VOP_pred_type	Int iModuloInc = 0;	while (m_pbitstrmIn -> getBits (1) != 0)		iModuloInc++;	Time tCurrSec = iModuloInc + ((m_vopmd.vopPredType != BVOP ||				  (m_vopmd.vopPredType == BVOP && m_volmd.volType == ENHN_LAYER ))?				m_tModuloBaseDecd : m_tModuloBaseDisp);	//	Added for error resilient mode by Toshiba(1997-11-14)	UInt uiMarker = m_pbitstrmIn -> getBits (1);	ASSERT(uiMarker == 1);	//	End Toshiba(1997-11-14)	Time tVopIncr = 0;	if(m_iNumBitsTimeIncr!=0)		tVopIncr = m_pbitstrmIn -> getBits (m_iNumBitsTimeIncr);	uiMarker = m_pbitstrmIn->getBits (1); // marker bit	ASSERT(uiMarker == 1);	m_tOldModuloBaseDecd = m_tModuloBaseDecd;	m_tOldModuloBaseDisp = m_tModuloBaseDisp;	if (m_vopmd.vopPredType != BVOP ||		(m_vopmd.vopPredType == BVOP && m_volmd.volType == ENHN_LAYER ))	{		m_tModuloBaseDisp = m_tModuloBaseDecd;		//update most recently displayed time base		m_tModuloBaseDecd = tCurrSec;	}    m_t = tCurrSec * m_volmd.iClockRate*m_iClockRateScale + tVopIncr*m_iClockRateScale;		if (m_pbitstrmIn->getBits (1) == 0)		{		//vop_coded == false		m_vopmd.bInterlace = FALSE;	//wchen: temporary solution		return FALSE;	}// NEWPRED	if (m_volmd.bNewpredEnable) {		m_vopmd.m_iVopID = m_pbitstrmIn -> getBits(m_vopmd.m_iNumBitsVopID);		m_vopmd.m_iVopID4Prediction_Indication = m_pbitstrmIn -> getBits(NUMBITS_VOP_ID_FOR_PREDICTION_INDICATION);		if( m_vopmd.m_iVopID4Prediction_Indication )			m_vopmd.m_iVopID4Prediction = m_pbitstrmIn -> getBits(m_vopmd.m_iNumBitsVopID);		m_pbitstrmIn -> getBits(MARKER_BIT);			g_pNewPredDec->GetRef(				NP_VOP_HEADER,				m_vopmd.vopPredType,				m_vopmd.m_iVopID,					m_vopmd.m_iVopID4Prediction_Indication,				m_vopmd.m_iVopID4Prediction		);	}// ~NEWPRED	if ((m_vopmd.vopPredType == PVOP  || (m_uiSprite == 2 && m_vopmd.vopPredType == SPRITE)) && m_volmd.bShapeOnly==FALSE) // GMC		m_vopmd.iRoundingControl = m_pbitstrmIn->getBits (1); //"VOP_Rounding_Type"	else		m_vopmd.iRoundingControl = 0;// RRV insertion	if((m_volmd.breduced_resolution_vop_enable == 1)&&(m_volmd.fAUsage == RECTANGLE)&&	   ((m_vopmd.vopPredType == PVOP)||(m_vopmd.vopPredType == IVOP)))	{	  	m_vopmd.RRVmode.iRRVOnOff	= m_pbitstrmIn->getBits (1);	}		else	{		m_vopmd.RRVmode.iRRVOnOff	= 0;	}// ~RRV	if (m_volmd.fAUsage != RECTANGLE) {// Begin: modified by Hughes	  4/9/98	  if (!(m_uiSprite == 1 && m_vopmd.vopPredType == IVOP)) {// End: modified by Hughes	  4/9/98		Int width = m_pbitstrmIn -> getBits (NUMBITS_VOP_WIDTH);// spt VOP		ASSERT (width % MB_SIZE == 0); // for sprite, may not be multiple of MB_SIZE		Int marker;		marker = m_pbitstrmIn -> getBits (1); // marker bit		ASSERT(marker==1);		Int height = m_pbitstrmIn -> getBits (NUMBITS_VOP_HEIGHT);// spt VOP		ASSERT (height % MB_SIZE == 0); // for sprite, may not be multiple of MB_SIZE		marker = m_pbitstrmIn -> getBits (1); // marker bit		ASSERT(marker==1);		//wchen: cd changed to 2s complement		Int left = (m_pbitstrmIn -> getBits (1) == 0) ?					m_pbitstrmIn->getBits (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1) : 					((Int)m_pbitstrmIn->getBits (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1) - (1 << (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1)));		marker = m_pbitstrmIn -> getBits (1); // marker bit		ASSERT(marker==1);		Int top = (m_pbitstrmIn -> getBits (1) == 0) ?				   m_pbitstrmIn->getBits (NUMBITS_VOP_VERTICAL_SPA_REF - 1) : 				   ((Int)m_pbitstrmIn->getBits (NUMBITS_VOP_VERTICAL_SPA_REF - 1) - (1 << (NUMBITS_VOP_VERTICAL_SPA_REF - 1)));		ASSERT(((left | top)&1)==0); // must be even pix unit		marker = m_pbitstrmIn -> getBits (1); // marker bit added Nov 10, swinder		ASSERT(marker==1);		m_rctCurrVOPY = CRct (left, top, left + width, top + height);		m_rctCurrVOPUV = m_rctCurrVOPY.downSampleBy2 ();	  }	  if ( m_volmd.volType == ENHN_LAYER && m_volmd.iEnhnType != 0 ){ // change added for Norio Ito//OBSSFIX_MODE3 //TPS_FIX_BGC			m_vopmd.bBGComposition = m_pbitstrmIn -> getBits (1); // modified by Sharp (98/3/24)//			BGComposition = m_pbitstrmIn -> getBits (1); // modified by Sharp (98/3/24)//~OBSSFIX_MODE3 //~TPS_FIX_BGC//			ASSERT(BackgroundComposition==1); // modified by Sharp (98/3/24)		}		m_volmd.bNoCrChange = m_pbitstrmIn -> getBits (1);	//VOP_CR_Change_Disable		Int iVopConstantAlpha = m_pbitstrmIn -> getBits (1);		if(iVopConstantAlpha==1)			m_vopmd.iVopConstantAlphaValue = m_pbitstrmIn -> getBits (8);		else			m_vopmd.iVopConstantAlphaValue = 255;		m_vopmd.bShapeCodingType = (m_vopmd.vopPredType == IVOP) ? 0 : 1; //	Added error resilient mode by Toshiba(1998-1-16)	}	// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 15 Jun 1998	if (! m_volmd.bComplexityEstimationDisable) {		// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999		if (  (m_volmd.iEstimationMethod != 0) && (m_volmd.iEstimationMethod != 1) ) {		//// Replaced line: if (m_volmd.iEstimationMethod != 0) {		// END: Complexity Estimation syntax support - Update version 2			fprintf (stderr, "ERROR: Unknown estimation method number %d.\n", m_volmd.iEstimationMethod);			exit (1);		}				if (m_vopmd.vopPredType == IVOP ||			m_vopmd.vopPredType == PVOP ||			m_vopmd.vopPredType == BVOP) {			if (m_volmd.bOpaque) {				printf ("dcecs_opaque = %d\n", m_vopmd.iOpaque = m_pbitstrmIn -> getBits (8));				if (m_vopmd.iOpaque == 0) {					fprintf (stderr, "ERROR: Illegal null value for 'opaque' complexity estimation.\n");					exit (1);				}			}			if (m_volmd.bTransparent) {				printf ("dcecs_transparent = %d\n", m_vopmd.iTransparent = m_pbitstrmIn -> getBits (8));				if (m_vopmd.iTransparent == 0) {					fprintf (stderr, "ERROR: Illegal null value for 'transparent' complexity estimation.\n");					exit (1);				}			}			if (m_volmd.bIntraCAE) {				printf ("dcecs_intra_cae = %d\n", m_vopmd.iIntraCAE = m_pbitstrmIn -> getBits (8));				i

⌨️ 快捷键说明

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