Ignore:
Timestamp:
25 Jun 2015, 16:19:05 (9 years ago)
Author:
seregin
Message:

Patch provided by Hiron Franck <franck.hiron@…> to complete implementation of the CRI (Colour remapping info) with the following features:

  • Management of SEI-CRI messages per picture
  • Management of the persistence of the colour remapping information (parameter “colour_remap_persistence_flag”)
  • Output the remapping picture in display order
  • Maintains the HM like mode (#define SVC_EXTENSION 0)
File:
1 edited

Legend:

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

    r1030 r1089  
    5050#endif
    5151#if Q0074_COLOUR_REMAPPING_SEI
    52 ,  m_colourRemapSEIFile(string(""))
     52,  m_colourRemapSEIFileRoot(string(""))
    5353#endif
    5454{
     
    149149#endif
    150150#if Q0074_COLOUR_REMAPPING_SEI
    151   string  cfg_colourRemapSEIFile;
     151  string cfg_colourRemapSEIFileRoot;
    152152#endif
    153153
     
    181181    ("QP,q",                  m_fQP,          30.0, "Qp value, if value is float, QP is switched once during encoding")
    182182#if Q0074_COLOUR_REMAPPING_SEI
    183     ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
     183    ("SEIColourRemappingInfoFileRoot", cfg_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters file name")
    184184#endif
    185185  ;
     
    196196#endif
    197197#if Q0074_COLOUR_REMAPPING_SEI
    198   m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str());
     198  m_colourRemapSEIFileRoot = cfg_colourRemapSEIFileRoot.empty() ? NULL : strdup(cfg_colourRemapSEIFileRoot.c_str());
    199199#endif
    200200
     
    216216    }
    217217  }
    218 
    219 #if Q0074_COLOUR_REMAPPING_SEI
    220   if( m_colourRemapSEIFile.size() > 0 )
    221   {
    222     FILE* fic;
    223     Int retval;
    224     if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL)
    225     {
    226       fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str());
    227       exit(EXIT_FAILURE);
    228     }
    229 
    230     Int tempCode;
    231     retval = fscanf( fic, "%d", &m_colourRemapSEIId );
    232     retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEICancelFlag = tempCode ? 1 : 0;
    233     if( !m_colourRemapSEICancelFlag )
    234     {
    235       retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0;
    236       retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0;
    237       if( m_colourRemapSEIVideoSignalInfoPresentFlag )
    238       {
    239         retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0;
    240         retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries );
    241         retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction );
    242         retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients );
    243       }
    244 
    245       retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth );
    246       retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth );
    247  
    248       for( Int c=0 ; c<3 ; c++ )
    249       {
    250         retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] );
    251         if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )
    252         {
    253           m_colourRemapSEIPreLutCodedValue[c]  = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];
    254           m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];
    255           for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ )
    256           {
    257             retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] );
    258             retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] );
    259           }
    260         }
    261       }
    262 
    263       retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0;
    264       if( m_colourRemapSEIMatrixPresentFlag )
    265       {
    266         retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom );
    267         for( Int c=0 ; c<3 ; c++ )
    268           for( Int i=0 ; i<3 ; i++ )
    269             retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] );
    270       }
    271 
    272       for( Int c=0 ; c<3 ; c++ )
    273       {
    274         retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] );
    275         if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )
    276         {
    277           m_colourRemapSEIPostLutCodedValue[c]  = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];
    278           m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];
    279           for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ )
    280           {
    281             retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] );
    282             retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] );
    283           }
    284         }
    285       }
    286     }
    287 
    288     fclose( fic );
    289     if( retval != 1 )
    290     {
    291       fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n");
    292       exit(EXIT_FAILURE);
    293     }
    294   }
    295 #endif
    296218
    297219  return true;
     
    560482  }
    561483#endif
    562 #if Q0074_COLOUR_REMAPPING_SEI
    563   if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag )
    564   {
    565     xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");
    566     xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive");
    567     for( Int c=0 ; c<3 ; c++)
    568     {
    569       xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");
    570       if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )
    571         for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++)
    572         {
    573           xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive");
    574           xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");
    575         }
    576       xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");
    577       if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )
    578         for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++)
    579         {
    580           xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");
    581           xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");
    582         }
    583     }
    584     if( m_colourRemapSEIMatrixPresentFlag )
    585     {
    586       xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive");
    587       for( Int c=0 ; c<3 ; c++)
    588         for( Int i=0 ; i<3 ; i++)
    589           xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive");
    590     }
    591   }
    592 #endif
    593484
    594485#undef xConfirmPara
Note: See TracChangeset for help on using the changeset viewer.