Changeset 856 in SHVCSoftware for branches/SHM-dev/source/App/TAppEncoder
- Timestamp:
- 11 Aug 2014, 19:11:02 (10 years ago)
- Location:
- branches/SHM-dev/source/App/TAppEncoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r849 r856 91 91 m_codedPivotValue = NULL; 92 92 m_targetPivotValue = NULL; 93 #if Q0074_COLOUR_REMAPPING_SEI 94 for( Int c=0 ; c<3 ; c++) 95 { 96 m_colourRemapSEIPreLutCodedValue[c] = NULL; 97 m_colourRemapSEIPreLutTargetValue[c] = NULL; 98 m_colourRemapSEIPostLutCodedValue[c] = NULL; 99 m_colourRemapSEIPostLutTargetValue[c] = NULL; 100 } 101 #endif 93 102 } 94 103 #endif … … 128 137 free(m_pchReconFile); 129 138 free(m_pchdQPFile); 139 #if Q0074_COLOUR_REMAPPING_SEI 140 for( Int c=0 ; c<3 ; c++) 141 { 142 if ( m_colourRemapSEIPreLutCodedValue[c] ) 143 { 144 delete[] m_colourRemapSEIPreLutCodedValue[c]; 145 } 146 if ( m_colourRemapSEIPreLutTargetValue[c] ) 147 { 148 delete[] m_colourRemapSEIPreLutTargetValue[c]; 149 } 150 if ( m_colourRemapSEIPostLutCodedValue[c] ) 151 { 152 delete[] m_colourRemapSEIPostLutCodedValue[c]; 153 } 154 if ( m_colourRemapSEIPostLutTargetValue[c] ) 155 { 156 delete[] m_colourRemapSEIPostLutTargetValue[c]; 157 } 158 } 159 #endif 130 160 #endif 131 161 free(m_scalingListFile); … … 335 365 string* cfg_ReconFile [MAX_LAYERS]; 336 366 Double* cfg_fQP [MAX_LAYERS]; 337 #if Q0074_SEI_COLOR_MAPPING338 string* cfg_seiColorMappingFile[MAX_LAYERS];339 #endif340 341 367 #if REPN_FORMAT_IN_VPS 342 368 Int* cfg_repFormatIdx [MAX_LAYERS]; … … 448 474 #endif 449 475 Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; 476 #if Q0074_COLOUR_REMAPPING_SEI 477 string* cfg_colourRemapSEIFile[MAX_LAYERS]; 478 #endif 450 479 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 451 480 { … … 453 482 cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; 454 483 cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; 484 #if Q0074_COLOUR_REMAPPING_SEI 485 cfg_colourRemapSEIFile[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFile; 486 #endif 455 487 #if REPN_FORMAT_IN_VPS 456 488 cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; … … 461 493 cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; 462 494 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 463 #if Q0074_SEI_COLOR_MAPPING464 cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile;465 #endif466 495 #if LAYER_CTB 467 496 // coding unit (CU) definition … … 562 591 string cfg_ReconFile; 563 592 string cfg_dQPFile; 593 #if Q0074_COLOUR_REMAPPING_SEI 594 string cfg_colourRemapSEIFile; 595 #endif 564 596 #endif //SVC_EXTENSION 565 597 string cfgColumnWidth; … … 573 605 string cfg_kneeSEIOutputKneePointValue; 574 606 #endif 607 575 608 po::Options opts; 576 609 opts.addOptions() … … 665 698 ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d") 666 699 #endif 700 #if Q0074_COLOUR_REMAPPING_SEI 701 ("SEIColourRemappingInfoFile%d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d") 702 #endif 667 703 #if O0194_DIFFERENT_BITDEPTH_EL_BL 668 704 ("InputBitDepth%d", cfg_InputBitDepthY, 8, MAX_LAYERS, "Bit-depth of input file for layer %d") … … 691 727 #endif 692 728 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") 693 #if Q0074_SEI_COLOR_MAPPING694 ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data")695 #endif696 729 #else //SVC_EXTENSION 697 730 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") … … 724 757 ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") 725 758 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 759 #if Q0074_COLOUR_REMAPPING_SEI 760 ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name") 761 #endif 726 762 #endif //SVC_EXTENSION 727 763 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") … … 1171 1207 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 1172 1208 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 1173 #endif //SVC_EXTENSION 1209 #if Q0074_COLOUR_REMAPPING_SEI 1210 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str()); 1211 #endif 1212 #endif //SVC_EXTENSION 1213 1174 1214 1175 1215 Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str()); … … 1953 1993 } 1954 1994 #endif 1955 1995 #if Q0074_COLOUR_REMAPPING_SEI 1996 #if !SVC_EXTENSION 1997 // reading external Colour Remapping Information SEI message parameters from file 1998 if( m_colourRemapSEIFile.c_str() ) 1999 { 2000 FILE* fic; 2001 Int retval; 2002 if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL) 2003 { 2004 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str()); 2005 exit(EXIT_FAILURE); 2006 } 2007 2008 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 2009 retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag ); 2010 if( !m_colourRemapSEICancelFlag ) 2011 { 2012 retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag ); 2013 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalTypePresentFlag); 2014 if( m_colourRemapSEIVideoSignalTypePresentFlag ) 2015 { 2016 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoFullRangeFlag ); 2017 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 2018 retval = fscanf( fic, "%d", &m_colourRemapSEITransferCharacteristics ); 2019 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoeffs ); 2020 } 2021 2022 retval = fscanf( fic, "%d", &m_colourRemapSEICodedDataBitDepth ); 2023 retval = fscanf( fic, "%d", &m_colourRemapSEITargetBitDepth ); 2024 2025 for( Int c=0 ; c<3 ; c++ ) 2026 { 2027 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 2028 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 2029 { 2030 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2031 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2032 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 2033 { 2034 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 2035 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 2036 } 2037 } 2038 } 2039 2040 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag ); 2041 if( m_colourRemapSEIMatrixPresentFlag ) 2042 { 2043 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 2044 for( Int c=0 ; c<3 ; c++ ) 2045 for( Int i=0 ; i<3 ; i++ ) 2046 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 2047 } 2048 2049 for( Int c=0 ; c<3 ; c++ ) 2050 { 2051 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 2052 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 2053 { 2054 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2055 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2056 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 2057 { 2058 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 2059 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 2060 } 2061 } 2062 } 2063 } 2064 2065 fclose( fic ); 2066 if( retval != 1 ) 2067 { 2068 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 2069 exit(EXIT_FAILURE); 2070 } 2071 } 2072 #else 2073 // Reading external Colour Remapping Information SEI message parameters from file 2074 // It seems that TAppEncLayerCfg::parseCfg is not used 2075 for(UInt layer = 0; layer < m_numLayers; layer++) 2076 { 2077 if( cfg_colourRemapSEIFile[layer]->c_str() ) 2078 { 2079 FILE* fic; 2080 Int retval; 2081 if((fic = fopen(cfg_colourRemapSEIFile[layer]->c_str(),"r")) == (FILE*)NULL) 2082 { 2083 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", cfg_colourRemapSEIFile[layer]->c_str()); 2084 exit(EXIT_FAILURE); 2085 } 2086 2087 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIId ); 2088 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICancelFlag ); 2089 if( !m_acLayerCfg[layer].m_colourRemapSEICancelFlag ) 2090 { 2091 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag ); 2092 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIVideoSignalTypePresentFlag); 2093 if( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalTypePresentFlag ) 2094 { 2095 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIVideoFullRangeFlag ); 2096 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 2097 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITransferCharacteristics ); 2098 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixCoeffs ); 2099 } 2100 2101 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICodedDataBitDepth ); 2102 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITargetBitDepth ); 2103 2104 for( Int c=0 ; c<3 ; c++ ) 2105 { 2106 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ); 2107 if( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 2108 { 2109 m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2110 m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2111 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 2112 { 2113 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c][i] ); 2114 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c][i] ); 2115 } 2116 } 2117 } 2118 2119 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ); 2120 if( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ) 2121 { 2122 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 2123 for( Int c=0 ; c<3 ; c++ ) 2124 for( Int i=0 ; i<3 ; i++ ) 2125 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICoeffs[c][i] ); 2126 } 2127 2128 for( Int c=0 ; c<3 ; c++ ) 2129 { 2130 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ); 2131 if( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 2132 { 2133 m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2134 m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2135 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 2136 { 2137 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c][i] ); 2138 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c][i] ); 2139 } 2140 } 2141 } 2142 } 2143 2144 fclose( fic ); 2145 if( retval != 1 ) 2146 { 2147 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 2148 exit(EXIT_FAILURE); 2149 } 2150 } 2151 } 2152 #endif 2153 #endif 1956 2154 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1957 2155 if (m_interLayerConstrainedTileSetsSEIEnabled) … … 3044 3242 } 3045 3243 #endif 3244 #if Q0074_COLOUR_REMAPPING_SEI 3245 #if !SVC_EXTENSION 3246 if ( m_colourRemapSEIFile.c_str() && !m_colourRemapSEICancelFlag ) 3247 { 3248 xConfirmPara( m_colourRemapSEICodedDataBitDepth < 8 || m_colourRemapSEICodedDataBitDepth > 16 , "colour_remap_coded_data_bit_depth shall be in the range of 8 to 16, inclusive"); 3249 xConfirmPara( m_colourRemapSEITargetBitDepth < 8 || (m_colourRemapSEITargetBitDepth > 16 && m_colourRemapSEITargetBitDepth < 255) , "colour_remap_target_bit_depth shall be in the range of 8 to 16, inclusive"); 3250 for( Int c=0 ; c<3 ; c++) 3251 { 3252 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"); 3253 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 3254 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) 3255 { 3256 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEICodedDataBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_coded_data_bit_depth)-1, inclusive"); 3257 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 3258 } 3259 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"); 3260 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 3261 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) 3262 { 3263 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 3264 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 3265 } 3266 } 3267 if ( m_colourRemapSEIMatrixPresentFlag ) 3268 { 3269 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); 3270 for( Int c=0 ; c<3 ; c++) 3271 for( Int i=0 ; i<3 ; i++) 3272 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"); 3273 } 3274 } 3275 #endif 3276 #endif 3046 3277 3047 3278 #if RC_SHVC_HARMONIZATION -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r825 r856 220 220 Bool m_useRDOQ; ///< flag for using RD optimized quantization 221 221 Bool m_useRDOQTS; ///< flag for using RD optimized quantization for transform skip 222 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)222 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 223 223 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 224 224 Int m_iSearchRange; ///< ME search range … … 250 250 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 251 251 #endif 252 253 252 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction 254 255 253 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 256 254 Int m_recoveryPointSEIEnabled; … … 284 282 Int* m_codedPivotValue; 285 283 Int* m_targetPivotValue; 286 #if Q0074_SEI_COLOR_MAPPING287 Char* m_pchSEIColorMappingFile; ///< SEI Color Mapping File (initialized from external file)288 #endif289 284 Int m_framePackingSEIEnabled; 290 285 Int m_framePackingSEIType; … … 373 368 Int m_elRapSliceBEnabled; 374 369 #endif 370 #if Q0074_COLOUR_REMAPPING_SEI 371 #if !SVC_EXTENSION 372 string m_colourRemapSEIFile; 373 Int m_colourRemapSEIId; 374 Bool m_colourRemapSEICancelFlag; 375 Bool m_colourRemapSEIPersistenceFlag; 376 Bool m_colourRemapSEIVideoSignalTypePresentFlag; 377 Bool m_colourRemapSEIVideoFullRangeFlag; 378 Int m_colourRemapSEIPrimaries; 379 Int m_colourRemapSEITransferCharacteristics; 380 Int m_colourRemapSEIMatrixCoeffs; 381 Int m_colourRemapSEICodedDataBitDepth; 382 Int m_colourRemapSEITargetBitDepth; 383 Int m_colourRemapSEIPreLutNumValMinus1[3]; 384 Int* m_colourRemapSEIPreLutCodedValue[3]; 385 Int* m_colourRemapSEIPreLutTargetValue[3]; 386 Bool m_colourRemapSEIMatrixPresentFlag; 387 Int m_colourRemapSEILog2MatrixDenom; 388 Int m_colourRemapSEICoeffs[3][3]; 389 Int m_colourRemapSEIPostLutNumValMinus1[3]; 390 Int* m_colourRemapSEIPostLutCodedValue[3]; 391 Int* m_colourRemapSEIPostLutTargetValue[3]; 392 #endif 393 #endif 375 394 // internal member functions 376 395 #if LAYER_CTB -
branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r849 r856 49 49 , m_repFormatIdx (-1) 50 50 #endif 51 { 51 #if Q0074_COLOUR_REMAPPING_SEI 52 , m_colourRemapSEIFile(string("")) 53 #endif 54 { 55 #if Q0074_COLOUR_REMAPPING_SEI 56 for( Int c=0 ; c<3 ; c++) 57 { 58 m_colourRemapSEIPreLutCodedValue[c] = NULL; 59 m_colourRemapSEIPreLutTargetValue[c] = NULL; 60 m_colourRemapSEIPostLutCodedValue[c] = NULL; 61 m_colourRemapSEIPostLutTargetValue[c] = NULL; 62 } 63 #endif 52 64 m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; 53 65 m_aiPad[1] = m_aiPad[0] = 0; … … 87 99 delete[] m_aidQP; 88 100 } 101 #if Q0074_COLOUR_REMAPPING_SEI 102 for( Int c=0 ; c<3 ; c++) 103 { 104 if ( m_colourRemapSEIPreLutCodedValue[c] ) 105 { 106 delete[] m_colourRemapSEIPreLutCodedValue[c]; 107 } 108 if ( m_colourRemapSEIPreLutTargetValue[c] ) 109 { 110 delete[] m_colourRemapSEIPreLutTargetValue[c]; 111 } 112 if ( m_colourRemapSEIPostLutCodedValue[c] ) 113 { 114 delete[] m_colourRemapSEIPostLutCodedValue[c]; 115 } 116 if ( m_colourRemapSEIPostLutTargetValue[c] ) 117 { 118 delete[] m_colourRemapSEIPostLutTargetValue[c]; 119 } 120 } 121 #endif 89 122 } 90 123 … … 114 147 Int tmpInputChromaFormat; 115 148 Int tmpChromaFormat; 149 #endif 150 #if Q0074_COLOUR_REMAPPING_SEI 151 string cfg_colourRemapSEIFile; 116 152 #endif 117 153 … … 144 180 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 145 181 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") 146 ; 182 #if Q0074_COLOUR_REMAPPING_SEI 183 ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name") 184 #endif 185 ; 147 186 148 187 po::setDefaults(opts); … … 156 195 m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat))); 157 196 #endif 197 #if Q0074_COLOUR_REMAPPING_SEI 198 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str()); 199 #endif 158 200 159 201 // reading external dQP description from file … … 174 216 } 175 217 } 218 219 #if Q0074_COLOUR_REMAPPING_SEI 220 if( m_colourRemapSEIFile.c_str() ) 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 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 231 retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag ); 232 if( !m_colourRemapSEICancelFlag ) 233 { 234 retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag ); 235 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalTypePresentFlag); 236 if( m_colourRemapSEIVideoSignalTypePresentFlag ) 237 { 238 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoFullRangeFlag ); 239 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 240 retval = fscanf( fic, "%d", &m_colourRemapSEITransferCharacteristics ); 241 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoeffs ); 242 } 243 244 retval = fscanf( fic, "%d", &m_colourRemapSEICodedDataBitDepth ); 245 retval = fscanf( fic, "%d", &m_colourRemapSEITargetBitDepth ); 246 247 for( Int c=0 ; c<3 ; c++ ) 248 { 249 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 250 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 251 { 252 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 253 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 254 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 255 { 256 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 257 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 258 } 259 } 260 } 261 262 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag ); 263 if( m_colourRemapSEIMatrixPresentFlag ) 264 { 265 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 266 for( Int c=0 ; c<3 ; c++ ) 267 for( Int i=0 ; i<3 ; i++ ) 268 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 269 } 270 271 for( Int c=0 ; c<3 ; c++ ) 272 { 273 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 274 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 275 { 276 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 277 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 278 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 279 { 280 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 281 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 282 } 283 } 284 } 285 } 286 287 fclose( fic ); 288 if( retval != 1 ) 289 { 290 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 291 exit(EXIT_FAILURE); 292 } 293 } 294 #endif 295 176 296 return true; 177 297 } … … 396 516 } 397 517 #endif 518 #if Q0074_COLOUR_REMAPPING_SEI 519 if ( m_colourRemapSEIFile.c_str() && !m_colourRemapSEICancelFlag ) 520 { 521 xConfirmPara( m_colourRemapSEICodedDataBitDepth < 8 || m_colourRemapSEICodedDataBitDepth > 16 , "colour_remap_coded_data_bit_depth shall be in the range of 8 to 16, inclusive"); 522 xConfirmPara( m_colourRemapSEITargetBitDepth < 8 || (m_colourRemapSEITargetBitDepth > 16 && m_colourRemapSEITargetBitDepth < 255) , "colour_remap_target_bit_depth shall be in the range of 8 to 16, inclusive"); 523 for( Int c=0 ; c<3 ; c++) 524 { 525 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"); 526 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 527 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) 528 { 529 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEICodedDataBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_coded_data_bit_depth)-1, inclusive"); 530 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 531 } 532 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"); 533 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 534 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) 535 { 536 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 || m_colourRemapSEIMatrixPresentFlag ) 537 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 538 else 539 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEICodedDataBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_coded_data_bit_depth)-1, inclusive"); 540 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEITargetBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 541 } 542 } 543 if( m_colourRemapSEIMatrixPresentFlag ) 544 { 545 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); 546 for( Int c=0 ; c<3 ; c++) 547 for( Int i=0 ; i<3 ; i++) 548 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"); 549 } 550 } 551 #endif 398 552 399 553 #undef xConfirmPara -
branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r849 r856 55 55 Int m_numActiveRefLayers; 56 56 #endif 57 #if Q0074_SEI_COLOR_MAPPING58 string m_cSeiColorMappingFile;59 #endif60 57 61 58 #if LAYER_CTB … … 127 124 #if REPN_FORMAT_IN_VPS 128 125 Int m_repFormatIdx; 126 #endif 127 #if Q0074_COLOUR_REMAPPING_SEI 128 string m_colourRemapSEIFile; ///< Colour Remapping Information SEI message parameters file 129 Int m_colourRemapSEIId; 130 Bool m_colourRemapSEICancelFlag; 131 Bool m_colourRemapSEIPersistenceFlag; 132 Bool m_colourRemapSEIVideoSignalTypePresentFlag; 133 Bool m_colourRemapSEIVideoFullRangeFlag; 134 Int m_colourRemapSEIPrimaries; 135 Int m_colourRemapSEITransferCharacteristics; 136 Int m_colourRemapSEIMatrixCoeffs; 137 Int m_colourRemapSEICodedDataBitDepth; 138 Int m_colourRemapSEITargetBitDepth; 139 Int m_colourRemapSEIPreLutNumValMinus1[3]; 140 Int* m_colourRemapSEIPreLutCodedValue[3]; 141 Int* m_colourRemapSEIPreLutTargetValue[3]; 142 Bool m_colourRemapSEIMatrixPresentFlag; 143 Int m_colourRemapSEILog2MatrixDenom; 144 Int m_colourRemapSEICoeffs[3][3]; 145 Int m_colourRemapSEIPostLutNumValMinus1[3]; 146 Int* m_colourRemapSEIPostLutCodedValue[3]; 147 Int* m_colourRemapSEIPostLutTargetValue[3]; 129 148 #endif 130 149 public: -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r849 r856 534 534 m_acTEncTop[layer].setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 535 535 #endif 536 #if Q0074_SEI_COLOR_MAPPING 537 m_acTEncTop[layer].setColorMappingInfoSEIFile ( m_acLayerCfg[layer].m_cSeiColorMappingFile.empty() ? NULL : const_cast<Char *>(m_acLayerCfg[layer].m_cSeiColorMappingFile.c_str()) ); 536 #if Q0074_COLOUR_REMAPPING_SEI 537 m_acTEncTop[layer].setCRISEIFile ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) ); 538 m_acTEncTop[layer].setCRISEIId ( m_acLayerCfg[layer].m_colourRemapSEIId ); 539 m_acTEncTop[layer].setCRISEICancelFlag ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag ); 540 m_acTEncTop[layer].setCRISEIPersistenceFlag ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag ); 541 m_acTEncTop[layer].setCRISEIVideoSignalTypePresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalTypePresentFlag ); 542 m_acTEncTop[layer].setCRISEIVideoFullRangeFlag ( m_acLayerCfg[layer].m_colourRemapSEIVideoFullRangeFlag ); 543 m_acTEncTop[layer].setCRISEIPrimaries ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 544 m_acTEncTop[layer].setCRISEITransferCharacteristics ( m_acLayerCfg[layer].m_colourRemapSEITransferCharacteristics ); 545 m_acTEncTop[layer].setCRISEIMatrixCoeffs ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoeffs ); 546 m_acTEncTop[layer].setCRISEICodedDataBitDepth ( m_acLayerCfg[layer].m_colourRemapSEICodedDataBitDepth ); 547 m_acTEncTop[layer].setCRISEITargetBitDepth ( m_acLayerCfg[layer].m_colourRemapSEITargetBitDepth ); 548 m_acTEncTop[layer].setCRISEIPreLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 ); 549 m_acTEncTop[layer].setCRISEIPreLutCodedValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue ); 550 m_acTEncTop[layer].setCRISEIPreLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue ); 551 m_acTEncTop[layer].setCRISEIMatrixPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ); 552 m_acTEncTop[layer].setCRISEILog2MatrixDenom ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 553 m_acTEncTop[layer].setCRISEICoeffs ( m_acLayerCfg[layer].m_colourRemapSEICoeffs ); 554 m_acTEncTop[layer].setCRISEIPostLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 ); 555 m_acTEncTop[layer].setCRISEIPostLutCodedValue ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue ); 556 m_acTEncTop[layer].setCRISEIPostLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue ); 538 557 #endif 539 558 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); … … 900 919 m_cTEncTop.setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 901 920 #endif 902 #if Q0074_SEI_COLOR_MAPPING 903 m_cTEncTop.setColorMappingInfoSEIFile ( m_pchSEIColorMappingFile ); 921 #if Q0074_COLOUR_REMAPPING_SEI 922 m_cTEncTop.setCRISEIFile ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) ); 923 m_cTEncTop.setCRISEIId ( m_colourRemapSEIId ); 924 m_cTEncTop.setCRISEICancelFlag ( m_colourRemapSEICancelFlag ); 925 m_cTEncTop.setCRISEIPersistenceFlag ( m_colourRemapSEIPersistenceFlag ); 926 m_cTEncTop.setCRISEIVideoSignalTypePresentFlag ( m_colourRemapSEIVideoSignalTypePresentFlag ); 927 m_cTEncTop.setCRISEIVideoFullRangeFlag ( m_colourRemapSEIVideoFullRangeFlag ); 928 m_cTEncTop.setCRISEIPrimaries ( m_colourRemapSEIPrimaries ); 929 m_cTEncTop.setCRISEITransferCharacteristics ( m_colourRemapSEITransferCharacteristics ); 930 m_cTEncTop.setCRISEIMatrixCoeffs ( m_colourRemapSEIMatrixCoeffs ); 931 m_cTEncTop.setCRISEICodedDataBitDepth ( m_colourRemapSEICodedDataBitDepth ); 932 m_cTEncTop.setCRISEITargetBitDepth ( m_colourRemapSEITargetBitDepth ); 933 m_cTEncTop.setCRISEIPreLutNumValMinus1 ( m_colourRemapSEIPreLutNumValMinus1 ); 934 m_cTEncTop.setCRISEIPreLutCodedValue ( m_colourRemapSEIPreLutCodedValue ); 935 m_cTEncTop.setCRISEIPreLutTargetValue ( m_colourRemapSEIPreLutTargetValue ); 936 m_cTEncTop.setCRISEIMatrixPresentFlag ( m_colourRemapSEIMatrixPresentFlag ); 937 m_cTEncTop.setCRISEILog2MatrixDenom ( m_colourRemapSEILog2MatrixDenom ); 938 m_cTEncTop.setCRISEICoeffs ( m_colourRemapSEICoeffs ); 939 m_cTEncTop.setCRISEIPostLutNumValMinus1 ( m_colourRemapSEIPostLutNumValMinus1 ); 940 m_cTEncTop.setCRISEIPostLutCodedValue ( m_colourRemapSEIPostLutCodedValue ); 941 m_cTEncTop.setCRISEIPostLutTargetValue ( m_colourRemapSEIPostLutTargetValue ); 904 942 #endif 905 943 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
Note: See TracChangeset for help on using the changeset viewer.