Changeset 1089 in SHVCSoftware for branches/SHM-dev/source/App/TAppEncoder


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)
Location:
branches/SHM-dev/source/App/TAppEncoder
Files:
5 edited

Legend:

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

    r1087 r1089  
    146146  m_codedPivotValue = NULL;
    147147  m_targetPivotValue = NULL;
    148 #if Q0074_COLOUR_REMAPPING_SEI
    149   for( Int c=0 ; c<3 ; c++)
    150   {
    151     m_colourRemapSEIPreLutCodedValue[c]   = NULL;
    152     m_colourRemapSEIPreLutTargetValue[c]  = NULL;
    153     m_colourRemapSEIPostLutCodedValue[c]  = NULL;
    154     m_colourRemapSEIPostLutTargetValue[c] = NULL;
    155   }
    156 #endif
    157148}
    158149#endif
     
    193184  free(m_pchReconFile);
    194185  free(m_pchdQPFile);
    195 #if Q0074_COLOUR_REMAPPING_SEI
    196   for( Int c=0 ; c<3 ; c++)
    197   {
    198     if ( m_colourRemapSEIPreLutCodedValue[c] )
    199     {
    200       delete[] m_colourRemapSEIPreLutCodedValue[c];
    201     }
    202     if ( m_colourRemapSEIPreLutTargetValue[c] )
    203     {
    204       delete[] m_colourRemapSEIPreLutTargetValue[c];
    205     }
    206     if ( m_colourRemapSEIPostLutCodedValue[c] )
    207     {
    208       delete[] m_colourRemapSEIPostLutCodedValue[c];
    209     }
    210     if ( m_colourRemapSEIPostLutTargetValue[c] )
    211     {
    212       delete[] m_colourRemapSEIPostLutTargetValue[c];
    213     }
    214   }
    215 #endif
    216186#endif
    217187  free(m_scalingListFile);
     
    885855  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
    886856#if Q0074_COLOUR_REMAPPING_SEI
    887   string* cfg_colourRemapSEIFile[MAX_LAYERS];
     857  string* cfg_colourRemapSEIFileRoot[MAX_LAYERS];
    888858#endif
    889859  Int*    cfg_waveFrontSynchro[MAX_LAYERS];
     
    907877    cfg_fQP[layer]          = &m_acLayerCfg[layer].m_fQP;
    908878#if Q0074_COLOUR_REMAPPING_SEI
    909     cfg_colourRemapSEIFile[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFile;
     879    cfg_colourRemapSEIFileRoot[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFileRoot;
    910880#endif
    911881#if REPN_FORMAT_IN_VPS
     
    10401010  string cfg_dQPFile;
    10411011#if Q0074_COLOUR_REMAPPING_SEI
    1042   string cfg_colourRemapSEIFile;
     1012  string cfg_colourRemapSEIFileRoot;
    10431013#endif
    10441014#endif //SVC_EXTENSION
     
    12181188#endif
    12191189#if Q0074_COLOUR_REMAPPING_SEI
    1220   ("SEIColourRemappingInfoFile%d",                   cfg_colourRemapSEIFile,           string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
     1190  ("SEIColourRemappingInfoFileRoot%d",              cfg_colourRemapSEIFileRoot,           string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
    12211191#endif
    12221192#if O0194_DIFFERENT_BITDEPTH_EL_BL
     
    12931263  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
    12941264#if Q0074_COLOUR_REMAPPING_SEI
    1295   ("SEIColourRemappingInfoFile",                      cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
     1265  ("SEIColourRemappingInfoFileRoot",                  cfg_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters file name")
    12961266#endif
    12971267#endif //SVC_EXTENSION
     
    18691839  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    18701840#if Q0074_COLOUR_REMAPPING_SEI
    1871   m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str());
     1841  m_colourRemapSEIFileRoot = cfg_colourRemapSEIFileRoot.empty() ? NULL : strdup(cfg_colourRemapSEIFileRoot.c_str());
    18721842#endif
    18731843#endif //SVC_EXTENSION
     
    30292999  }
    30303000#endif
    3031 #if Q0074_COLOUR_REMAPPING_SEI
    3032 #if !SVC_EXTENSION
    3033   // reading external Colour Remapping Information SEI message parameters from file
    3034   if( m_colourRemapSEIFile )
    3035   {
    3036     FILE* fic;
    3037     Int retval;
    3038     if((fic = fopen(m_colourRemapSEIFile,"r")) == (FILE*)NULL)
    3039     {
    3040       fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile);
    3041       exit(EXIT_FAILURE);
    3042     }
    3043 
    3044     retval = fscanf( fic, "%d", &m_colourRemapSEIId );
    3045     retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag );
    3046     if( !m_colourRemapSEICancelFlag )
    3047     {
    3048       retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag );
    3049       retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalInfoPresentFlag);
    3050       if( m_colourRemapSEIVideoSignalInfoPresentFlag )
    3051       {
    3052         retval = fscanf( fic, "%d", &m_colourRemapSEIFullRangeFlag  );
    3053         retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries );
    3054         retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction );
    3055         retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients );
    3056       }
    3057 
    3058       retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth );
    3059       retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth );
    3060  
    3061       for( Int c=0 ; c<3 ; c++ )
    3062       {
    3063         retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] );
    3064         if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )
    3065         {
    3066           m_colourRemapSEIPreLutCodedValue[c]  = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];
    3067           m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];
    3068           for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ )
    3069           {
    3070             retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] );
    3071             retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] );
    3072           }
    3073         }
    3074       }
    3075 
    3076       retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag );
    3077       if( m_colourRemapSEIMatrixPresentFlag )
    3078       {
    3079         retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom );
    3080         for( Int c=0 ; c<3 ; c++ )
    3081           for( Int i=0 ; i<3 ; i++ )
    3082             retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] );
    3083       }
    3084 
    3085       for( Int c=0 ; c<3 ; c++ )
    3086       {
    3087         retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] );
    3088         if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )
    3089         {
    3090           m_colourRemapSEIPostLutCodedValue[c]  = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];
    3091           m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];
    3092           for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ )
    3093           {
    3094             retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] );
    3095             retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] );
    3096           }
    3097         }
    3098       }
    3099     }
    3100 
    3101     fclose( fic );
    3102     if( retval != 1 )
    3103     {
    3104       fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n");
    3105       exit(EXIT_FAILURE);
    3106     }
    3107   }
    3108 #else
    3109    // Reading external Colour Remapping Information SEI message parameters from file
    3110   // It seems that TAppEncLayerCfg::parseCfg is not used
    3111   for(UInt layer = 0; layer < m_numLayers; layer++)
    3112   {
    3113     if( cfg_colourRemapSEIFile[layer]->length() )
    3114     {
    3115       FILE* fic;
    3116       Int retval;
    3117       if((fic = fopen(cfg_colourRemapSEIFile[layer]->c_str(),"r")) == (FILE*)NULL)
    3118       {
    3119         fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", cfg_colourRemapSEIFile[layer]->c_str());
    3120         exit(EXIT_FAILURE);
    3121       }
    3122       Int tempCode;
    3123       retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIId );
    3124       retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEICancelFlag = tempCode ? 1 : 0;
    3125       if( !m_acLayerCfg[layer].m_colourRemapSEICancelFlag )
    3126       {
    3127         retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0;
    3128         retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0;
    3129         if( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag )
    3130         {
    3131           retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0;
    3132           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
    3133           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
    3134           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
    3135         }
    3136 
    3137         retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
    3138         retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
    3139  
    3140         for( Int c=0 ; c<3 ; c++ )
    3141         {
    3142           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] );
    3143           if( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]>0 )
    3144           {
    3145             m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c]  = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1];
    3146             m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1];
    3147             for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ; i++ )
    3148             {
    3149               retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c][i] );
    3150               retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c][i] );
    3151             }
    3152           }
    3153         }
    3154 
    3155         retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0;
    3156         if( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag )
    3157         {
    3158           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
    3159           for( Int c=0 ; c<3 ; c++ )
    3160             for( Int i=0 ; i<3 ; i++ )
    3161               retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICoeffs[c][i] );
    3162         }
    3163 
    3164         for( Int c=0 ; c<3 ; c++ )
    3165         {
    3166           retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] );
    3167           if( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]>0 )
    3168           {
    3169             m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c]  = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1];
    3170             m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1];
    3171             for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ; i++ )
    3172             {
    3173               retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c][i] );
    3174               retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c][i] );
    3175             }
    3176           }
    3177         }
    3178       }
    3179 
    3180       fclose( fic );
    3181       if( retval != 1 )
    3182       {
    3183         fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n");
    3184         exit(EXIT_FAILURE);
    3185       }
    3186     }
    3187   }
    3188 #endif
    3189 #endif
     3001
    31903002#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    31913003  if (m_interLayerConstrainedTileSetsSEIEnabled)
     
    45234335  }
    45244336#endif
    4525 #if Q0074_COLOUR_REMAPPING_SEI
    4526 #if !SVC_EXTENSION
    4527   if ( m_colourRemapSEIFile && !m_colourRemapSEICancelFlag )
    4528   {
    4529     xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");
    4530     xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive");
    4531     for( Int c=0 ; c<3 ; c++)
    4532     {
    4533       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");
    4534       if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )
    4535         for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++)
    4536         {
    4537           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");
    4538           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");
    4539         }
    4540       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");
    4541       if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )
    4542         for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++)
    4543         {
    4544           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");
    4545           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");
    4546         }
    4547     }
    4548     if ( m_colourRemapSEIMatrixPresentFlag )
    4549     {
    4550       xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive");
    4551       for( Int c=0 ; c<3 ; c++)
    4552         for( Int i=0 ; i<3 ; i++)
    4553           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");
    4554     }
    4555   }
    4556 #endif
    4557 #endif
    45584337
    45594338#if RC_SHVC_HARMONIZATION
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1057 r1089  
    462462#if Q0074_COLOUR_REMAPPING_SEI
    463463#if !SVC_EXTENSION
    464   Char*     m_colourRemapSEIFile;
    465   Int       m_colourRemapSEIId;
    466   Bool      m_colourRemapSEICancelFlag;
    467   Bool      m_colourRemapSEIPersistenceFlag;
    468   Bool      m_colourRemapSEIVideoSignalInfoPresentFlag;
    469   Bool      m_colourRemapSEIFullRangeFlag;
    470   Int       m_colourRemapSEIPrimaries;
    471   Int       m_colourRemapSEITransferFunction;
    472   Int       m_colourRemapSEIMatrixCoefficients;
    473   Int       m_colourRemapSEIInputBitDepth;
    474   Int       m_colourRemapSEIBitDepth;
    475   Int       m_colourRemapSEIPreLutNumValMinus1[3];
    476   Int*      m_colourRemapSEIPreLutCodedValue[3];
    477   Int*      m_colourRemapSEIPreLutTargetValue[3];
    478   Bool      m_colourRemapSEIMatrixPresentFlag;
    479   Int       m_colourRemapSEILog2MatrixDenom;
    480   Int       m_colourRemapSEICoeffs[3][3];
    481   Int       m_colourRemapSEIPostLutNumValMinus1[3];
    482   Int*      m_colourRemapSEIPostLutCodedValue[3];
    483   Int*      m_colourRemapSEIPostLutTargetValue[3];
     464  string    m_colourRemapSEIFileRoot;
    484465#endif
    485466#endif
  • 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
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r1057 r1089  
    132132#endif
    133133#if Q0074_COLOUR_REMAPPING_SEI
    134   string    m_colourRemapSEIFile;                           ///< Colour Remapping Information SEI message parameters file
     134  string    m_colourRemapSEIFileRoot;                           ///< Colour Remapping Information SEI message parameters file
    135135  Int       m_colourRemapSEIId;
    136136  Bool      m_colourRemapSEICancelFlag;
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1085 r1089  
    675675#endif
    676676#if Q0074_COLOUR_REMAPPING_SEI
    677     m_acTEncTop[layer].setCRISEIFile                            ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
    678     m_acTEncTop[layer].setCRISEIId                              ( m_acLayerCfg[layer].m_colourRemapSEIId );
    679     m_acTEncTop[layer].setCRISEICancelFlag                      ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
    680     m_acTEncTop[layer].setCRISEIPersistenceFlag                 ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
    681     m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag      ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
    682     m_acTEncTop[layer].setCRISEIFullRangeFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
    683     m_acTEncTop[layer].setCRISEIPrimaries                       ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
    684     m_acTEncTop[layer].setCRISEITransferFunction                ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
    685     m_acTEncTop[layer].setCRISEIMatrixCoefficients              ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
    686     m_acTEncTop[layer].setCRISEIInputBitDepth                   ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
    687     m_acTEncTop[layer].setCRISEIBitDepth                        ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
    688     m_acTEncTop[layer].setCRISEIPreLutNumValMinus1              ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
    689     m_acTEncTop[layer].setCRISEIPreLutCodedValue                ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
    690     m_acTEncTop[layer].setCRISEIPreLutTargetValue               ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
    691     m_acTEncTop[layer].setCRISEIMatrixPresentFlag               ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
    692     m_acTEncTop[layer].setCRISEILog2MatrixDenom                 ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
    693     m_acTEncTop[layer].setCRISEICoeffs                          ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
    694     m_acTEncTop[layer].setCRISEIPostLutNumValMinus1             ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
    695     m_acTEncTop[layer].setCRISEIPostLutCodedValue               ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
    696     m_acTEncTop[layer].setCRISEIPostLutTargetValue              ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
     677    m_acTEncTop[layer].setCRISEIFileRoot                                    ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFileRoot.c_str()) );
    697678#endif   
    698679#if LAYERS_NOT_PRESENT_SEI
     
    10971078  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    10981079#if Q0074_COLOUR_REMAPPING_SEI
    1099   m_cTEncTop.setCRISEIFile                       ( m_colourRemapSEIFile );
    1100   m_cTEncTop.setCRISEIId                         ( m_colourRemapSEIId );
    1101   m_cTEncTop.setCRISEICancelFlag                 ( m_colourRemapSEICancelFlag );
    1102   m_cTEncTop.setCRISEIPersistenceFlag            ( m_colourRemapSEIPersistenceFlag );
    1103   m_cTEncTop.setCRISEIVideoSignalInfoPresentFlag ( m_colourRemapSEIVideoSignalInfoPresentFlag );
    1104   m_cTEncTop.setCRISEIFullRangeFlag              ( m_colourRemapSEIFullRangeFlag );
    1105   m_cTEncTop.setCRISEIPrimaries                  ( m_colourRemapSEIPrimaries );
    1106   m_cTEncTop.setCRISEITransferFunction           ( m_colourRemapSEITransferFunction );
    1107   m_cTEncTop.setCRISEIMatrixCoefficients         ( m_colourRemapSEIMatrixCoefficients );
    1108   m_cTEncTop.setCRISEIInputBitDepth              ( m_colourRemapSEIInputBitDepth );
    1109   m_cTEncTop.setCRISEIBitDepth                   ( m_colourRemapSEIBitDepth );
    1110   m_cTEncTop.setCRISEIPreLutNumValMinus1         ( m_colourRemapSEIPreLutNumValMinus1 );
    1111   m_cTEncTop.setCRISEIPreLutCodedValue           ( m_colourRemapSEIPreLutCodedValue );
    1112   m_cTEncTop.setCRISEIPreLutTargetValue          ( m_colourRemapSEIPreLutTargetValue );
    1113   m_cTEncTop.setCRISEIMatrixPresentFlag          ( m_colourRemapSEIMatrixPresentFlag );
    1114   m_cTEncTop.setCRISEILog2MatrixDenom            ( m_colourRemapSEILog2MatrixDenom );
    1115   m_cTEncTop.setCRISEICoeffs                     ( m_colourRemapSEICoeffs );
    1116   m_cTEncTop.setCRISEIPostLutNumValMinus1        ( m_colourRemapSEIPostLutNumValMinus1 );
    1117   m_cTEncTop.setCRISEIPostLutCodedValue          ( m_colourRemapSEIPostLutCodedValue );
    1118   m_cTEncTop.setCRISEIPostLutTargetValue         ( m_colourRemapSEIPostLutTargetValue );
     1080  m_cTEncTop.setCRISEIFileRoot                                    ( const_cast<Char*>(m_colourRemapSEIFileRoot.c_str()) );
    11191081#endif
    11201082#if LAYERS_NOT_PRESENT_SEI
Note: See TracChangeset for help on using the changeset viewer.