Changeset 1214 in SHVCSoftware for branches/SHM-dev/source
- Timestamp:
- 8 Jul 2015, 23:35:39 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1212 r1214 1652 1652 ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") 1653 1653 ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") 1654 #if R0151_CGS_3D_ASYMLUT_IMPROVE1655 1654 ("CGSAdaptC", m_nCGSAdaptiveChroma , 1, "adaptive chroma partition (only for the case of two chroma partitions)") 1656 #endif1657 1655 #if R0179_ENC_OPT_3DLUT_SIZE 1658 1656 ("CGSSizeRDO", m_nCGSLutSizeRDO , 0, "RDOpt selection of best table size (effective when large maximum table size such as 8x8x8 is used)") … … 4511 4509 printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); 4512 4510 #endif 4513 #if R0151_CGS_3D_ASYMLUT_IMPROVE4514 4511 printf("CGSAdaptC:%d " , m_nCGSAdaptiveChroma ); 4515 #endif4516 4512 #if R0179_ENC_OPT_3DLUT_SIZE 4517 4513 printf("CGSSizeRDO:%d " , m_nCGSLutSizeRDO ); -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1212 r1214 511 511 Int m_nCGSMaxYPartNumLog2; 512 512 Int m_nCGSLUTBit; 513 #if R0151_CGS_3D_ASYMLUT_IMPROVE514 513 Int m_nCGSAdaptiveChroma; 515 #endif516 514 #if R0179_ENC_OPT_3DLUT_SIZE 517 515 Int m_nCGSLutSizeRDO; -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1212 r1214 761 761 m_acTEncTop[layer].setCGSMaxYPartNumLog2 ( m_nCGSMaxYPartNumLog2 ); 762 762 m_acTEncTop[layer].setCGSLUTBit ( m_nCGSLUTBit ); 763 #if R0151_CGS_3D_ASYMLUT_IMPROVE764 763 m_acTEncTop[layer].setCGSAdaptChroma ( m_nCGSAdaptiveChroma ); 765 #endif766 764 #if R0179_ENC_OPT_3DLUT_SIZE 767 765 m_acTEncTop[layer].setCGSLutSizeRDO ( m_nCGSLutSizeRDO ); -
branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.cpp
r1213 r1214 10 10 11 11 #if CGS_3D_ASYMLUT 12 13 12 const Int TCom3DAsymLUT::m_nVertexIdxOffset[4][3] = { { 0 , 0 , 0 } , { 0 , 1 , 0 } , { 0 , 1 , 1 } , { 1 , 1 , 1 } }; 14 13 … … 28 27 } 29 28 30 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 31 #if R0151_CGS_3D_ASYMLUT_IMPROVE 32 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 33 #endif 34 ) 29 Void TCom3DAsymLUT::create( Int nMaxOctantDepth, Int nInputBitDepth, Int nInputBitDepthC, Int nOutputBitDepth, Int nOutputBitDepthC, Int nMaxYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV ) 35 30 { 36 31 m_nMaxOctantDepth = nMaxOctantDepth; … … 44 39 m_nMaxPartNumLog2 = 3 * m_nMaxOctantDepth + m_nMaxYPartNumLog2; 45 40 46 xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 47 #if R0151_CGS_3D_ASYMLUT_IMPROVE 48 , nAdaptCThresholdU , nAdaptCThresholdV 49 #endif 50 ); 41 xUpdatePartitioning( nMaxOctantDepth, nMaxYPartNumLog2, nAdaptCThresholdU, nAdaptCThresholdV ); 51 42 52 43 m_nYSize = 1 << ( m_nMaxOctantDepth + m_nMaxYPartNumLog2 ); … … 77 68 78 69 79 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 80 #if R0151_CGS_3D_ASYMLUT_IMPROVE 81 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 82 #endif 83 ) 70 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth, Int nCurYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV ) 84 71 { 85 72 assert( nCurOctantDepth <= m_nMaxOctantDepth ); … … 94 81 m_nYShift2Idx = m_nInputBitDepthY - m_nCurOctantDepth - m_nCurYPartNumLog2; 95 82 m_nUShift2Idx = m_nVShift2Idx = m_nInputBitDepthC - m_nCurOctantDepth; 96 #if R0151_CGS_3D_ASYMLUT_IMPROVE 83 97 84 m_nMappingShift = 10 + m_nInputBitDepthY - m_nOutputBitDepthY; 98 85 m_nAdaptCThresholdU = nAdaptCThresholdU; 99 86 m_nAdaptCThresholdV = nAdaptCThresholdV; 100 #else 101 m_nMappingShift = m_nYShift2Idx + m_nUShift2Idx; 102 #endif 87 103 88 m_nMappingOffset = 1 << ( m_nMappingShift - 1 ); 104 89 … … 201 186 202 187 SYUVP sPred; 203 #if R0151_CGS_3D_ASYMLUT_IMPROVE 188 204 189 sPred.Y = sPred.U = sPred.V = 0; 190 205 191 if( nVertexIdx == 0 ) 192 { 206 193 sPred.Y = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 194 } 207 195 else if( nVertexIdx == 1 ) 196 { 208 197 sPred.U = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 198 } 209 199 else if( nVertexIdx == 2 ) 200 { 210 201 sPred.V = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 211 #else 212 sPred.Y = ( yIdx + m_nVertexIdxOffset[nVertexIdx][0] ) << ( m_nYShift2Idx + m_nDeltaBitDepth ); 213 sPred.U = ( uIdx + m_nVertexIdxOffset[nVertexIdx][1] ) << ( m_nUShift2Idx + m_nDeltaBitDepthC ); 214 sPred.V = ( vIdx + m_nVertexIdxOffset[nVertexIdx][2] ) << ( m_nVShift2Idx + m_nDeltaBitDepthC ); 215 #endif 216 return( sPred ); 202 } 203 204 return sPred; 217 205 } 218 206 … … 221 209 SCuboid*** pCuboid = pCurCuboid ? pCurCuboid : m_pCuboid ; 222 210 223 #if R0151_CGS_3D_ASYMLUT_IMPROVE224 211 SYUVP sPred; 225 212 if( yIdx == 0 ) … … 233 220 sPred = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx]; 234 221 } 235 #else 236 // PredA 237 SYUVP sPredA = xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ); 238 239 // PredB 240 SYUVP sPredB; 241 memset( &sPredB , 0 , sizeof( sPredB ) ); 242 if( yIdx > 0 ) 243 { 244 SYUVP & recNeighborP = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx]; 245 SYUVP sPredNeighbor = xGetCuboidVertexPredA( yIdx - 1 , uIdx , vIdx , nVertexIdx ); 246 sPredB.Y += recNeighborP.Y - sPredNeighbor.Y ; 247 sPredB.U += recNeighborP.U - sPredNeighbor.U ; 248 sPredB.V += recNeighborP.V - sPredNeighbor.V ; 249 250 Pel min = - ( 1 << ( getOutputBitDepthY() - 2 ) ); 251 Pel max = - min; 252 sPredB.Y = Clip3( min , max , sPredB.Y ); 253 min = - ( 1 << ( getOutputBitDepthC() - 2 ) ); 254 max = - min; 255 sPredB.U = Clip3( min , max , sPredB.U ); 256 sPredB.V = Clip3( min , max , sPredB.V ); 257 } 258 259 SYUVP sPred; 260 sPred.Y = sPredA.Y + sPredB.Y; 261 sPred.U = sPredA.U + sPredB.U; 262 sPred.V = sPredA.V + sPredB.V; 263 #endif 222 264 223 return sPred ; 265 224 } … … 294 253 Pel TCom3DAsymLUT::xMapY( Pel y , Pel u , Pel v ) 295 254 { 296 #if R0151_CGS_3D_ASYMLUT_IMPROVE297 255 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 298 256 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; 299 #else 300 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 301 Pel dstY = rCuboid.P[0].Y; 302 Int deltaY = y - ( y >> m_nYShift2Idx << m_nYShift2Idx ); 303 Int deltaU = u - ( u >> m_nUShift2Idx << m_nUShift2Idx ); 304 Int deltaV = v - ( v >> m_nVShift2Idx << m_nVShift2Idx ); 305 dstY += ( Pel )( ( ( ( deltaY * ( rCuboid.P[3].Y - rCuboid.P[2].Y ) ) << m_nUShift2Idx ) 306 + ( ( deltaU * ( rCuboid.P[1].Y - rCuboid.P[0].Y ) ) << m_nYShift2Idx ) 307 + ( ( deltaV * ( rCuboid.P[2].Y - rCuboid.P[1].Y ) ) << m_nYShift2Idx ) 308 + m_nMappingOffset ) >> m_nMappingShift ); 309 #endif 257 310 258 return( dstY ); 311 259 } … … 313 261 SYUVP TCom3DAsymLUT::xMapUV( Pel y , Pel u , Pel v ) 314 262 { 315 #if R0151_CGS_3D_ASYMLUT_IMPROVE316 263 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 317 264 SYUVP dst; … … 319 266 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; 320 267 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; 321 #else 322 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 323 SYUVP dst = rCuboid.P[0]; 324 Int deltaY = y - ( y >> m_nYShift2Idx << m_nYShift2Idx ); 325 Int deltaU = u - ( u >> m_nUShift2Idx << m_nUShift2Idx ); 326 Int deltaV = v - ( v >> m_nVShift2Idx << m_nVShift2Idx ); 327 dst.U += ( Pel )( ( ( ( deltaY * ( rCuboid.P[3].U - rCuboid.P[2].U ) ) << m_nUShift2Idx ) 328 + ( ( deltaU * ( rCuboid.P[1].U - rCuboid.P[0].U ) ) << m_nYShift2Idx ) 329 + ( ( deltaV * ( rCuboid.P[2].U - rCuboid.P[1].U ) ) << m_nYShift2Idx ) 330 + m_nMappingOffset ) >> m_nMappingShift ); 331 dst.V += ( Pel )( ( ( ( deltaY * ( rCuboid.P[3].V - rCuboid.P[2].V ) ) << m_nUShift2Idx ) 332 + ( ( deltaU * ( rCuboid.P[1].V - rCuboid.P[0].V ) ) << m_nYShift2Idx ) 333 + ( ( deltaV * ( rCuboid.P[2].V - rCuboid.P[1].V ) ) << m_nYShift2Idx ) 334 + m_nMappingOffset ) >> m_nMappingShift ); 335 #endif 268 336 269 return( dst ); 337 270 } … … 349 282 { 350 283 assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() ); 351 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() 352 #if R0151_CGS_3D_ASYMLUT_IMPROVE 353 , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV() 354 #endif 355 ); 284 xUpdatePartitioning( pSrc->getCurOctantDepth(), pSrc->getCurYPartNumLog2(), pSrc->getAdaptChromaThresholdU(), pSrc->getAdaptChromaThresholdV() ); 356 285 setResQuantBit( pSrc->getResQuantBit() ); 357 286 xSaveCuboids( pSrc->m_pCuboid ); -
branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.h
r1213 r1214 27 27 virtual ~TCom3DAsymLUT(); 28 28 29 virtual Void 30 virtual Void 29 virtual Void create( Int nMaxOctantDepth, Int nInputBitDepth, Int nInputBitDepthC, Int nOutputBitDepth, Int nOutputBitDepthC, Int nMaxYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV ); 30 virtual Void destroy(); 31 31 32 32 Int getMaxOctantDepth() { return m_nMaxOctantDepth; } … … 55 55 Bool isRefLayer( UInt uiRefLayerId ); 56 56 57 #if R0151_CGS_3D_ASYMLUT_IMPROVE58 57 Void setAdaptChromaThresholdU( Int n ) { m_nAdaptCThresholdU = n; } 59 58 Int getAdaptChromaThresholdU() { return m_nAdaptCThresholdU; } 60 59 Void setAdaptChromaThresholdV( Int n ) { m_nAdaptCThresholdV = n; } 61 60 Int getAdaptChromaThresholdV() { return m_nAdaptCThresholdV; } 62 #endif 61 63 62 #if R0179_ENC_OPT_3DLUT_SIZE 64 63 Int getMaxYSize() { return 1<<(m_nMaxOctantDepth+m_nMaxYPartNumLog2); } … … 108 107 const static Int m_nVertexIdxOffset[4][3]; 109 108 std::vector<UInt> m_vRefLayerId; 110 #if R0151_CGS_3D_ASYMLUT_IMPROVE 109 111 110 Int m_nAdaptCThresholdU; 112 111 Int m_nAdaptCThresholdV; 113 #endif 112 114 113 #if R0164_CGS_LUT_BUGFIX_CHECK 115 114 Bool *** m_pCuboidExplicit; … … 125 124 Void xFree3DArray( T *** &p ); 126 125 127 Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 128 #if R0151_CGS_3D_ASYMLUT_IMPROVE 129 , Int nAdaptCThresholdU , Int nAdaptCThreshodV 130 #endif 131 ); 126 Void xUpdatePartitioning( Int nCurOctantDepth, Int nCurYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThreshodV ); 132 127 SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); 133 128 Pel xMapY( Pel y , Pel u , Pel v ); … … 137 132 Int xGetUSize() { return m_nUSize; } 138 133 Int xGetVSize() { return m_nVSize; } 139 #if R0151_CGS_3D_ASYMLUT_IMPROVE140 134 Int xGetYIdx(Pel y) { return( y >> m_nYShift2Idx ); } 141 135 Int xGetUIdx(Pel u) { return( m_nCurOctantDepth == 1 ? u >= m_nAdaptCThresholdU : u >> m_nUShift2Idx ); } 142 136 Int xGetVIdx(Pel v) { return( m_nCurOctantDepth == 1 ? v >= m_nAdaptCThresholdV : v >> m_nVShift2Idx ); } 143 137 Int xGetNormCoeffOne() { return( 1 << m_nMappingShift ); } 144 #else145 Int xGetYShift2Idx() { return m_nYShift2Idx; }146 Int xGetUShift2Idx() { return m_nUShift2Idx; }147 Int xGetVShift2Idx() { return m_nVShift2Idx; }148 #endif149 138 SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx]; } 150 139 Void xSaveCuboids( SCuboid *** pSrcCuboid ); -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1213 r1214 58 58 #if CGS_3D_ASYMLUT 59 59 #define CGS_GCC_NO_VECTORIZATION 1 60 #define R0151_CGS_3D_ASYMLUT_IMPROVE 1 ///< JCTVC-R0151: Non-uniform chroma partitioning and improved LUT coefficient coding61 60 #define R0164_CGS_LUT_BUGFIX 1 ///< JCTVC-R0164: Bug fix with LUT syntax 62 61 #define R0164_CGS_LUT_BUGFIX_CHECK 0 ///< JCTVC-R0164: Add traces explicitly/non-explicitly encoded vertices and check if 3DLUT is correctly filled -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1213 r1214 3535 3535 #endif 3536 3536 3537 #if R0151_CGS_3D_ASYMLUT_IMPROVE3538 3537 Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); 3539 3538 Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); … … 3547 3546 nAdaptCThresholdV += delta; 3548 3547 } 3549 #endif 3548 3550 3549 pc3DAsymLUT->destroy(); 3551 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , 3552 uiChromaInputBitDepthM8 + 8 , 3553 uiOutputBitDepthM8 + 8 , 3554 uiChromaOutputBitDepthM8 + 8 , 3555 uiCurPartNumLog2 3556 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3557 , nAdaptCThresholdU , nAdaptCThresholdV 3558 #endif 3559 ); 3550 pc3DAsymLUT->create( uiCurOctantDepth, uiInputBitDepthM8 + 8, uiChromaInputBitDepthM8 + 8, uiOutputBitDepthM8 + 8, uiChromaOutputBitDepthM8 + 8, uiCurPartNumLog2, nAdaptCThresholdU, nAdaptCThresholdV ); 3560 3551 pc3DAsymLUT->setResQuantBit( uiResQaunBit ); 3561 3552 … … 3613 3604 if( uiCodeVertex ) 3614 3605 { 3615 #if R0151_CGS_3D_ASYMLUT_IMPROVE3616 3606 #if R0300_CGS_RES_COEFF_CODING 3617 3607 xReadParam( deltaY, nFLCbits ); … … 3622 3612 xReadParam( deltaU ); 3623 3613 xReadParam( deltaV ); 3624 #endif3625 #else3626 READ_SVLC( deltaY , "resY" );3627 READ_SVLC( deltaU , "resU" );3628 READ_SVLC( deltaV , "resV" );3629 3614 #endif 3630 3615 } … … 3665 3650 } 3666 3651 3667 #if R0151_CGS_3D_ASYMLUT_IMPROVE3668 3652 #if R0300_CGS_RES_COEFF_CODING 3669 3653 Void TDecCavlc::xReadParam( Int& param, Int rParam ) … … 3691 3675 else param = 0; 3692 3676 } 3693 #endif3694 3677 #endif 3695 3678 -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r1212 r1214 148 148 Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 149 149 Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 150 #if R0151_CGS_3D_ASYMLUT_IMPROVE151 150 #if R0300_CGS_RES_COEFF_CODING 152 151 Void xReadParam( Int& param, Int flc_bits ); 153 152 #else 154 153 Void xReadParam( Int& param ); 155 #endif156 154 #endif 157 155 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
r1212 r1214 15 15 16 16 m_pBestEncCuboid = NULL; 17 #if R0151_CGS_3D_ASYMLUT_IMPROVE18 17 m_nAccuFrameBit = 0; 19 18 m_nAccuFrameCGSBit = 0; 20 19 m_nPrevFrameCGSPartNumLog2 = 0; 21 #else22 memset( m_nPrevFrameBit , 0 , sizeof( m_nPrevFrameBit ) );23 memset( m_nPrevFrameCGSBit , 0 , sizeof( m_nPrevFrameCGSBit ) );24 memset( m_nPrevFrameCGSPartNumLog2 , 0 , sizeof( m_nPrevFrameCGSPartNumLog2 ) );25 memset( m_nPrevFrameOverWritePPS , 0 , sizeof( m_nPrevFrameOverWritePPS ) );26 #endif27 20 m_dTotalFrameBit = 0; 28 21 m_nTotalCGSBit = 0; … … 67 60 } 68 61 69 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 70 #if R0151_CGS_3D_ASYMLUT_IMPROVE 71 , 1 << ( nInputBitDepthC - 1 ) , 1 << ( nInputBitDepthC - 1 ) 72 #endif 73 ); 62 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2, 1 << ( nInputBitDepthC - 1 ) , 1 << ( nInputBitDepthC - 1 ) ); 63 74 64 xAllocate3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() ); 75 65 xAllocate3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() ); … … 111 101 } 112 102 113 #if R0151_CGS_3D_ASYMLUT_IMPROVE114 103 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 , 115 104 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ) … … 173 162 return( dMinError ); 174 163 } 175 #else 176 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 , 177 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , 178 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ) 179 { 180 Int nInitP0 = rP0; 181 Int nInitP1 = rP1; 182 Int nInitP3 = rP3; 183 Int nInitP7 = rP7; 184 185 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); 186 if( N > 16 && dNorm != 0 ) 187 { 188 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; 189 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; 190 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; 191 Double dInitD = (-uu * yy * vs * Yv + uu * yy * Ys * vv + uu * vs * yv * Yy - uu * ys * Yy * vv + uu * ys * yv * Yv - uu * Ys * yv * yv + yy * vs * uv * Yu + yy * us * uv * Yv - yy * Ys * uv * uv - yy * us * Yu * vv + ys * yu * Yu * vv + vs * Yv * yu * yu + ys * Yy * uv * uv - us * yu * yv * Yv + us * yu * Yy * vv + 2 * Ys * yv * uv * yu - vs * uv * yu * Yy - vs * yv * yu * Yu - Ys * vv * yu * yu - us * uv * yv * Yy - ys * yv * uv * Yu - ys * yu * uv * Yv + us * Yu * yv * yv) / dNorm; 192 nInitP0 = xxCoeff2Vertex( dInitA , dInitB , dInitC , dInitD , y0 , u0 , v0 ) >> nResQuantBit << nResQuantBit ; 193 nInitP1 = xxCoeff2Vertex( dInitA , dInitB , dInitC , dInitD , y0 , u0 + nLengthUV , v0 ) >> nResQuantBit << nResQuantBit ; 194 nInitP3 = xxCoeff2Vertex( dInitA , dInitB , dInitC , dInitD , y0 , u0 + nLengthUV , v0 + nLengthUV ) >> nResQuantBit << nResQuantBit ; 195 nInitP7 = xxCoeff2Vertex( dInitA , dInitB , dInitC , dInitD , y0 + nLengthY , u0 + nLengthUV , v0 + nLengthUV ) >> nResQuantBit << nResQuantBit ; 196 } 197 198 Int nMin = - ( 1 << ( m_nLUTBitDepth - 1 ) ); 199 Int nMax = - nMin - ( 1 << nResQuantBit ); 200 Int nMask = ( 1 << nResQuantBit ) - 1; 201 202 Double dMinError = MAX_DOUBLE; 203 Int testRange = 2; 204 for( Int i = - testRange , nDeltaP01 = nInitP1 - nInitP0 - testRange * ( 1 << nResQuantBit ) ; i <= testRange ; i++ , nDeltaP01 += ( 1 << nResQuantBit ) ) 205 { 206 for( Int j = - testRange , nDeltaP13 = nInitP3 - nInitP1 - testRange * ( 1 << nResQuantBit ) ; j <= testRange ; j++ , nDeltaP13 += ( 1 << nResQuantBit ) ) 207 { 208 for( Int k = - testRange , nDeltaP37 = nInitP7 - nInitP3 - testRange * ( 1 << nResQuantBit ) ; k <= testRange ; k++ , nDeltaP37 += ( 1 << nResQuantBit ) ) 209 { 210 Double a = 1.0 * nDeltaP37 / nLengthY; 211 Double b = 1.0 * nDeltaP01 / nLengthUV; 212 Double c = 1.0 * nDeltaP13 / nLengthUV; 213 Double d = ( Ys - a * ys - b * us - c * vs ) / N; 214 Int nP0 = xxCoeff2Vertex( a , b , c , d , y0 , u0 , v0 ) >> nResQuantBit << nResQuantBit ; 215 nP0 = Clip3( nMin , nMax , nP0 ); 216 Int nP1 = Clip3( nMin , nMax , nP0 + nDeltaP01 ); 217 Int nP3 = Clip3( nMin , nMax , nP1 + nDeltaP13 ); 218 Int nP7 = Clip3( nMin , nMax , nP3 + nDeltaP37 ); 219 if ( nP0 & nMask ) 220 { 221 nP0 -= ( nP0 & nMask ); 222 } 223 if ( nP1 & nMask ) 224 { 225 nP1 -= ( nP1 & nMask ); 226 } 227 if ( nP3 & nMask ) 228 { 229 nP3 -= ( nP3 & nMask ); 230 } 231 if ( nP7 & nMask ) 232 { 233 nP7 -= ( nP7 & nMask ); 234 } 235 assert( !( nP0 & nMask ) && !( nP1 & nMask ) && !( nP3 & nMask ) && !( nP7 & nMask ) ); 236 Double dError = xxCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , y0 , u0 , v0 , nLengthY , nLengthUV , nP0 , nP1 , nP3 , nP7 ); 237 if( dError < dMinError ) 238 { 239 dMinError = dError; 240 rP0 = ( Pel )nP0; 241 rP1 = ( Pel )nP1; 242 rP3 = ( Pel )nP3; 243 rP7 = ( Pel )nP7; 244 assert( nMin <= rP0 && rP0 <= nMax && nMin <= rP1 && rP1 <= nMax && nMin <= rP3 && rP3 <= nMax && nMin <= rP7 && rP7 <= nMax ); 245 } 246 } 247 } 248 } 249 250 return( dMinError ); 251 } 252 #endif 253 254 #if R0151_CGS_3D_ASYMLUT_IMPROVE 164 255 165 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 256 166 { … … 287 197 return( dErrorLuma + dErrorChroma); 288 198 } 289 #else 290 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 291 { 292 xxCollectData( pCurPic , refLayerIdc ); 293 294 Double dErrorLuma = 0 , dErrorChroma = 0; 295 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 296 Int nUVSize = 1 << getCurOctantDepth(); 297 Int nLengthY = 1 << ( getInputBitDepthY() - getCurOctantDepth() - getCurYPartNumLog2() ); 298 Int nLengthUV = 1 << ( getInputBitDepthC() - getCurOctantDepth() ); 299 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 300 { 301 for( Int uIdx = 0 ; uIdx < nUVSize ; uIdx++ ) 302 { 303 for( Int vIdx = 0 ; vIdx < nUVSize ; vIdx++ ) 304 { 305 SColorInfo & rCuboidColorInfo = m_pColorInfo[yIdx][uIdx][vIdx]; 306 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 307 SCuboid & rCuboid = xGetCuboid( yIdx , uIdx , vIdx ); 308 Int y0 = yIdx << xGetYShift2Idx(); 309 Int u0 = uIdx << xGetUShift2Idx(); 310 Int v0 = vIdx << xGetVShift2Idx(); 311 if( rCuboidColorInfo.N > 0 ) 312 { 313 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 , 314 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y ); 315 } 316 if( rCuboidColorInfoC.N > 0 ) 317 { 318 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 , 319 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U ); 320 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 , 321 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V ); 322 } 323 } 324 } 325 } 326 327 return( dErrorLuma + dErrorChroma); 328 } 329 #endif 330 331 #if R0151_CGS_3D_ASYMLUT_IMPROVE 199 332 200 #if R0179_ENC_OPT_3DLUT_SIZE 333 201 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB, Double dFrameLambda ) … … 497 365 } 498 366 #endif 499 500 367 501 368 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ) … … 560 427 return( dMinError ); 561 428 } 562 #else563 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB )564 {565 m_nLUTBitDepth = pCfg->getCGSLUTBit();566 Int nCurYPartNumLog2 = 0 , nCurOctantDepth = 0;567 xxDerivePartNumLog2( pSlice , pCfg , nCurOctantDepth , nCurYPartNumLog2 , bSignalPPS , bElRapSliceTypeB );568 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 );569 xxCollectData( pCurPic , refLayerIdc );570 Int nBestResQuanBit = 0;571 Double dError0 = xxDeriveVertexes( nBestResQuanBit , m_pBestEncCuboid );572 Double dCurError = dError0;573 Double dFactor = 1 + 0.001 * ( pSlice->getDepth() + 1 );574 for( Int nResQuanBit = 1 ; nResQuanBit < 4 ; nResQuanBit++ )575 {576 Double dError = xxDeriveVertexes( nResQuanBit , m_pEncCuboid );577 if( dError < dError0 * dFactor )578 {579 nBestResQuanBit = nResQuanBit;580 SCuboid *** tmp = m_pBestEncCuboid;581 m_pBestEncCuboid = m_pEncCuboid;582 m_pEncCuboid = tmp;583 dCurError = dError;584 }585 else586 {587 break;588 }589 }590 setResQuantBit( nBestResQuanBit );591 xSaveCuboids( m_pBestEncCuboid );592 return( dCurError );593 }594 #endif595 429 596 430 Double TEnc3DAsymLUT::xxDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid ) … … 599 433 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 600 434 Int nUVSize = 1 << getCurOctantDepth(); 601 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 602 Int nLengthY = 1 << ( getInputBitDepthY() - getCurOctantDepth() - getCurYPartNumLog2() ); 603 Int nLengthUV = 1 << ( getInputBitDepthC() - getCurOctantDepth() ); 604 #endif 435 605 436 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 606 437 { … … 612 443 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 613 444 SCuboid & rCuboid = pCurCuboid[yIdx][uIdx][vIdx]; 614 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 615 Int y0 = yIdx << xGetYShift2Idx(); 616 Int u0 = uIdx << xGetUShift2Idx(); 617 Int v0 = vIdx << xGetVShift2Idx(); 618 #endif 445 619 446 for( Int idxVertex = 0 ; idxVertex < 4 ; idxVertex++ ) 620 447 { … … 625 452 { 626 453 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 , 627 #if !R0151_CGS_3D_ASYMLUT_IMPROVE628 y0 , u0 , v0 , nLengthY , nLengthUV ,629 #endif630 454 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 631 455 } 456 632 457 if( rCuboidColorInfoC.N > 0 ) 633 458 { 634 459 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 , 635 #if !R0151_CGS_3D_ASYMLUT_IMPROVE636 y0 , u0 , v0 , nLengthY , nLengthUV ,637 #endif638 460 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 461 639 462 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 , 640 #if !R0151_CGS_3D_ASYMLUT_IMPROVE641 y0 , u0 , v0 , nLengthY , nLengthUV ,642 #endif643 463 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 644 464 } … … 703 523 // since we do data collection only for overlapped region, the border extension is good enough 704 524 705 #if R0151_CGS_3D_ASYMLUT_IMPROVE706 525 m_dSumU = m_dSumV = 0; 707 526 m_nNChroma = 0; 708 #endif 527 709 528 for( Int i = top ; i <= bottom ; i++ ) 710 529 { … … 738 557 } 739 558 740 #if R0151_CGS_3D_ASYMLUT_IMPROVE741 559 m_dSumU += u; 742 560 m_dSumV += v; 743 561 m_nNChroma++; 744 #endif 562 745 563 SColorInfo sColorInfo; 746 #if R0151_CGS_3D_ASYMLUT_IMPROVE747 564 SColorInfo & rCuboidColorInfo = m_pColorInfo[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 748 #else 749 SColorInfo & rCuboidColorInfo = m_pColorInfo[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 750 #endif 565 751 566 memset(&sColorInfo, 0, sizeof(SColorInfo)); 567 752 568 sColorInfo.Ys = Y; 753 569 sColorInfo.ys = y; … … 775 591 u = pIRLU[posIRLUV]; 776 592 v = pIRLV[posIRLUV]; 777 #if R0151_CGS_3D_ASYMLUT_IMPROVE 593 778 594 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 779 #else 780 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 781 #endif 595 782 596 sColorInfo.Us = U; 783 597 sColorInfo.Vs = V; … … 810 624 Void TEnc3DAsymLUT::xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ) 811 625 { 812 #if !R0151_CGS_3D_ASYMLUT_IMPROVE813 Int nSliceType = pSlice->getSliceType();814 // update slice type as what will be done later815 if( pSlice->getActiveNumILRRefIdx() == 0 && pSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )816 {817 nSliceType = I_SLICE;818 }819 else if( !bElRapSliceTypeB )820 {821 if( (pSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&822 (pSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&823 pSlice->getSliceType() == B_SLICE )824 {825 nSliceType = P_SLICE;826 }827 }828 829 const Int nSliceTempLevel = pSlice->getDepth();830 #endif831 626 Int nPartNumLog2 = 4; 832 627 if( pSlice->getBaseColPic( pSlice->getInterLayerPredLayerIdc( 0 ) )->getSlice( 0 )->isIntra() ) … … 834 629 nPartNumLog2 = xGetMaxPartNumLog2(); 835 630 } 836 #if R0151_CGS_3D_ASYMLUT_IMPROVE 631 837 632 if( m_nAccuFrameBit && pSlice->getPPS()->getCGSFlag() ) 838 633 { 839 634 Double dBitCost = 1.0 * m_nAccuFrameCGSBit / m_nAccuFrameBit; 840 635 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2; 841 #else 842 if( m_nPrevFrameBit[nSliceType][nSliceTempLevel] && pSlice->getPPS()->getCGSFlag() ) 843 { 844 Double dBitCost = 1.0 * m_nPrevFrameCGSBit[nSliceType][nSliceTempLevel] / m_nPrevFrameBit[nSliceType][nSliceTempLevel]; 845 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2[nSliceType][nSliceTempLevel]; 846 #endif 636 847 637 Double dBitCostT = 0.03; 848 638 if( dBitCost < dBitCostT / 6.0 ) … … 855 645 } 856 646 } 857 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 858 else 859 { 860 nPartNumLog2 -= nSliceTempLevel; 861 } 862 #endif 647 863 648 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 864 649 xxMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 ); … … 885 670 Void TEnc3DAsymLUT::updatePicCGSBits( TComSlice * pcSlice , Int nPPSBit ) 886 671 { 887 #if !R0151_CGS_3D_ASYMLUT_IMPROVE888 const Int nSliceType = pcSlice->getSliceType();889 const Int nSliceTempLevel = pcSlice->getDepth();890 #endif891 672 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 892 673 { 893 674 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 894 #if R0151_CGS_3D_ASYMLUT_IMPROVE895 675 m_nAccuFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 896 #else897 m_nPrevFrameBit[nSliceType][nSliceTempLevel] = pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit();898 #endif899 676 m_dTotalFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 900 677 } 901 #if R0151_CGS_3D_ASYMLUT_IMPROVE 678 902 679 m_nAccuFrameCGSBit += nPPSBit; 903 680 m_nTotalCGSBit += nPPSBit; 904 681 m_nPrevFrameCGSPartNumLog2 = getCurOctantDepth() * 3 + getCurYPartNumLog2(); 905 #else 906 m_nPrevFrameOverWritePPS[nSliceType][nSliceTempLevel] = pcSlice->getCGSOverWritePPS(); 907 m_nPrevFrameCGSBit[nSliceType][nSliceTempLevel] = nPPSBit; 908 m_nTotalCGSBit += nPPSBit; 909 m_nPrevFrameCGSPartNumLog2[nSliceType][nSliceTempLevel] = getCurOctantDepth() * 3 + getCurYPartNumLog2(); 910 #endif 682 911 683 #if R0179_ENC_OPT_3DLUT_SIZE 912 684 Int nCurELFrameBit = pcSlice->getPic()->getFrameBit(); … … 1033 805 { 1034 806 assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() ); 1035 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() 1036 #if R0151_CGS_3D_ASYMLUT_IMPROVE 1037 , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV() 1038 #endif 1039 ); 807 xUpdatePartitioning( pSrc->getCurOctantDepth(), pSrc->getCurYPartNumLog2(), pSrc->getAdaptChromaThresholdU(), pSrc->getAdaptChromaThresholdV() ); 1040 808 setResQuantBit( pSrc->getResQuantBit() ); 1041 809 } 1042 1043 810 #endif 1044 811 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h
r1212 r1214 100 100 SCuboid *** m_pEncCuboid; 101 101 SCuboid *** m_pBestEncCuboid; 102 #if R0151_CGS_3D_ASYMLUT_IMPROVE 103 Int m_nAccuFrameBit; // base + enhancement layer 104 Int m_nAccuFrameCGSBit; 105 Int m_nPrevFrameCGSPartNumLog2; 106 #else 107 Int m_nPrevFrameBit[3][MAX_TLAYER]; // base + enhancement layer 108 Int m_nPrevFrameCGSBit[3][MAX_TLAYER]; 109 Int m_nPrevFrameCGSPartNumLog2[3][MAX_TLAYER]; 110 Int m_nPrevFrameOverWritePPS[3][MAX_TLAYER]; 111 #endif 112 Double m_dTotalFrameBit; 113 Int m_nTotalCGSBit; 114 Int m_nPPSBit; 115 Int m_nLUTBitDepth; 102 Int m_nAccuFrameBit; // base + enhancement layer 103 Int m_nAccuFrameCGSBit; 104 Int m_nPrevFrameCGSPartNumLog2; 105 Double m_dTotalFrameBit; 106 Int m_nTotalCGSBit; 107 Int m_nPPSBit; 108 Int m_nLUTBitDepth; 116 109 #if R0179_ENC_OPT_3DLUT_SIZE 117 110 … … 124 117 SLUTSize m_sLutSizes[MAX_NUM_LUT_SIZES]; 125 118 #endif 126 #if R0151_CGS_3D_ASYMLUT_IMPROVE127 119 Double m_dSumU; 128 120 Double m_dSumV; 129 121 Int m_nNChroma; 130 #endif131 122 #if R0179_ENC_OPT_3DLUT_SIZE 132 123 TComOutputBitstream *m_pBitstreamRedirect; … … 135 126 136 127 private: 137 #if R0151_CGS_3D_ASYMLUT_IMPROVE138 128 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 , 139 129 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 140 #else 141 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 , 142 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , 143 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 144 #endif 130 145 131 Void xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ); 146 132 Void xxMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 ); … … 149 135 150 136 Double xxDeriveVertexes( Int nResQuantBit , SCuboid *** pCurCuboid ); 151 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 , 152 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 );153 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 ,154 Double a , Double b , Double c , Double d ); 155 #if R0151_CGS_3D_ASYMLUT_IMPROVE 156 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 , 157 Pel nP0 , Pel nP1 , Pel nP3, Pel nP7 );158 #endif 137 138 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, 139 Int y0, Int u0, Int v0, Int nLengthY, Int nLengthUV, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ); 140 141 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, Double a, Double b, Double c, Double d ); 142 143 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, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ); 144 159 145 #if R0179_ENC_OPT_3DLUT_SIZE 160 146 Void xxConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize ); … … 175 161 } 176 162 177 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 , 178 Double a , Double b , Double c , Double d ) 163 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, Double a, Double b, Double c, Double d ) 179 164 { 180 165 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; … … 182 167 }; 183 168 184 #if R0151_CGS_3D_ASYMLUT_IMPROVE 185 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 , 186 Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 ) 169 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, Pel nP0, Pel nP1, Pel nP3, Pel nP7 ) 187 170 { 188 171 const Int nOne = xGetNormCoeffOne(); … … 194 177 return( dError ); 195 178 }; 196 #endif197 179 198 180 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r1213 r1214 2495 2495 WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" ); 2496 2496 #endif 2497 #if R0151_CGS_3D_ASYMLUT_IMPROVE 2497 2498 2498 if( pc3DAsymLUT->getCurOctantDepth() == 1 ) 2499 2499 { … … 2501 2501 WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdV() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_v_delta" ); 2502 2502 } 2503 #endif2504 2503 2505 2504 #if R0164_CGS_LUT_BUGFIX_CHECK … … 2555 2554 if( uiCodeVertex ) 2556 2555 { 2557 #if R0151_CGS_3D_ASYMLUT_IMPROVE2558 2556 #if R0300_CGS_RES_COEFF_CODING 2559 2557 xWriteParam( sRes.Y, nFLCbits ); … … 2565 2563 xWriteParam( sRes.V ); 2566 2564 #endif 2567 #else2568 WRITE_SVLC( sRes.Y , "resY" );2569 WRITE_SVLC( sRes.U , "resU" );2570 WRITE_SVLC( sRes.V , "resV" );2571 #endif2572 2565 } 2573 2566 } … … 2579 2572 } 2580 2573 2581 #if R0151_CGS_3D_ASYMLUT_IMPROVE2582 2574 #if R0300_CGS_RES_COEFF_CODING 2583 2575 Void TEncCavlc::xWriteParam( Int param, UInt rParam) … … 2595 2587 WRITE_FLAG( param <0, "sign"); 2596 2588 } 2597 #endif2598 2589 2599 2590 #if R0300_CGS_RES_COEFF_CODING -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h
r1212 r1214 174 174 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 175 175 #endif 176 #if R0151_CGS_3D_ASYMLUT_IMPROVE177 176 #if R0300_CGS_RES_COEFF_CODING 178 177 Void xWriteParam( Int param, UInt nFLCBits); … … 182 181 #else 183 182 Void xWriteParam( Int param); 184 #endif185 183 #endif 186 184 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1212 r1214 409 409 Int m_nCGSMaxYPartNumLog2; 410 410 Int m_nCGSLUTBit; 411 #if R0151_CGS_3D_ASYMLUT_IMPROVE412 411 Int m_nCGSAdaptiveChroma; 413 #endif414 412 #if R0179_ENC_OPT_3DLUT_SIZE 415 413 Int m_nCGSLutSizeRDO; … … 1150 1148 Void setCGSLUTBit(Int n) { m_nCGSLUTBit = n; } 1151 1149 Int getCGSLUTBit() { return m_nCGSLUTBit; } 1152 #if R0151_CGS_3D_ASYMLUT_IMPROVE1153 1150 Void setCGSAdaptChroma(Int n) { m_nCGSAdaptiveChroma = n; } 1154 1151 Int getCGSAdaptChroma() { return m_nCGSAdaptiveChroma; } 1155 #endif1156 1152 #if R0179_ENC_OPT_3DLUT_SIZE 1157 1153 Void setCGSLutSizeRDO(Int n) { m_nCGSLutSizeRDO = n; }
Note: See TracChangeset for help on using the changeset viewer.