Changeset 1214 in SHVCSoftware for branches/SHM-dev/source


Ignore:
Timestamp:
8 Jul 2015, 23:35:39 (9 years ago)
Author:
seregin
Message:

macro cleanup: R0151_CGS_3D_ASYMLUT_IMPROVE

Location:
branches/SHM-dev/source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1212 r1214  
    16521652  ("CGSMaxYPartNumLog",  m_nCGSMaxYPartNumLog2 , 2, "max Y part number ")
    16531653  ("CGSLUTBit",     m_nCGSLUTBit , 12, "bit depth of CGS LUT")
    1654 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    16551654  ("CGSAdaptC",     m_nCGSAdaptiveChroma , 1, "adaptive chroma partition (only for the case of two chroma partitions)")
    1656 #endif
    16571655#if R0179_ENC_OPT_3DLUT_SIZE
    16581656  ("CGSSizeRDO",     m_nCGSLutSizeRDO , 0, "RDOpt selection of best table size (effective when large maximum table size such as 8x8x8 is used)")
     
    45114509  printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit );
    45124510#endif
    4513 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    45144511  printf("CGSAdaptC:%d " , m_nCGSAdaptiveChroma );
    4515 #endif
    45164512#if R0179_ENC_OPT_3DLUT_SIZE
    45174513  printf("CGSSizeRDO:%d " , m_nCGSLutSizeRDO );
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1212 r1214  
    511511  Int       m_nCGSMaxYPartNumLog2;
    512512  Int       m_nCGSLUTBit;
    513 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    514513  Int       m_nCGSAdaptiveChroma;
    515 #endif
    516514#if R0179_ENC_OPT_3DLUT_SIZE
    517515  Int       m_nCGSLutSizeRDO;
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1212 r1214  
    761761    m_acTEncTop[layer].setCGSMaxYPartNumLog2                     ( m_nCGSMaxYPartNumLog2 );
    762762    m_acTEncTop[layer].setCGSLUTBit                              ( m_nCGSLUTBit );
    763 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    764763    m_acTEncTop[layer].setCGSAdaptChroma                         ( m_nCGSAdaptiveChroma );
    765 #endif
    766764#if R0179_ENC_OPT_3DLUT_SIZE
    767765    m_acTEncTop[layer].setCGSLutSizeRDO                          ( m_nCGSLutSizeRDO );
  • branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.cpp

    r1213 r1214  
    1010
    1111#if CGS_3D_ASYMLUT
    12 
    1312const Int TCom3DAsymLUT::m_nVertexIdxOffset[4][3] = { { 0 , 0 , 0 } , { 0 , 1 , 0 } , { 0 , 1 , 1 } , { 1 , 1 , 1 } };
    1413
     
    2827}
    2928
    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   )
     29Void TCom3DAsymLUT::create( Int nMaxOctantDepth, Int nInputBitDepth, Int nInputBitDepthC, Int nOutputBitDepth, Int nOutputBitDepthC, Int nMaxYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV )
    3530{
    3631  m_nMaxOctantDepth = nMaxOctantDepth;
     
    4439  m_nMaxPartNumLog2 = 3 * m_nMaxOctantDepth + m_nMaxYPartNumLog2;
    4540
    46   xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2
    47 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    48     , nAdaptCThresholdU , nAdaptCThresholdV
    49 #endif
    50     );
     41  xUpdatePartitioning( nMaxOctantDepth, nMaxYPartNumLog2, nAdaptCThresholdU, nAdaptCThresholdV );
    5142
    5243  m_nYSize = 1 << ( m_nMaxOctantDepth + m_nMaxYPartNumLog2 );
     
    7768
    7869
    79 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2
    80 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    81   , Int nAdaptCThresholdU , Int nAdaptCThresholdV
    82 #endif
    83   )
     70Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth, Int nCurYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV  )
    8471{
    8572  assert( nCurOctantDepth <= m_nMaxOctantDepth );
     
    9481  m_nYShift2Idx = m_nInputBitDepthY - m_nCurOctantDepth - m_nCurYPartNumLog2;
    9582  m_nUShift2Idx = m_nVShift2Idx = m_nInputBitDepthC - m_nCurOctantDepth;
    96 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     83
    9784  m_nMappingShift = 10 + m_nInputBitDepthY - m_nOutputBitDepthY;
    9885  m_nAdaptCThresholdU = nAdaptCThresholdU;
    9986  m_nAdaptCThresholdV = nAdaptCThresholdV;
    100 #else
    101   m_nMappingShift = m_nYShift2Idx + m_nUShift2Idx;
    102 #endif
     87
    10388  m_nMappingOffset = 1 << ( m_nMappingShift - 1 );
    10489
     
    201186 
    202187  SYUVP sPred;
    203 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     188
    204189  sPred.Y = sPred.U = sPred.V = 0;
     190
    205191  if( nVertexIdx == 0 )
     192  {
    206193    sPred.Y = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY );
     194  }
    207195  else if( nVertexIdx == 1 )
     196  {
    208197    sPred.U = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY );
     198  }
    209199  else if( nVertexIdx == 2 )
     200  {
    210201    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;
    217205}
    218206
     
    221209  SCuboid***  pCuboid = pCurCuboid ? pCurCuboid : m_pCuboid ;
    222210
    223 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    224211  SYUVP sPred;
    225212  if( yIdx == 0 )
     
    233220    sPred = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx];
    234221  }
    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
    264223  return sPred ;
    265224}
     
    294253Pel TCom3DAsymLUT::xMapY( Pel y , Pel u , Pel v )
    295254{
    296 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    297255  const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)];
    298256  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
    310258  return( dstY );
    311259}
     
    313261SYUVP TCom3DAsymLUT::xMapUV( Pel y , Pel u , Pel v )
    314262{
    315 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    316263  const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)];
    317264  SYUVP dst;
     
    319266  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;
    320267  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
    336269  return( dst );
    337270}
     
    349282{
    350283  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() );
    356285  setResQuantBit( pSrc->getResQuantBit() );
    357286  xSaveCuboids( pSrc->m_pCuboid );
  • branches/SHM-dev/source/Lib/TLibCommon/TCom3DAsymLUT.h

    r1213 r1214  
    2727  virtual ~TCom3DAsymLUT();
    2828
    29   virtual Void  create( Int nMaxOctantDepth, Int nInputBitDepth, Int nInputBitDepthC, Int nOutputBitDepth, Int nOutputBitDepthC, Int nMaxYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV );
    30   virtual Void  destroy();
     29  virtual Void create( Int nMaxOctantDepth, Int nInputBitDepth, Int nInputBitDepthC, Int nOutputBitDepth, Int nOutputBitDepthC, Int nMaxYPartNumLog2, Int nAdaptCThresholdU, Int nAdaptCThresholdV );
     30  virtual Void destroy();
    3131
    3232  Int   getMaxOctantDepth() { return m_nMaxOctantDepth; }
     
    5555  Bool  isRefLayer( UInt uiRefLayerId );
    5656
    57 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    5857  Void  setAdaptChromaThresholdU( Int n ) { m_nAdaptCThresholdU = n; }
    5958  Int   getAdaptChromaThresholdU()        { return m_nAdaptCThresholdU; }
    6059  Void  setAdaptChromaThresholdV( Int n ) { m_nAdaptCThresholdV = n;  }
    6160  Int   getAdaptChromaThresholdV()        { return m_nAdaptCThresholdV; }
    62 #endif
     61
    6362#if R0179_ENC_OPT_3DLUT_SIZE
    6463  Int   getMaxYSize() { return 1<<(m_nMaxOctantDepth+m_nMaxYPartNumLog2); }
     
    108107  const static Int m_nVertexIdxOffset[4][3];
    109108  std::vector<UInt> m_vRefLayerId;
    110 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     109
    111110  Int   m_nAdaptCThresholdU;
    112111  Int   m_nAdaptCThresholdV;
    113 #endif
     112
    114113#if R0164_CGS_LUT_BUGFIX_CHECK
    115114  Bool  *** m_pCuboidExplicit;
     
    125124  Void xFree3DArray( T *** &p );
    126125
    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 );
    132127  SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx );
    133128  Pel   xMapY( Pel y , Pel u , Pel v );
     
    137132  Int   xGetUSize()  { return m_nUSize;  }
    138133  Int   xGetVSize()  { return m_nVSize;  }
    139 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    140134  Int   xGetYIdx(Pel y)  { return( y >> m_nYShift2Idx ); }
    141135  Int   xGetUIdx(Pel u)  { return( m_nCurOctantDepth == 1 ? u >= m_nAdaptCThresholdU : u >> m_nUShift2Idx ); }
    142136  Int   xGetVIdx(Pel v)  { return( m_nCurOctantDepth == 1 ? v >= m_nAdaptCThresholdV : v >> m_nVShift2Idx ); }
    143137  Int   xGetNormCoeffOne()    { return( 1 << m_nMappingShift ); }
    144 #else
    145   Int   xGetYShift2Idx() { return m_nYShift2Idx; }
    146   Int   xGetUShift2Idx() { return m_nUShift2Idx; }
    147   Int   xGetVShift2Idx() { return m_nVShift2Idx; }
    148 #endif
    149138  SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx];  }
    150139  Void  xSaveCuboids( SCuboid *** pSrcCuboid );
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1213 r1214  
    5858#if CGS_3D_ASYMLUT
    5959#define CGS_GCC_NO_VECTORIZATION         1
    60 #define R0151_CGS_3D_ASYMLUT_IMPROVE     1      ///< JCTVC-R0151: Non-uniform chroma partitioning and improved LUT coefficient coding
    6160#define R0164_CGS_LUT_BUGFIX             1      ///< JCTVC-R0164: Bug fix with LUT syntax
    6261#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  
    35353535#endif
    35363536
    3537 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    35383537  Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 );
    35393538  Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 );
     
    35473546    nAdaptCThresholdV += delta;
    35483547  }
    3549 #endif
     3548
    35503549  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 );
    35603551  pc3DAsymLUT->setResQuantBit( uiResQaunBit );
    35613552
     
    36133604        if( uiCodeVertex )
    36143605        {
    3615 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    36163606#if R0300_CGS_RES_COEFF_CODING
    36173607          xReadParam( deltaY, nFLCbits );
     
    36223612          xReadParam( deltaU );
    36233613          xReadParam( deltaV );
    3624 #endif
    3625 #else
    3626           READ_SVLC( deltaY , "resY" );
    3627           READ_SVLC( deltaU , "resU" );
    3628           READ_SVLC( deltaV , "resV" );
    36293614#endif
    36303615        }
     
    36653650}
    36663651
    3667 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    36683652#if R0300_CGS_RES_COEFF_CODING
    36693653Void TDecCavlc::xReadParam( Int& param, Int rParam )
     
    36913675  else param = 0;
    36923676}
    3693 #endif
    36943677#endif
    36953678
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r1212 r1214  
    148148  Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT );
    149149  Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength );
    150 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    151150#if R0300_CGS_RES_COEFF_CODING
    152151  Void xReadParam( Int& param, Int flc_bits );
    153152#else
    154153  Void xReadParam( Int& param );
    155 #endif
    156154#endif
    157155#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp

    r1212 r1214  
    1515
    1616  m_pBestEncCuboid = NULL;
    17 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    1817  m_nAccuFrameBit = 0;
    1918  m_nAccuFrameCGSBit = 0;
    2019  m_nPrevFrameCGSPartNumLog2 = 0;
    21 #else
    22   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 #endif
    2720  m_dTotalFrameBit = 0;
    2821  m_nTotalCGSBit = 0;
     
    6760  }
    6861
    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
    7464  xAllocate3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() );
    7565  xAllocate3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() );
     
    111101}
    112102
    113 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    114103Double 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 ,
    115104  Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit )
     
    173162  return( dMinError );
    174163}
    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
    255165Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc )
    256166{
     
    287197  return( dErrorLuma + dErrorChroma);
    288198}
    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
    332200#if R0179_ENC_OPT_3DLUT_SIZE
    333201Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB, Double dFrameLambda )
     
    497365}
    498366#endif
    499 
    500367
    501368Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB )
     
    560427  return( dMinError );
    561428}
    562 #else
    563 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     else
    586     {
    587       break;
    588     }
    589   }
    590   setResQuantBit( nBestResQuanBit );
    591   xSaveCuboids( m_pBestEncCuboid );
    592   return( dCurError );
    593 }
    594 #endif
    595429
    596430Double TEnc3DAsymLUT::xxDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid )
     
    599433  Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() );
    600434  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
    605436  for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ )
    606437  {
     
    612443        SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx];
    613444        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
    619446        for( Int idxVertex = 0 ; idxVertex < 4 ; idxVertex++ )
    620447        {
     
    625452        {
    626453          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_IMPROVE
    628             y0 , u0 , v0 , nLengthY , nLengthUV ,
    629 #endif
    630454            rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit );
    631455        }
     456
    632457        if( rCuboidColorInfoC.N > 0 )
    633458        {
    634459          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_IMPROVE
    636             y0 , u0 , v0 , nLengthY , nLengthUV ,
    637 #endif
    638460            rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit );
     461
    639462          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_IMPROVE
    641             y0 , u0 , v0 , nLengthY , nLengthUV ,
    642 #endif
    643463            rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit );
    644464        }
     
    703523  // since we do data collection only for overlapped region, the border extension is good enough
    704524
    705 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    706525  m_dSumU = m_dSumV = 0;
    707526  m_nNChroma = 0;
    708 #endif
     527
    709528  for( Int i = top ; i <= bottom ; i++ )
    710529  {
     
    738557      }
    739558
    740 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    741559      m_dSumU += u;
    742560      m_dSumV += v;
    743561      m_nNChroma++;
    744 #endif
     562
    745563      SColorInfo sColorInfo;
    746 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    747564      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
    751566      memset(&sColorInfo, 0, sizeof(SColorInfo));
     567
    752568      sColorInfo.Ys = Y;
    753569      sColorInfo.ys = y;
     
    775591        u = pIRLU[posIRLUV];
    776592        v = pIRLV[posIRLUV];
    777 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     593
    778594        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
    782596        sColorInfo.Us = U;
    783597        sColorInfo.Vs = V;
     
    810624Void TEnc3DAsymLUT::xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB )
    811625{
    812 #if !R0151_CGS_3D_ASYMLUT_IMPROVE
    813   Int nSliceType = pSlice->getSliceType();
    814   // update slice type as what will be done later
    815   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 #endif
    831626  Int nPartNumLog2 = 4;
    832627  if( pSlice->getBaseColPic( pSlice->getInterLayerPredLayerIdc( 0 ) )->getSlice( 0 )->isIntra() )
     
    834629    nPartNumLog2 = xGetMaxPartNumLog2();
    835630  }
    836 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     631
    837632  if( m_nAccuFrameBit && pSlice->getPPS()->getCGSFlag() )
    838633  {
    839634    Double dBitCost = 1.0 * m_nAccuFrameCGSBit / m_nAccuFrameBit;
    840635    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
    847637    Double dBitCostT = 0.03;
    848638    if( dBitCost < dBitCostT / 6.0 )
     
    855645    }
    856646  }
    857 #if !R0151_CGS_3D_ASYMLUT_IMPROVE
    858   else
    859   {
    860     nPartNumLog2 -= nSliceTempLevel;
    861   }
    862 #endif
     647
    863648  nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2()  , nPartNumLog2 );
    864649  xxMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 );
     
    885670Void TEnc3DAsymLUT::updatePicCGSBits( TComSlice * pcSlice , Int nPPSBit )
    886671{
    887 #if !R0151_CGS_3D_ASYMLUT_IMPROVE
    888   const Int nSliceType = pcSlice->getSliceType();
    889   const Int nSliceTempLevel = pcSlice->getDepth();
    890 #endif
    891672  for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    892673  {
    893674    UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
    894 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    895675    m_nAccuFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit();
    896 #else
    897     m_nPrevFrameBit[nSliceType][nSliceTempLevel] = pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit();
    898 #endif
    899676    m_dTotalFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit();
    900677  }
    901 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     678
    902679  m_nAccuFrameCGSBit += nPPSBit;
    903680  m_nTotalCGSBit += nPPSBit;
    904681  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
    911683#if R0179_ENC_OPT_3DLUT_SIZE
    912684  Int nCurELFrameBit = pcSlice->getPic()->getFrameBit();
     
    1033805{
    1034806  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() );
    1040808  setResQuantBit( pSrc->getResQuantBit() );
    1041809}
    1042 
    1043810#endif
    1044811#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h

    r1212 r1214  
    100100  SCuboid *** m_pEncCuboid;
    101101  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;
    116109#if R0179_ENC_OPT_3DLUT_SIZE
    117110
     
    124117  SLUTSize m_sLutSizes[MAX_NUM_LUT_SIZES];
    125118#endif
    126 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    127119  Double m_dSumU;
    128120  Double m_dSumV;
    129121  Int    m_nNChroma;
    130 #endif
    131122#if R0179_ENC_OPT_3DLUT_SIZE
    132123  TComOutputBitstream  *m_pBitstreamRedirect;
     
    135126
    136127private:
    137 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    138128  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 ,
    139129    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
    145131  Void    xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB );
    146132  Void    xxMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 );
     
    149135
    150136  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
    159145#if R0179_ENC_OPT_3DLUT_SIZE
    160146  Void    xxConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize );
     
    175161}
    176162
    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 )
     163Double 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 ) 
    179164{
    180165  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;
     
    182167};
    183168
    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 )
     169Double 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 ) 
    187170{
    188171  const Int nOne = xGetNormCoeffOne();
     
    194177  return( dError );
    195178};
    196 #endif
    197179
    198180#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1213 r1214  
    24952495  WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" );
    24962496#endif
    2497 #if R0151_CGS_3D_ASYMLUT_IMPROVE
     2497
    24982498  if( pc3DAsymLUT->getCurOctantDepth() == 1 )
    24992499  {
     
    25012501    WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdV() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_v_delta" );
    25022502  }
    2503 #endif
    25042503
    25052504#if R0164_CGS_LUT_BUGFIX_CHECK
     
    25552554        if( uiCodeVertex )
    25562555        {
    2557 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    25582556#if R0300_CGS_RES_COEFF_CODING
    25592557          xWriteParam( sRes.Y, nFLCbits );
     
    25652563          xWriteParam( sRes.V );
    25662564#endif
    2567 #else
    2568           WRITE_SVLC( sRes.Y , "resY" );
    2569           WRITE_SVLC( sRes.U , "resU" );
    2570           WRITE_SVLC( sRes.V , "resV" );
    2571 #endif
    25722565        }
    25732566      }
     
    25792572}
    25802573
    2581 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    25822574#if R0300_CGS_RES_COEFF_CODING
    25832575Void TEncCavlc::xWriteParam( Int param, UInt rParam)
     
    25952587    WRITE_FLAG( param <0, "sign");
    25962588}
    2597 #endif
    25982589
    25992590#if R0300_CGS_RES_COEFF_CODING
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r1212 r1214  
    174174  Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength );
    175175#endif
    176 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    177176#if R0300_CGS_RES_COEFF_CODING
    178177  Void xWriteParam( Int param, UInt nFLCBits);
     
    182181#else
    183182  Void xWriteParam( Int param);
    184 #endif
    185183#endif
    186184#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1212 r1214  
    409409  Int       m_nCGSMaxYPartNumLog2;
    410410  Int       m_nCGSLUTBit;
    411 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    412411  Int       m_nCGSAdaptiveChroma;
    413 #endif
    414412#if R0179_ENC_OPT_3DLUT_SIZE
    415413  Int       m_nCGSLutSizeRDO;
     
    11501148  Void      setCGSLUTBit(Int n)           { m_nCGSLUTBit = n;    }
    11511149  Int       getCGSLUTBit()                { return m_nCGSLUTBit; }
    1152 #if R0151_CGS_3D_ASYMLUT_IMPROVE
    11531150  Void      setCGSAdaptChroma(Int n)      { m_nCGSAdaptiveChroma = n;  }
    11541151  Int       getCGSAdaptChroma()           { return m_nCGSAdaptiveChroma; }
    1155 #endif
    11561152#if R0179_ENC_OPT_3DLUT_SIZE
    11571153  Void      setCGSLutSizeRDO(Int n)      { m_nCGSLutSizeRDO = n;  }
Note: See TracChangeset for help on using the changeset viewer.