Changeset 856 in SHVCSoftware for branches/SHM-dev/source
- Timestamp:
- 11 Aug 2014, 19:11:02 (10 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.cpp
r820 r856 115 115 ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.") 116 116 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 117 #if Q0074_COLOUR_REMAPPING_SEI 118 ("SEIColourRemappingInfo", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n" 119 "\t1: apply colour remapping on decoded pictures if available in the bitstream\n" 120 "\t0: ignore SEI message") 121 #endif 117 122 ; 118 123 po::setDefaults(opts); -
branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.h
r820 r856 69 69 Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded 70 70 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 71 #if Q0074_COLOUR_REMAPPING_SEI 72 Bool m_colourRemapSEIEnabled; ///< Enable the Colour Remapping Information SEI message if available (remapping decoded pictures) 73 #endif 71 74 72 75 #if SVC_EXTENSION … … 98 101 , m_iMaxTemporalLayer(-1) 99 102 , m_decodedPictureHashSEIEnabled(0) 103 #if Q0074_COLOUR_REMAPPING_SEI 104 , m_colourRemapSEIEnabled(0) 105 #endif 100 106 #if SVC_EXTENSION 101 107 , m_tgtLayerId(0) -
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
r845 r856 568 568 m_acTDecTop[layer].init(); 569 569 m_acTDecTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 570 #if Q0074_COLOUR_REMAPPING_SEI 571 m_acTDecTop[layer].setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled); 572 #endif 570 573 m_acTDecTop[layer].setNumLayer( m_tgtLayerId + 1 ); 571 574 #if OUTPUT_LAYER_SET_INDEX … … 573 576 #endif 574 577 } 575 576 578 #else 577 579 m_cTDecTop.init(); 578 580 m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 581 #if Q0074_COLOUR_REMAPPING_SEI 582 m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled); 583 #endif 579 584 #endif 580 585 } … … 675 680 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 676 681 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 677 #if Q0074_SEI_COLOR_MAPPING678 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )679 {680 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );681 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );682 }683 #endif684 682 #if REPN_FORMAT_IN_VPS 685 683 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 710 708 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 711 709 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 712 #if Q0074_SEI_COLOR_MAPPING713 if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )714 {715 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );716 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );717 }718 #endif719 710 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 720 711 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 791 782 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 792 783 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 793 #if Q0074_SEI_COLOR_MAPPING794 if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )795 {796 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );797 }798 #endif799 800 784 #if REPN_FORMAT_IN_VPS 801 785 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 898 882 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 899 883 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 900 #if Q0074_SEI_COLOR_MAPPING901 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )902 {903 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );904 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );905 }906 #endif907 884 #if REPN_FORMAT_IN_VPS 908 885 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 933 910 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 934 911 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 935 #if Q0074_SEI_COLOR_MAPPING936 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )937 {938 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );939 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );940 }941 #endif942 912 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 943 913 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 1017 987 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1018 988 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1019 #if Q0074_SEI_COLOR_MAPPING1020 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )1021 {1022 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );1023 }1024 #endif1025 989 #if REPN_FORMAT_IN_VPS 1026 990 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 1049 1013 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1050 1014 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1051 #if Q0074_SEI_COLOR_MAPPING1052 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )1053 {1054 pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec );1055 }1056 #endif1057 1015 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 1058 1016 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 1137 1095 #endif 1138 1096 TComPicYuv* pPicCYuvRec = pic->getPicYuvRec(); 1139 #if Q0074_SEI_COLOR_MAPPING1140 pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );1141 #endif1142 1097 m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, 1143 1098 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), -
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 ); -
branches/SHM-dev/source/Lib/TLibCommon/SEI.h
r846 r856 98 98 #endif 99 99 #endif 100 #if Q0074_ SEI_COLOR_MAPPING101 COLO R_MAPPING_INFO= 143,100 #if Q0074_COLOUR_REMAPPING_SEI 101 COLOUR_REMAPPING_INFO = 143, 102 102 #endif 103 103 #if Q0078_ADD_LAYER_SETS … … 447 447 }; 448 448 #endif 449 #if Q0074_SEI_COLOR_MAPPING 450 class SEIColorMappingInfo : public SEI 451 { 452 public: 453 PayloadType payloadType() const { return COLOR_MAPPING_INFO; } 454 SEIColorMappingInfo() { 455 } 456 virtual ~SEIColorMappingInfo() {} 457 458 Int m_colorMapId; 459 Bool m_colorMapCancelFlag; 460 Bool m_colorMapPersistenceFlag; 461 Bool m_colorMap_video_signal_type_present_flag; 462 Bool m_colorMap_video_full_range_flag; 463 Int m_colorMap_primaries; 464 Int m_colorMap_transfer_characteristics; 465 Int m_colorMap_matrix_coeffs; 466 Int m_colorMapModelId; 467 468 Int m_colour_map_coded_data_bit_depth; 469 Int m_colour_map_target_bit_depth; 470 471 Int m_num_input_pivots[3]; 472 Int* m_coded_input_pivot_value[3]; 473 Int* m_target_input_pivot_value[3]; 474 475 Bool m_matrix_flag; 476 Int m_log2_matrix_denom; 477 Int m_matrix_coef[3][3]; 478 479 Int m_num_output_pivots[3]; 480 Int* m_coded_output_pivot_value[3]; 481 Int* m_target_output_pivot_value[3]; 449 #if Q0074_COLOUR_REMAPPING_SEI 450 class SEIColourRemappingInfo : public SEI 451 { 452 public: 453 PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; } 454 SEIColourRemappingInfo() {} 455 ~SEIColourRemappingInfo() {} 456 457 Int m_colourRemapId; 458 Bool m_colourRemapCancelFlag; 459 Bool m_colourRemapPersistenceFlag; 460 Bool m_colourRemapVideoSignalTypePresentFlag; 461 Bool m_colourRemapVideoFullRangeFlag; 462 Int m_colourRemapPrimaries; 463 Int m_colourRemapTransferCharacteristics; 464 Int m_colourRemapMatrixCoeffs; 465 Int m_colourRemapCodedDataBitDepth; 466 Int m_colourRemapTargetBitDepth; 467 Int m_preLutNumValMinus1[3]; 468 std::vector<Int> m_preLutCodedValue[3]; 469 std::vector<Int> m_preLutTargetValue[3]; 470 Bool m_colourRemapMatrixPresentFlag; 471 Int m_log2MatrixDenom; 472 Int m_colourRemapCoeffs[3][3]; 473 Int m_postLutNumValMinus1[3]; 474 std::vector<Int> m_postLutCodedValue[3]; 475 std::vector<Int> m_postLutTargetValue[3]; 482 476 }; 483 477 #endif -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r815 r856 366 366 } 367 367 368 #if SVC_EXTENSION369 368 Void TComPicYuv::dump( Char* pFileName, Bool bAdd, Int bitDepth ) 370 369 { … … 431 430 } 432 431 433 #endif434 435 432 //! \} -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h
r815 r856 191 191 Void convertToMonochrome(); 192 192 #endif 193 #endif //SVC_EXTENSION 193 194 Void dump( Char* pFileName, Bool bAdd, Int bitDepth ); 194 #endif //SVC_EXTENSION195 195 196 196 };// END CLASS DEFINITION TComPicYuv -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r854 r856 109 109 #define R0300_CGS_RES_COEFF_CODING 1 ///< JCTVC-R0300: improved residual coefficient coding for R0151 110 110 #endif 111 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted predic iton for color gamut scalability111 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediction for colour gamut scalability 112 112 #define POC_RESET_FLAG 0 ///< JCTVC-N0244: POC reset flag for layer pictures. 113 113 #define POC_RESET_IDC 1 ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG … … 280 280 #define MAX_SUB_STREAMS 1024 281 281 #endif 282 #define Q0074_SEI_COLOR_MAPPING 1 ///< JCTVC-Q0074, SEI Color Mapping283 282 #define LAYERS_NOT_PRESENT_SEI 1 ///< JCTVC-M0043: add layers not present SEI. 284 283 #define N0383_IL_CONSTRAINED_TILE_SETS_SEI 1 … … 288 287 289 288 #endif // SVC_EXTENSION 289 #define Q0074_COLOUR_REMAPPING_SEI 1 ///< JCTVC-Q0074, JCTVC-R0344: SEI Colour Remapping Information 290 290 291 291 -
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp
r847 r856 98 98 break; 99 99 #endif 100 #if Q0074_ SEI_COLOR_MAPPING101 case SEI::COLO R_MAPPING_INFO:102 fprintf( g_hTrace, "===========Colo r Mapping InfoSEI message ===========\n");100 #if Q0074_COLOUR_REMAPPING_SEI 101 case SEI::COLOUR_REMAPPING_INFO: 102 fprintf( g_hTrace, "===========Colour Remapping Information SEI message ===========\n"); 103 103 break; 104 104 #endif … … 132 132 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 133 133 break; 134 #if !REMOVE_BSP_HRD_SEI 134 135 case SEI::BSP_HRD: 135 136 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 136 137 break; 138 #endif 137 139 #endif 138 140 #if Q0078_ADD_LAYER_SETS … … 304 306 break; 305 307 #endif 306 #if Q0074_ SEI_COLOR_MAPPING307 case SEI::COLO R_MAPPING_INFO:308 sei = new SEIColo rMappingInfo;309 xParseSEIColo rMappingInfo((SEIColorMappingInfo&) *sei, payloadSize);308 #if Q0074_COLOUR_REMAPPING_SEI 309 case SEI::COLOUR_REMAPPING_INFO: 310 sei = new SEIColourRemappingInfo; 311 xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize); 310 312 break; 311 313 #endif … … 923 925 #endif 924 926 925 #if Q0074_ SEI_COLOR_MAPPING926 Void SEIReader::xParseSEIColo rMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)927 #if Q0074_COLOUR_REMAPPING_SEI 928 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt /*payloadSize*/) 927 929 { 928 930 UInt uiVal; 929 931 Int iVal; 930 932 931 READ_UVLC( uiVal, "colour_map_id" ); sei.m_colorMapId = uiVal; 932 READ_FLAG( uiVal, "colour_map_cancel_flag" ); sei.m_colorMapCancelFlag = uiVal; 933 if( !sei.m_colorMapCancelFlag ) 934 { 935 READ_FLAG( uiVal, "colour_map_persistence_flag" ); sei.m_colorMapPersistenceFlag = uiVal; 936 READ_FLAG( uiVal, "colour_map_video_signal_type_present_flag" ); sei.m_colorMap_video_signal_type_present_flag = uiVal; 937 if ( sei.m_colorMap_video_signal_type_present_flag ) { 938 READ_FLAG( uiVal, "colour_map_video_full_range_flag" ); sei.m_colorMap_video_full_range_flag = uiVal; 939 READ_CODE( 8, uiVal, "colour_map_primaries" ); sei.m_colorMap_primaries = uiVal; 940 READ_CODE( 8, uiVal, "colour_map_transfer_characteristics" ); sei.m_colorMap_transfer_characteristics = uiVal; 941 READ_CODE( 8, uiVal, "colour_map_matrix_coeffs" ); sei.m_colorMap_matrix_coeffs = uiVal; 942 } 943 } 944 945 READ_CODE( 5, uiVal, "colour_map_coded_data_bit_depth" ); sei.m_colour_map_coded_data_bit_depth = uiVal; 946 READ_CODE( 5, uiVal, "colour_map_target_bit_depth" ); sei.m_colour_map_target_bit_depth = uiVal; 947 READ_UVLC( uiVal, "colour_map_model_id" ); sei.m_colorMapModelId = uiVal; 948 949 assert( sei.m_colorMapModelId == 0 ); 933 READ_UVLC( uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal; 934 READ_FLAG( uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal; 935 if( !sei.m_colourRemapCancelFlag ) 936 { 937 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; 942 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; 950 948 951 for( Int i=0 ; i<3 ; i++ ) 952 { 953 READ_CODE( 8, uiVal, "num_input_pivots_minus1[i]" ); sei.m_num_input_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 954 sei.m_coded_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 955 sei.m_target_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 956 if( uiVal > 0 ) 957 { 958 for ( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 959 { 960 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_input_pivot_value[i][j]" ); sei.m_coded_input_pivot_value[i][j] = uiVal; 961 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_input_pivot_value[i][j]" ); sei.m_target_input_pivot_value[i][j] = uiVal; 962 } 963 } 964 else 965 { 966 sei.m_coded_input_pivot_value[i][0] = 0; 967 sei.m_target_input_pivot_value[i][0] = 0; 968 sei.m_coded_input_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 969 sei.m_target_input_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 970 } 971 } 972 973 READ_FLAG( uiVal, "matrix_flag" ); sei.m_matrix_flag = uiVal; 974 if( sei.m_matrix_flag ) 975 { 976 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2_matrix_denom = uiVal; 977 for ( Int i=0 ; i<3 ; i++ ) 978 { 979 for ( Int j=0 ; j<3 ; j++ ) 980 { 981 READ_SVLC( iVal, "matrix_coef[i][j]" ); sei.m_matrix_coef[i][j] = iVal; 982 } 983 } 984 } 985 986 for ( Int i=0 ; i<3 ; i++ ) 987 { 988 READ_CODE( 8, uiVal, "num_output_pivots_minus1[i]" ); sei.m_num_output_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 989 sei.m_coded_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 990 sei.m_target_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 991 if( uiVal > 0 ) 992 { 993 for ( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 994 { 995 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_output_pivot_value[i][j]" ); sei.m_coded_output_pivot_value[i][j] = uiVal; 996 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_output_pivot_value[i][j]" ); sei.m_target_output_pivot_value[i][j] = uiVal; 997 } 998 } 999 else 1000 { 1001 sei.m_coded_output_pivot_value[i][0] = 0; 1002 sei.m_target_output_pivot_value[i][0] = 0; 1003 sei.m_coded_output_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 1004 sei.m_target_output_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 949 for( Int c=0 ; c<3 ; c++ ) 950 { 951 READ_CODE( 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 952 sei.m_preLutCodedValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 953 sei.m_preLutTargetValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 954 if( uiVal> 0 ) 955 for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 956 { 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; 959 } 960 else // pre_lut_num_val_minus1[c] == 0 961 { 962 sei.m_preLutCodedValue[c][0] = 0; 963 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 ; 966 } 967 } 968 969 READ_FLAG( uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal; 970 if( sei.m_colourRemapMatrixPresentFlag ) 971 { 972 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal; 973 for ( Int c=0 ; c<3 ; c++ ) 974 for ( Int i=0 ; i<3 ; i++ ) 975 { 976 READ_SVLC( iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal; 977 } 978 } 979 else // setting default matrix (I3) 980 { 981 sei.m_log2MatrixDenom = 0; 982 for ( Int c=0 ; c<3 ; c++ ) 983 for ( Int i=0 ; i<3 ; i++ ) 984 sei.m_colourRemapCoeffs[c][i] = (c==i) ? 1 : 0; 985 } 986 for( Int c=0 ; c<3 ; c++ ) 987 { 988 READ_CODE( 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 989 sei.m_postLutCodedValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 990 sei.m_postLutTargetValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 991 if( uiVal > 0 ) 992 for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 993 { 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; 996 } 997 else 998 { 999 sei.m_postLutCodedValue[c][0] = 0; 1000 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; 1003 } 1005 1004 } 1006 1005 } -
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.h
r846 r856 93 93 Void xParseSEIKneeFunctionInfo (SEIKneeFunctionInfo& sei, UInt payloadSize); 94 94 #endif 95 #if Q0074_ SEI_COLOR_MAPPING96 Void xParseSEIColo rMappingInfo (SEIColorMappingInfo& sei, UInt payloadSize);95 #if Q0074_COLOUR_REMAPPING_SEI 96 Void xParseSEIColourRemappingInfo (SEIColourRemappingInfo& sei, UInt payloadSize); 97 97 #endif 98 98 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
r841 r856 54 54 //! \{ 55 55 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI); 56 #if Q0074_COLOUR_REMAPPING_SEI 57 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 ); 58 static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI 59 #endif 56 60 // ==================================================================================================================== 57 61 // Constructor / destructor / initialization / destroy … … 252 256 calcAndPrintHashStatus(*rpcPic->getPicYuvRec(), hash); 253 257 } 258 #if Q0074_COLOUR_REMAPPING_SEI 259 if (m_colourRemapSEIEnabled) 260 { 261 SEIMessages colourRemappingInfo = getSeisByType(rpcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 262 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 263 if (colourRemappingInfo.size() > 1) 264 { 265 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 266 } 267 applyColourRemapping(*rpcPic->getPicYuvRec(), seiColourRemappingInfo 268 #if SVC_EXTENSION 269 , rpcPic->getLayerId() 270 #endif 271 ); 272 } 273 #endif 254 274 255 275 #if SETTING_PIC_OUTPUT_MARK … … 339 359 } 340 360 } 361 362 #if Q0074_COLOUR_REMAPPING_SEI 363 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI ) 364 { 365 for ( Int c=0 ; c<3 ; c++ ) 366 { 367 Int bitDepth = c ? bitDepthC : bitDepthY ; 368 preLut[c].resize(1 << bitDepth); 369 postLut[c].resize(1 << pCriSEI->m_colourRemapTargetBitDepth); 370 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) 373 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) 377 if( bitDepthDiff<0 ) 378 printf ("Warning: CRI SEI - colourRemapTargetBitDepth (%d) <colourRemapCodedDataBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapTargetBitDepth, pCriSEI->m_colourRemapCodedDataBitDepth); 379 380 //Fill preLut 381 for ( Int k=0 ; k<(1<<bitDepth) ; k++ ) 382 { 383 Int iSample = k << iShift1 ; 384 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ ) 385 { 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 390 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 391 { 392 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev); 393 preLut[c][k] = (Int)( 0.5f + fInterpol ); 394 iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1; 395 } 396 } 397 } 398 399 //Fill postLut 400 for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapTargetBitDepth) ; k++ ) 401 { 402 Int iSample = k; 403 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ ) 404 { 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 409 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 410 { 411 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ; 412 postLut[c][k] = (Int)( 0.5f + fInterpol ); 413 iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1; 414 } 415 } 416 } 417 } 418 } 419 420 static void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId ) 421 { 422 if( !storeCriSEI.size() ) 423 #if SVC_EXTENSION 424 storeCriSEI.resize(MAX_LAYERS); 425 #else 426 storeCriSEI.resize(1); 427 #endif 428 429 if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management) 430 storeCriSEI[layerId] = *pCriSEI; 431 432 if( !storeCriSEI[layerId].m_colourRemapCancelFlag ) 433 { 434 Int iHeight = pic.getHeight(); 435 Int iWidth = pic.getWidth(); 436 Int iStride = pic.getStride(); 437 Int iCStride = pic.getCStride(); 438 439 Pel *YUVIn[3], *YUVOut[3]; 440 YUVIn[0] = pic.getLumaAddr(); 441 YUVIn[1] = pic.getCbAddr(); 442 YUVIn[2] = pic.getCrAddr(); 443 444 TComPicYuv picColourRemapped; 445 #if SVC_EXTENSION 446 #if AUXILIARY_PICTURES 447 picColourRemapped.create( pic.getWidth(), pic.getHeight(), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 448 #else 449 picColourRemapped.create( pic.getWidth(), pic.getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 450 #endif 451 #else 452 picColourRemapped.create( pic.getWidth(), pic.getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 453 #endif 454 YUVOut[0] = picColourRemapped.getLumaAddr(); 455 YUVOut[1] = picColourRemapped.getCbAddr(); 456 YUVOut[2] = picColourRemapped.getCrAddr(); 457 458 #if SVC_EXTENSION 459 Int bitDepthY = g_bitDepthYLayer[layerId]; 460 Int bitDepthC = g_bitDepthCLayer[layerId]; 461 462 assert( g_bitDepthY == bitDepthY ); 463 assert( g_bitDepthC == bitDepthC ); 464 #else 465 Int bitDepthY = g_bitDepthY; 466 Int bitDepthC = g_bitDepthC; 467 #endif 468 469 std::vector<Int> preLut[3]; 470 std::vector<Int> postLut[3]; 471 xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] ); 472 473 Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1)); 474 475 for( Int y = 0; y < iHeight ; y++ ) 476 { 477 for( Int x = 0; x < iWidth ; x++ ) 478 { 479 Int YUVPre[3], YUVMat[3]; 480 YUVPre[0] = preLut[0][ YUVIn[0][x] ]; 481 YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ]; 482 YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ]; 483 484 YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0] 485 + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1] 486 + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2] 487 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 488 YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapTargetBitDepth)-1, YUVMat[0] ); 489 YUVOut[0][x] = postLut[0][ YUVMat[0] ]; 490 491 if( (y&1) && (x&1) ) 492 { 493 for(Int c=1 ; c<3 ; c++) 494 { 495 YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0] 496 + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1] 497 + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2] 498 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 499 YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapTargetBitDepth)-1, YUVMat[c] ); 500 YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ]; 501 } 502 } 503 } 504 YUVIn[0] += iStride; 505 YUVOut[0] += iStride; 506 if( y&1 ) 507 { 508 YUVIn[1] += iCStride; 509 YUVIn[2] += iCStride; 510 YUVOut[1] += iCStride; 511 YUVOut[2] += iCStride; 512 } 513 } 514 515 //Write remapped picture in decoding order 516 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 ); 519 520 picColourRemapped.destroy(); 521 522 storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence 523 } 524 } 525 #endif 341 526 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.h
r595 r856 82 82 Double m_dDecTime; 83 83 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 84 84 #if Q0074_COLOUR_REMAPPING_SEI 85 Bool m_colourRemapSEIEnabled; ///< Enable/disable Colour Remapping Information SEI message acting on decoded pictures 86 #endif 85 87 #if SVC_EXTENSION 86 88 UInt m_layerId; … … 114 116 115 117 void setDecodedPictureHashSEIEnabled(Int enabled) { m_decodedPictureHashSEIEnabled = enabled; } 118 #if Q0074_COLOUR_REMAPPING_SEI 119 void setColourRemappingInfoSEIEnabled(Int enabled) { m_colourRemapSEIEnabled = enabled; } 120 #endif 116 121 #if SVC_EXTENSION 117 122 TDecTop* getLayerDec(UInt LayerId) { return m_ppcTDecTop[LayerId]; } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r854 r856 117 117 #endif 118 118 119 #if Q0074_SEI_COLOR_MAPPING120 m_ColorMapping = new TDecColorMapping();121 #endif122 123 119 #if POC_RESET_RESTRICTIONS 124 120 resetPocRestrictionCheckParameters(); … … 137 133 delete m_pColorMappedPic; 138 134 m_pColorMappedPic = NULL; 139 }140 #endif141 #if Q0074_SEI_COLOR_MAPPING142 if ( m_ColorMapping )143 {144 delete m_ColorMapping;145 m_ColorMapping = NULL;146 135 } 147 136 #endif … … 891 880 g_uiMaxCUDepth = sps->getMaxCUDepth(); 892 881 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 893 894 #if Q0074_SEI_COLOR_MAPPING895 for(Int compID=0; compID<3; compID++)896 {897 m_ColorMapping->setColorMapping( compID ? g_bitDepthC : g_bitDepthY, compID );898 }899 #endif900 882 901 883 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) … … 2324 2306 } 2325 2307 } 2326 #if Q0074_SEI_COLOR_MAPPING2327 m_ColorMapping->setColorMapping( m_SEIs );2328 #endif2329 2308 } 2330 2309 #else … … 2857 2836 #endif //SVC_EXTENSION 2858 2837 2859 #if Q0074_SEI_COLOR_MAPPING2860 TDecColorMapping::TDecColorMapping()2861 {2862 m_pcColorMappingPic[0] = NULL;2863 m_pcColorMappingPic[1] = NULL;2864 2865 m_colorMapCancelFlag = true;2866 2867 for( Int i=0 ; i<3 ; i++ )2868 {2869 m_lut1d_computed[i] = false;2870 m_lut1d_input[i] = NULL;2871 m_coded_input_pivot_value[i] = NULL;2872 m_target_input_pivot_value[i] = NULL;2873 }2874 for( Int i=0 ; i<3 ; i++ )2875 {2876 m_lut1d_output[i] = NULL;2877 m_coded_output_pivot_value[i] = NULL;2878 m_target_output_pivot_value[i] = NULL;2879 }2880 }2881 2882 TDecColorMapping::~TDecColorMapping()2883 {2884 if ( m_pcColorMappingPic[0] ) delete m_pcColorMappingPic[0];2885 if ( m_pcColorMappingPic[1] ) delete m_pcColorMappingPic[1];2886 2887 for( Int i=0 ; i<3 ; i++ )2888 {2889 if ( m_lut1d_input[i] ) delete m_lut1d_input[i];2890 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i];2891 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i];2892 }2893 for( Int i=0 ; i<3 ; i++ )2894 {2895 if ( m_lut1d_output[i] ) delete m_lut1d_output[i];2896 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i];2897 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i];2898 }2899 }2900 2901 Void TDecColorMapping::setColorMapping( SEIMessages m_SEIs )2902 {2903 SEIMessages colorMappingInfo = getSeisByType(m_SEIs, SEI::COLOR_MAPPING_INFO) ;2904 SEIColorMappingInfo *seiColorMappingInfo = NULL;2905 if (colorMappingInfo.size() !=0)2906 {2907 seiColorMappingInfo = (SEIColorMappingInfo*)(*colorMappingInfo.begin());2908 2909 m_colorMapId = seiColorMappingInfo->m_colorMapId;2910 m_colorMapCancelFlag = seiColorMappingInfo->m_colorMapCancelFlag;2911 if( !m_colorMapCancelFlag )2912 {2913 m_colorMapPersistenceFlag = seiColorMappingInfo->m_colorMapPersistenceFlag;2914 m_colorMap_video_signal_type_present_flag = seiColorMappingInfo->m_colorMap_video_signal_type_present_flag;2915 m_colorMap_video_full_range_flag = seiColorMappingInfo->m_colorMap_video_full_range_flag;2916 m_colorMap_primaries = seiColorMappingInfo->m_colorMap_primaries;2917 m_colorMap_transfer_characteristics = seiColorMappingInfo->m_colorMap_transfer_characteristics;2918 m_colorMap_matrix_coeffs = seiColorMappingInfo->m_colorMap_matrix_coeffs;2919 m_colorMapModelId = seiColorMappingInfo->m_colorMapModelId;2920 2921 m_colour_map_coded_data_bit_depth = seiColorMappingInfo->m_colour_map_coded_data_bit_depth;2922 m_colour_map_target_bit_depth = seiColorMappingInfo->m_colour_map_target_bit_depth;2923 2924 for( Int i=0 ; i<3 ; i++ )2925 {2926 m_num_input_pivots[i] = seiColorMappingInfo->m_num_input_pivots[i];2927 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i];2928 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i];2929 m_coded_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ];2930 m_target_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ];2931 for( Int j=0 ; j<m_num_input_pivots[i] ; j++ )2932 {2933 m_coded_input_pivot_value[i][j] = seiColorMappingInfo->m_coded_input_pivot_value[i][j];2934 m_target_input_pivot_value[i][j] = seiColorMappingInfo->m_target_input_pivot_value[i][j];2935 }2936 }2937 2938 m_matrix_flag = seiColorMappingInfo->m_matrix_flag;2939 m_log2_matrix_denom = m_matrix_flag ? (seiColorMappingInfo->m_log2_matrix_denom) : (0) ;2940 for( Int i=0 ; i<3 ; i++ )2941 {2942 for( Int j=0 ; j<3 ; j++ )2943 {2944 m_matrix_coef[i][j] = seiColorMappingInfo->m_matrix_coef[i][j];2945 }2946 }2947 2948 for( Int i=0 ; i<3 ; i++ )2949 {2950 m_num_output_pivots[i] = seiColorMappingInfo->m_num_output_pivots[i];2951 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i];2952 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i];2953 m_coded_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ];2954 m_target_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ];2955 for( Int j=0 ; j<m_num_output_pivots[i] ; j++ )2956 {2957 m_coded_output_pivot_value[i][j] = seiColorMappingInfo->m_coded_output_pivot_value[i][j];2958 m_target_output_pivot_value[i][j] = seiColorMappingInfo->m_target_output_pivot_value[i][j];2959 }2960 }2961 2962 memset( m_lut1d_computed, 0, sizeof( m_lut1d_computed ) );2963 }2964 }2965 2966 }2967 2968 Void TDecColorMapping::setColorMapping( Int bitDepth, Int iComp )2969 {2970 if( !m_colorMapCancelFlag && !m_lut1d_computed[iComp] )2971 {2972 2973 if ( m_lut1d_input[iComp] ) delete m_lut1d_input[iComp];2974 if ( m_lut1d_output[iComp] ) delete m_lut1d_output[iComp];2975 2976 m_lut1d_input[iComp] = new Int[ 1 << bitDepth ];2977 m_lut1d_output[iComp] = new Int[ 1 << bitDepth ];2978 2979 Int iShift = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0);2980 Int iShiftPivot = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_coded_data_bit_depth);2981 2982 for( Int k=0 ; k<(1<<bitDepth) ; k++ )2983 {2984 Int iSample = k << iShift ;2985 if( m_num_input_pivots[iComp] > 1 )2986 {2987 for( Int iPivot=0 ; iPivot<m_num_input_pivots[iComp] ; iPivot++ )2988 {2989 Int iCodedPrev = m_coded_input_pivot_value[iComp][iPivot] << iShiftPivot;2990 Int iCodedNext = m_coded_input_pivot_value[iComp][iPivot+1] << iShiftPivot;2991 Int iTargetPrev = m_target_input_pivot_value[iComp][iPivot] << iShiftPivot;2992 Int iTargetNext = m_target_input_pivot_value[iComp][iPivot+1] << iShiftPivot;2993 if ( iCodedPrev <= iSample && iSample < iCodedNext )2994 {2995 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;2996 m_lut1d_input[iComp][k] = (Int)( 0.5 + fInterpol );2997 iPivot = m_num_input_pivots[iComp]; // stop2998 }2999 }3000 }3001 else3002 {3003 m_lut1d_input[iComp][k] = k;3004 }3005 }3006 3007 iShift = ( (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0) );3008 Int iOffset = iShift ? (1 << (iShift - 1)) : (0) ;3009 iShiftPivot = (m_colour_map_target_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_target_bit_depth) ;3010 for( Int k=0 ; k<(1<<bitDepth) ; k++ )3011 {3012 Int iSample = k << iShift;3013 if ( m_num_output_pivots[iComp]>1 )3014 {3015 for( Int iPivot=0 ; iPivot<m_num_output_pivots[iComp] ; iPivot++ )3016 {3017 Int iCodedPrev = m_coded_output_pivot_value[iComp][iPivot] << iShiftPivot;3018 Int iCodedNext = m_coded_output_pivot_value[iComp][iPivot+1] << iShiftPivot;3019 Int iTargetPrev = m_target_output_pivot_value[iComp][iPivot] << iShiftPivot;3020 Int iTargetNext = m_target_output_pivot_value[iComp][iPivot+1] << iShiftPivot;3021 if ( iCodedPrev <= iSample && iSample < iCodedNext )3022 {3023 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;3024 m_lut1d_output[iComp][k] = ( (Int)(0.5 + fInterpol) + iOffset ) >> iShift ;3025 iPivot = m_num_output_pivots[iComp]; // stop3026 }3027 }3028 }3029 else3030 {3031 m_lut1d_output[iComp][k] = k;3032 }3033 }3034 3035 m_lut1d_computed[iComp] = true;3036 }3037 3038 }3039 3040 TComPicYuv* TDecColorMapping::getColorMapping( TComPicYuv* pPicYuvRec, Int iTop, Int curlayerId )3041 {3042 if( !m_colorMapCancelFlag )3043 {3044 if( !m_pcColorMappingPic[iTop] )3045 {3046 m_pcColorMappingPic[iTop] = new TComPicYuv;3047 #if SVC_EXTENSION3048 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), pPicYuvRec->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );3049 #else3050 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );3051 #endif3052 }3053 3054 Int iHeight = pPicYuvRec->getHeight();3055 Int iWidth = pPicYuvRec->getWidth();3056 Int iStride = pPicYuvRec->getStride();3057 Int iCStride = pPicYuvRec->getCStride();3058 3059 Pel* Lum0 = pPicYuvRec->getLumaAddr();3060 Pel* Cb0 = pPicYuvRec->getCbAddr();3061 Pel* Cr0 = pPicYuvRec->getCrAddr();3062 Pel* Lum1 = m_pcColorMappingPic[iTop]->getLumaAddr();3063 Pel* Cb1 = m_pcColorMappingPic[iTop]->getCbAddr();3064 Pel* Cr1 = m_pcColorMappingPic[iTop]->getCrAddr();3065 3066 #if SVC_EXTENSION3067 Int bitDepthY = g_bitDepthYLayer[curlayerId];3068 Int bitDepthC = g_bitDepthCLayer[curlayerId];3069 3070 assert( g_bitDepthY == bitDepthY );3071 assert( g_bitDepthC == bitDepthC );3072 #else3073 Int bitDepthY = g_bitDepthY;3074 Int bitDepthC = g_bitDepthC;3075 #endif3076 3077 Int iYShift = (m_colour_map_target_bit_depth >= bitDepthY) ? (m_colour_map_target_bit_depth - bitDepthY) : (0) ;3078 Int iCShift = (m_colour_map_target_bit_depth >= bitDepthC) ? (m_colour_map_target_bit_depth - bitDepthC) : (0) ;3079 Int offsetY = (1 << (m_log2_matrix_denom+iYShift - 1));3080 Int offsetC = (1 << (m_log2_matrix_denom+iCShift - 1));3081 3082 Int cShift = 1 ;3083 3084 //Pel* LumPrev0 = Lum0;3085 for( Int y = 0; y < iHeight ; y++ )3086 {3087 Bool bDoChroma = (y % 2);3088 for( Int x = 0; x < iWidth ; x++ )3089 {3090 Int s1Y = m_lut1d_input[0][ Lum0[x] ];3091 Int s1U = m_lut1d_input[1][ Cb0[x>>1] ];3092 Int s1V = m_lut1d_input[2][ Cr0[x>>1] ];3093 3094 Int s2Y, s2U, s2V;3095 if( m_matrix_flag )3096 {3097 s2Y = ( m_matrix_coef[0][0]*s1Y + m_matrix_coef[0][1]*s1U + m_matrix_coef[0][2]*s1V + offsetY ) >> ( m_log2_matrix_denom + iYShift );3098 //s2Y = ClipBD( s2Y , bitDepthY );3099 s2Y = ClipY( s2Y );3100 Lum1[x] = m_lut1d_output[0][ s2Y ];3101 }3102 else3103 {3104 s1Y = ( s1Y + offsetY ) >> iYShift ;3105 //s1Y = ClipBD( s1Y , bitDepthY );3106 s1Y = ClipY( s1Y );3107 Lum1[x] = m_lut1d_output[0][ s1Y ];3108 }3109 3110 if( bDoChroma && (x%2) )3111 {3112 if( m_matrix_flag )3113 {3114 //s1Y = ( m_lut1d_input[0][ Lum0[x] ] + m_lut1d_input[0][ Lum0[x+1] ] + m_lut1d_input[0][ LumPrev0[x] ] + m_lut1d_input[0][ LumPrev0[x+1] ] + 2 ) >> 2 ;3115 //s1Y = m_lut1d_input[0][ (Lum0[x] + Lum0[x+1] + LumPrev0[x] + LumPrev0[x+1] + 2)>>2 ] ;3116 s1Y = m_lut1d_input[0][ Lum0[x] ];3117 3118 s2U = ( m_matrix_coef[1][0]*s1Y + m_matrix_coef[1][1]*s1U + m_matrix_coef[1][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;3119 s2V = ( m_matrix_coef[2][0]*s1Y + m_matrix_coef[2][1]*s1U + m_matrix_coef[2][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;3120 //s2U = ClipBD( s2U , bitDepthC );3121 //s2V = ClipBD( s2V , bitDepthC );3122 s2U = ClipC( s2U );3123 s2V = ClipC( s2V );3124 Cb1[x>>cShift] = m_lut1d_output[1][ s2U ];3125 Cr1[x>>cShift] = m_lut1d_output[2][ s2V ];3126 }3127 else3128 {3129 s1U = ( s1U + offsetC ) >> iCShift ;3130 s1V = ( s1V + offsetC ) >> iCShift ;3131 //s1U = ClipBD( s1U , bitDepthC );3132 //s1V = ClipBD( s1V , bitDepthC );3133 s1U = ClipC( s1U );3134 s1V = ClipC( s1V );3135 Cb1[x>>cShift] = m_lut1d_output[1][ s1U ];3136 Cr1[x>>cShift] = m_lut1d_output[2][ s1V ];3137 }3138 }3139 3140 }3141 3142 //LumPrev0 = Lum0;3143 Lum0 += iStride;3144 Lum1 += iStride;3145 if( bDoChroma )3146 {3147 Cb0 += iCStride;3148 Cr0 += iCStride;3149 Cb1 += iCStride;3150 Cr1 += iCStride;3151 }3152 }3153 3154 return m_pcColorMappingPic[iTop];3155 }3156 3157 return pPicYuvRec;3158 }3159 #endif3160 2838 3161 2839 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
r854 r856 64 64 // ==================================================================================================================== 65 65 66 #if Q0074_SEI_COLOR_MAPPING67 class TDecColorMapping68 {69 Int m_colorMapId;70 Bool m_colorMapCancelFlag;71 Bool m_colorMapPersistenceFlag;72 Bool m_colorMap_video_signal_type_present_flag;73 Bool m_colorMap_video_full_range_flag;74 Int m_colorMap_primaries;75 Int m_colorMap_transfer_characteristics;76 Int m_colorMap_matrix_coeffs;77 Int m_colorMapModelId;78 79 Int m_colour_map_coded_data_bit_depth;80 Int m_colour_map_target_bit_depth;81 82 Int m_num_input_pivots[3];83 Int* m_coded_input_pivot_value[3];84 Int* m_target_input_pivot_value[3];85 86 Bool m_matrix_flag;87 Int m_log2_matrix_denom;88 Int m_matrix_coef[3][3];89 90 Int m_num_output_pivots[3];91 Int* m_coded_output_pivot_value[3];92 Int* m_target_output_pivot_value[3];93 94 Bool m_lut1d_computed[3];95 Int* m_lut1d_input[3];96 Int* m_lut1d_output[3];97 TComPicYuv* m_pcColorMappingPic[2];98 99 public:100 TDecColorMapping();101 ~TDecColorMapping();102 103 Bool getColorMappingFlag() { return(!m_colorMapCancelFlag);};104 105 Void setColorMapping( SEIMessages m_SEIs );106 Void setColorMapping( Int bitDepthY, Int bitDepthC );107 TComPicYuv* getColorMapping( TComPicYuv* pPicYuvRec, Int iTop=0, Int curlayerId=0 );108 };// END CLASS DEFINITION TDecColorMapping109 #endif110 111 66 /// decoder class 112 67 class TDecTop … … 209 164 #endif 210 165 public: 211 #if Q0074_SEI_COLOR_MAPPING212 TDecColorMapping* m_ColorMapping;213 #endif214 215 166 #if POC_RESET_RESTRICTIONS 216 167 static Bool m_checkPocRestrictionsForCurrAu; … … 236 187 237 188 void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } 189 #if Q0074_COLOUR_REMAPPING_SEI 190 void setColourRemappingInfoSEIEnabled(Bool enabled) { m_cGopDecoder.setColourRemappingInfoSEIEnabled(enabled); } 191 #endif 238 192 239 193 Void init(); -
branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r847 r856 92 92 break; 93 93 #endif 94 #if Q0074_ SEI_COLOR_MAPPING95 case SEI::COLO R_MAPPING_INFO:96 fprintf( g_hTrace, "=========== Colo r Mapping InfoSEI message ===========\n");94 #if Q0074_COLOUR_REMAPPING_SEI 95 case SEI::COLOUR_REMAPPING_INFO: 96 fprintf( g_hTrace, "=========== Colour Remapping Information SEI message ===========\n"); 97 97 break; 98 98 #endif … … 126 126 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 127 127 break; 128 #if !REMOVE_BSP_HRD_SEI 128 129 case SEI::BSP_HRD: 129 130 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 130 131 break; 132 #endif 131 133 #endif 132 134 #if Q0078_ADD_LAYER_SETS … … 195 197 break; 196 198 #endif 197 #if Q0074_ SEI_COLOR_MAPPING198 case SEI::COLO R_MAPPING_INFO:199 xWriteSEIColo rMappingInfo(*static_cast<const SEIColorMappingInfo*>(&sei));199 #if Q0074_COLOUR_REMAPPING_SEI 200 case SEI::COLOUR_REMAPPING_INFO: 201 xWriteSEIColourRemappingInfo(*static_cast<const SEIColourRemappingInfo*>(&sei)); 200 202 break; 201 203 #endif … … 636 638 } 637 639 #endif 638 #if Q0074_SEI_COLOR_MAPPING 639 Void SEIWriter::xWriteSEIColorMappingInfo(const SEIColorMappingInfo& sei) 640 { 641 WRITE_UVLC( sei.m_colorMapId, "colour_map_id" ); 642 WRITE_FLAG( sei.m_colorMapCancelFlag, "colour_map_cancel_flag" ); 643 if( !sei.m_colorMapCancelFlag ) 644 { 645 WRITE_FLAG( sei.m_colorMapPersistenceFlag, "colour_map_persistence_flag" ); 646 WRITE_FLAG( sei.m_colorMap_video_signal_type_present_flag, "colour_map_video_signal_type_present_flag" ); 647 if ( sei.m_colorMap_video_signal_type_present_flag ) 648 { 649 WRITE_FLAG( sei.m_colorMap_video_full_range_flag, "colour_map_video_full_range_flag" ); 650 WRITE_CODE( sei.m_colorMap_primaries, 8, "colour_map_primaries" ); 651 WRITE_CODE( sei.m_colorMap_transfer_characteristics, 8, "colour_map_transfer_characteristics" ); 652 WRITE_CODE( sei.m_colorMap_matrix_coeffs, 8, "colour_map_matrix_coeffs" ); 653 } 654 } 655 656 WRITE_CODE( sei.m_colour_map_coded_data_bit_depth, 5, "colour_map_coded_data_bit_depth" ); 657 WRITE_CODE( sei.m_colour_map_target_bit_depth, 5, "colour_map_target_bit_depth" ); 658 WRITE_UVLC( sei.m_colorMapModelId, "colour_map_model_id" ); 659 660 assert( sei.m_colorMapModelId == 0 ); 661 662 for( Int i=0 ; i<3 ; i++ ) 663 { 664 WRITE_CODE( sei.m_num_input_pivots[i] - 1, 8, "num_input_pivots_minus1[i]" ); 665 for( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 666 { 667 WRITE_CODE( sei.m_coded_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_input_pivot_value[i][j]" ); 668 WRITE_CODE( sei.m_target_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_input_pivot_value[i][j]" ); 669 } 670 } 671 672 WRITE_FLAG( sei.m_matrix_flag, "matrix_flag" ); 673 if( sei.m_matrix_flag ) 674 { 675 WRITE_CODE( sei.m_log2_matrix_denom, 4, "log2_matrix_denom" ); 676 for( Int i=0 ; i<3 ; i++ ) 677 { 678 for( Int j=0 ; j<3 ; j++ ) 679 { 680 WRITE_SVLC( sei.m_matrix_coef[i][j], "matrix_coef[i][j]" ); 681 } 682 } 683 } 684 685 for( Int i=0 ; i<3 ; i++ ) 686 { 687 WRITE_CODE( sei.m_num_output_pivots[i] - 1, 8, "num_output_pivots_minus1[i]" ); 688 for( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 689 { 690 WRITE_CODE( sei.m_coded_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_output_pivot_value[i][j]" ); 691 WRITE_CODE( sei.m_target_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_output_pivot_value[i][j]" ); 640 #if Q0074_COLOUR_REMAPPING_SEI 641 Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei) 642 { 643 WRITE_UVLC( sei.m_colourRemapId, "colour_remap_id" ); 644 WRITE_FLAG( sei.m_colourRemapCancelFlag, "colour_remap_cancel_flag" ); 645 if( !sei.m_colourRemapCancelFlag ) 646 { 647 WRITE_FLAG( sei.m_colourRemapPersistenceFlag, "colour_remap_persistence_flag" ); 648 WRITE_FLAG( sei.m_colourRemapVideoSignalTypePresentFlag, "colour_remap_video_signal_type_present_flag" ); 649 if ( sei.m_colourRemapVideoSignalTypePresentFlag ) 650 { 651 WRITE_FLAG( sei.m_colourRemapVideoFullRangeFlag, "colour_remap_video_full_range_flag" ); 652 WRITE_CODE( sei.m_colourRemapPrimaries, 8, "colour_remap_primaries" ); 653 WRITE_CODE( sei.m_colourRemapTransferCharacteristics, 8, "colour_remap_transfer_characteristics" ); 654 WRITE_CODE( sei.m_colourRemapMatrixCoeffs, 8, "colour_remap_matrix_coeffs" ); 655 } 656 WRITE_CODE( sei.m_colourRemapCodedDataBitDepth, 8, "colour_remap_coded_data_bit_depth" ); 657 WRITE_CODE( sei.m_colourRemapTargetBitDepth, 8, "colour_remap_target_bit_depth" ); 658 for( Int c=0 ; c<3 ; c++ ) 659 { 660 WRITE_CODE( sei.m_preLutNumValMinus1[c], 8, "pre_lut_num_val_minus1[c]" ); 661 if( sei.m_preLutNumValMinus1[c]>0 ) 662 for( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 663 { 664 WRITE_CODE( sei.m_preLutCodedValue[c][i], (( sei.m_colourRemapCodedDataBitDepth + 7 ) >> 3 ) << 3, "pre_lut_coded_value[c][i]" ); 665 WRITE_CODE( sei.m_preLutTargetValue[c][i], (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, "pre_lut_target_value[c][i]" ); 666 } 667 } 668 WRITE_FLAG( sei.m_colourRemapMatrixPresentFlag, "colour_remap_matrix_present_flag" ); 669 if( sei.m_colourRemapMatrixPresentFlag ) 670 { 671 WRITE_CODE( sei.m_log2MatrixDenom, 4, "log2_matrix_denom" ); 672 for( Int c=0 ; c<3 ; c++ ) 673 for( Int i=0 ; i<3 ; i++ ) 674 WRITE_SVLC( sei.m_colourRemapCoeffs[c][i], "colour_remap_coeffs[c][i]" ); 675 } 676 677 for( Int c=0 ; c<3 ; c++ ) 678 { 679 WRITE_CODE( sei.m_postLutNumValMinus1[c], 8, "m_postLutNumValMinus1[c]" ); 680 if( sei.m_postLutNumValMinus1[c]>0 ) 681 for( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 682 { 683 if( sei.m_preLutNumValMinus1[c]>0 || sei.m_colourRemapMatrixPresentFlag ) 684 WRITE_CODE( sei.m_postLutCodedValue[c][i], (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" ); 685 else 686 WRITE_CODE( sei.m_postLutCodedValue[c][i], (( sei.m_colourRemapCodedDataBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" ); 687 WRITE_CODE( sei.m_postLutTargetValue[c][i], (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, "post_lut_target_value[c][i]" ); 688 } 692 689 } 693 690 } -
branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.h
r846 r856 75 75 Void xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei); 76 76 #endif 77 #if Q0074_ SEI_COLOR_MAPPING78 Void xWriteSEIColo rMappingInfo(const SEIColorMappingInfo& sei);77 #if Q0074_COLOUR_REMAPPING_SEI 78 Void xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei); 79 79 #endif 80 80 Void xWriteSEISOPDescription(const SEISOPDescription& sei); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r849 r856 385 385 Int* m_kneeSEIOutputKneePoint; 386 386 #endif 387 #if Q0074_SEI_COLOR_MAPPING388 Char* m_seiColorMappingFile;389 #endif390 387 #if Q0189_TMVP_CONSTRAINTS 391 388 Int m_TMVPConstraintsSEIEnabled; 392 389 #endif 393 390 #endif //SVC_EXTENSION 391 #if Q0074_COLOUR_REMAPPING_SEI 392 Char* m_colourRemapSEIFile; ///< SEI Colour Remapping File (initialized from external file) 393 Int m_colourRemapSEIId; 394 Bool m_colourRemapSEICancelFlag; 395 Bool m_colourRemapSEIPersistenceFlag; 396 Bool m_colourRemapSEIVideoSignalTypePresentFlag; 397 Bool m_colourRemapSEIVideoFullRangeFlag; 398 Int m_colourRemapSEIPrimaries; 399 Int m_colourRemapSEITransferCharacteristics; 400 Int m_colourRemapSEIMatrixCoeffs; 401 Int m_colourRemapSEICodedDataBitDepth; 402 Int m_colourRemapSEITargetBitDepth; 403 Int m_colourRemapSEIPreLutNumValMinus1[3]; 404 Int* m_colourRemapSEIPreLutCodedValue[3]; 405 Int* m_colourRemapSEIPreLutTargetValue[3]; 406 Bool m_colourRemapSEIMatrixPresentFlag; 407 Int m_colourRemapSEILog2MatrixDenom; 408 Int m_colourRemapSEICoeffs[3][3]; 409 Int m_colourRemapSEIPostLutNumValMinus1[3]; 410 Int* m_colourRemapSEIPostLutCodedValue[3]; 411 Int* m_colourRemapSEIPostLutTargetValue[3]; 412 #endif 394 413 395 414 public: … … 684 703 Int* getKneeSEIOutputKneePoint() { return m_kneeSEIOutputKneePoint; } 685 704 #endif 686 #if Q0074_SEI_COLOR_MAPPING 687 Void setColorMappingInfoSEIFile( Char* nameFile ) { m_seiColorMappingFile = nameFile; } 688 Char* getColorMappingInfoSEIFile() { return m_seiColorMappingFile; } 705 #if Q0074_COLOUR_REMAPPING_SEI 706 Void setCRISEIFile( Char* pch ) { m_colourRemapSEIFile = pch; } 707 Char* getCRISEIFile() { return m_colourRemapSEIFile; } 708 Void setCRISEIId(Int i) { m_colourRemapSEIId = i; } 709 Int getCRISEIId() { return m_colourRemapSEIId; } 710 Void setCRISEICancelFlag(Bool b) { m_colourRemapSEICancelFlag = b; } 711 Bool getCRISEICancelFlag() { return m_colourRemapSEICancelFlag; } 712 Void setCRISEIPersistenceFlag(Bool b) { m_colourRemapSEIPersistenceFlag = b; } 713 Bool getCRISEIPersistenceFlag() { return m_colourRemapSEIPersistenceFlag; } 714 Void setCRISEIVideoSignalTypePresentFlag(Bool b) { m_colourRemapSEIVideoSignalTypePresentFlag = b; } 715 Bool getCRISEIVideoSignalTypePresentFlag() { return m_colourRemapSEIVideoSignalTypePresentFlag; } 716 Void setCRISEIVideoFullRangeFlag(Bool b) { m_colourRemapSEIVideoFullRangeFlag = b; } 717 Bool getCRISEIVideoFullRangeFlag() { return m_colourRemapSEIVideoFullRangeFlag; } 718 Void setCRISEIPrimaries(Int i) { m_colourRemapSEIPrimaries = i; } 719 Int getCRISEIPrimaries() { return m_colourRemapSEIPrimaries; } 720 Void setCRISEITransferCharacteristics(Int i) { m_colourRemapSEITransferCharacteristics = i; } 721 Int getCRISEITransferCharacteristics() { return m_colourRemapSEITransferCharacteristics; } 722 Void setCRISEIMatrixCoeffs(Int i) { m_colourRemapSEIMatrixCoeffs = i; } 723 Int getCRISEIMatrixCoeffs() { return m_colourRemapSEIMatrixCoeffs; } 724 Void setCRISEICodedDataBitDepth(Int i) { m_colourRemapSEICodedDataBitDepth = i; } 725 Int getCRISEICodedDataBitDepth() { return m_colourRemapSEICodedDataBitDepth; } 726 Void setCRISEITargetBitDepth(Int i) { m_colourRemapSEITargetBitDepth = i; } 727 Int getCRISEITargetBitDepth() { return m_colourRemapSEITargetBitDepth; } 728 Void setCRISEIPreLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutNumValMinus1[c] = i[c]; } 729 Int getCRISEIPreLutNumValMinus1(Int i) { return m_colourRemapSEIPreLutNumValMinus1[i]; } 730 Void setCRISEIPreLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutCodedValue[c] = i[c]; } 731 Int* getCRISEIPreLutCodedValue(Int i) { return m_colourRemapSEIPreLutCodedValue[i]; } 732 Void setCRISEIPreLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutTargetValue[c] = i[c]; } 733 Int* getCRISEIPreLutTargetValue(Int i) { return m_colourRemapSEIPreLutTargetValue[i]; } 734 Void setCRISEIMatrixPresentFlag(Bool b) { m_colourRemapSEIMatrixPresentFlag = b; } 735 Bool getCRISEIMatrixPresentFlag() { return m_colourRemapSEIMatrixPresentFlag; } 736 Void setCRISEILog2MatrixDenom(Int i) { m_colourRemapSEILog2MatrixDenom = i; } 737 Int getCRISEILog2MatrixDenom() { return m_colourRemapSEILog2MatrixDenom; } 738 Void setCRISEICoeffs(Int i[3][3]) { for(Int c=0 ; c<3 ; c++) for(Int j=0 ; j<3 ; j++) m_colourRemapSEICoeffs[c][j] = i[c][j]; } 739 Int* getCRISEICoeffs(Int i) { return m_colourRemapSEICoeffs[i]; } 740 Void setCRISEIPostLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutNumValMinus1[c] = i[c]; } 741 Int getCRISEIPostLutNumValMinus1(Int i) { return m_colourRemapSEIPostLutNumValMinus1[i]; } 742 Void setCRISEIPostLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutCodedValue[c] = i[c]; } 743 Int* getCRISEIPostLutCodedValue(Int i) { return m_colourRemapSEIPostLutCodedValue[i]; } 744 Void setCRISEIPostLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutTargetValue[c] = i[c]; } 745 Int* getCRISEIPostLutTargetValue(Int i) { return m_colourRemapSEIPostLutTargetValue[i]; } 689 746 #endif 690 747 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r849 r856 365 365 #endif 366 366 367 #if Q0074_ SEI_COLOR_MAPPING368 SEIColo rMappingInfo* TEncGOP::xCreateSEIColorMappingInfo( Char* file)367 #if Q0074_COLOUR_REMAPPING_SEI 368 SEIColourRemappingInfo* TEncGOP::xCreateSEIColourRemappingInfo() 369 369 { 370 SEIColorMappingInfo *seiColorMappingInfo = new SEIColorMappingInfo(); 371 372 FILE* fic = fopen( file, "r" ); 373 374 Int iVal, retval; 375 376 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMapId ); 377 retval = fscanf( fic, "%d", &iVal ); 378 seiColorMappingInfo->m_colorMapCancelFlag = iVal; 379 if( !seiColorMappingInfo->m_colorMapCancelFlag ) 380 { 381 retval = fscanf( fic, "%d", &iVal ); 382 seiColorMappingInfo->m_colorMapPersistenceFlag = iVal; 383 retval = fscanf( fic, "%d", &iVal ); 384 seiColorMappingInfo->m_colorMap_video_signal_type_present_flag = iVal; 385 if( seiColorMappingInfo->m_colorMap_video_signal_type_present_flag ) 386 { 387 retval = fscanf( fic, "%d", &iVal ); 388 seiColorMappingInfo->m_colorMap_video_full_range_flag = iVal; 389 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_primaries ); 390 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_transfer_characteristics ); 391 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_matrix_coeffs ); 392 } 393 } 394 395 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_coded_data_bit_depth ); 396 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_target_bit_depth ); 397 retval = fscanf( fic, "%d", &iVal ); 398 seiColorMappingInfo->m_colorMapModelId = iVal; 399 400 assert( seiColorMappingInfo->m_colorMapModelId == 0 ); 401 402 for( Int i=0 ; i<3 ; i++ ) 403 { 404 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_num_input_pivots[i] ); 405 seiColorMappingInfo->m_coded_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 406 seiColorMappingInfo->m_target_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 407 for( Int j=0 ; j<seiColorMappingInfo->m_num_input_pivots[i] ; j++ ) 408 { 409 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_input_pivot_value[i][j] ); 410 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_input_pivot_value[i][j] ); 411 } 412 } 413 414 retval = fscanf( fic, "%d", &iVal ); 415 seiColorMappingInfo->m_matrix_flag = iVal; 416 if( seiColorMappingInfo->m_matrix_flag ) 417 { 418 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_log2_matrix_denom ); 419 for( Int i=0 ; i<3 ; i++ ) 420 { 421 for( Int j=0 ; j<3 ; j++ ) 422 { 423 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_matrix_coef[i][j] ); 424 } 425 } 426 } 427 428 for( Int i=0 ; i<3 ; i++ ) 429 { 430 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_num_output_pivots[i] ); 431 seiColorMappingInfo->m_coded_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 432 seiColorMappingInfo->m_target_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 433 for( Int j=0 ; j<seiColorMappingInfo->m_num_output_pivots[i] ; j++ ) 434 { 435 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_output_pivot_value[i][j] ); 436 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_output_pivot_value[i][j] ); 437 } 438 } 439 440 fclose( fic ); 441 442 if( retval != 1 ) 443 { 444 printf("Error: can't read color mapping information\n"); 445 } 446 447 return seiColorMappingInfo; 370 SEIColourRemappingInfo *seiColourRemappingInfo = new SEIColourRemappingInfo(); 371 seiColourRemappingInfo->m_colourRemapId = m_pcCfg->getCRISEIId(); 372 seiColourRemappingInfo->m_colourRemapCancelFlag = m_pcCfg->getCRISEICancelFlag(); 373 if( !seiColourRemappingInfo->m_colourRemapCancelFlag ) 374 { 375 seiColourRemappingInfo->m_colourRemapPersistenceFlag = m_pcCfg->getCRISEIPersistenceFlag(); 376 seiColourRemappingInfo->m_colourRemapVideoSignalTypePresentFlag = m_pcCfg->getCRISEIVideoSignalTypePresentFlag(); 377 if( seiColourRemappingInfo->m_colourRemapVideoSignalTypePresentFlag ) 378 { 379 seiColourRemappingInfo->m_colourRemapVideoFullRangeFlag = m_pcCfg->getCRISEIVideoFullRangeFlag(); 380 seiColourRemappingInfo->m_colourRemapPrimaries = m_pcCfg->getCRISEIPrimaries(); 381 seiColourRemappingInfo->m_colourRemapTransferCharacteristics = m_pcCfg->getCRISEITransferCharacteristics(); 382 seiColourRemappingInfo->m_colourRemapMatrixCoeffs = m_pcCfg->getCRISEIMatrixCoeffs(); 383 } 384 seiColourRemappingInfo->m_colourRemapCodedDataBitDepth = m_pcCfg->getCRISEICodedDataBitDepth(); 385 seiColourRemappingInfo->m_colourRemapTargetBitDepth = m_pcCfg->getCRISEITargetBitDepth(); 386 for( Int c=0 ; c<3 ; c++ ) 387 { 388 seiColourRemappingInfo->m_preLutNumValMinus1[c] = m_pcCfg->getCRISEIPreLutNumValMinus1(c); 389 if( seiColourRemappingInfo->m_preLutNumValMinus1[c]>0 ) 390 { 391 seiColourRemappingInfo->m_preLutCodedValue[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1); 392 seiColourRemappingInfo->m_preLutTargetValue[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1); 393 for( Int i=0 ; i<=seiColourRemappingInfo->m_preLutNumValMinus1[c] ; i++) 394 { 395 seiColourRemappingInfo->m_preLutCodedValue[c][i] = (m_pcCfg->getCRISEIPreLutCodedValue(c))[i]; 396 seiColourRemappingInfo->m_preLutTargetValue[c][i] = (m_pcCfg->getCRISEIPreLutTargetValue(c))[i]; 397 } 398 } 399 } 400 seiColourRemappingInfo->m_colourRemapMatrixPresentFlag = m_pcCfg->getCRISEIMatrixPresentFlag(); 401 if( seiColourRemappingInfo->m_colourRemapMatrixPresentFlag ) 402 { 403 seiColourRemappingInfo->m_log2MatrixDenom = m_pcCfg->getCRISEILog2MatrixDenom(); 404 for( Int c=0 ; c<3 ; c++ ) 405 for( Int i=0 ; i<3 ; i++ ) 406 seiColourRemappingInfo->m_colourRemapCoeffs[c][i] = (m_pcCfg->getCRISEICoeffs(c))[i]; 407 } 408 for( Int c=0 ; c<3 ; c++ ) 409 { 410 seiColourRemappingInfo->m_postLutNumValMinus1[c] = m_pcCfg->getCRISEIPostLutNumValMinus1(c); 411 if( seiColourRemappingInfo->m_postLutNumValMinus1[c]>0 ) 412 { 413 seiColourRemappingInfo->m_postLutCodedValue[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1); 414 seiColourRemappingInfo->m_postLutTargetValue[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1); 415 for( Int i=0 ; i<=seiColourRemappingInfo->m_postLutNumValMinus1[c] ; i++) 416 { 417 seiColourRemappingInfo->m_postLutCodedValue[c][i] = (m_pcCfg->getCRISEIPostLutCodedValue(c))[i]; 418 seiColourRemappingInfo->m_postLutTargetValue[c][i] = (m_pcCfg->getCRISEIPostLutTargetValue(c))[i]; 419 } 420 } 421 } 422 } 423 return seiColourRemappingInfo; 448 424 } 449 425 #endif … … 532 508 } 533 509 #endif 534 #if Q0074_ SEI_COLOR_MAPPING535 if(m_pcCfg->getC olorMappingInfoSEIFile())536 { 537 SEIColo rMappingInfo *sei = xCreateSEIColorMappingInfo( m_pcCfg->getColorMappingInfoSEIFile());510 #if Q0074_COLOUR_REMAPPING_SEI 511 if(m_pcCfg->getCRISEIFile()) 512 { 513 SEIColourRemappingInfo *sei = xCreateSEIColourRemappingInfo (); 538 514 539 515 #if SVC_EXTENSION 540 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_layerId); // temporalId = 0 ?516 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, sps->getLayerId()); // SEI-CRI is applied per layer 541 517 #else 542 518 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
r823 r856 225 225 SEIKneeFunctionInfo* xCreateSEIKneeFunctionInfo(); 226 226 #endif 227 #if Q0074_ SEI_COLOR_MAPPING228 SEIColo rMappingInfo* xCreateSEIColorMappingInfo( Char* file);227 #if Q0074_COLOUR_REMAPPING_SEI 228 SEIColourRemappingInfo* xCreateSEIColourRemappingInfo(); 229 229 #endif 230 230
Note: See TracChangeset for help on using the changeset viewer.