Ignore:
Timestamp:
12 Jul 2014, 08:45:16 (10 years ago)
Author:
interdigital
Message:

Added R0300_CGS_RES_COEFF_CODING for improved residual coefficient coding
Added R0179_CGS_SIZE_8x1x1 to allow 8x1x1 LUT size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r825 r826  
    27892789  assert( pc3DAsymLUT->getResQuantBit() < 4 );
    27902790  WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" );
     2791#if R0300_CGS_RES_COEFF_CODING
     2792  xFindDeltaBits( pc3DAsymLUT );
     2793  assert(pc3DAsymLUT->getDeltaBits() >=1 && pc3DAsymLUT->getDeltaBits() <= 4);
     2794  WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" );
     2795#endif
    27912796#if R0151_CGS_3D_ASYMLUT_IMPROVE
    27922797  if( pc3DAsymLUT->getCurOctantDepth() == 1 )
     
    28282833  else
    28292834  {
     2835#if R0300_CGS_RES_COEFF_CODING
     2836    Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ;
     2837    nFLCbits = nFLCbits >= 0 ? nFLCbits : 0;
     2838#endif
    28302839    for( Int l = 0 ; l < nYPartNum ; l++ )
    28312840    {
     
    28452854        {
    28462855#if R0151_CGS_3D_ASYMLUT_IMPROVE
     2856#if R0300_CGS_RES_COEFF_CODING
     2857          xWriteParam( sRes.Y, nFLCbits );
     2858          xWriteParam( sRes.U, nFLCbits );
     2859          xWriteParam( sRes.V, nFLCbits );
     2860#else
    28472861          xWriteParam( sRes.Y );
    28482862          xWriteParam( sRes.U );
    28492863          xWriteParam( sRes.V );
     2864#endif
    28502865#else
    28512866          WRITE_SVLC( sRes.Y , "resY" );
     
    28632878
    28642879#if R0151_CGS_3D_ASYMLUT_IMPROVE
     2880#if R0300_CGS_RES_COEFF_CODING
     2881Void TEncCavlc::xWriteParam( Int param, UInt rParam)
     2882#else
    28652883Void TEncCavlc::xWriteParam( Int param)
    2866 {
     2884#endif
     2885{
     2886#if !R0300_CGS_RES_COEFF_CODING
    28672887  const UInt rParam = 7;
     2888#endif
    28682889  Int codeNumber = abs(param);
    28692890  WRITE_UVLC(codeNumber / (1 << rParam), "quotient");
     
    28742895#endif
    28752896
     2897#if R0300_CGS_RES_COEFF_CODING
     2898Void TEncCavlc::xFindDeltaBits( TCom3DAsymLUT * pc3DAsymLUT )
     2899{
     2900  Int nDeltaBits;
     2901  Int nBestDeltaBits = -1;
     2902  Int nBestBits = MAX_INT;
     2903  for( nDeltaBits = 1; nDeltaBits < 5; nDeltaBits++)
     2904  {
     2905    Int nCurBits = 0;
     2906    xTally3DAsymLUTOctantBits( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth(), nDeltaBits, nCurBits );
     2907    //printf("%d, %d, %d\n", nDeltaBits, nCurBits, nBestBits);
     2908    if(nCurBits < nBestBits)
     2909    {
     2910      nBestDeltaBits = nDeltaBits;
     2911      nBestBits = nCurBits;
     2912    }
     2913  }
     2914
     2915  assert(nBestDeltaBits >=1 && nBestDeltaBits < 5);
     2916  pc3DAsymLUT->setDeltaBits(nBestDeltaBits);
     2917}
     2918
     2919Void TEncCavlc::xTally3DAsymLUTOctantBits( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength, Int nDeltaBits, Int& nCurBits )
     2920{
     2921  UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth();
     2922  if( nDepth < pc3DAsymLUT->getCurOctantDepth() )
     2923    nCurBits ++;
     2924  Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2();
     2925  if( uiOctantSplit )
     2926  {
     2927    Int nHalfLength = nLength >> 1;
     2928    for( Int l = 0 ; l < 2 ; l++ )
     2929    {
     2930      for( Int m = 0 ; m < 2 ; m++ )
     2931      {
     2932        for( Int n = 0 ; n < 2 ; n++ )
     2933        {
     2934          xTally3DAsymLUTOctantBits( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength, nDeltaBits, nCurBits );
     2935        }
     2936      }
     2937    }
     2938  }
     2939  else
     2940  {
     2941    Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-nDeltaBits ;
     2942    nFLCbits = nFLCbits >= 0 ? nFLCbits:0;
     2943    //printf("nFLCbits = %d\n", nFLCbits);
     2944
     2945    for( Int l = 0 ; l < nYPartNum ; l++ )
     2946    {
     2947      for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ )
     2948      {
     2949        SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx );
     2950
     2951        UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0;
     2952        nCurBits++;
     2953        if( uiCodeVertex )
     2954        {
     2955          xCheckParamBits( sRes.Y, nFLCbits, nCurBits );
     2956          xCheckParamBits( sRes.U, nFLCbits, nCurBits );
     2957          xCheckParamBits( sRes.V, nFLCbits, nCurBits );
     2958        }
     2959      }
     2960    }
     2961  }
     2962}
     2963
     2964Void TEncCavlc::xCheckParamBits( Int param, Int rParam, Int &nBits)
     2965{
     2966  Int codeNumber = abs(param);
     2967  Int codeQuotient = codeNumber >> rParam;
     2968  Int qLen;
     2969
     2970  UInt uiLength = 1;
     2971  UInt uiTemp = ++codeQuotient;
     2972   
     2973  while( 1 != uiTemp )
     2974  {
     2975    uiTemp >>= 1;
     2976    uiLength += 2;
     2977  }
     2978
     2979  qLen  = (uiLength >> 1);
     2980  qLen += ((uiLength+1) >> 1);
     2981
     2982  nBits += qLen;
     2983  nBits += rParam;
     2984  if (abs(param))
     2985    nBits++;
     2986}
     2987#endif
     2988
    28762989#endif
    28772990//! \}
Note: See TracChangeset for help on using the changeset viewer.