📄 vopsedec.cpp
字号:
//~OBSS_SAIT_991015
m_volmd.bDeblockFilterDisable = TRUE;
m_uiSprite = 0;
m_volmd.bNot8Bit = 0;
m_volmd.bComplexityEstimationDisable = 1;
m_volmd.bDataPartitioning = 0;
m_volmd.bReversibleVlc = FALSE;
m_volmd.bDeblockFilterDisable = TRUE;
return;
}
m_volmd.bShapeOnly=FALSE;
if(uiAUsage==3)
uiAUsage=2;
m_volmd.fAUsage = (AlphaUsage) uiAUsage;
if (m_volmd.fAUsage == RECTANGLE) {
UInt uiMarker = m_pbitstrmIn -> getBits (1);
assert(uiMarker==1);
m_ivolWidth = m_pbitstrmIn -> getBits (NUMBITS_VOP_WIDTH);
uiMarker = m_pbitstrmIn -> getBits (1);
assert(uiMarker==1);
m_ivolHeight = m_pbitstrmIn -> getBits (NUMBITS_VOP_HEIGHT);
uiMarker = m_pbitstrmIn -> getBits (1);
assert(uiMarker==1);
}
m_vopmd.bInterlace = m_pbitstrmIn -> getBits (1); // interlace (was vop flag)
m_volmd.bAdvPredDisable = m_pbitstrmIn -> getBits (1); //VOL_obmc_Disable
// decode sprite info
// GMC
if(m_volmd.uiVerID == 1)
// ~GMC
m_uiSprite = m_pbitstrmIn -> getBits (1);
// GMC
else if(m_volmd.uiVerID == 2)
m_uiSprite = m_pbitstrmIn -> getBits (2);
// ~GMC
if (m_uiSprite == 1) { // sprite information
Int isprite_hdim = m_pbitstrmIn -> getBits (NUMBITS_SPRITE_HDIM);
Int iMarker = m_pbitstrmIn -> getBits (MARKER_BIT);
assert (iMarker == 1);
Int isprite_vdim = m_pbitstrmIn -> getBits (NUMBITS_SPRITE_VDIM);
iMarker = m_pbitstrmIn -> getBits (MARKER_BIT);
assert (iMarker == 1);
Int isprite_left_edge = (m_pbitstrmIn -> getBits (1) == 0) ?
m_pbitstrmIn->getBits (NUMBITS_SPRITE_LEFT_EDGE - 1) : ((Int)m_pbitstrmIn->getBits (NUMBITS_SPRITE_LEFT_EDGE - 1) - (1 << 12));
assert(isprite_left_edge%2 == 0);
iMarker = m_pbitstrmIn -> getBits (MARKER_BIT);
assert (iMarker == 1);
Int isprite_top_edge = (m_pbitstrmIn -> getBits (1) == 0) ?
m_pbitstrmIn->getBits (NUMBITS_SPRITE_TOP_EDGE - 1) : ((Int)m_pbitstrmIn->getBits (NUMBITS_SPRITE_LEFT_EDGE - 1) - (1 << 12));
assert(isprite_top_edge%2 == 0);
iMarker = m_pbitstrmIn -> getBits (MARKER_BIT);
assert (iMarker == 1);
m_rctSpt.left = isprite_left_edge;
m_rctSpt.right = isprite_left_edge + isprite_hdim;
m_rctSpt.top = isprite_top_edge;
m_rctSpt.bottom = isprite_top_edge + isprite_vdim;
m_rctSpt.width = isprite_hdim;
m_rctSptPieceY = m_rctSpt; //initialization; will be overwritten by first vop header
// GMC
}
if (m_uiSprite == 1 || m_uiSprite == 2) { // sprite information
// ~GMC
m_iNumOfPnts = m_pbitstrmIn -> getBits (NUMBITS_NUM_SPRITE_POINTS);
// GMC_V2
if(m_uiSprite == 2)
assert (m_iNumOfPnts == 0 ||
m_iNumOfPnts == 1 ||
m_iNumOfPnts == 2 ||
m_iNumOfPnts == 3);
// ~GM_V2
m_rgstSrcQ = new CSiteD [m_iNumOfPnts];
m_rgstDstQ = new CSiteD [m_iNumOfPnts];
m_uiWarpingAccuracy = m_pbitstrmIn -> getBits (NUMBITS_WARPING_ACCURACY);
Bool bLightChange = m_pbitstrmIn -> getBits (1);
// GMC
}
if (m_uiSprite == 1) { // sprite information
// ~GMC
// Begin: modified by Hughes 4/9/98
Bool bsptMode = m_pbitstrmIn -> getBits (1); // Low_latency_sprite_enable
if ( bsptMode)
m_sptMode = LOW_LATENCY ;
else
m_sptMode = BASIC_SPRITE ;
// End: modified by Hughes 4/9/98
}
// HHI Suehring 991022
// HHI Schueuer: sadct
if (m_volmd.fAUsage != RECTANGLE ) {
if (m_volmd.uiVerID == 1)
m_volmd.bSadctDisable = TRUE;
else
m_volmd.bSadctDisable = m_pbitstrmIn -> getBits(1);
}
// end HHI
// end HHI Suehring 991022
/*
//OBSS_SAIT_991015
// HHI Schueuer: sadct
if (m_volmd.fAUsage != RECTANGLE ) {
if (m_volmd.uiVerID == 1)
m_volmd.bSadctDisable = TRUE;
else
m_volmd.bSadctDisable = m_pbitstrmIn -> getBits (1);
}
// end HHI
//~OBSS_SAIT_991015
*/
m_volmd.bNot8Bit = (Bool) m_pbitstrmIn -> getBits(1);
if (m_volmd.bNot8Bit) {
m_volmd.uiQuantPrecision = (UInt) m_pbitstrmIn -> getBits (4);
m_volmd.nBits = (UInt) m_pbitstrmIn -> getBits (4);
assert(m_volmd.nBits>3);
} else {
m_volmd.uiQuantPrecision = 5;
m_volmd.nBits = 8;
}
if (m_volmd.fAUsage == EIGHT_BIT)
{
m_volmd.bNoGrayQuantUpdate = m_pbitstrmIn -> getBits (1);
UInt uiCompMethod = m_pbitstrmIn -> getBits (1);
UInt uiLinearComp = m_pbitstrmIn -> getBits (1);
}
m_volmd.fQuantizer = (Quantizer) m_pbitstrmIn -> getBits (1);
if (m_volmd.fQuantizer == Q_MPEG) {
m_volmd.bLoadIntraMatrix = m_pbitstrmIn -> getBits (1);
if (m_volmd.bLoadIntraMatrix) {
UInt i = 0;
Int iElem;
do {
iElem = m_pbitstrmIn -> getBits (NUMBITS_QMATRIX);
m_volmd.rgiIntraQuantizerMatrix [grgiStandardZigzag[i]] = iElem;
} while (iElem != 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]];
}
}
else {
memcpy (m_volmd.rgiIntraQuantizerMatrix, rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));
}
m_volmd.bLoadInterMatrix = m_pbitstrmIn -> getBits (1);
if (m_volmd.bLoadInterMatrix) {
UInt i = 0;
Int iElem;
do {
iElem = m_pbitstrmIn -> getBits (NUMBITS_QMATRIX);
m_volmd.rgiInterQuantizerMatrix [grgiStandardZigzag[i]] = iElem;
} while (iElem != 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]];
}
}
else {
memcpy (m_volmd.rgiInterQuantizerMatrix, rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));
}
if (m_volmd.fAUsage == EIGHT_BIT) {
for(Int iAuxComp=0; iAuxComp<m_volmd.iAuxCompCount; iAuxComp++ ) { // MAC (SB) 2-Dec-99
m_volmd.bLoadIntraMatrixAlpha = m_pbitstrmIn -> getBits (1);
if (m_volmd.bLoadIntraMatrixAlpha) {
for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {
Int iElem = m_pbitstrmIn -> getBits (NUMBITS_QMATRIX);
if (iElem != 0)
m_volmd.rgiIntraQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i]] = iElem;
else
m_volmd.rgiIntraQuantizerMatrixAlpha[iAuxComp] [i] = m_volmd.rgiIntraQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i - 1]];
}
}
else {
#ifdef _FOR_GSSP_
// memcpy (m_volmd.rgiIntraQuantizerMatrixAlpha, rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));
// use rgiDefaultIntraQMatrixAlpha instead of rgiDefaultIntraQMatrix (both defined in ./sys/global.hpp), mwi
memcpy (m_volmd.rgiIntraQuantizerMatrixAlpha[iAuxComp], rgiDefaultIntraQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));
#else
for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++)
m_volmd.rgiIntraQuantizerMatrixAlpha[iAuxComp] [i] = 16;
#endif
}
m_volmd.bLoadInterMatrixAlpha = m_pbitstrmIn -> getBits (1);
if (m_volmd.bLoadInterMatrixAlpha) {
for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++) {
Int iElem = m_pbitstrmIn -> getBits (NUMBITS_QMATRIX);
if (iElem != 0)
m_volmd.rgiInterQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i]] = iElem;
else
m_volmd.rgiInterQuantizerMatrixAlpha[iAuxComp] [i] = m_volmd.rgiInterQuantizerMatrixAlpha[iAuxComp] [grgiStandardZigzag[i - 1]];
}
}
else {
#ifdef _FOR_GSSP_
// memcpy (m_volmd.rgiInterQuantizerMatrixAlpha, rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof (Int));
// use rgiDefaultInterQMatrixAlpha instead of rgiDefaultInterQMatrix (both defined in ./sys/global.hpp), mwi
memcpy (m_volmd.rgiInterQuantizerMatrixAlpha[iAuxComp], rgiDefaultInterQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof (Int));
#else
for (UInt i = 0; i < BLOCK_SQUARE_SIZE; i++)
m_volmd.rgiInterQuantizerMatrixAlpha[iAuxComp] [i] = 16;
#endif
}
}
}
}
// GMC
if(m_volmd.uiVerID == 1)
// added for compatibility with version 1 video
// this is tentative integration
// please change codes if there is any problems
m_volmd.bQuarterSample = 0; //Quarter sample
else if(m_volmd.uiVerID == 2)
// ~GMC
m_volmd.bQuarterSample = m_pbitstrmIn -> getBits (1); //Quarter sample
// Bool bComplxityEsti = m_pbitstrmIn->getBits (1); //Complexity estimation; don't know how to use it
// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 15 Jun 1998
m_volmd.bComplexityEstimationDisable = m_pbitstrmIn -> getBits (1);
if (! m_volmd.bComplexityEstimationDisable) {
m_volmd.iEstimationMethod = m_pbitstrmIn -> getBits (2);
// 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 complexity estimation method number %d.\n", m_volmd.iEstimationMethod);
exit (1);
}
m_volmd.bShapeComplexityEstimationDisable = m_pbitstrmIn -> getBits (1);
if (! m_volmd.bShapeComplexityEstimationDisable) {
m_volmd.bOpaque = m_pbitstrmIn -> getBits (1);
m_volmd.bTransparent = m_pbitstrmIn -> getBits (1);
m_volmd.bIntraCAE = m_pbitstrmIn -> getBits (1);
m_volmd.bInterCAE = m_pbitstrmIn -> getBits (1);
m_volmd.bNoUpdate = m_pbitstrmIn -> getBits (1);
m_volmd.bUpsampling = m_pbitstrmIn -> getBits (1);
if (!(m_volmd.bOpaque ||
m_volmd.bTransparent ||
m_volmd.bIntraCAE ||
m_volmd.bInterCAE ||
m_volmd.bNoUpdate ||
m_volmd.bUpsampling)) {
fatal_error("Shape complexity estimation is enabled,\nbut no corresponding flag is enabled.");
}
}
else
m_volmd.bOpaque =
m_volmd.bTransparent =
m_volmd.bIntraCAE =
m_volmd.bInterCAE =
m_volmd.bNoUpdate =
m_volmd.bUpsampling = false;
m_volmd.bTextureComplexityEstimationSet1Disable = m_pbitstrmIn -> getBits (1);
// GMC
if(m_uiSprite == 2) assert(m_volmd.bTextureComplexityEstimationSet1Disable == TRUE);
// ~GMC
if (! m_volmd.bTextureComplexityEstimationSet1Disable) {
m_volmd.bIntraBlocks = m_pbitstrmIn -> getBits (1);
m_volmd.bInterBlocks = m_pbitstrmIn -> getBits (1);
m_volmd.bInter4vBlocks = m_pbitstrmIn -> getBits (1);
m_volmd.bNotCodedBlocks = m_pbitstrmIn -> getBits (1);
if (!(m_volmd.bIntraBlocks ||
m_volmd.bInterBlocks ||
m_volmd.bInter4vBlocks ||
m_volmd.bNotCodedBlocks)) {
fatal_error("Texture complexity estimation set 1 is enabled,\nbut no corresponding flag is enabled.");
}
}
else
m_volmd.bIntraBlocks =
m_volmd.bInterBlocks =
m_volmd.bInter4vBlocks =
m_volmd.bNotCodedBlocks = false;
uiMark = m_pbitstrmIn -> getBits (1);
assert (uiMark == 1);
m_volmd.bTextureComplexityEstimationSet2Disable = m_pbitstrmIn -> getBits (1);
if (! m_volmd.bTextureComplexityEstimationSet2Disable) {
m_volmd.bDCTCoefs = m_pbitstrmIn -> getBits (1);
m_volmd.bDCTLines = m_pbitstrmIn -> getBits (1);
m_volmd.bVLCSymbols = m_pbitstrmIn -> getBits (1);
m_volmd.bVLCBits = m_pbitstrmIn -> getBits (1);
if (!(m_volmd.bDCTCoefs ||
m_volmd.bDCTLines ||
m_volmd.bVLCSymbols ||
m_volmd.bVLCBits)) {
fatal_error("Texture complexity estimation set 2 is enabled,\nbut no corresponding flag is enabled.");
}
}
else
m_volmd.bDCTCoefs =
m_volmd.bDCTLines =
m_volmd.bVLCSymbols =
m_volmd.bVLCBits = false;
m_volmd.bMotionCompensationComplexityDisable = m_pbitstrmIn -> getBits (1);
if (! m_volmd.bMotionCompensationComplexityDisable) {
m_volmd.bAPM = m_pbitstrmIn -> getBits (1);
m_volmd.bNPM = m_pbitstrmIn -> getBits (1);
m_volmd.bInterpolateMCQ = m_pbitstrmIn -> getBits (1);
m_volmd.bForwBackMCQ = m_pbitstrmIn -> getBits (1);
m_volmd.bHalfpel2 = m_pbitstrmIn -> getBits (1);
m_volmd.bHalfpel4 = m_pbitstrmIn -> getBits (1);
if (!(m_volmd.bAPM ||
m_volmd.bNPM ||
m_volmd.bInterpolateMCQ ||
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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -