Changeset 825 in SHVCSoftware for branches/SHM-dev
- Timestamp:
- 11 Jul 2014, 20:42:00 (10 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r823 r825 1003 1003 ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") 1004 1004 ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") 1005 #if R0151_CGS_3D_ASYMLUT_IMPROVE 1006 ("CGSAdaptC", m_nCGSAdaptiveChroma , 1, "adaptive chroma partition (only for the case of two chroma partitions)") 1007 #endif 1005 1008 #endif 1006 1009 #if Q0108_TSA_STSA … … 3087 3090 printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); 3088 3091 #endif 3092 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3093 printf("CGSAdaptC:%d " , m_nCGSAdaptiveChroma ); 3094 #endif 3089 3095 printf("\n\n"); 3090 3096 -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r823 r825 435 435 Int m_nCGSMaxYPartNumLog2; 436 436 Int m_nCGSLUTBit; 437 #endif 437 #if R0151_CGS_3D_ASYMLUT_IMPROVE 438 Int m_nCGSAdaptiveChroma; 439 #endif 440 #endif 438 441 #endif //SVC_EXTENSION 439 442 public: -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r823 r825 650 650 m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 ); 651 651 m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit ); 652 #if R0151_CGS_3D_ASYMLUT_IMPROVE 653 m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma ); 654 #endif 652 655 #endif 653 656 #if Q0078_ADD_LAYER_SETS -
branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.cpp
r815 r825 17 17 m_pCuboid = NULL; 18 18 m_nResQuanBit = 0; 19 #if R0164_CGS_LUT_BUGFIX 20 m_pCuboidExplicit = NULL; 21 #endif 19 22 } 20 23 … … 24 27 } 25 28 26 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 ) 29 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 30 #if R0151_CGS_3D_ASYMLUT_IMPROVE 31 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 32 #endif 33 ) 27 34 { 28 35 m_nMaxOctantDepth = nMaxOctantDepth; … … 36 43 m_nMaxPartNumLog2 = 3 * m_nMaxOctantDepth + m_nMaxYPartNumLog2; 37 44 38 xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 ); 45 xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 46 #if R0151_CGS_3D_ASYMLUT_IMPROVE 47 , nAdaptCThresholdU , nAdaptCThresholdV 48 #endif 49 ); 39 50 40 51 m_nYSize = 1 << ( m_nMaxOctantDepth + m_nMaxYPartNumLog2 ); … … 48 59 } 49 60 xAllocate3DArray( m_pCuboid , m_nYSize , m_nUSize , m_nVSize ); 61 62 #if R0164_CGS_LUT_BUGFIX 63 xAllocate3DArray( m_pCuboidExplicit , m_nYSize , m_nUSize , m_nVSize ); 64 #endif 50 65 } 51 66 … … 53 68 { 54 69 xFree3DArray( m_pCuboid ); 55 } 56 57 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 ) 70 #if R0164_CGS_LUT_BUGFIX 71 xFree3DArray( m_pCuboidExplicit ); 72 #endif 73 } 74 75 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 76 #if R0151_CGS_3D_ASYMLUT_IMPROVE 77 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 78 #endif 79 ) 58 80 { 59 81 assert( nCurOctantDepth <= m_nMaxOctantDepth ); … … 64 86 m_nYShift2Idx = m_nInputBitDepthY - m_nCurOctantDepth - m_nCurYPartNumLog2; 65 87 m_nUShift2Idx = m_nVShift2Idx = m_nInputBitDepthC - m_nCurOctantDepth; 88 #if R0151_CGS_3D_ASYMLUT_IMPROVE 89 m_nMappingShift = 10 + m_nInputBitDepthY - m_nOutputBitDepthY; 90 m_nAdaptCThresholdU = nAdaptCThresholdU; 91 m_nAdaptCThresholdV = nAdaptCThresholdV; 92 #else 66 93 m_nMappingShift = m_nYShift2Idx + m_nUShift2Idx; 94 #endif 67 95 m_nMappingOffset = 1 << ( m_nMappingShift - 1 ); 68 96 } … … 159 187 160 188 SYUVP sPred; 189 #if R0151_CGS_3D_ASYMLUT_IMPROVE 190 sPred.Y = sPred.U = sPred.V = 0; 191 if( nVertexIdx == 0 ) 192 sPred.Y = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 193 else if( nVertexIdx == 1 ) 194 sPred.U = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 195 else if( nVertexIdx == 2 ) 196 sPred.V = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 197 #else 161 198 sPred.Y = ( yIdx + m_nVertexIdxOffset[nVertexIdx][0] ) << ( m_nYShift2Idx + m_nDeltaBitDepth ); 162 199 sPred.U = ( uIdx + m_nVertexIdxOffset[nVertexIdx][1] ) << ( m_nUShift2Idx + m_nDeltaBitDepthC ); 163 200 sPred.V = ( vIdx + m_nVertexIdxOffset[nVertexIdx][2] ) << ( m_nVShift2Idx + m_nDeltaBitDepthC ); 201 #endif 164 202 return( sPred ); 165 203 } … … 169 207 SCuboid*** pCuboid = pCurCuboid ? pCurCuboid : m_pCuboid ; 170 208 209 #if R0151_CGS_3D_ASYMLUT_IMPROVE 210 SYUVP sPred; 211 if( yIdx == 0 ) 212 { 213 sPred.Y = nVertexIdx == 0 ? 1024 : 0; 214 sPred.U = nVertexIdx == 1 ? 1024 : 0; 215 sPred.V = nVertexIdx == 2 ? 1024 : 0; 216 } 217 else 218 { 219 sPred = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx]; 220 } 221 #else 171 222 // PredA 172 223 SYUVP sPredA = xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ); … … 196 247 sPred.U = sPredA.U + sPredB.U; 197 248 sPred.V = sPredA.V + sPredB.V; 198 249 #endif 199 250 return sPred ; 200 251 } … … 220 271 rYUVP.U = sPred.U + ( deltaU << m_nResQuanBit ); 221 272 rYUVP.V = sPred.V + ( deltaV << m_nResQuanBit ); 273 #if R0150_CGS_SIGNAL_CONSTRAINTS 274 // LUT coefficients are less than 12-bit 275 assert( -2048 <= rYUVP.Y && rYUVP.Y <= 2047 ); 276 assert( -2048 <= rYUVP.U && rYUVP.U <= 2047 ); 277 assert( -2048 <= rYUVP.V && rYUVP.V <= 2047 ); 278 #endif 222 279 } 223 280 224 281 Pel TCom3DAsymLUT::xMapY( Pel y , Pel u , Pel v ) 225 282 { 283 #if R0151_CGS_3D_ASYMLUT_IMPROVE 284 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 285 Pel dstY = ( ( rCuboid.P[0].Y * y + rCuboid.P[1].Y * u + rCuboid.P[2].Y * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].Y; 286 #else 226 287 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 227 288 Pel dstY = rCuboid.P[0].Y; … … 233 294 + ( ( deltaV * ( rCuboid.P[2].Y - rCuboid.P[1].Y ) ) << m_nYShift2Idx ) 234 295 + m_nMappingOffset ) >> m_nMappingShift ); 296 #endif 235 297 return( dstY ); 236 298 } … … 238 300 SYUVP TCom3DAsymLUT::xMapUV( Pel y , Pel u , Pel v ) 239 301 { 302 #if R0151_CGS_3D_ASYMLUT_IMPROVE 303 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 304 SYUVP dst; 305 dst.Y = 0; 306 dst.U = ( ( rCuboid.P[0].U * y + rCuboid.P[1].U * u + rCuboid.P[2].U * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].U; 307 dst.V = ( ( rCuboid.P[0].V * y + rCuboid.P[1].V * u + rCuboid.P[2].V * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].V; 308 #else 240 309 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 241 310 SYUVP dst = rCuboid.P[0]; … … 251 320 + ( ( deltaV * ( rCuboid.P[2].V - rCuboid.P[1].V ) ) << m_nYShift2Idx ) 252 321 + m_nMappingOffset ) >> m_nMappingShift ); 322 #endif 253 323 return( dst ); 254 324 } … … 262 332 { 263 333 assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() ); 264 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() ); 334 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() 335 #if R0151_CGS_3D_ASYMLUT_IMPROVE 336 , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV() 337 #endif 338 ); 265 339 setResQuantBit( pSrc->getResQuantBit() ); 266 340 xSaveCuboids( pSrc->m_pCuboid ); 267 341 } 268 342 269 #endif 270 343 #if R0164_CGS_LUT_BUGFIX 344 Void TCom3DAsymLUT::xInitCuboids( ) 345 { 346 // All vertices are initialized as non-exlicitly-encoded 347 for( Int yIdx = 0 ; yIdx < m_nYSize ; yIdx++ ) 348 { 349 for( Int uIdx = 0 ; uIdx < m_nUSize ; uIdx++ ) 350 { 351 for( Int vIdx = 0 ; vIdx < m_nVSize ; vIdx++ ) 352 { 353 m_pCuboidExplicit[yIdx][uIdx][vIdx] = false; 354 } 355 } 356 } 357 } 358 359 Void TCom3DAsymLUT::xCuboidsExplicitCheck( Int yIdx , Int uIdx , Int vIdx ) 360 { 361 if ( m_pCuboidExplicit[yIdx][uIdx][vIdx] == false ) 362 { 363 if( yIdx > 0) 364 assert ( m_pCuboidExplicit[yIdx-1][uIdx][vIdx] ); 365 366 for ( Int nVertexIdx=0 ; nVertexIdx<4 ; nVertexIdx++ ) 367 m_pCuboid[yIdx][uIdx][vIdx].P[nVertexIdx] = yIdx == 0 ? xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ): xGetCuboidVertexPredAll( yIdx , uIdx , vIdx , nVertexIdx ); 368 369 m_pCuboidExplicit[yIdx][uIdx][vIdx] = true ; 370 } 371 } 372 373 374 Void TCom3DAsymLUT::xCuboidsExplicitCheck( Bool bDecode ) 375 { 376 Int ySize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 377 Int uSize = 1 << getCurOctantDepth(); 378 Int vSize = 1 << getCurOctantDepth(); 379 for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ ) 380 { 381 for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ ) 382 { 383 for( Int vIdx = 0 ; vIdx < vSize ; vIdx++ ) 384 { 385 if ( bDecode ) 386 xCuboidsExplicitCheck( yIdx , uIdx , vIdx ); 387 388 assert( m_pCuboidExplicit[yIdx][uIdx][vIdx] ); 389 } 390 } 391 } 392 393 } 394 #endif 395 396 #if R0150_CGS_SIGNAL_CONSTRAINTS 397 Bool TCom3DAsymLUT::isRefLayer( UInt uiRefLayerId ) 398 { 399 Bool bIsRefLayer = false; 400 for( UInt i = 0 ; i < m_vRefLayerId.size() ; i++ ) 401 { 402 if( m_vRefLayerId[i] == uiRefLayerId ) 403 { 404 bIsRefLayer = true; 405 break; 406 } 407 } 408 409 return( bIsRefLayer ); 410 } 411 #endif 412 413 #endif 414 -
branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.h
r815 r825 4 4 5 5 #include "TypeDef.h" 6 #if R0150_CGS_SIGNAL_CONSTRAINTS 7 #include <cassert> 8 #include <vector> 9 #endif 6 10 7 11 #if Q0048_CGS_3D_ASYMLUT … … 25 29 virtual ~TCom3DAsymLUT(); 26 30 27 virtual Void create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 ); 31 virtual Void create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 32 #if R0151_CGS_3D_ASYMLUT_IMPROVE 33 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 34 #endif 35 ); 28 36 virtual Void destroy(); 29 37 … … 38 46 Int getMaxYPartNumLog2() { return m_nMaxYPartNumLog2; } 39 47 Int getCurYPartNumLog2() { return m_nCurYPartNumLog2; } 48 #if R0150_CGS_SIGNAL_CONSTRAINTS 49 Void addRefLayerId( UInt uiRefLayerId ) 50 { 51 if( !isRefLayer( uiRefLayerId ) ) 52 m_vRefLayerId.push_back( uiRefLayerId ); 53 } 54 size_t getRefLayerNum() { return m_vRefLayerId.size(); } 55 UInt getRefLayerId( UInt n ) { assert( n < m_vRefLayerId.size() ); return m_vRefLayerId[n]; } 56 Bool isRefLayer( UInt uiRefLayerId ); 57 #endif 58 #if R0151_CGS_3D_ASYMLUT_IMPROVE 59 Void setAdaptChromaThresholdU( Int n ) { m_nAdaptCThresholdU = n; } 60 Int getAdaptChromaThresholdU() { return m_nAdaptCThresholdU; } 61 Void setAdaptChromaThresholdV( Int n ) { m_nAdaptCThresholdV = n; } 62 Int getAdaptChromaThresholdV() { return m_nAdaptCThresholdV; } 63 #endif 40 64 41 65 Void colorMapping( TComPicYuv * pcPicSrc, TComPicYuv * pcPicDst ); … … 45 69 SYUVP getCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); 46 70 Void setCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx , Int deltaY , Int deltaU , Int deltaV ); 47 71 #if R0164_CGS_LUT_BUGFIX 72 Void xInitCuboids( ); 73 Void xCuboidsExplicitCheck( Int yIdx , Int uIdx , Int vIdx ); 74 Void xCuboidsExplicitCheck( Bool bDecode ); 75 Void xSetExplicit( Int yIdx , Int uIdx , Int vIdx ) { m_pCuboidExplicit[yIdx][uIdx][vIdx] = true ;} 76 #endif 48 77 49 78 private: … … 70 99 SCuboid *** m_pCuboid; 71 100 const static Int m_nVertexIdxOffset[4][3]; 101 #if R0150_CGS_SIGNAL_CONSTRAINTS 102 std::vector<UInt> m_vRefLayerId; 103 #endif 104 #if R0151_CGS_3D_ASYMLUT_IMPROVE 105 Int m_nAdaptCThresholdU; 106 Int m_nAdaptCThresholdV; 107 #endif 108 #if R0164_CGS_LUT_BUGFIX 109 Bool *** m_pCuboidExplicit; 110 #endif 72 111 73 112 protected: … … 79 118 Void xFree3DArray( T *** &p ); 80 119 81 Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 ); 120 Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 121 #if R0151_CGS_3D_ASYMLUT_IMPROVE 122 , Int nAdaptCThresholdU , Int nAdaptCThreshodV 123 #endif 124 ); 82 125 SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); 83 126 Pel xMapY( Pel y , Pel u , Pel v ); … … 87 130 Int xGetUSize() { return m_nUSize; } 88 131 Int xGetVSize() { return m_nVSize; } 132 #if R0151_CGS_3D_ASYMLUT_IMPROVE 133 Int xGetYIdx(Pel y) { return( y >> m_nYShift2Idx ); } 134 Int xGetUIdx(Pel u) { return( m_nCurOctantDepth == 1 ? u >= m_nAdaptCThresholdU : u >> m_nUShift2Idx ); } 135 Int xGetVIdx(Pel v) { return( m_nCurOctantDepth == 1 ? v >= m_nAdaptCThresholdV : v >> m_nVShift2Idx ); } 136 Int xGetNormCoeffOne() { return( 1 << m_nMappingShift ); } 137 #else 89 138 Int xGetYShift2Idx() { return m_nYShift2Idx; } 90 139 Int xGetUShift2Idx() { return m_nUShift2Idx; } 91 140 Int xGetVShift2Idx() { return m_nVShift2Idx; } 141 #endif 92 142 SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx]; } 93 143 Void xSaveCuboids( SCuboid *** pSrcCuboid ); -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r823 r825 2626 2626 2627 2627 #endif // __TCOMSLICE__ 2628 -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r823 r825 93 93 #if Q0048_CGS_3D_ASYMLUT 94 94 #define CGS_GCC_NO_VECTORIZATION 1 95 #define O0194_WEIGHTED_PREDICTION_CGS 0 96 #else 95 #define R0150_CGS_SIGNAL_CONSTRAINTS 1 ///< JCTVC-R0150: CGS signaling improvement and constraints 96 #define R0151_CGS_3D_ASYMLUT_IMPROVE 1 ///< JCTVC-R0151: Non-uniform chroma partitioning and improved LUT coefficient coding 97 #define R0164_CGS_LUT_BUGFIX 1 ///< JCTVC-R0164: Bug fix with LUT syntax 98 #endif 97 99 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediciton for color gamut scalability 98 #endif99 100 #define POC_RESET_FLAG 0 ///< JCTVC-N0244: POC reset flag for layer pictures. 100 101 #define POC_RESET_IDC 1 ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r824 r825 316 316 #endif 317 317 318 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false );319 320 if(pcPPS->getScalingListPresentFlag ())321 {322 parseScalingList( pcPPS->getScalingList() );323 }318 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); 319 320 if(pcPPS->getScalingListPresentFlag ()) 321 { 322 parseScalingList( pcPPS->getScalingList() ); 323 } 324 324 325 325 #if SCALINGLIST_INFERRING … … 381 381 #endif 382 382 383 while ( xMoreRbspData() )384 {385 READ_FLAG( uiCode, "pps_extension_data_flag");386 }383 while ( xMoreRbspData() ) 384 { 385 READ_FLAG( uiCode, "pps_extension_data_flag"); 386 } 387 387 #if P0166_MODIFIED_PPS_EXTENSION 388 388 } … … 474 474 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 475 475 } 476 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode);477 if( pcVUI->getHrdParametersPresentFlag() )478 {479 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );480 }476 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 477 if( pcVUI->getHrdParametersPresentFlag() ) 478 { 479 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 480 } 481 481 } 482 482 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); … … 552 552 { 553 553 if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || 554 554 ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) 555 555 { 556 556 for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) … … 747 747 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 748 748 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 749 749 750 750 if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) 751 751 { 752 752 assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); 753 753 } 754 754 755 755 Int maxCUDepthDelta = uiCode; 756 756 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); … … 788 788 { 789 789 #endif 790 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode );791 if(pcSPS->getScalingListPresentFlag ())792 {793 parseScalingList( pcSPS->getScalingList() );794 }790 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); 791 if(pcSPS->getScalingListPresentFlag ()) 792 { 793 parseScalingList( pcSPS->getScalingList() ); 794 } 795 795 #if SCALINGLIST_INFERRING 796 796 } … … 1097 1097 #endif 1098 1098 #if VPS_VUI_OFFSET 1099 READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode );1099 READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode ); 1100 1100 #endif 1101 1101 #if O0109_MOVE_VPS_VUI_FLAG … … 1148 1148 if( !vps->getSplittingFlag() ) 1149 1149 { 1150 for(j = 0; j < numScalabilityTypes; j++)1151 {1152 READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);1150 for(j = 0; j < numScalabilityTypes; j++) 1151 { 1152 READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode); 1153 1153 #if !AUXILIARY_PICTURES 1154 assert( uiCode <= vps->getMaxLayerId() );1155 #endif 1156 }1157 }1154 assert( uiCode <= vps->getMaxLayerId() ); 1155 #endif 1156 } 1157 } 1158 1158 } 1159 1159 #endif … … 1242 1242 { 1243 1243 #if O0225_MAX_TID_FOR_REF_LAYERS 1244 1245 1246 1247 1248 1249 1250 1251 1244 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 1245 { 1246 if(vps->getDirectDependencyFlag(j, i)) 1247 { 1248 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode); 1249 assert( uiCode <= vps->getMaxTLayers()); 1250 } 1251 } 1252 1252 #else 1253 1253 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode); … … 1261 1261 { 1262 1262 #if O0225_MAX_TID_FOR_REF_LAYERS 1263 1264 1265 1266 1263 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 1264 { 1265 vps->setMaxTidIlRefPicsPlus1(i, j, 7); 1266 } 1267 1267 #else 1268 1268 vps->setMaxTidIlRefPicsPlus1(i, 7); … … 1827 1827 #endif 1828 1828 } 1829 1829 1830 1830 // When not present, the value of num_add_olss is inferred to be equal to 0. 1831 1831 // NumOutputLayerSets = num_add_olss + NumLayerSets … … 1841 1841 for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ ) 1842 1842 { 1843 vps->setOutputLayerFlag(i, j, 1);1843 vps->setOutputLayerFlag(i, j, 1); 1844 1844 } 1845 1845 } … … 1851 1851 vps->setSubLayerDpbInfoPresentFlag( i, 0, true ); 1852 1852 } 1853 1853 1854 1854 // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1. 1855 1855 vps->setVpsNumRepFormats( vps->getMaxLayers() ); … … 1869 1869 // vps_poc_lsb_aligned_flag 1870 1870 // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0. 1871 1871 1872 1872 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1873 1873 // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0. … … 1946 1946 READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( uiCode ); 1947 1947 #endif 1948 1948 1949 1949 if( repFormat->getChromaFormatVpsIdc() == 3 ) 1950 1950 { … … 1966 1966 #if DPB_PARAMS_MAXTLAYERS 1967 1967 #if BITRATE_PICRATE_SIGNALLING 1968 1969 1970 #else 1971 1972 1973 #endif 1974 1975 1968 Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()]; 1969 for(Int i = 0; i < vps->getNumLayerSets(); i++) 1970 #else 1971 Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()]; 1972 for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) 1973 #endif 1974 { 1975 UInt maxSLMinus1 = 0; 1976 1976 #if CHANGE_NUMSUBDPB_IDX 1977 1978 #else 1979 1977 Int optLsIdx = vps->getOutputLayerSetIdx( i ); 1978 #else 1979 Int optLsIdx = i; 1980 1980 #endif 1981 1981 #if BITRATE_PICRATE_SIGNALLING 1982 1983 #endif 1984 1985 1986 1987 1988 1982 optLsIdx = i; 1983 #endif 1984 for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) { 1985 Int lId = vps->getLayerSetLayerIdList(optLsIdx, k); 1986 maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId))); 1987 } 1988 MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1; 1989 1989 #if BITRATE_PICRATE_SIGNALLING 1990 1991 #endif 1992 1993 #endif 1994 1990 vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); 1991 #endif 1992 } 1993 #endif 1994 1995 1995 #if !RESOLUTION_BASED_DPB 1996 1996 vps->deriveNumberOfSubDpbs(); … … 2313 2313 #if VPS_VUI_VIDEO_SIGNAL_MOVE 2314 2314 #else 2315 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); 2316 if (vps->getVideoSigPresentVpsFlag()) 2317 { 2318 READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); 2315 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); 2316 if (vps->getVideoSigPresentVpsFlag()) 2317 { 2318 READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); 2319 } 2320 else 2321 { 2322 vps->setNumVideoSignalInfo(vps->getMaxLayers()); 2323 } 2324 2325 2326 for(i = 0; i < vps->getNumVideoSignalInfo(); i++) 2327 { 2328 READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); 2329 READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); 2330 READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); 2331 READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); 2332 READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); 2333 } 2334 if(!vps->getVideoSigPresentVpsFlag()) 2335 { 2336 for (i=0; i < vps->getMaxLayers(); i++) 2337 { 2338 vps->setVideoSignalInfoIdx(i,i); 2339 } 2340 } 2341 else { 2342 vps->setVideoSignalInfoIdx(0,0); 2343 if (vps->getNumVideoSignalInfo() > 1 ) 2344 { 2345 for (i=1; i < vps->getMaxLayers(); i++) 2346 READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); 2347 } 2348 else { 2349 for (i=1; i < vps->getMaxLayers(); i++) 2350 { 2351 vps->setVideoSignalInfoIdx(i,0); 2352 } 2353 } 2354 } 2355 #endif 2356 #endif 2357 2358 #if O0164_MULTI_LAYER_HRD 2359 READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); 2360 if (vps->getVpsVuiBspHrdPresentFlag()) 2361 { 2362 READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); 2363 vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); 2364 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) 2365 { 2366 if( i > 0 ) 2367 { 2368 READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); 2369 } 2370 parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 2371 } 2372 #if Q0078_ADD_LAYER_SETS 2373 for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) 2374 #else 2375 for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) 2376 #endif 2377 { 2378 READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); 2379 #if HRD_BPB 2380 Int chkPart=0; 2381 #endif 2382 for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) 2383 { 2384 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2385 { 2386 if( vps->getLayerIdIncludedFlag(h, j) ) 2387 { 2388 READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); 2389 } 2390 } 2391 #if HRD_BPB 2392 chkPart+=vps->getLayerInBspFlag(h, i, j); 2393 #endif 2394 } 2395 #if HRD_BPB 2396 assert(chkPart<=1); 2397 #endif 2398 #if HRD_BPB 2399 if(vps->getNumBitstreamPartitions(h)==1) 2400 { 2401 Int chkPartition1=0; Int chkPartition2=0; 2402 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2403 { 2404 if( vps->getLayerIdIncludedFlag(h, j) ) 2405 { 2406 chkPartition1+=vps->getLayerInBspFlag(h, 0, j); 2407 chkPartition2++; 2408 } 2409 } 2410 assert(chkPartition1!=chkPartition2); 2411 } 2412 #endif 2413 if (vps->getNumBitstreamPartitions(h)) 2414 { 2415 #if Q0182_MULTI_LAYER_HRD_UPDATE 2416 READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); 2417 #else 2418 READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); 2419 #endif 2420 for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) 2421 { 2422 for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) 2423 { 2424 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); 2425 #if HRD_BPB 2426 assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); 2427 #endif 2428 2429 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); 2430 #if HRD_BPB 2431 assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); 2432 #endif 2433 } 2434 } 2435 } 2436 } 2437 } 2438 #endif 2439 2440 #if P0182_VPS_VUI_PS_FLAG 2441 for(i = 1; i < vps->getMaxLayers(); i++) 2442 { 2443 if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) 2444 { 2445 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); 2446 vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); 2319 2447 } 2320 2448 else 2321 2449 { 2322 vps->setNumVideoSignalInfo(vps->getMaxLayers()); 2323 } 2324 2325 2326 for(i = 0; i < vps->getNumVideoSignalInfo(); i++) 2327 { 2328 READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); 2329 READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); 2330 READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); 2331 READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); 2332 READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); 2333 } 2334 if(!vps->getVideoSigPresentVpsFlag()) 2335 { 2336 for (i=0; i < vps->getMaxLayers(); i++) 2337 { 2338 vps->setVideoSignalInfoIdx(i,i); 2339 } 2340 } 2341 else { 2342 vps->setVideoSignalInfoIdx(0,0); 2343 if (vps->getNumVideoSignalInfo() > 1 ) 2344 { 2345 for (i=1; i < vps->getMaxLayers(); i++) 2346 READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); 2347 } 2348 else { 2349 for (i=1; i < vps->getMaxLayers(); i++) 2350 { 2351 vps->setVideoSignalInfoIdx(i,0); 2352 } 2353 } 2354 } 2355 #endif 2356 #endif 2357 2358 #if O0164_MULTI_LAYER_HRD 2359 READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); 2360 if (vps->getVpsVuiBspHrdPresentFlag()) 2361 { 2362 READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); 2363 vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); 2364 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) 2365 { 2366 if( i > 0 ) 2367 { 2368 READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); 2369 } 2370 parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 2371 } 2372 #if Q0078_ADD_LAYER_SETS 2373 for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) 2374 #else 2375 for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) 2376 #endif 2377 { 2378 READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); 2379 #if HRD_BPB 2380 Int chkPart=0; 2381 #endif 2382 for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) 2383 { 2384 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2385 { 2386 if( vps->getLayerIdIncludedFlag(h, j) ) 2387 { 2388 READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); 2389 } 2390 } 2391 #if HRD_BPB 2392 chkPart+=vps->getLayerInBspFlag(h, i, j); 2393 #endif 2394 } 2395 #if HRD_BPB 2396 assert(chkPart<=1); 2397 #endif 2398 #if HRD_BPB 2399 if(vps->getNumBitstreamPartitions(h)==1) 2400 { 2401 Int chkPartition1=0; Int chkPartition2=0; 2402 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2403 { 2404 if( vps->getLayerIdIncludedFlag(h, j) ) 2405 { 2406 chkPartition1+=vps->getLayerInBspFlag(h, 0, j); 2407 chkPartition2++; 2408 } 2409 } 2410 assert(chkPartition1!=chkPartition2); 2411 } 2412 #endif 2413 if (vps->getNumBitstreamPartitions(h)) 2414 { 2415 #if Q0182_MULTI_LAYER_HRD_UPDATE 2416 READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); 2417 #else 2418 READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); 2419 #endif 2420 for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) 2421 { 2422 for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) 2423 { 2424 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); 2425 #if HRD_BPB 2426 assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); 2427 #endif 2428 2429 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); 2430 #if HRD_BPB 2431 assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); 2432 #endif 2433 } 2434 } 2435 } 2436 } 2437 } 2438 #endif 2439 2440 #if P0182_VPS_VUI_PS_FLAG 2441 for(i = 1; i < vps->getMaxLayers(); i++) 2442 { 2443 if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) 2444 { 2445 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); 2446 vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); 2447 } 2448 else 2449 { 2450 vps->setBaseLayerPSCompatibilityFlag( i, 0 ); 2451 } 2452 } 2450 vps->setBaseLayerPSCompatibilityFlag( i, 0 ); 2451 } 2452 } 2453 2453 #endif 2454 2454 } … … 2532 2532 #if Q0142_POC_LSB_NOT_PRESENT 2533 2533 #if SHM_FIX7 2534 2534 Int iPOClsb = 0; 2535 2535 #endif 2536 2536 #endif … … 2659 2659 #if N0065_LAYER_POC_ALIGNMENT 2660 2660 #if SHM_FIX7 2661 2661 } 2662 2662 #endif 2663 2663 #if POC_RESET_IDC_DECODER 2664 else 2665 { 2666 rpcSlice->setPicOrderCntLsb( 0 ); 2667 } 2668 #endif 2669 if( !rpcSlice->getIdrPicFlag() ) 2670 { 2671 #endif 2672 TComReferencePictureSet* rps; 2673 rps = rpcSlice->getLocalRPS(); 2674 rpcSlice->setRPS(rps); 2675 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2676 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2677 { 2678 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2679 } 2680 else // use reference to short-term reference picture set in PPS 2681 { 2682 Int numBits = 0; 2683 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) 2684 { 2685 numBits++; 2686 } 2687 if (numBits > 0) 2688 { 2689 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2664 else 2665 { 2666 rpcSlice->setPicOrderCntLsb( 0 ); 2667 } 2668 #endif 2669 if( !rpcSlice->getIdrPicFlag() ) 2670 { 2671 #endif 2672 TComReferencePictureSet* rps; 2673 rps = rpcSlice->getLocalRPS(); 2674 rpcSlice->setRPS(rps); 2675 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2676 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2677 { 2678 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2679 } 2680 else // use reference to short-term reference picture set in PPS 2681 { 2682 Int numBits = 0; 2683 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) 2684 { 2685 numBits++; 2686 } 2687 if (numBits > 0) 2688 { 2689 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2690 } 2691 else 2692 { 2693 uiCode = 0; 2694 } 2695 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2696 } 2697 if(sps->getLongTermRefsPresent()) 2698 { 2699 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2700 UInt numOfLtrp = 0; 2701 UInt numLtrpInSPS = 0; 2702 if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) 2703 { 2704 READ_UVLC( uiCode, "num_long_term_sps"); 2705 numLtrpInSPS = uiCode; 2706 numOfLtrp += numLtrpInSPS; 2707 rps->setNumberOfLongtermPictures(numOfLtrp); 2708 } 2709 Int bitsForLtrpInSPS = 0; 2710 while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2711 { 2712 bitsForLtrpInSPS++; 2713 } 2714 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2715 numOfLtrp += uiCode; 2716 rps->setNumberOfLongtermPictures(numOfLtrp); 2717 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 2718 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 2719 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2720 { 2721 Int pocLsbLt; 2722 if (k < numLtrpInSPS) 2723 { 2724 uiCode = 0; 2725 if (bitsForLtrpInSPS > 0) 2726 { 2727 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2728 } 2729 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); 2730 2731 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); 2732 rps->setUsed(j,usedByCurrFromSPS); 2690 2733 } 2691 2734 else 2692 2735 { 2693 uiCode = 0; 2694 } 2695 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2696 } 2697 if(sps->getLongTermRefsPresent()) 2698 { 2699 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2700 UInt numOfLtrp = 0; 2701 UInt numLtrpInSPS = 0; 2702 if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) 2703 { 2704 READ_UVLC( uiCode, "num_long_term_sps"); 2705 numLtrpInSPS = uiCode; 2706 numOfLtrp += numLtrpInSPS; 2707 rps->setNumberOfLongtermPictures(numOfLtrp); 2708 } 2709 Int bitsForLtrpInSPS = 0; 2710 while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2711 { 2712 bitsForLtrpInSPS++; 2713 } 2714 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2715 numOfLtrp += uiCode; 2716 rps->setNumberOfLongtermPictures(numOfLtrp); 2717 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 2718 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 2719 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2720 { 2721 Int pocLsbLt; 2722 if (k < numLtrpInSPS) 2736 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2737 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2738 } 2739 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2740 Bool mSBPresentFlag = uiCode ? true : false; 2741 if(mSBPresentFlag) 2742 { 2743 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2744 Bool deltaFlag = false; 2745 // First LTRP || First LTRP from SH 2746 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2723 2747 { 2724 uiCode = 0; 2725 if (bitsForLtrpInSPS > 0) 2726 { 2727 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2728 } 2729 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); 2730 2731 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); 2732 rps->setUsed(j,usedByCurrFromSPS); 2748 deltaFlag = true; 2749 } 2750 if(deltaFlag) 2751 { 2752 deltaPocMSBCycleLT = uiCode; 2733 2753 } 2734 2754 else 2735 2755 { 2736 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2737 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2756 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2738 2757 } 2739 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2740 Bool mSBPresentFlag = uiCode ? true : false; 2741 if(mSBPresentFlag) 2758 2759 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2760 - iPOClsb + pocLsbLt; 2761 rps->setPOC (j, pocLTCurr); 2762 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 2763 rps->setCheckLTMSBPresent(j,true); 2764 } 2765 else 2766 { 2767 rps->setPOC (j, pocLsbLt); 2768 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 2769 rps->setCheckLTMSBPresent(j,false); 2770 2771 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2772 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2742 2773 { 2743 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2744 Bool deltaFlag = false; 2745 // First LTRP || First LTRP from SH 2746 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2747 { 2748 deltaFlag = true; 2749 } 2750 if(deltaFlag) 2751 { 2752 deltaPocMSBCycleLT = uiCode; 2753 } 2754 else 2755 { 2756 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2757 } 2758 2759 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2760 - iPOClsb + pocLsbLt; 2761 rps->setPOC (j, pocLTCurr); 2762 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 2763 rps->setCheckLTMSBPresent(j,true); 2774 deltaPocMSBCycleLT = 0; 2764 2775 } 2765 else 2776 } 2777 prevDeltaMSB = deltaPocMSBCycleLT; 2778 } 2779 offset += rps->getNumberOfLongtermPictures(); 2780 rps->setNumberOfPictures(offset); 2781 } 2782 #if DPB_CONSTRAINTS 2783 if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) 2784 { 2785 #if Q0078_ADD_LAYER_SETS 2786 for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 2787 #else 2788 for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) 2789 #endif 2790 { 2791 Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); 2792 Int chkAssert=0; 2793 for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) 2794 { 2795 if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) 2766 2796 { 2767 rps->setPOC (j, pocLsbLt); 2768 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 2769 rps->setCheckLTMSBPresent(j,false); 2770 2771 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2772 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2773 { 2774 deltaPocMSBCycleLT = 0; 2797 chkAssert=1; 2798 } 2799 } 2800 if(chkAssert) 2801 { 2802 // There may be something wrong here (layer id assumed to be layer idx?) 2803 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2804 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); 2805 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2806 } 2807 } 2808 2809 2810 } 2811 if(rpcSlice->getLayerId() == 0) 2812 { 2813 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); 2814 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); 2815 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); 2816 } 2817 #endif 2818 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2819 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2820 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2821 { 2822 // In the case of BLA picture types, rps data is read from slice header but ignored 2823 rps = rpcSlice->getLocalRPS(); 2824 rps->setNumberOfNegativePictures(0); 2825 rps->setNumberOfPositivePictures(0); 2826 rps->setNumberOfLongtermPictures(0); 2827 rps->setNumberOfPictures(0); 2828 rpcSlice->setRPS(rps); 2829 } 2830 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 2831 { 2832 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 2833 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2834 } 2835 else 2836 { 2837 rpcSlice->setEnableTMVPFlag(false); 2838 } 2839 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 2840 } 2841 #endif 2842 } 2843 2844 #if SVC_EXTENSION 2845 rpcSlice->setActiveNumILRRefIdx(0); 2846 if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) ) 2847 { 2848 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); 2849 rpcSlice->setInterLayerPredEnabledFlag(uiCode); 2850 if( rpcSlice->getInterLayerPredEnabledFlag()) 2851 { 2852 if(rpcSlice->getNumILRRefIdx() > 1) 2853 { 2854 Int numBits = 1; 2855 while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) 2856 { 2857 numBits++; 2858 } 2859 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 2860 { 2861 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); 2862 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 2863 } 2864 else 2865 { 2866 #if P0079_DERIVE_NUMACTIVE_REF_PICS 2867 for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) 2868 { 2869 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 2870 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 2871 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2872 #else 2873 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && 2874 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2875 #endif 2876 { 2877 rpcSlice->setActiveNumILRRefIdx(1); 2878 break; 2775 2879 } 2776 2880 } 2777 prevDeltaMSB = deltaPocMSBCycleLT; 2778 } 2779 offset += rps->getNumberOfLongtermPictures(); 2780 rps->setNumberOfPictures(offset); 2781 } 2782 #if DPB_CONSTRAINTS 2783 if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) 2881 #else 2882 rpcSlice->setActiveNumILRRefIdx(1); 2883 #endif 2884 } 2885 2886 if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() ) 2887 { 2888 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2784 2889 { 2785 #if Q0078_ADD_LAYER_SETS 2786 for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 2787 #else 2788 for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) 2789 #endif 2790 { 2791 Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); 2792 Int chkAssert=0; 2793 for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) 2794 { 2795 if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) 2796 { 2797 chkAssert=1; 2798 } 2799 } 2800 if(chkAssert) 2801 { 2802 // There may be something wrong here (layer id assumed to be layer idx?) 2803 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2804 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); 2805 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2806 } 2807 } 2808 2809 2890 rpcSlice->setInterLayerPredLayerIdc(i,i); 2810 2891 } 2811 if(rpcSlice->getLayerId() == 0) 2892 } 2893 else 2894 { 2895 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2812 2896 { 2813 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); 2814 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); 2815 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); 2897 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 2898 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 2816 2899 } 2817 #endif 2818 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2819 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2820 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2821 { 2822 // In the case of BLA picture types, rps data is read from slice header but ignored 2823 rps = rpcSlice->getLocalRPS(); 2824 rps->setNumberOfNegativePictures(0); 2825 rps->setNumberOfPositivePictures(0); 2826 rps->setNumberOfLongtermPictures(0); 2827 rps->setNumberOfPictures(0); 2828 rpcSlice->setRPS(rps); 2829 } 2830 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 2831 { 2832 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 2833 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2900 } 2834 2901 } 2835 2902 else 2836 2903 { 2837 rpcSlice->setEnableTMVPFlag(false);2838 }2839 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX72840 }2841 #endif2842 }2843 2844 #if SVC_EXTENSION2845 rpcSlice->setActiveNumILRRefIdx(0);2846 if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )2847 {2848 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");2849 rpcSlice->setInterLayerPredEnabledFlag(uiCode);2850 if( rpcSlice->getInterLayerPredEnabledFlag())2851 {2852 if(rpcSlice->getNumILRRefIdx() > 1)2853 {2854 Int numBits = 1;2855 while ((1 << numBits) < rpcSlice->getNumILRRefIdx())2856 {2857 numBits++;2858 }2859 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag())2860 {2861 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" );2862 rpcSlice->setActiveNumILRRefIdx(uiCode + 1);2863 }2864 else2865 {2866 #if P0079_DERIVE_NUMACTIVE_REF_PICS2867 for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ )2868 {2869 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO2870 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) &&2871 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) )2872 #else2873 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() &&2874 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) )2875 #endif2876 {2877 rpcSlice->setActiveNumILRRefIdx(1);2878 break;2879 }2880 }2881 #else2882 rpcSlice->setActiveNumILRRefIdx(1);2883 #endif2884 }2885 2886 if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() )2887 {2888 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )2889 {2890 rpcSlice->setInterLayerPredLayerIdc(i,i);2891 }2892 }2893 else2894 {2895 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )2896 {2897 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" );2898 rpcSlice->setInterLayerPredLayerIdc(uiCode,i);2899 }2900 }2901 }2902 else2903 {2904 2904 #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS 2905 2905 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 2906 2907 2908 #else 2909 2910 2906 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 2907 (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) 2908 #else 2909 if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer()) && 2910 (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) 2911 2911 #endif 2912 2912 { … … 2917 2917 } 2918 2918 #endif 2919 2920 2921 2922 2923 2924 2919 } 2920 } 2921 } 2922 else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true && (rpcSlice->getLayerId() > 0 )) 2923 { 2924 rpcSlice->setInterLayerPredEnabledFlag(true); 2925 2925 2926 2926 #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS 2927 2928 2929 2930 2931 2927 Int numRefLayerPics = 0; 2928 Int i = 0; 2929 Int refLayerPicIdc [MAX_VPS_LAYER_ID_PLUS1]; 2930 for(i = 0, numRefLayerPics = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) 2931 { 2932 2932 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 2933 2934 2933 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 2934 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2935 2935 #else 2936 2937 2936 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && 2937 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2938 2938 #endif 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 #else 2949 2950 2951 2952 2953 2939 { 2940 refLayerPicIdc[ numRefLayerPics++ ] = i; 2941 } 2942 } 2943 rpcSlice->setActiveNumILRRefIdx(numRefLayerPics); 2944 for( i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2945 { 2946 rpcSlice->setInterLayerPredLayerIdc(refLayerPicIdc[i],i); 2947 } 2948 #else 2949 rpcSlice->setActiveNumILRRefIdx(rpcSlice->getNumILRRefIdx()); 2950 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2951 { 2952 rpcSlice->setInterLayerPredLayerIdc(i,i); 2953 } 2954 2954 #endif 2955 2955 } 2956 2956 #if P0312_VERT_PHASE_ADJ 2957 2958 2959 2960 2961 2962 2963 2964 2957 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2958 { 2959 UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i); 2960 if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) 2961 { 2962 READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc ); 2963 } 2964 } 2965 2965 #endif 2966 2966 #endif //SVC_EXTENSION 2967 2967 2968 2969 2970 2968 if(sps->getUseSAO()) 2969 { 2970 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 2971 2971 #if AUXILIARY_PICTURES 2972 2972 ChromaFormat format; 2973 2973 #if REPN_FORMAT_IN_VPS 2974 2974 #if O0096_REP_FORMAT_INDEX 2975 2976 2977 2978 2979 2980 2981 2975 if( sps->getLayerId() == 0 ) 2976 { 2977 format = sps->getChromaFormatIdc(); 2978 } 2979 else 2980 { 2981 format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 2982 2982 #if Q0195_REP_FORMAT_CLEANUP 2983 assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check 2984 #endif 2985 } 2986 #else 2987 if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) 2988 { 2989 format = sps->getChromaFormatIdc(); 2990 } 2991 else 2992 { 2993 format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 2994 } 2995 #endif 2996 #else 2983 assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check 2984 #endif 2985 } 2986 #else 2987 if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) 2988 { 2997 2989 format = sps->getChromaFormatIdc(); 2998 #endif 2999 if (format != CHROMA_400) 3000 { 2990 } 2991 else 2992 { 2993 format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 2994 } 2995 #endif 2996 #else 2997 format = sps->getChromaFormatIdc(); 2998 #endif 2999 if (format != CHROMA_400) 3000 { 3001 3001 #endif 3002 3002 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 3003 3003 #if AUXILIARY_PICTURES 3004 } 3005 else 3006 { 3007 rpcSlice->setSaoEnabledFlagChroma(false); 3008 } 3009 #endif 3010 } 3011 3012 if (rpcSlice->getIdrPicFlag()) 3013 { 3014 rpcSlice->setEnableTMVPFlag(false); 3015 } 3016 if (!rpcSlice->isIntra()) 3017 { 3018 3019 READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); 3020 if (uiCode) 3021 { 3022 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 3023 if (rpcSlice->isInterB()) 3024 { 3025 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 3004 3026 } 3005 3027 else 3006 3028 { 3007 rpcSlice->setSaoEnabledFlagChroma(false); 3008 } 3009 #endif 3010 } 3011 3012 if (rpcSlice->getIdrPicFlag()) 3013 { 3014 rpcSlice->setEnableTMVPFlag(false); 3015 } 3016 if (!rpcSlice->isIntra()) 3017 { 3018 3019 READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); 3020 if (uiCode) 3021 { 3022 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 3023 if (rpcSlice->isInterB()) 3024 { 3025 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 3026 } 3027 else 3028 { 3029 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 3030 } 3029 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 3030 } 3031 } 3032 else 3033 { 3034 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); 3035 if (rpcSlice->isInterB()) 3036 { 3037 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); 3031 3038 } 3032 3039 else 3033 3040 { 3034 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); 3035 if (rpcSlice->isInterB()) 3036 { 3037 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); 3038 } 3039 else 3040 { 3041 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 3042 } 3043 } 3044 } 3045 // } 3046 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); 3047 if(!rpcSlice->isIntra()) 3048 { 3049 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3050 { 3051 refPicListModification->setRefPicListModificationFlagL0( 0 ); 3041 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 3042 } 3043 } 3044 } 3045 // } 3046 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); 3047 if(!rpcSlice->isIntra()) 3048 { 3049 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3050 { 3051 refPicListModification->setRefPicListModificationFlagL0( 0 ); 3052 } 3053 else 3054 { 3055 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 3056 } 3057 3058 if(refPicListModification->getRefPicListModificationFlagL0()) 3059 { 3060 uiCode = 0; 3061 Int i = 0; 3062 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); 3063 if ( numRpsCurrTempList0 > 1 ) 3064 { 3065 Int length = 1; 3066 numRpsCurrTempList0 --; 3067 while ( numRpsCurrTempList0 >>= 1) 3068 { 3069 length ++; 3070 } 3071 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3072 { 3073 READ_CODE( length, uiCode, "list_entry_l0" ); 3074 refPicListModification->setRefPicSetIdxL0(i, uiCode ); 3075 } 3052 3076 } 3053 3077 else 3054 3078 { 3055 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 3056 } 3057 3058 if(refPicListModification->getRefPicListModificationFlagL0()) 3059 { 3060 uiCode = 0; 3061 Int i = 0; 3062 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); 3063 if ( numRpsCurrTempList0 > 1 ) 3064 { 3065 Int length = 1; 3066 numRpsCurrTempList0 --; 3067 while ( numRpsCurrTempList0 >>= 1) 3068 { 3069 length ++; 3070 } 3071 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3072 { 3073 READ_CODE( length, uiCode, "list_entry_l0" ); 3074 refPicListModification->setRefPicSetIdxL0(i, uiCode ); 3075 } 3076 } 3077 else 3078 { 3079 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3080 { 3081 refPicListModification->setRefPicSetIdxL0(i, 0 ); 3082 } 3083 } 3084 } 3079 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3080 { 3081 refPicListModification->setRefPicSetIdxL0(i, 0 ); 3082 } 3083 } 3084 } 3085 } 3086 else 3087 { 3088 refPicListModification->setRefPicListModificationFlagL0(0); 3089 } 3090 if(rpcSlice->isInterB()) 3091 { 3092 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3093 { 3094 refPicListModification->setRefPicListModificationFlagL1( 0 ); 3085 3095 } 3086 3096 else 3087 3097 { 3088 refPicListModification->setRefPicListModificationFlagL0(0); 3089 } 3090 if(rpcSlice->isInterB()) 3091 { 3092 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3093 { 3094 refPicListModification->setRefPicListModificationFlagL1( 0 ); 3098 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); 3099 } 3100 if(refPicListModification->getRefPicListModificationFlagL1()) 3101 { 3102 uiCode = 0; 3103 Int i = 0; 3104 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); 3105 if ( numRpsCurrTempList1 > 1 ) 3106 { 3107 Int length = 1; 3108 numRpsCurrTempList1 --; 3109 while ( numRpsCurrTempList1 >>= 1) 3110 { 3111 length ++; 3112 } 3113 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3114 { 3115 READ_CODE( length, uiCode, "list_entry_l1" ); 3116 refPicListModification->setRefPicSetIdxL1(i, uiCode ); 3117 } 3095 3118 } 3096 3119 else 3097 3120 { 3098 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); 3099 } 3100 if(refPicListModification->getRefPicListModificationFlagL1()) 3101 { 3102 uiCode = 0; 3103 Int i = 0; 3104 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); 3105 if ( numRpsCurrTempList1 > 1 ) 3106 { 3107 Int length = 1; 3108 numRpsCurrTempList1 --; 3109 while ( numRpsCurrTempList1 >>= 1) 3110 { 3111 length ++; 3112 } 3113 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3114 { 3115 READ_CODE( length, uiCode, "list_entry_l1" ); 3116 refPicListModification->setRefPicSetIdxL1(i, uiCode ); 3117 } 3118 } 3119 else 3120 { 3121 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3122 { 3123 refPicListModification->setRefPicSetIdxL1(i, 0 ); 3124 } 3125 } 3126 } 3121 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3122 { 3123 refPicListModification->setRefPicSetIdxL1(i, 0 ); 3124 } 3125 } 3126 } 3127 } 3128 else 3129 { 3130 refPicListModification->setRefPicListModificationFlagL1(0); 3131 } 3132 if (rpcSlice->isInterB()) 3133 { 3134 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 3135 } 3136 3137 rpcSlice->setCabacInitFlag( false ); // default 3138 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 3139 { 3140 READ_FLAG(uiCode, "cabac_init_flag"); 3141 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 3142 } 3143 3144 if ( rpcSlice->getEnableTMVPFlag() ) 3145 { 3146 #if SVC_EXTENSION && REF_IDX_MFM 3147 // set motion mapping flag 3148 rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); 3149 #endif 3150 if ( rpcSlice->getSliceType() == B_SLICE ) 3151 { 3152 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 3153 rpcSlice->setColFromL0Flag(uiCode); 3127 3154 } 3128 3155 else 3129 3156 { 3130 refPicListModification->setRefPicListModificationFlagL1(0); 3131 } 3132 if (rpcSlice->isInterB()) 3133 { 3134 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 3135 } 3136 3137 rpcSlice->setCabacInitFlag( false ); // default 3138 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 3139 { 3140 READ_FLAG(uiCode, "cabac_init_flag"); 3141 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 3142 } 3143 3144 if ( rpcSlice->getEnableTMVPFlag() ) 3145 { 3146 #if SVC_EXTENSION && REF_IDX_MFM 3147 // set motion mapping flag 3148 rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); 3149 #endif 3150 if ( rpcSlice->getSliceType() == B_SLICE ) 3151 { 3152 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 3153 rpcSlice->setColFromL0Flag(uiCode); 3154 } 3155 else 3156 { 3157 rpcSlice->setColFromL0Flag( 1 ); 3158 } 3159 3160 if ( rpcSlice->getSliceType() != I_SLICE && 3161 ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 3162 (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 3163 { 3164 READ_UVLC( uiCode, "collocated_ref_idx" ); 3165 rpcSlice->setColRefIdx(uiCode); 3166 } 3167 else 3168 { 3169 rpcSlice->setColRefIdx(0); 3170 } 3171 } 3172 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 3173 { 3174 xParsePredWeightTable(rpcSlice); 3175 rpcSlice->initWpScaling(); 3176 } 3177 if (!rpcSlice->isIntra()) 3178 { 3179 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 3180 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 3181 } 3182 3183 READ_SVLC( iCode, "slice_qp_delta" ); 3184 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 3157 rpcSlice->setColFromL0Flag( 1 ); 3158 } 3159 3160 if ( rpcSlice->getSliceType() != I_SLICE && 3161 ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 3162 (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 3163 { 3164 READ_UVLC( uiCode, "collocated_ref_idx" ); 3165 rpcSlice->setColRefIdx(uiCode); 3166 } 3167 else 3168 { 3169 rpcSlice->setColRefIdx(0); 3170 } 3171 } 3172 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 3173 { 3174 xParsePredWeightTable(rpcSlice); 3175 rpcSlice->initWpScaling(); 3176 } 3177 if (!rpcSlice->isIntra()) 3178 { 3179 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 3180 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 3181 } 3182 3183 READ_SVLC( iCode, "slice_qp_delta" ); 3184 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 3185 3185 3186 3186 #if REPN_FORMAT_IN_VPS 3187 3187 #if O0194_DIFFERENT_BITDEPTH_EL_BL 3188 g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); 3189 g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); 3190 #endif 3191 assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); 3192 #else 3193 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 3194 #endif 3195 assert( rpcSlice->getSliceQp() <= 51 ); 3196 3197 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 3198 { 3199 READ_SVLC( iCode, "slice_qp_delta_cb" ); 3200 rpcSlice->setSliceQpDeltaCb( iCode ); 3201 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 3202 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 3203 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 3204 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 3205 3206 READ_SVLC( iCode, "slice_qp_delta_cr" ); 3207 rpcSlice->setSliceQpDeltaCr( iCode ); 3208 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 3209 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 3210 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 3211 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 3212 } 3213 3214 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 3215 { 3216 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 3217 { 3218 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 3188 g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); 3189 g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); 3190 #endif 3191 assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); 3192 #else 3193 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 3194 #endif 3195 assert( rpcSlice->getSliceQp() <= 51 ); 3196 3197 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 3198 { 3199 READ_SVLC( iCode, "slice_qp_delta_cb" ); 3200 rpcSlice->setSliceQpDeltaCb( iCode ); 3201 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 3202 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 3203 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 3204 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 3205 3206 READ_SVLC( iCode, "slice_qp_delta_cr" ); 3207 rpcSlice->setSliceQpDeltaCr( iCode ); 3208 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 3209 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 3210 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 3211 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 3212 } 3213 3214 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 3215 { 3216 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 3217 { 3218 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 3219 } 3220 else 3221 { 3222 rpcSlice->setDeblockingFilterOverrideFlag(0); 3223 } 3224 if(rpcSlice->getDeblockingFilterOverrideFlag()) 3225 { 3226 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 3227 if(!rpcSlice->getDeblockingFilterDisable()) 3228 { 3229 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 3230 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 3231 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 3232 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 3233 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 3234 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 3235 } 3236 } 3237 else 3238 { 3239 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); 3240 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 3241 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 3242 } 3243 } 3244 else 3245 { 3246 rpcSlice->setDeblockingFilterDisable ( false ); 3247 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 3248 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 3249 } 3250 3251 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); 3252 Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); 3253 3254 if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 3255 { 3256 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); 3257 } 3258 else 3259 { 3260 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 3261 } 3262 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 3263 3264 } 3265 3266 UInt *entryPointOffset = NULL; 3267 UInt numEntryPointOffsets, offsetLenMinus1; 3268 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3269 { 3270 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 3271 if (numEntryPointOffsets>0) 3272 { 3273 READ_UVLC(offsetLenMinus1, "offset_len_minus1"); 3274 } 3275 entryPointOffset = new UInt[numEntryPointOffsets]; 3276 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3277 { 3278 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 3279 entryPointOffset[ idx ] = uiCode + 1; 3280 } 3281 } 3282 else 3283 { 3284 rpcSlice->setNumEntryPointOffsets ( 0 ); 3285 } 3286 3287 #if POC_RESET_IDC_SIGNALLING 3288 Int sliceHeaderExtensionLength = 0; 3289 if(pps->getSliceHeaderExtensionPresentFlag()) 3290 { 3291 READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; 3292 } 3293 else 3294 { 3295 sliceHeaderExtensionLength = 0; 3296 } 3297 UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits 3298 if( sliceHeaderExtensionLength > 0 ) 3299 { 3300 if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) 3301 { 3302 READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); 3303 } 3304 else 3305 { 3306 rpcSlice->setPocResetIdc( 0 ); 3307 } 3308 #if Q0142_POC_LSB_NOT_PRESENT 3309 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) 3310 { 3311 assert( rpcSlice->getPocResetIdc() != 2 ); 3312 } 3313 #endif 3314 if( rpcSlice->getPocResetIdc() > 0 ) 3315 { 3316 READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); 3317 } 3318 else 3319 { 3320 3321 rpcSlice->setPocResetPeriodId( 0 ); 3322 } 3323 3324 if (rpcSlice->getPocResetIdc() == 3) 3325 { 3326 READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); 3327 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); 3328 #if Q0142_POC_LSB_NOT_PRESENT 3329 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) 3330 { 3331 assert( rpcSlice->getPocLsbVal() == 0 ); 3332 } 3333 #endif 3334 } 3335 3336 // Derive the value of PocMsbValRequiredFlag 3337 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() 3338 /* || related to vps_poc_lsb_aligned_flag */ 3339 ); 3340 3341 if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ ) 3342 { 3343 READ_FLAG( uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false ); 3344 } 3345 else 3346 { 3347 #if POC_MSB_VAL_PRESENT_FLAG_SEM 3348 if( sliceHeaderExtensionLength == 0 ) 3349 { 3350 rpcSlice->setPocMsbValPresentFlag( false ); 3351 } 3352 else if( rpcSlice->getPocMsbValRequiredFlag() ) 3353 #else 3354 if( rpcSlice->getPocMsbValRequiredFlag() ) 3355 #endif 3356 { 3357 rpcSlice->setPocMsbValPresentFlag( true ); 3358 } 3359 else 3360 { 3361 rpcSlice->setPocMsbValPresentFlag( false ); 3362 } 3363 } 3364 3365 #if !POC_RESET_IDC_DECODER 3366 Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3367 #endif 3368 if( rpcSlice->getPocMsbValPresentFlag() ) 3369 { 3370 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3371 3372 #if !POC_RESET_IDC_DECODER 3373 // Update POC of the slice based on this MSB val 3374 Int pocLsb = rpcSlice->getPOC() % maxPocLsb; 3375 rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); 3376 } 3377 else 3378 { 3379 rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); 3380 #endif 3381 } 3382 3383 // Read remaining bits in the slice header extension. 3384 UInt endBits = m_pcBitstream->getNumBitsRead(); 3385 Int counter = (endBits - startBits) % 8; 3386 if( counter ) 3387 { 3388 counter = 8 - counter; 3389 } 3390 3391 while( counter ) 3392 { 3393 #if Q0146_SSH_EXT_DATA_BIT 3394 READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); 3395 #else 3396 READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); 3397 #endif 3398 counter--; 3399 } 3400 } 3401 #else 3402 if(pps->getSliceHeaderExtensionPresentFlag()) 3403 { 3404 READ_UVLC(uiCode,"slice_header_extension_length"); 3405 for(Int i=0; i<uiCode; i++) 3406 { 3407 UInt ignore; 3408 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 3409 } 3410 } 3411 #endif 3412 m_pcBitstream->readByteAlignment(); 3413 3414 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3415 { 3416 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 3417 3418 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 3419 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3420 { 3421 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 3422 { 3423 endOfSliceHeaderLocation++; 3424 } 3425 } 3426 3427 Int curEntryPointOffset = 0; 3428 Int prevEntryPointOffset = 0; 3429 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3430 { 3431 curEntryPointOffset += entryPointOffset[ idx ]; 3432 3433 Int emulationPreventionByteCount = 0; 3434 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3435 { 3436 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 3437 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 3438 { 3439 emulationPreventionByteCount++; 3440 } 3441 } 3442 3443 entryPointOffset[ idx ] -= emulationPreventionByteCount; 3444 prevEntryPointOffset = curEntryPointOffset; 3445 } 3446 3447 if ( pps->getTilesEnabledFlag() ) 3448 { 3449 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 3450 3451 UInt prevPos = 0; 3452 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 3453 { 3454 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 3455 prevPos += entryPointOffset[ idx ]; 3456 } 3457 } 3458 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 3459 { 3460 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 3461 rpcSlice->allocSubstreamSizes(numSubstreams); 3462 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 3463 for (Int idx=0; idx<numSubstreams-1; idx++) 3464 { 3465 if ( idx < numEntryPointOffsets ) 3466 { 3467 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 3219 3468 } 3220 3469 else 3221 3470 { 3222 rpcSlice->setDeblockingFilterOverrideFlag(0); 3223 } 3224 if(rpcSlice->getDeblockingFilterOverrideFlag()) 3225 { 3226 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 3227 if(!rpcSlice->getDeblockingFilterDisable()) 3228 { 3229 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 3230 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 3231 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 3232 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 3233 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 3234 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 3235 } 3236 } 3237 else 3238 { 3239 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); 3240 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 3241 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 3242 } 3243 } 3244 else 3245 { 3246 rpcSlice->setDeblockingFilterDisable ( false ); 3247 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 3248 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 3249 } 3250 3251 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); 3252 Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); 3253 3254 if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 3255 { 3256 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); 3257 } 3258 else 3259 { 3260 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 3261 } 3262 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 3263 3264 } 3265 3266 UInt *entryPointOffset = NULL; 3267 UInt numEntryPointOffsets, offsetLenMinus1; 3268 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3269 { 3270 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 3271 if (numEntryPointOffsets>0) 3272 { 3273 READ_UVLC(offsetLenMinus1, "offset_len_minus1"); 3274 } 3275 entryPointOffset = new UInt[numEntryPointOffsets]; 3276 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3277 { 3278 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 3279 entryPointOffset[ idx ] = uiCode + 1; 3280 } 3281 } 3282 else 3283 { 3284 rpcSlice->setNumEntryPointOffsets ( 0 ); 3285 } 3286 3287 #if POC_RESET_IDC_SIGNALLING 3288 Int sliceHeaderExtensionLength = 0; 3289 if(pps->getSliceHeaderExtensionPresentFlag()) 3290 { 3291 READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; 3292 } 3293 else 3294 { 3295 sliceHeaderExtensionLength = 0; 3296 } 3297 UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits 3298 if( sliceHeaderExtensionLength > 0 ) 3299 { 3300 if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) 3301 { 3302 READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); 3303 } 3304 else 3305 { 3306 rpcSlice->setPocResetIdc( 0 ); 3307 } 3308 #if Q0142_POC_LSB_NOT_PRESENT 3309 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) 3310 { 3311 assert( rpcSlice->getPocResetIdc() != 2 ); 3312 } 3313 #endif 3314 if( rpcSlice->getPocResetIdc() > 0 ) 3315 { 3316 READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); 3317 } 3318 else 3319 { 3320 3321 rpcSlice->setPocResetPeriodId( 0 ); 3322 } 3323 3324 if (rpcSlice->getPocResetIdc() == 3) 3325 { 3326 READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); 3327 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); 3328 #if Q0142_POC_LSB_NOT_PRESENT 3329 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) 3330 { 3331 assert( rpcSlice->getPocLsbVal() == 0 ); 3332 } 3333 #endif 3334 } 3335 3336 // Derive the value of PocMsbValRequiredFlag 3337 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() 3338 /* || related to vps_poc_lsb_aligned_flag */ 3339 ); 3340 3341 if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ ) 3342 { 3343 READ_FLAG( uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false ); 3344 } 3345 else 3346 { 3347 #if POC_MSB_VAL_PRESENT_FLAG_SEM 3348 if( sliceHeaderExtensionLength == 0 ) 3349 { 3350 rpcSlice->setPocMsbValPresentFlag( false ); 3351 } 3352 else if( rpcSlice->getPocMsbValRequiredFlag() ) 3353 #else 3354 if( rpcSlice->getPocMsbValRequiredFlag() ) 3355 #endif 3356 { 3357 rpcSlice->setPocMsbValPresentFlag( true ); 3358 } 3359 else 3360 { 3361 rpcSlice->setPocMsbValPresentFlag( false ); 3362 } 3363 } 3364 3365 #if !POC_RESET_IDC_DECODER 3366 Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3367 #endif 3368 if( rpcSlice->getPocMsbValPresentFlag() ) 3369 { 3370 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3371 3372 #if !POC_RESET_IDC_DECODER 3373 // Update POC of the slice based on this MSB val 3374 Int pocLsb = rpcSlice->getPOC() % maxPocLsb; 3375 rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); 3376 } 3377 else 3378 { 3379 rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); 3380 #endif 3381 } 3382 3383 // Read remaining bits in the slice header extension. 3384 UInt endBits = m_pcBitstream->getNumBitsRead(); 3385 Int counter = (endBits - startBits) % 8; 3386 if( counter ) 3387 { 3388 counter = 8 - counter; 3389 } 3390 3391 while( counter ) 3392 { 3393 #if Q0146_SSH_EXT_DATA_BIT 3394 READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); 3395 #else 3396 READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); 3397 #endif 3398 counter--; 3399 } 3400 } 3401 #else 3402 if(pps->getSliceHeaderExtensionPresentFlag()) 3403 { 3404 READ_UVLC(uiCode,"slice_header_extension_length"); 3405 for(Int i=0; i<uiCode; i++) 3406 { 3407 UInt ignore; 3408 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 3409 } 3410 } 3411 #endif 3412 m_pcBitstream->readByteAlignment(); 3413 3414 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3415 { 3416 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 3417 3418 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 3419 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3420 { 3421 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 3422 { 3423 endOfSliceHeaderLocation++; 3424 } 3425 } 3426 3427 Int curEntryPointOffset = 0; 3428 Int prevEntryPointOffset = 0; 3429 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3430 { 3431 curEntryPointOffset += entryPointOffset[ idx ]; 3432 3433 Int emulationPreventionByteCount = 0; 3434 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3435 { 3436 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 3437 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 3438 { 3439 emulationPreventionByteCount++; 3440 } 3441 } 3442 3443 entryPointOffset[ idx ] -= emulationPreventionByteCount; 3444 prevEntryPointOffset = curEntryPointOffset; 3445 } 3446 3447 if ( pps->getTilesEnabledFlag() ) 3448 { 3449 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 3450 3451 UInt prevPos = 0; 3452 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 3453 { 3454 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 3455 prevPos += entryPointOffset[ idx ]; 3456 } 3457 } 3458 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 3459 { 3460 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 3461 rpcSlice->allocSubstreamSizes(numSubstreams); 3462 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 3463 for (Int idx=0; idx<numSubstreams-1; idx++) 3464 { 3465 if ( idx < numEntryPointOffsets ) 3466 { 3467 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 3468 } 3469 else 3470 { 3471 pSubstreamSizes[ idx ] = 0; 3472 } 3473 } 3474 } 3475 3476 if (entryPointOffset) 3477 { 3478 delete [] entryPointOffset; 3479 } 3480 } 3481 3482 return; 3471 pSubstreamSizes[ idx ] = 0; 3472 } 3473 } 3474 } 3475 3476 if (entryPointOffset) 3477 { 3478 delete [] entryPointOffset; 3479 } 3480 } 3481 3482 return; 3483 3483 } 3484 3484 … … 3743 3743 { 3744 3744 #endif 3745 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma;3746 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma;3745 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3746 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3747 3747 #if AUXILIARY_PICTURES 3748 3748 } … … 3923 3923 Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 3924 3924 { 3925 #if R0150_CGS_SIGNAL_CONSTRAINTS 3926 UInt uiNumRefLayersM1; 3927 READ_UVLC( uiNumRefLayersM1 , "num_cm_ref_layers_minus1" ); 3928 assert( uiNumRefLayersM1 <= 61 ); 3929 for( UInt i = 0 ; i <= uiNumRefLayersM1 ; i++ ) 3930 { 3931 UInt uiRefLayerId; 3932 READ_CODE( 6 , uiRefLayerId , "cm_ref_layer_id" ); 3933 pc3DAsymLUT->addRefLayerId( uiRefLayerId ); 3934 } 3935 #endif 3925 3936 UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit; 3926 3937 READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" ); 3927 3938 READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" ); 3939 #if R0150_CGS_SIGNAL_CONSTRAINTS 3940 UInt uiChromaInputBitDepthM8 , uiChromaOutputBitDepthM8; 3941 READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_luma_bit_depth_minus8" ); 3942 READ_CODE( 3 , uiChromaInputBitDepthM8 , "cm_input_chroma_bit_depth_minus8" ); 3943 READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_luma_bit_depth_minus8" ); 3944 READ_CODE( 3 , uiChromaOutputBitDepthM8 , "cm_output_chroma_bit_depth_minus8" ); 3945 #else 3928 3946 READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" ); 3929 3947 Int iInputBitDepthCDelta; … … 3932 3950 Int iOutputBitDepthCDelta; 3933 3951 READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta"); 3952 #endif 3934 3953 READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" ); 3954 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3955 #if R0150_CGS_SIGNAL_CONSTRAINTS 3956 Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); 3957 Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); 3958 #else 3959 Int nAdaptCThresholdU = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); 3960 Int nAdaptCThresholdV = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); 3961 #endif 3962 if( uiCurOctantDepth == 1 ) 3963 { 3964 Int delta = 0; 3965 READ_SVLC( delta , "cm_adapt_threshold_u_delta" ); 3966 nAdaptCThresholdU += delta; 3967 READ_SVLC( delta , "cm_adapt_threshold_v_delta" ); 3968 nAdaptCThresholdV += delta; 3969 } 3970 #endif 3935 3971 pc3DAsymLUT->destroy(); 3936 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, uiOutputBitDepthM8 + 8 , uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta ,uiCurPartNumLog2 ); 3972 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , 3973 #if R0150_CGS_SIGNAL_CONSTRAINTS 3974 uiChromaInputBitDepthM8 + 8 , 3975 #else 3976 uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, 3977 #endif 3978 uiOutputBitDepthM8 + 8 , 3979 #if R0150_CGS_SIGNAL_CONSTRAINTS 3980 uiChromaOutputBitDepthM8 + 8 , 3981 #else 3982 uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta , 3983 #endif 3984 uiCurPartNumLog2 3985 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3986 , nAdaptCThresholdU , nAdaptCThresholdV 3987 #endif 3988 ); 3937 3989 pc3DAsymLUT->setResQuantBit( uiResQaunBit ); 3938 3990 3991 #if R0164_CGS_LUT_BUGFIX 3992 pc3DAsymLUT->xInitCuboids(); 3993 #endif 3939 3994 xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 3995 #if R0164_CGS_LUT_BUGFIX 3996 pc3DAsymLUT->xCuboidsExplicitCheck( true ); 3997 #endif 3940 3998 } 3941 3999 … … 3964 4022 for( Int l = 0 ; l < nYPartNum ; l++ ) 3965 4023 { 4024 #if R0164_CGS_LUT_BUGFIX 4025 Int shift = pc3DAsymLUT->getMaxOctantDepth() - nDepth ; 4026 #endif 3966 4027 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 3967 4028 { … … 3971 4032 if( uiCodeVertex ) 3972 4033 { 4034 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4035 xReadParam( deltaY ); 4036 xReadParam( deltaU ); 4037 xReadParam( deltaV ); 4038 #else 3973 4039 READ_SVLC( deltaY , "resY" ); 3974 4040 READ_SVLC( deltaU , "resU" ); 3975 4041 READ_SVLC( deltaV , "resV" ); 3976 } 4042 #endif 4043 } 4044 #if R0164_CGS_LUT_BUGFIX 4045 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); 4046 #else 3977 4047 pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); 3978 } 3979 } 3980 } 3981 } 4048 #endif 4049 } 4050 #if R0164_CGS_LUT_BUGFIX 4051 pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); 4052 #endif 4053 } 4054 } 4055 } 4056 4057 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4058 Void TDecCavlc::xReadParam( Int& param ) 4059 { 4060 const UInt rParam = 7; 4061 UInt prefix; 4062 UInt codeWord ; 4063 UInt rSymbol; 4064 UInt sign; 4065 4066 READ_UVLC( prefix, "quotient") ; 4067 READ_CODE (rParam, codeWord, "remainder"); 4068 rSymbol = (prefix<<rParam) + codeWord; 4069 4070 if(rSymbol) 4071 { 4072 READ_FLAG(sign, "sign"); 4073 param = sign ? -(Int)(rSymbol) : (Int)(rSymbol); 4074 } 4075 else param = 0; 4076 } 4077 #endif 3982 4078 #endif 3983 4079 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r815 r825 143 143 Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 144 144 Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 145 #if R0151_CGS_3D_ASYMLUT_IMPROVE 146 Void xReadParam( Int& param ); 147 #endif 145 148 #endif 146 149 }; -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r823 r825 1779 1779 #if Q0048_CGS_3D_ASYMLUT 1780 1780 TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 1781 if( pcSlice->getPPS()->getCGSFlag() ) 1782 { 1781 if( pcSlice->getPPS()->getCGSFlag() 1782 #if R0150_CGS_SIGNAL_CONSTRAINTS 1783 && m_c3DAsymLUTPPS.isRefLayer( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ) 1784 #endif 1785 ) 1786 { 1787 #if R0150_CGS_SIGNAL_CONSTRAINTS 1788 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepthY() == m_c3DAsymLUTPPS.getInputBitDepthY() ); 1789 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepthC() == m_c3DAsymLUTPPS.getInputBitDepthC() ); 1790 assert( pcSlice->getBitDepthY() >= m_c3DAsymLUTPPS.getOutputBitDepthY() ); 1791 assert( pcSlice->getBitDepthY() >= m_c3DAsymLUTPPS.getOutputBitDepthC() ); 1792 #endif 1783 1793 if(!m_pColorMappedPic) 1784 1794 { -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
r815 r825 15 15 m_pEncCuboid = NULL; 16 16 m_pBestEncCuboid = NULL; 17 memset( m_nPrevFrameBit , 0 , sizeof( m_nPrevFrameBit ) ); 18 memset( m_nPrevFrameCGSBit , 0 , sizeof( m_nPrevFrameCGSBit ) ); 19 memset( m_nPrevFrameCGSPartNumLog2 , 0 , sizeof( m_nPrevFrameCGSPartNumLog2 ) ); 20 memset( m_nPrevFrameOverWritePPS , 0 , sizeof( m_nPrevFrameOverWritePPS ) ); 17 m_nAccuFrameBit = 0; 18 m_nAccuFrameCGSBit = 0; 19 m_nPrevFrameCGSPartNumLog2 = 0; 21 20 m_dTotalFrameBit = 0; 22 21 m_nTotalCGSBit = 0; … … 32 31 } 33 32 34 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 ); 33 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 34 #if R0151_CGS_3D_ASYMLUT_IMPROVE 35 , 1 << ( nInputBitDepthC - 1 ) , 1 << ( nInputBitDepthC - 1 ) 36 #endif 37 ); 35 38 xAllocate3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() ); 36 39 xAllocate3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() ); … … 58 61 } 59 62 63 #if R0151_CGS_3D_ASYMLUT_IMPROVE 64 Double TEnc3DAsymLUT::xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 65 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ) 66 { 67 Int nInitP0 = rP0; 68 Int nInitP1 = rP1; 69 Int nInitP3 = rP3; 70 Int nInitP7 = rP7; 71 72 const Int nOne = xGetNormCoeffOne(); 73 Double dNorm = (N * yy * vv * uu - N * yy * uv * uv - N * yv * yv * uu - N * vv * yu * yu + 2 * N * yv * uv * yu - yy * vs * vs * uu + 2 * yy * vs * uv * us - yy * vv * us * us - 2 * vs * uv * yu * ys + uv * uv * ys * ys + vs * vs * yu * yu - 2 * yv * vs * us * yu + 2 * yv * vs * ys * uu - 2 * yv * uv * us * ys + 2 * vv * yu * ys * us - vv * uu * ys * ys + yv * yv * us * us); 74 if( N > 16 && dNorm != 0 ) 75 { 76 Double dInitA = (-N * uu * yv * Yv + N * uu * Yy * vv - N * Yy * uv * uv + N * yv * uv * Yu - N * yu * Yu * vv + N * yu * uv * Yv + yu * us * Ys * vv - vs * ys * uv * Yu - yu * vs * us * Yv - yv * uv * us * Ys - yv * vs * us * Yu - yu * uv * vs * Ys - ys * us * uv * Yv + ys * us * Yu * vv + 2 * Yy * vs * uv * us + uu * yv * vs * Ys - uu * ys * Ys * vv + uu * vs * ys * Yv + ys * Ys * uv * uv - Yy * vv * us * us + yu * Yu * vs * vs + yv * Yv * us * us - uu * Yy * vs * vs) / dNorm; 77 Double dInitB = (N * yy * Yu * vv - N * yy * uv * Yv - N * Yu * yv * yv - N * yu * Yy * vv + N * uv * yv * Yy + N * yv * yu * Yv - yy * us * Ys * vv + yy * uv * vs * Ys - yy * Yu * vs * vs + yy * vs * us * Yv - uv * vs * ys * Yy - yv * yu * vs * Ys + yu * Yy * vs * vs + yu * ys * Ys * vv - uv * yv * ys * Ys + 2 * Yu * yv * vs * ys + us * ys * Yy * vv - vs * ys * yu * Yv + uv * ys * ys * Yv + us * Ys * yv * yv - Yu * ys * ys * vv - yv * ys * us * Yv - vs * us * yv * Yy) / dNorm; 78 Double dInitC = -(-N * yy * Yv * uu + N * yy * uv * Yu - N * yv * yu * Yu - N * uv * yu * Yy + N * Yv * yu * yu + N * yv * Yy * uu - yy * uv * us * Ys + yy * Yv * us * us + yy * vs * Ys * uu - yy * vs * us * Yu + yv * ys * us * Yu - vs * Ys * yu * yu - yv * ys * Ys * uu + vs * us * yu * Yy + vs * ys * yu * Yu - uv * Yu * ys * ys + Yv * uu * ys * ys - yv * Yy * us * us - 2 * Yv * yu * ys * us - vs * ys * Yy * uu + uv * us * ys * Yy + uv * yu * ys * Ys + yv * yu * us * Ys) / dNorm; 79 nInitP0 = ( Int )( dInitA * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 80 nInitP1 = ( Int )( dInitB * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 81 nInitP3 = ( Int )( dInitC * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 82 } 83 84 Int nMin = - ( 1 << ( m_nLUTBitDepth - 1 ) ); 85 Int nMax = - nMin - ( 1 << nResQuantBit ); 86 Int nMask = ( 1 << nResQuantBit ) - 1; 87 88 Double dMinError = MAX_DOUBLE; 89 Int nTestRange = 2; 90 Int nStepSize = 1 << nResQuantBit; 91 for( Int i = - nTestRange ; i <= nTestRange ; i++ ) 92 { 93 for( Int j = - nTestRange ; j <= nTestRange ; j++ ) 94 { 95 for( Int k = - nTestRange ; k <= nTestRange ; k++ ) 96 { 97 Int nTestP0 = Clip3( nMin , nMax , nInitP0 + i * nStepSize ); 98 Int nTestP1 = Clip3( nMin , nMax , nInitP1 + j * nStepSize ); 99 Int nTestP3 = Clip3( nMin , nMax , nInitP3 + k * nStepSize ); 100 Double a = 1.0 * nTestP0 / nOne; 101 Double b = 1.0 * nTestP1 / nOne; 102 Double c = 1.0 * nTestP3 / nOne; 103 Double d = ( Ys - a * ys - b * us - c * vs ) / N; 104 nInitP7 = ( ( Int )d ) >> nResQuantBit << nResQuantBit; 105 for( Int m = 0 ; m < 2 ; m++ ) 106 { 107 Int nTestP7 = Clip3( nMin , nMax , nInitP7 + m * nStepSize ); 108 Double dError = xxCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , nTestP7 ); 109 if( dError < dMinError ) 110 { 111 dMinError = dError; 112 rP0 = ( Pel )nTestP0; 113 rP1 = ( Pel )nTestP1; 114 rP3 = ( Pel )nTestP3; 115 rP7 = ( Pel )nTestP7; 116 } 117 } 118 } 119 } 120 } 121 assert( !( rP0 & nMask ) && !( rP1 & nMask ) && !( rP3 & nMask ) && !( rP7 & nMask ) ); 122 123 return( dMinError ); 124 } 125 #else 60 126 Double TEnc3DAsymLUT::xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 61 127 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , … … 134 200 return( dMinError ); 135 201 } 136 202 #endif 203 204 #if R0151_CGS_3D_ASYMLUT_IMPROVE 205 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 206 { 207 xxCollectData( pCurPic , refLayerIdc ); 208 209 Double dErrorLuma = 0 , dErrorChroma = 0; 210 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 211 Int nUVSize = 1 << getCurOctantDepth(); 212 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 213 { 214 for( Int uIdx = 0 ; uIdx < nUVSize ; uIdx++ ) 215 { 216 for( Int vIdx = 0 ; vIdx < nUVSize ; vIdx++ ) 217 { 218 SColorInfo & rCuboidColorInfo = m_pColorInfo[yIdx][uIdx][vIdx]; 219 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 220 SCuboid & rCuboid = xGetCuboid( yIdx , uIdx , vIdx ); 221 if( rCuboidColorInfo.N > 0 ) 222 { 223 dErrorLuma += xxCalEstDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 224 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y ); 225 } 226 if( rCuboidColorInfoC.N > 0 ) 227 { 228 dErrorChroma += xxCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 229 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U ); 230 dErrorChroma += xxCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 231 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V ); 232 } 233 } 234 } 235 } 236 237 return( dErrorLuma + dErrorChroma); 238 } 239 #else 137 240 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 138 241 { … … 174 277 return( dErrorLuma + dErrorChroma); 175 278 } 176 279 #endif 280 281 #if R0151_CGS_3D_ASYMLUT_IMPROVE 282 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ) 283 { 284 m_nLUTBitDepth = pCfg->getCGSLUTBit(); 285 Int nCurYPartNumLog2 = 0 , nCurOctantDepth = 0; 286 xxDerivePartNumLog2( pSlice , pCfg , nCurOctantDepth , nCurYPartNumLog2 , bSignalPPS , bElRapSliceTypeB ); 287 288 Int nBestResQuanBit = 0; 289 Int nBestAdaptCThresholdU = 1 << ( getInputBitDepthC() - 1 ); 290 Int nBestAdaptCThresholdV = 1 << ( getInputBitDepthC() - 1 ); 291 Int nBestOctantDepth = nCurOctantDepth; 292 Int nBestYPartNumLog2 = nCurYPartNumLog2; 293 Int nTargetLoop = 1 + ( pCfg->getCGSAdaptChroma() && ( nCurOctantDepth == 1 || ( nCurOctantDepth * 3 + nCurYPartNumLog2 ) >= 5 ) ); 294 Double dMinError = MAX_DOUBLE; 295 for( Int nLoop = 0 ; nLoop < nTargetLoop ; nLoop++ ) 296 { 297 Int nAdaptCThresholdU = 1 << ( getInputBitDepthC() - 1 ); 298 Int nAdaptCThresholdV = 1 << ( getInputBitDepthC() - 1 ); 299 if( nLoop > 0 ) 300 { 301 nAdaptCThresholdU = ( Int )( m_dSumU / m_nNChroma + 0.5 ); 302 nAdaptCThresholdV = ( Int )( m_dSumV / m_nNChroma + 0.5 ); 303 if( nCurOctantDepth > 1 ) 304 { 305 nCurOctantDepth = 1; 306 nCurYPartNumLog2 = 2; 307 } 308 if( nAdaptCThresholdU == nBestAdaptCThresholdU && nAdaptCThresholdV == nBestAdaptCThresholdV 309 && nCurOctantDepth == nBestOctantDepth && nCurYPartNumLog2 == nBestYPartNumLog2 ) 310 break; 311 } 312 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 , nAdaptCThresholdU , nAdaptCThresholdV ); 313 xxCollectData( pCurPic , refLayerIdc ); 314 for( Int nResQuanBit = 0 ; nResQuanBit < 4 ; nResQuanBit++ ) 315 { 316 Double dError = xxDeriveVertexes( nResQuanBit , m_pEncCuboid ) / ( 1 + ( nResQuanBit > 0 ) * 0.001 * ( pSlice->getDepth() + 1 ) ); 317 if( dError <= dMinError ) 318 { 319 nBestResQuanBit = nResQuanBit; 320 nBestAdaptCThresholdU = nAdaptCThresholdU; 321 nBestAdaptCThresholdV = nAdaptCThresholdV; 322 nBestOctantDepth = nCurOctantDepth; 323 nBestYPartNumLog2 = nCurYPartNumLog2; 324 SCuboid *** tmp = m_pBestEncCuboid; 325 m_pBestEncCuboid = m_pEncCuboid; 326 m_pEncCuboid = tmp; 327 dMinError = dError; 328 } 329 else 330 { 331 break; 332 } 333 } 334 } 335 setResQuantBit( nBestResQuanBit ); 336 xUpdatePartitioning( nBestOctantDepth , nBestYPartNumLog2 , nBestAdaptCThresholdU , nBestAdaptCThresholdV ); 337 xSaveCuboids( m_pBestEncCuboid ); 338 return( dMinError ); 339 } 340 #else 177 341 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ) 178 342 { … … 204 368 setResQuantBit( nBestResQuanBit ); 205 369 xSaveCuboids( m_pBestEncCuboid ); 206 207 370 return( dCurError ); 208 371 } 372 #endif 209 373 210 374 Double TEnc3DAsymLUT::xxDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid ) … … 213 377 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 214 378 Int nUVSize = 1 << getCurOctantDepth(); 379 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 215 380 Int nLengthY = 1 << ( getInputBitDepthY() - getCurOctantDepth() - getCurYPartNumLog2() ); 216 381 Int nLengthUV = 1 << ( getInputBitDepthC() - getCurOctantDepth() ); 382 #endif 217 383 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 218 384 { … … 224 390 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 225 391 SCuboid & rCuboid = pCurCuboid[yIdx][uIdx][vIdx]; 392 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 226 393 Int y0 = yIdx << xGetYShift2Idx(); 227 394 Int u0 = uIdx << xGetUShift2Idx(); 228 395 Int v0 = vIdx << xGetVShift2Idx(); 396 #endif 229 397 for( Int idxVertex = 0 ; idxVertex < 4 ; idxVertex++ ) 230 398 { … … 235 403 { 236 404 dErrorLuma += xxDeriveVertexPerColor( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 237 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 405 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 406 y0 , u0 , v0 , nLengthY , nLengthUV , 407 #endif 408 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 238 409 } 239 410 if( rCuboidColorInfoC.N > 0 ) 240 411 { 241 412 dErrorChroma += xxDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 242 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 413 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 414 y0 , u0 , v0 , nLengthY , nLengthUV , 415 #endif 416 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 243 417 dErrorChroma += xxDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 244 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 418 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 419 y0 , u0 , v0 , nLengthY , nLengthUV , 420 #endif 421 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 245 422 } 246 423 … … 299 476 // since we do data collection only for overlapped region, the border extension is good enough 300 477 478 #if R0151_CGS_3D_ASYMLUT_IMPROVE 479 m_dSumU = m_dSumV = 0; 480 m_nNChroma = 0; 481 #endif 301 482 for( Int i = top ; i <= bottom ; i++ ) 302 483 { … … 330 511 } 331 512 513 #if R0151_CGS_3D_ASYMLUT_IMPROVE 514 m_dSumU += u; 515 m_dSumV += v; 516 m_nNChroma++; 517 #endif 332 518 SColorInfo sColorInfo; 519 #if R0151_CGS_3D_ASYMLUT_IMPROVE 520 SColorInfo & rCuboidColorInfo = m_pColorInfo[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 521 #else 333 522 SColorInfo & rCuboidColorInfo = m_pColorInfo[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 523 #endif 334 524 memset(&sColorInfo, 0, sizeof(SColorInfo)); 335 525 sColorInfo.Ys = Y; … … 358 548 u = pIRLU[posIRLUV]; 359 549 v = pIRLV[posIRLUV]; 550 #if R0151_CGS_3D_ASYMLUT_IMPROVE 551 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 552 #else 360 553 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 554 #endif 361 555 sColorInfo.Us = U; 362 556 sColorInfo.Vs = V; … … 389 583 Void TEnc3DAsymLUT::xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ) 390 584 { 391 Int nSliceType = pSlice->getSliceType();392 // update slice type as what will be done later393 if( pSlice->getActiveNumILRRefIdx() == 0 && pSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )394 {395 nSliceType = I_SLICE;396 }397 else if( !bElRapSliceTypeB )398 {399 if( (pSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&400 (pSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&401 pSlice->getSliceType() == B_SLICE )402 {403 nSliceType = P_SLICE;404 }405 }406 407 const Int nSliceTempLevel = pSlice->getDepth();408 585 Int nPartNumLog2 = 4; 409 586 if( pSlice->getBaseColPic( pSlice->getInterLayerPredLayerIdc( 0 ) )->getSlice( 0 )->isIntra() ) … … 411 588 nPartNumLog2 = xGetMaxPartNumLog2(); 412 589 } 413 if( m_n PrevFrameBit[nSliceType][nSliceTempLevel]&& pSlice->getPPS()->getCGSFlag() )414 { 415 Double dBitCost = 1.0 * m_n PrevFrameCGSBit[nSliceType][nSliceTempLevel] / m_nPrevFrameBit[nSliceType][nSliceTempLevel];416 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2 [nSliceType][nSliceTempLevel];590 if( m_nAccuFrameBit && pSlice->getPPS()->getCGSFlag() ) 591 { 592 Double dBitCost = 1.0 * m_nAccuFrameCGSBit / m_nAccuFrameBit; 593 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2; 417 594 Double dBitCostT = 0.03; 418 595 if( dBitCost < dBitCostT / 6.0 ) … … 425 602 } 426 603 } 427 else 428 { 429 nPartNumLog2 -= nSliceTempLevel; 430 } 431 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 604 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 432 605 xxMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 ); 433 606 } … … 453 626 Void TEnc3DAsymLUT::updatePicCGSBits( TComSlice * pcSlice , Int nPPSBit ) 454 627 { 455 const Int nSliceType = pcSlice->getSliceType();456 const Int nSliceTempLevel = pcSlice->getDepth();457 458 628 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 459 629 { 460 630 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 461 m_n PrevFrameBit[nSliceType][nSliceTempLevel]= pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit();631 m_nAccuFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 462 632 m_dTotalFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 463 633 } 464 m_nPrevFrameOverWritePPS[nSliceType][nSliceTempLevel] = pcSlice->getCGSOverWritePPS(); 465 m_nPrevFrameCGSBit[nSliceType][nSliceTempLevel] = nPPSBit; 634 m_nAccuFrameCGSBit += nPPSBit; 466 635 m_nTotalCGSBit += nPPSBit; 467 m_nPrevFrameCGSPartNumLog2 [nSliceType][nSliceTempLevel]= getCurOctantDepth() * 3 + getCurYPartNumLog2();468 } 469 470 #endif 636 m_nPrevFrameCGSPartNumLog2 = getCurOctantDepth() * 3 + getCurYPartNumLog2(); 637 } 638 639 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h
r713 r825 78 78 SCuboid *** m_pEncCuboid; 79 79 SCuboid *** m_pBestEncCuboid; 80 Int m_nPrevFrameBit[3][MAX_TLAYER]; // base + enhancement layer 81 Int m_nPrevFrameCGSBit[3][MAX_TLAYER]; 82 Int m_nPrevFrameCGSPartNumLog2[3][MAX_TLAYER]; 83 Int m_nPrevFrameOverWritePPS[3][MAX_TLAYER]; 80 Int m_nAccuFrameBit; // base + enhancement layer 81 Int m_nAccuFrameCGSBit; 82 Int m_nPrevFrameCGSPartNumLog2; 84 83 Double m_dTotalFrameBit; 85 84 Int m_nTotalCGSBit; 86 85 Int m_nPPSBit; 87 86 Int m_nLUTBitDepth; 87 #if R0151_CGS_3D_ASYMLUT_IMPROVE 88 Double m_dSumU; 89 Double m_dSumV; 90 Int m_nNChroma; 91 #endif 88 92 89 93 private: 94 #if R0151_CGS_3D_ASYMLUT_IMPROVE 95 Double xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 96 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 97 #else 90 98 Double xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 91 99 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , 92 100 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 101 #endif 93 102 Void xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ); 94 103 Void xxMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 ); … … 100 109 inline Double xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 101 110 Double a , Double b , Double c , Double d ); 111 #if R0151_CGS_3D_ASYMLUT_IMPROVE 112 inline Double xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 113 Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 ); 114 #endif 102 115 }; 103 116 … … 118 131 return( dError ); 119 132 }; 133 134 #if R0151_CGS_3D_ASYMLUT_IMPROVE 135 Double TEnc3DAsymLUT::xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 136 Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 ) 137 { 138 const Int nOne = xGetNormCoeffOne(); 139 Double a = 1.0 * nP0 / nOne; 140 Double b = 1.0 * nP1 / nOne; 141 Double c = 1.0 * nP3 / nOne; 142 Double d = nP7; 143 Double dError = N * d * d + 2 * b * c * uv + 2 * a * c * yv + 2 * a * b * yu - 2 * c * Yv - 2 * b * Yu - 2 * a * Yy + 2 * c * d * vs + 2 * b * d * us + 2 * a * d * ys + a * a * yy + c * c * vv + b * b * uu - 2 * d * Ys + YY; 144 return( dError ); 145 }; 120 146 #endif 121 147 122 148 #endif 149 150 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r824 r825 2762 2762 Void TEncCavlc::xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 2763 2763 { 2764 #if R0150_CGS_SIGNAL_CONSTRAINTS 2765 UInt uiNumRefLayers = ( UInt )pc3DAsymLUT->getRefLayerNum(); 2766 WRITE_UVLC( uiNumRefLayers - 1 , "num_cm_ref_layers_minus1" ); 2767 for( UInt i = 0 ; i < uiNumRefLayers ; i++ ) 2768 { 2769 WRITE_CODE( pc3DAsymLUT->getRefLayerId( i ) , 6 , "cm_ref_layer_id" ); 2770 } 2771 #endif 2764 2772 assert( pc3DAsymLUT->getCurOctantDepth() < 4 ); 2765 2773 WRITE_CODE( pc3DAsymLUT->getCurOctantDepth() , 2 , "cm_octant_depth" ); … … 2767 2775 WRITE_CODE( pc3DAsymLUT->getCurYPartNumLog2() , 2 , "cm_y_part_num_log2" ); 2768 2776 assert( pc3DAsymLUT->getInputBitDepthY() < 16 ); 2777 #if R0150_CGS_SIGNAL_CONSTRAINTS 2778 WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_luma_bit_depth_minus8" ); 2779 WRITE_CODE( pc3DAsymLUT->getInputBitDepthC() - 8 , 3 , "cm_input_chroma_bit_depth_minus8" ); 2780 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_luma_bit_depth_minus8" ); 2781 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthC() - 8 , 3 , "cm_output_chroma_bit_depth_minus8" ); 2782 #else 2769 2783 WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_bit_depth_minus8" ); 2770 2784 WRITE_SVLC(pc3DAsymLUT->getInputBitDepthC()-pc3DAsymLUT->getInputBitDepthY(), "cm_input_bit_depth_chroma delta"); … … 2772 2786 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_bit_depth_minus8" ); 2773 2787 WRITE_SVLC(pc3DAsymLUT->getOutputBitDepthC()-pc3DAsymLUT->getOutputBitDepthY(), "cm_output_bit_depth_chroma_delta"); 2788 #endif 2774 2789 assert( pc3DAsymLUT->getResQuantBit() < 4 ); 2775 2790 WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); 2776 2791 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2792 if( pc3DAsymLUT->getCurOctantDepth() == 1 ) 2793 { 2794 WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdU() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_u_delta" ); 2795 WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdV() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_v_delta" ); 2796 } 2797 #endif 2798 2799 #if R0164_CGS_LUT_BUGFIX 2800 pc3DAsymLUT->xInitCuboids(); 2801 #endif 2777 2802 xCode3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 2803 #if R0164_CGS_LUT_BUGFIX 2804 pc3DAsymLUT->xCuboidsExplicitCheck( false ); 2805 #endif 2778 2806 } 2779 2807 … … 2802 2830 for( Int l = 0 ; l < nYPartNum ; l++ ) 2803 2831 { 2832 #if R0164_CGS_LUT_BUGFIX 2833 Int shift = pc3DAsymLUT->getMaxOctantDepth() - nDepth ; 2834 #endif 2804 2835 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 2805 2836 { 2837 #if R0164_CGS_LUT_BUGFIX 2838 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx ); 2839 #else 2806 2840 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 2841 #endif 2807 2842 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 2808 2843 WRITE_FLAG( uiCodeVertex , "coded_vertex_flag" ); 2809 2844 if( uiCodeVertex ) 2810 2845 { 2846 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2847 xWriteParam( sRes.Y ); 2848 xWriteParam( sRes.U ); 2849 xWriteParam( sRes.V ); 2850 #else 2811 2851 WRITE_SVLC( sRes.Y , "resY" ); 2812 2852 WRITE_SVLC( sRes.U , "resU" ); 2813 2853 WRITE_SVLC( sRes.V , "resV" ); 2814 } 2815 } 2816 } 2817 } 2818 } 2854 #endif 2855 } 2856 } 2857 #if R0164_CGS_LUT_BUGFIX 2858 pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); 2859 #endif 2860 } 2861 } 2862 } 2863 2864 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2865 Void TEncCavlc::xWriteParam( Int param) 2866 { 2867 const UInt rParam = 7; 2868 Int codeNumber = abs(param); 2869 WRITE_UVLC(codeNumber / (1 << rParam), "quotient"); 2870 WRITE_CODE((codeNumber % (1 << rParam)), rParam, "remainder"); 2871 if (abs(param)) 2872 WRITE_FLAG( param <0, "sign"); 2873 } 2874 #endif 2875 2819 2876 #endif 2820 2877 //! \} -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h
r815 r825 173 173 Void xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 174 174 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 175 #if R0151_CGS_3D_ASYMLUT_IMPROVE 176 Void xWriteParam( Int param); 177 #endif 175 178 #endif 176 179 #endif //SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r823 r825 367 367 Int m_nCGSMaxYPartNumLog2; 368 368 Int m_nCGSLUTBit; 369 #if R0151_CGS_3D_ASYMLUT_IMPROVE 370 Int m_nCGSAdaptiveChroma; 371 #endif 369 372 #endif 370 373 #if P0050_KNEE_FUNCTION_SEI … … 940 943 Void setCGSLUTBit(Int n) { m_nCGSLUTBit = n; } 941 944 Int getCGSLUTBit() { return m_nCGSLUTBit; } 945 #if R0151_CGS_3D_ASYMLUT_IMPROVE 946 Void setCGSAdaptChroma(Int n) { m_nCGSAdaptiveChroma = n; } 947 Int getCGSAdaptChroma() { return m_nCGSAdaptiveChroma; } 948 #endif 942 949 #endif 943 950 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r823 r825 1153 1153 if( pcSlice->getPPS()->getCGSFlag() ) 1154 1154 { 1155 #if R0150_CGS_SIGNAL_CONSTRAINTS 1156 // all reference layers are currently taken as CGS reference layers 1157 m_Enc3DAsymLUTPPS.addRefLayerId( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ); 1158 m_Enc3DAsymLUTPicUpdate.addRefLayerId( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ); 1159 #endif 1155 1160 if(g_posScalingFactor[refLayerIdc][0] < (1<<16) || g_posScalingFactor[refLayerIdc][1] < (1<<16)) //if(pcPic->isSpatialEnhLayer(refLayerIdc)) 1156 1161 { … … 3987 3992 if( m_layerId && pcSlice->getPPS()->getCGSFlag() ) 3988 3993 { 3994 if( m_Enc3DAsymLUTPPS.getPPSBit() > 0 ) 3995 m_Enc3DAsymLUTPicUpdate.copy3DAsymLUT( &m_Enc3DAsymLUTPPS ); 3989 3996 m_Enc3DAsymLUTPicUpdate.updatePicCGSBits( pcSlice , m_Enc3DAsymLUTPPS.getPPSBit() ); 3990 3997 }
Note: See TracChangeset for help on using the changeset viewer.