📄 vopsedec.c
字号:
{ for (i = 0; i < BLOCK_SQUARE_SIZE; i++) { iElem = getBits (NUMBITS_QMATRIX); if (iElem != 0) pVOL->rgiIntraQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i]] = iElem; else pVOL->rgiIntraQuantizerMatrixAlpha[iAuxComp] [i] = pVOL->rgiIntraQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i - 1]]; } } else {#ifdef _FOR_GSSP_ memcpy (pVOL->rgiIntraQuantizerMatrixAlpha[iAuxComp], rgiDefaultIntraQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));#else for (i = 0; i < BLOCK_SQUARE_SIZE; i++) pVOL->rgiIntraQuantizerMatrixAlpha[iAuxComp] [i] = 16;#endif } MP4V_RETSINGLEBIT(&pVOL->bLoadInterMatrixAlpha); if (pVOL->bLoadInterMatrixAlpha) { for (i = 0; i < BLOCK_SQUARE_SIZE; i++) { iElem = getBits (NUMBITS_QMATRIX); if (iElem != 0) pVOL->rgiInterQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i]] = iElem; else pVOL->rgiInterQuantizerMatrixAlpha[iAuxComp] [i] = pVOL->rgiInterQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i - 1]]; } } else {#ifdef _FOR_GSSP_ // memcpy (pVOL->rgiInterQuantizerMatrixAlpha, rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int)); // use rgiDefaultInterQMatrixAlpha instead of rgiDefaultInterQMatrix (both defined in ./sys/global.hpp), mwi memcpy (pVOL->rgiInterQuantizerMatrixAlpha[iAuxComp], rgiDefaultInterQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));#else for (i = 0; i < BLOCK_SQUARE_SIZE; i++) pVOL->rgiInterQuantizerMatrixAlpha[iAuxComp] [i] = 16;#endif } } } } if(pVOL->uiVerID == 1) // added for compatibility with version 1 video // this is tentative integration // please change codes if there is any problems pVOL->bQuarterSample = 0; //Quarter sample else if(pVOL->uiVerID == 2) MP4V_RETSINGLEBIT(&pVOL->bQuarterSample);// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 15 Jun 1998 MP4V_RETSINGLEBIT(&pVOL->bComplexityEstimationDisable);#ifdef DUAL_MODE if (! pVOL->bComplexityEstimationDisable) { pVOL->iEstimationMethod = getBits (2); // START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999 if ( (pVOL->iEstimationMethod != 0) && (pVOL->iEstimationMethod != 1)) { //// Replaced line: if (pVOL->iEstimationMethod != 0) { // END: Complexity Estimation syntax support - Update version 2 fprintf (stderr, "ERROR: Unknown complexity estimation method number %d.\n", pVOL->iEstimationMethod); exit (1); } MP4V_RETSINGLEBIT(&pVOL->bShapeComplexityEstimationDisable); if (!pVOL->bShapeComplexityEstimationDisable) { MP4V_RETSINGLEBIT(&pVOL->bOpaque); MP4V_RETSINGLEBIT(&pVOL->bTransparent); MP4V_RETSINGLEBIT(&pVOL->bIntraCAE); MP4V_RETSINGLEBIT(&pVOL->bInterCAE); MP4V_RETSINGLEBIT(&pVOL->bNoUpdate); MP4V_RETSINGLEBIT(&pVOL->bUpsampling); if (!(pVOL->bOpaque || pVOL->bTransparent || pVOL->bIntraCAE || pVOL->bInterCAE || pVOL->bNoUpdate || pVOL->bUpsampling)) { MP4V_FATAL_ERROR("Shape complexity estimation is enabled,\nbut no corresponding flag is enabled."); } } else pVOL->bOpaque = pVOL->bTransparent = pVOL->bIntraCAE = pVOL->bInterCAE = pVOL->bNoUpdate = pVOL->bUpsampling = FALSE; MP4V_RETSINGLEBIT(&pVOL->bTextureComplexityEstimationSet1Disable);#ifndef NO_ASSERTS#ifdef DUAL_MODE if(g_pVO->m_uiSprite == 2) assert(pVOL->bTextureComplexityEstimationSet1Disable == TRUE);#endif#endif if (!pVOL->bTextureComplexityEstimationSet1Disable) { MP4V_RETSINGLEBIT(&pVOL->bIntraBlocks); MP4V_RETSINGLEBIT(&pVOL->bInterBlocks); MP4V_RETSINGLEBIT(&pVOL->bInter4vBlocks); MP4V_RETSINGLEBIT(&pVOL->bNotCodedBlocks); if (!(pVOL->bIntraBlocks || pVOL->bInterBlocks || pVOL->bInter4vBlocks || pVOL->bNotCodedBlocks)) { MP4V_FATAL_ERROR("Texture complexity estimation set 1 is enabled,\nbut no corresponding flag is enabled."); } } else pVOL->bIntraBlocks = pVOL->bInterBlocks = pVOL->bInter4vBlocks = pVOL->bNotCodedBlocks = FALSE; MP4V_RETSINGLEBIT(&uiMark);#ifndef NO_ASSERTS assert (uiMark == 1);#endif MP4V_RETSINGLEBIT(&pVOL->bTextureComplexityEstimationSet2Disable); if (!pVOL->bTextureComplexityEstimationSet2Disable) { MP4V_RETSINGLEBIT(&pVOL->bDCTCoefs); MP4V_RETSINGLEBIT(&pVOL->bDCTLines); MP4V_RETSINGLEBIT(&pVOL->bVLCSymbols); MP4V_RETSINGLEBIT(&pVOL->bVLCBits); if (!(pVOL->bDCTCoefs || pVOL->bDCTLines || pVOL->bVLCSymbols || pVOL->bVLCBits)) { MP4V_FATAL_ERROR("Texture complexity estimation set 2 is enabled,\nbut no corresponding flag is enabled."); } } else pVOL->bDCTCoefs = pVOL->bDCTLines = pVOL->bVLCSymbols = pVOL->bVLCBits = FALSE; MP4V_RETSINGLEBIT(&pVOL->bMotionCompensationComplexityDisable); if (!pVOL->bMotionCompensationComplexityDisable) { MP4V_RETSINGLEBIT(&pVOL->bAPM); MP4V_RETSINGLEBIT(&pVOL->bNPM); MP4V_RETSINGLEBIT(&pVOL->bInterpolateMCQ); MP4V_RETSINGLEBIT(&pVOL->bForwBackMCQ); MP4V_RETSINGLEBIT(&pVOL->bHalfpel2); MP4V_RETSINGLEBIT(&pVOL->bHalfpel4); if (!(pVOL->bAPM || pVOL->bNPM || pVOL->bInterpolateMCQ || pVOL->bForwBackMCQ || pVOL->bHalfpel2 || pVOL->bHalfpel4)) { MP4V_FATAL_ERROR("Motion complexity estimation is enabled,\nbut no corresponding flag is enabled."); } } else pVOL->bAPM = pVOL->bNPM = pVOL->bInterpolateMCQ = pVOL->bForwBackMCQ = pVOL->bHalfpel2 = pVOL->bHalfpel4 = FALSE; MP4V_RETSINGLEBIT(&uiMark);#ifndef NO_ASSERTS assert (uiMark == 1);#endif // START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999 if (pVOL->iEstimationMethod == 1) { MP4V_RETSINGLEBIT(&pVOL->bVersion2ComplexityEstimationDisable); if (!pVOL->bVersion2ComplexityEstimationDisable) { MP4V_RETSINGLEBIT(&pVOL->bSadct); MP4V_RETSINGLEBIT(&pVOL->bQuarterpel); if (!(pVOL->bSadct || pVOL->bQuarterpel)) { MP4V_FATAL_ERROR("Version 2 complexity estimation is enabled,\nbut no corresponding flag is enabled."); } } else pVOL->bSadct = pVOL->bQuarterpel = FALSE; } else { pVOL->bVersion2ComplexityEstimationDisable = TRUE; pVOL->bSadct = pVOL->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 (pVOL->bShapeComplexityEstimationDisable && pVOL->bTextureComplexityEstimationSet1Disable && pVOL->bTextureComplexityEstimationSet2Disable && pVOL->bMotionCompensationComplexityDisable && pVOL->bVersion2ComplexityEstimationDisable) { MP4V_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#endif MP4V_RETSINGLEBIT(&uiResyncMarkerDisable); // Modified by Toshiba(1998-4-7) MP4V_RETSINGLEBIT(&pVOL->bDataPartitioning);#ifdef DUAL_MODE if (pVOL->bDataPartitioning) { bTmp = &pVOL->bReversibleVlc; MP4V_RETSINGLEBIT(bTmp); } else#endif pVOL->bReversibleVlc = FALSE; // End Toshiba// NEWPRED if(pVOL->uiVerID == 1) pVOL->bNewpredEnable = FALSE; else if(pVOL->uiVerID != 1) MP4V_RETSINGLEBIT(&pVOL->bNewpredEnable); // As of now, this flag is NOT defined. So, we shall // exit out on clips that have this ENABLED#ifndef ENABLE_NEW_PREDICTION // Check if this clip has NEWPREDICTION enabled. If so, just exit out if (pVOL->bNewpredEnable) { MP4V_FATAL_ERROR("NewPred detected : Exiting (not supported under MPEG-4 ASP)"); }#endif#ifdef DUAL_MODE// RRV insertion if(pVOL->uiVerID != 1) { bTmp = &pVOL->breduced_resolution_vop_enable; MP4V_RETSINGLEBIT(bTmp); } else#endif pVOL->breduced_resolution_vop_enable = 0;// ~RRV //wchen: wd changes MP4V_RETSINGLEBIT(&nLocalBit); pVOL->volType = (nLocalBit == 0) ? BASE_LAYER : ENHN_LAYER;#ifndef NO_ASSERTS#ifdef DUAL_MODE// NEWPRED if (pVOL->bNewpredEnable) assert (pVOL->volType == BASE_LAYER);// ~NEWPRED#endif#ifdef DUAL_MODE// GMC if(g_pVO->m_uiSprite == 2) assert(pVOL->volType == BASE_LAYER);#endif#endif// ~GMC pVOL->ihor_sampling_factor_n = 1; pVOL->ihor_sampling_factor_m = 1; pVOL->iver_sampling_factor_n = 1; pVOL->iver_sampling_factor_m = 1; //OBSS_SAIT_991015 pVOL->ihor_sampling_factor_n_shape = 1; pVOL->ihor_sampling_factor_m_shape = 1; pVOL->iver_sampling_factor_n_shape = 1; pVOL->iver_sampling_factor_m_shape = 1; //~OBSS_SAIT_991015#ifdef DUAL_MODE if (pVOL->volType == ENHN_LAYER) { MP4V_RETSINGLEBIT(&pVOL->iHierarchyType); if(pVOL->iHierarchyType == 0) fprintf(stdout,"Hierarchy_Type == 0 (Spatial scalability)\n"); else if(pVOL->iHierarchyType == 1) fprintf(stdout,"Hierarchy_type == 1 (Temporal scalability)\n"); getBits (4); // ref_layer_id MP4V_RETSINGLEBIT(&nLocalBit); pVOL->ihor_sampling_factor_n = getBits (5); pVOL->ihor_sampling_factor_m = getBits (5); pVOL->iver_sampling_factor_n = getBits (5); pVOL->iver_sampling_factor_m = getBits (5); MP4V_RETSINGLEBIT(&pVOL->iEnhnType); if (pVOL->fAUsage == ONE_BIT && pVOL->iHierarchyType == 0) { MP4V_RETSINGLEBIT(&pVOL->iuseRefShape); MP4V_RETSINGLEBIT(&pVOL->iuseRefTexture); pVOL->ihor_sampling_factor_n_shape = getBits (5); pVOL->ihor_sampling_factor_m_shape = getBits (5); pVOL->iver_sampling_factor_n_shape = getBits (5); pVOL->iver_sampling_factor_m_shape = getBits (5); } }#endif pVOL->bDeblockFilterDisable = TRUE; //no deblocking filter return 0;}#ifdef USE_MAIInt mpeg4_getmode(){ return g_MP4VDecodeMode;}Void mpeg4_setmode(UInt uiNextDecodeMode){ g_MP4VDecodeMode = uiNextDecodeMode; g_uiWaitForIFrame = TRUE; return; if (g_MP4VDecodeMode!=DECODE_NORMAL) { /* check for valid mode transitions to prevent decoder working with missing ref frames */ if (uiNextDecodeMode==DECODE_NORMAL) uiNextDecodeMode=DECODE_WAITFORI; else if (uiNextDecodeMode==DECODE_IP_ONLY) { if (g_MP4VDecodeMode==DECODE_I_ONLY || g_MP4VDecodeMode==DECODE_WAITFORI) uiNextDecodeMode=DECODE_WAITFORI_IPONLY; } } g_MP4VDecodeMode = uiNextDecodeMode;}#endif#ifdef ENABLE_MULTIPLE_VOL_SUPPORT// Stripped down version of the original functionint decodeVOHead_Stripped (CVideoObjectDecoder *pVOD){ UInt uiVoStartCode; if(peekBits(NUMBITS_START_CODE_SUFFIX)==VSS_START_CODE) { if(decodeVSHead()) { printf("decodeVOHead_Stripped : Failed to decode visual sequence headers\n"); return -1; /* failed */ } } uiVoStartCode = getBits (NUMBITS_VO_START_CODE); if (uiVoStartCode != VO_START_CODE) { printf("decodeVOHead_Stripped : Not VO_START_CODE\n"); return -2; /* failed */ }#ifndef NO_ASSERTS assert(uiVoStartCode == VO_START_CODE);#endif g_pVO->m_uiVOId = getBits (NUMBITS_VO_ID); return 0; /* success */}// Stripped down version of the original functionint decodeVOLHead_Stripped (CVideoObjectDecoder *pVOD, VOLMode *pVOL, VOPMode *pVOP){ UInt i,j, uiOLI, uiResyncMarkerDisable, uiVolStartCode; UInt uiVOLId, uiOLType, uiAspect; Int iElem, iAuxComp, iClockRate, nLocalBit; Bool bRandom, bFixFrameRate; UInt uiMark, uiCTP, uiAUsage; // hack to get init'ed pVOL->bSadctDisable = 0; //findStartCode(); /* HWG060628 - removed to avoid false detection of header (i.e. 18-xvid.avi) */ /* HWG060628 - we now check that we are correctly positioned at the start of a VOL header */ if (peekBits(NUMBITS_START_CODE_PREFIX+NUMBITS_VOL_START_CODE)!=(START_CODE_PREFIX<<NUMBITS_VOL_START_CODE)|VOL_START_CODE) {#ifdef ENABLE_PRINTS printf("decodeVOLHead_Stripped: No VOL_START_CODE code\n");#endif return 0; } getBits(NUMBITS_START_CODE_PREFIX); /* skip START CODE */ uiVolStartCode = getBits (NUMBITS_VOL_START_CODE); if (uiVolStartCode != VOL_START_CODE) return 0;#ifdef ENABLE_PRINTS printf("decodeVOLHead_Stripped: Multiple VOLs detected\n");#endif uiVOLId = getBits (NUMBITS_VOL_ID); MP4V_RETSINGLEBIT(&bRandom); uiOLType = getBits(8); // VOL_type_indication MP4V_RETSINGLEBIT(&uiOLI); if(uiOLI) { // GMC pVOL->uiVerID = getBits (4); // video_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -