Changeset 868 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibDecoder


Ignore:
Timestamp:
13 Aug 2014, 18:37:06 (11 years ago)
Author:
seregin
Message:

update for CRI SEI, provided by Andrivon Pierre <Pierre.Andrivon@…>

Location:
branches/SHM-dev/source/Lib/TLibDecoder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp

    r856 r868  
    936936  {
    937937    READ_FLAG( uiVal, "colour_remap_persistence_flag" );                sei.m_colourRemapPersistenceFlag = uiVal;
    938     READ_FLAG( uiVal, "colour_remap_video_signal_type_present_flag" );  sei.m_colourRemapVideoSignalTypePresentFlag = uiVal;
    939     if ( sei.m_colourRemapVideoSignalTypePresentFlag )
    940     {
    941       READ_FLAG( uiVal,    "colour_remap_video_full_range_flag" );     sei.m_colourRemapVideoFullRangeFlag = uiVal;
     938    READ_FLAG( uiVal, "colour_remap_video_signal_info_present_flag" );  sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal;
     939    if ( sei.m_colourRemapVideoSignalInfoPresentFlag )
     940    {
     941      READ_FLAG( uiVal,    "colour_remap_full_range_flag" );           sei.m_colourRemapFullRangeFlag = uiVal;
    942942      READ_CODE( 8, uiVal, "colour_remap_primaries" );                 sei.m_colourRemapPrimaries = uiVal;
    943       READ_CODE( 8, uiVal, "colour_remap_transfer_characteristics" );  sei.m_colourRemapTransferCharacteristics = uiVal;
    944       READ_CODE( 8, uiVal, "colour_remap_matrix_coeffs" );             sei.m_colourRemapMatrixCoeffs = uiVal;
    945     }
    946     READ_CODE( 8, uiVal, "colour_remap_coded_data_bit_depth" );  sei.m_colourRemapCodedDataBitDepth = uiVal;
    947     READ_CODE( 8, uiVal, "colour_remap_target_bit_depth" );      sei.m_colourRemapTargetBitDepth = uiVal;
     943      READ_CODE( 8, uiVal, "colour_remap_transfer_function" );         sei.m_colourRemapTransferFunction = uiVal;
     944      READ_CODE( 8, uiVal, "colour_remap_matrix_coefficients" );       sei.m_colourRemapMatrixCoefficients = uiVal;
     945    }
     946    READ_CODE( 8, uiVal, "colour_remap_input_bit_depth" ); sei.m_colourRemapInputBitDepth = uiVal;
     947    READ_CODE( 8, uiVal, "colour_remap_bit_depth" ); sei.m_colourRemapBitDepth = uiVal;
    948948 
    949949    for( Int c=0 ; c<3 ; c++ )
     
    955955        for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ )
    956956        {
    957           READ_CODE( (( sei.m_colourRemapCodedDataBitDepth   + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" );  sei.m_preLutCodedValue[c][i]  = uiVal;
    958           READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLutTargetValue[c][i] = uiVal;
     957          READ_CODE( (( sei.m_colourRemapInputBitDepth   + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" );  sei.m_preLutCodedValue[c][i]  = uiVal;
     958          READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLutTargetValue[c][i] = uiVal;
    959959        }
    960960      else // pre_lut_num_val_minus1[c] == 0
     
    962962        sei.m_preLutCodedValue[c][0]  = 0;
    963963        sei.m_preLutTargetValue[c][0] = 0;
    964         sei.m_preLutCodedValue[c][1]  = (1 << sei.m_colourRemapCodedDataBitDepth) - 1 ;
    965         sei.m_preLutTargetValue[c][1] = (1 << sei.m_colourRemapTargetBitDepth) - 1 ;
     964        sei.m_preLutCodedValue[c][1]  = (1 << sei.m_colourRemapInputBitDepth) - 1 ;
     965        sei.m_preLutTargetValue[c][1] = (1 << sei.m_colourRemapBitDepth) - 1 ;
    966966      }
    967967    }
     
    992992        for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ )
    993993        {
    994           READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" );  sei.m_postLutCodedValue[c][i] = uiVal;
    995           READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLutTargetValue[c][i] = uiVal;
     994          READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" );  sei.m_postLutCodedValue[c][i] = uiVal;
     995          READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLutTargetValue[c][i] = uiVal;
    996996        }
    997997      else
     
    999999        sei.m_postLutCodedValue[c][0]  = 0;
    10001000        sei.m_postLutTargetValue[c][0] = 0;
    1001         sei.m_postLutTargetValue[c][1] = (1 << sei.m_colourRemapTargetBitDepth) - 1;
    1002         sei.m_postLutCodedValue[c][1]  = (1 << sei.m_colourRemapTargetBitDepth) - 1;
     1001        sei.m_postLutTargetValue[c][1] = (1 << sei.m_colourRemapBitDepth) - 1;
     1002        sei.m_postLutCodedValue[c][1]  = (1 << sei.m_colourRemapBitDepth) - 1;
    10031003      }
    10041004    }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r856 r868  
    367367    Int bitDepth = c ? bitDepthC : bitDepthY ;
    368368    preLut[c].resize(1 << bitDepth);
    369     postLut[c].resize(1 << pCriSEI->m_colourRemapTargetBitDepth);
     369    postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth);
    370370   
    371     Int bitDepthDiff = pCriSEI->m_colourRemapTargetBitDepth - bitDepth;
    372     Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to TargetBitdepth (manage only case colourRemapTargetBitDepth>= bitdepth)
     371    Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth;
     372    Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth)
    373373    if( bitDepthDiff<0 )
    374       printf ("Warning: CRI SEI - colourRemapTargetBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapTargetBitDepth, bitDepth);
    375     bitDepthDiff = pCriSEI->m_colourRemapTargetBitDepth - pCriSEI->m_colourRemapCodedDataBitDepth;
    376     Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from codedDataBitdepth to TargetBitdepth (manage only case colourRemapTargetBitDepth>= colourRemapCodedDataBitDepth)
     374      printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth);
     375    bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth;
     376    Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth)
    377377    if( bitDepthDiff<0 )
    378       printf ("Warning: CRI SEI - colourRemapTargetBitDepth (%d) <colourRemapCodedDataBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapTargetBitDepth, pCriSEI->m_colourRemapCodedDataBitDepth);
     378      printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth);
    379379
    380380    //Fill preLut
     
    384384      for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ )
    385385      {
    386         Int iCodedPrev  = pCriSEI->m_preLutCodedValue[c][iPivot]    << iShift2; //Coded in CodedDataBitdepth
    387         Int iCodedNext  = pCriSEI->m_preLutCodedValue[c][iPivot+1]  << iShift2; //Coded in CodedDataBitdepth
    388         Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot];              //Coded in TargetBitdepth
    389         Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1];            //Coded in TargetBitdepth
     386        Int iCodedPrev  = pCriSEI->m_preLutCodedValue[c][iPivot]    << iShift2; //Coded in CRInputBitdepth
     387        Int iCodedNext  = pCriSEI->m_preLutCodedValue[c][iPivot+1]  << iShift2; //Coded in CRInputBitdepth
     388        Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot];              //Coded in CRBitdepth
     389        Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1];            //Coded in CRBitdepth
    390390        if ( iCodedPrev <= iSample && iSample <= iCodedNext )
    391391        {
     
    398398   
    399399    //Fill postLut
    400     for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapTargetBitDepth) ; k++ )
     400    for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ )
    401401    {
    402402      Int iSample = k;
    403403      for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ )
    404404      {
    405         Int iCodedPrev  = pCriSEI->m_postLutCodedValue[c][iPivot];    //Coded in TargetBitdepth
    406         Int iCodedNext  = pCriSEI->m_postLutCodedValue[c][iPivot+1];  //Coded in TargetBitdepth
    407         Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot];   //Coded in TargetBitdepth
    408         Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in TargetBitdepth
     405        Int iCodedPrev  = pCriSEI->m_postLutCodedValue[c][iPivot];    //Coded in CRBitdepth
     406        Int iCodedNext  = pCriSEI->m_postLutCodedValue[c][iPivot+1];  //Coded in CRBitdepth
     407        Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot];   //Coded in CRBitdepth
     408        Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth
    409409        if ( iCodedPrev <= iSample && iSample <= iCodedNext )
    410410        {
     
    486486                    + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2]
    487487                    + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
    488         YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapTargetBitDepth)-1, YUVMat[0] );
     488        YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] );
    489489        YUVOut[0][x] = postLut[0][ YUVMat[0] ];
    490490
     
    497497                        + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2]
    498498                        + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
    499             YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapTargetBitDepth)-1, YUVMat[c] );
     499            YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] );
    500500            YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ];   
    501501          }
     
    515515    //Write remapped picture in decoding order
    516516    Char  cTemp[255];
    517     sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapTargetBitDepth );
    518     picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapTargetBitDepth );
     517    sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth );
     518    picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
    519519
    520520    picColourRemapped.destroy();
Note: See TracChangeset for help on using the changeset viewer.