Changeset 1089 in SHVCSoftware for branches/SHM-dev/source
- Timestamp:
- 25 Jun 2015, 16:19:05 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.cpp
r1057 r1089 136 136 #endif 137 137 #if Q0074_COLOUR_REMAPPING_SEI 138 ("SEIColourRemappingInfo ", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n"138 ("SEIColourRemappingInfo,-cri", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n" 139 139 "\t1: apply colour remapping on decoded pictures if available in the bitstream\n" 140 140 "\t0: ignore SEI message") -
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
r1077 r1089 56 56 //! \{ 57 57 58 #if Q0074_COLOUR_REMAPPING_SEI 59 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 ); 60 static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI 61 static SEIColourRemappingInfo *seiColourRemappingInfoPrevious=NULL ; 62 #endif 63 58 64 // ==================================================================================================================== 59 65 // Constructor / destructor / initialization / destroy … … 112 118 free (m_pchReconFile); 113 119 m_pchReconFile = NULL; 120 } 121 #endif 122 #if Q0074_COLOUR_REMAPPING_SEI 123 if (seiColourRemappingInfoPrevious != NULL) 124 { 125 delete seiColourRemappingInfoPrevious; 114 126 } 115 127 #endif … … 657 669 m_acTDecTop[layer].init(); 658 670 m_acTDecTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 659 #if Q0074_COLOUR_REMAPPING_SEI660 m_acTDecTop[layer].setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);661 #endif662 671 #if FIX_CONF_MODE 663 672 m_acTDecTop[layer].setNumLayer( MAX_LAYERS ); … … 690 699 m_cTDecTop.setDecodedSEIMessageOutputStream(&os); 691 700 } 692 #if Q0074_COLOUR_REMAPPING_SEI693 m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);694 #endif695 701 #endif 696 702 } … … 958 964 } 959 965 966 #if Q0074_COLOUR_REMAPPING_SEI 967 if (m_colourRemapSEIEnabled) 968 { 969 SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 970 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 971 if (colourRemappingInfo.size() > 1) 972 { 973 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 974 } 975 if (seiColourRemappingInfo) 976 { 977 applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfo); 978 } 979 else // using the last CRI SEI received 980 { 981 const SEIColourRemappingInfo *seiColourRemappingInfoCopy; 982 seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious; 983 applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfoCopy); 984 } 985 986 // save the last CRI SEI received 987 if( seiColourRemappingInfo != NULL){ 988 if (seiColourRemappingInfoPrevious != NULL) 989 { 990 delete seiColourRemappingInfoPrevious; 991 seiColourRemappingInfoPrevious = NULL; 992 } 993 if (seiColourRemappingInfo->m_colourRemapPersistenceFlag) 994 { 995 seiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 996 seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo); 997 } 998 } 999 } 1000 #endif 1001 960 1002 // update POC of display order 961 1003 m_iPOCLastDisplay = pcPic->getPOC(); … … 1161 1203 } 1162 1204 1205 #if Q0074_COLOUR_REMAPPING_SEI 1206 if (m_colourRemapSEIEnabled) 1207 { 1208 SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 1209 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 1210 if (colourRemappingInfo.size() > 1) 1211 { 1212 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 1213 } 1214 if (seiColourRemappingInfo) 1215 { 1216 applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfo); 1217 } 1218 else // using the last CRI SEI received 1219 { 1220 const SEIColourRemappingInfo *seiColourRemappingInfoCopy; 1221 seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious; 1222 applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfoCopy); 1223 } 1224 1225 // save the last CRI SEI received 1226 if( seiColourRemappingInfo != NULL){ 1227 if (seiColourRemappingInfoPrevious != NULL) 1228 { 1229 delete seiColourRemappingInfoPrevious; 1230 seiColourRemappingInfoPrevious = NULL; 1231 } 1232 if (seiColourRemappingInfo->m_colourRemapPersistenceFlag) 1233 { 1234 seiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 1235 seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo); 1236 } 1237 } 1238 } 1239 #endif 1240 1163 1241 // update POC of display order 1164 1242 m_iPOCLastDisplay = pcPic->getPOC(); … … 1247 1325 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 1248 1326 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 1327 1328 #if Q0074_COLOUR_REMAPPING_SEI 1329 if (m_colourRemapSEIEnabled) 1330 { 1331 SEIMessages colourRemappingInfo = getSeisByType(pic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 1332 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 1333 if (colourRemappingInfo.size() > 1) 1334 { 1335 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 1336 } 1337 1338 if (seiColourRemappingInfo) 1339 { 1340 //printf ("\n\nColour Remapping is applied to POC : %d and LayerId : %d ",pic->getPOC(), pic->getLayerId()); 1341 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo 1342 #if SVC_EXTENSION 1343 , pic->getLayerId() 1344 #endif 1345 ); 1346 } 1347 else // using the last CRI SEI received 1348 { 1349 const SEIColourRemappingInfo *seiColourRemappingInfoCopy; 1350 seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious; 1351 applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy 1352 #if SVC_EXTENSION 1353 , pic->getLayerId() 1354 #endif 1355 ); 1356 } 1357 1358 // save the last CRI SEI received 1359 if( seiColourRemappingInfo != NULL){ 1360 if (seiColourRemappingInfoPrevious != NULL) 1361 { 1362 delete seiColourRemappingInfoPrevious; 1363 seiColourRemappingInfoPrevious = NULL; 1364 } 1365 if (seiColourRemappingInfo->m_colourRemapPersistenceFlag) 1366 { 1367 seiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 1368 seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo); 1369 } 1370 } 1371 } 1372 1373 #endif 1249 1374 } 1250 1375 // update POC of display order … … 1860 1985 #endif 1861 1986 #endif 1987 1988 #if Q0074_COLOUR_REMAPPING_SEI 1989 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI ) 1990 { 1991 for ( Int c=0 ; c<3 ; c++ ) 1992 { 1993 Int bitDepth = c ? bitDepthC : bitDepthY ; 1994 preLut[c].resize(1 << bitDepth); 1995 postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth); 1996 1997 Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth; 1998 Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth) 1999 if( bitDepthDiff<0 ) 2000 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth); 2001 bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth; 2002 Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth) 2003 if( bitDepthDiff<0 ) 2004 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth); 2005 2006 //Fill preLut 2007 for ( Int k=0 ; k<(1<<bitDepth) ; k++ ) 2008 { 2009 Int iSample = k << iShift1 ; 2010 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ ) 2011 { 2012 Int iCodedPrev = pCriSEI->m_preLutCodedValue[c][iPivot] << iShift2; //Coded in CRInputBitdepth 2013 Int iCodedNext = pCriSEI->m_preLutCodedValue[c][iPivot+1] << iShift2; //Coded in CRInputBitdepth 2014 Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot]; //Coded in CRBitdepth 2015 Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth 2016 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 2017 { 2018 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev); 2019 preLut[c][k] = (Int)( 0.5f + fInterpol ); 2020 iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1; 2021 } 2022 } 2023 } 2024 2025 //Fill postLut 2026 for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ ) 2027 { 2028 Int iSample = k; 2029 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ ) 2030 { 2031 Int iCodedPrev = pCriSEI->m_postLutCodedValue[c][iPivot]; //Coded in CRBitdepth 2032 Int iCodedNext = pCriSEI->m_postLutCodedValue[c][iPivot+1]; //Coded in CRBitdepth 2033 Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot]; //Coded in CRBitdepth 2034 Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth 2035 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 2036 { 2037 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ; 2038 postLut[c][k] = (Int)( 0.5f + fInterpol ); 2039 iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1; 2040 } 2041 } 2042 } 2043 } 2044 } 2045 2046 static void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId ) 2047 { 2048 if( !storeCriSEI.size() ) 2049 #if SVC_EXTENSION 2050 storeCriSEI.resize(MAX_LAYERS); 2051 #else 2052 storeCriSEI.resize(1); 2053 #endif 2054 2055 if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management) 2056 storeCriSEI[layerId] = *pCriSEI; 2057 2058 if( !storeCriSEI[layerId].m_colourRemapCancelFlag && pCriSEI) 2059 { 2060 Int iHeight = pic.getHeight(COMPONENT_Y); 2061 Int iWidth = pic.getWidth(COMPONENT_Y); 2062 Int iStride = pic.getStride(COMPONENT_Y); 2063 Int iCStride = pic.getStride(COMPONENT_Cb); 2064 2065 Pel *YUVIn[3], *YUVOut[3]; 2066 YUVIn[0] = pic.getAddr(COMPONENT_Y); 2067 YUVIn[1] = pic.getAddr(COMPONENT_Cb); 2068 YUVIn[2] = pic.getAddr(COMPONENT_Cr); 2069 2070 TComPicYuv picColourRemapped; 2071 #if SVC_EXTENSION 2072 #if AUXILIARY_PICTURES 2073 picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 2074 #else 2075 picColourRemapped.create( pic.getWidth(), pic.getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 2076 #endif 2077 #else 2078 picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 2079 #endif 2080 YUVOut[0] = picColourRemapped.getAddr(COMPONENT_Y); 2081 YUVOut[1] = picColourRemapped.getAddr(COMPONENT_Cb); 2082 YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr); 2083 2084 #if SVC_EXTENSION 2085 Int bitDepthY = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId]; 2086 Int bitDepthC = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId]; 2087 2088 #else 2089 Int bitDepthY = g_bitDepth[CHANNEL_TYPE_LUMA]; 2090 Int bitDepthC = g_bitDepth[CHANNEL_TYPE_CHROMA]; 2091 #endif 2092 2093 std::vector<Int> preLut[3]; 2094 std::vector<Int> postLut[3]; 2095 xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] ); 2096 2097 Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1)); 2098 2099 for( Int y = 0; y < iHeight ; y++ ) 2100 { 2101 for( Int x = 0; x < iWidth ; x++ ) 2102 { 2103 Int YUVPre[3], YUVMat[3]; 2104 YUVPre[0] = preLut[0][ YUVIn[0][x] ]; 2105 YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ]; 2106 YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ]; 2107 2108 YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0] 2109 + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1] 2110 + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2] 2111 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 2112 YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] ); 2113 YUVOut[0][x] = postLut[0][ YUVMat[0] ]; 2114 2115 if( (y&1) && (x&1) ) 2116 { 2117 for(Int c=1 ; c<3 ; c++) 2118 { 2119 YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0] 2120 + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1] 2121 + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2] 2122 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 2123 YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] ); 2124 YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ]; 2125 } 2126 } 2127 } 2128 YUVIn[0] += iStride; 2129 YUVOut[0] += iStride; 2130 if( y&1 ) 2131 { 2132 YUVIn[1] += iCStride; 2133 YUVIn[2] += iCStride; 2134 YUVOut[1] += iCStride; 2135 YUVOut[2] += iCStride; 2136 } 2137 } 2138 2139 //Write remapped picture in decoding order 2140 Char cTemp[255]; 2141 sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth ); 2142 picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth ); 2143 2144 picColourRemapped.destroy(); 2145 2146 storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence 2147 } 2148 else 2149 { 2150 //Write no remapped picture in decoding order 2151 if (storeCriSEI[layerId].m_colourRemapBitDepth == 8 || storeCriSEI[layerId].m_colourRemapBitDepth == 10) 2152 { 2153 Char cTemp[255]; 2154 sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), storeCriSEI[layerId].m_colourRemapBitDepth ); 2155 pic.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth ); 2156 } 2157 } 2158 } 2159 #endif 1862 2160 //! \} -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1087 r1089 146 146 m_codedPivotValue = NULL; 147 147 m_targetPivotValue = NULL; 148 #if Q0074_COLOUR_REMAPPING_SEI149 for( Int c=0 ; c<3 ; c++)150 {151 m_colourRemapSEIPreLutCodedValue[c] = NULL;152 m_colourRemapSEIPreLutTargetValue[c] = NULL;153 m_colourRemapSEIPostLutCodedValue[c] = NULL;154 m_colourRemapSEIPostLutTargetValue[c] = NULL;155 }156 #endif157 148 } 158 149 #endif … … 193 184 free(m_pchReconFile); 194 185 free(m_pchdQPFile); 195 #if Q0074_COLOUR_REMAPPING_SEI196 for( Int c=0 ; c<3 ; c++)197 {198 if ( m_colourRemapSEIPreLutCodedValue[c] )199 {200 delete[] m_colourRemapSEIPreLutCodedValue[c];201 }202 if ( m_colourRemapSEIPreLutTargetValue[c] )203 {204 delete[] m_colourRemapSEIPreLutTargetValue[c];205 }206 if ( m_colourRemapSEIPostLutCodedValue[c] )207 {208 delete[] m_colourRemapSEIPostLutCodedValue[c];209 }210 if ( m_colourRemapSEIPostLutTargetValue[c] )211 {212 delete[] m_colourRemapSEIPostLutTargetValue[c];213 }214 }215 #endif216 186 #endif 217 187 free(m_scalingListFile); … … 885 855 Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; 886 856 #if Q0074_COLOUR_REMAPPING_SEI 887 string* cfg_colourRemapSEIFile [MAX_LAYERS];857 string* cfg_colourRemapSEIFileRoot[MAX_LAYERS]; 888 858 #endif 889 859 Int* cfg_waveFrontSynchro[MAX_LAYERS]; … … 907 877 cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; 908 878 #if Q0074_COLOUR_REMAPPING_SEI 909 cfg_colourRemapSEIFile [layer] = &m_acLayerCfg[layer].m_colourRemapSEIFile;879 cfg_colourRemapSEIFileRoot[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFileRoot; 910 880 #endif 911 881 #if REPN_FORMAT_IN_VPS … … 1040 1010 string cfg_dQPFile; 1041 1011 #if Q0074_COLOUR_REMAPPING_SEI 1042 string cfg_colourRemapSEIFile ;1012 string cfg_colourRemapSEIFileRoot; 1043 1013 #endif 1044 1014 #endif //SVC_EXTENSION … … 1218 1188 #endif 1219 1189 #if Q0074_COLOUR_REMAPPING_SEI 1220 ("SEIColourRemappingInfoFile %d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")1190 ("SEIColourRemappingInfoFileRoot%d", cfg_colourRemapSEIFileRoot, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d") 1221 1191 #endif 1222 1192 #if O0194_DIFFERENT_BITDEPTH_EL_BL … … 1293 1263 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 1294 1264 #if Q0074_COLOUR_REMAPPING_SEI 1295 ("SEIColourRemappingInfoFile ", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")1265 ("SEIColourRemappingInfoFileRoot", cfg_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters file name") 1296 1266 #endif 1297 1267 #endif //SVC_EXTENSION … … 1869 1839 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 1870 1840 #if Q0074_COLOUR_REMAPPING_SEI 1871 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str());1841 m_colourRemapSEIFileRoot = cfg_colourRemapSEIFileRoot.empty() ? NULL : strdup(cfg_colourRemapSEIFileRoot.c_str()); 1872 1842 #endif 1873 1843 #endif //SVC_EXTENSION … … 3029 2999 } 3030 3000 #endif 3031 #if Q0074_COLOUR_REMAPPING_SEI 3032 #if !SVC_EXTENSION 3033 // reading external Colour Remapping Information SEI message parameters from file 3034 if( m_colourRemapSEIFile ) 3035 { 3036 FILE* fic; 3037 Int retval; 3038 if((fic = fopen(m_colourRemapSEIFile,"r")) == (FILE*)NULL) 3039 { 3040 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile); 3041 exit(EXIT_FAILURE); 3042 } 3043 3044 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 3045 retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag ); 3046 if( !m_colourRemapSEICancelFlag ) 3047 { 3048 retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag ); 3049 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalInfoPresentFlag); 3050 if( m_colourRemapSEIVideoSignalInfoPresentFlag ) 3051 { 3052 retval = fscanf( fic, "%d", &m_colourRemapSEIFullRangeFlag ); 3053 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 3054 retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction ); 3055 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients ); 3056 } 3057 3058 retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth ); 3059 retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth ); 3060 3061 for( Int c=0 ; c<3 ; c++ ) 3062 { 3063 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 3064 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 3065 { 3066 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 3067 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 3068 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 3069 { 3070 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 3071 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 3072 } 3073 } 3074 } 3075 3076 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag ); 3077 if( m_colourRemapSEIMatrixPresentFlag ) 3078 { 3079 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 3080 for( Int c=0 ; c<3 ; c++ ) 3081 for( Int i=0 ; i<3 ; i++ ) 3082 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 3083 } 3084 3085 for( Int c=0 ; c<3 ; c++ ) 3086 { 3087 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 3088 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 3089 { 3090 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 3091 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 3092 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 3093 { 3094 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 3095 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 3096 } 3097 } 3098 } 3099 } 3100 3101 fclose( fic ); 3102 if( retval != 1 ) 3103 { 3104 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 3105 exit(EXIT_FAILURE); 3106 } 3107 } 3108 #else 3109 // Reading external Colour Remapping Information SEI message parameters from file 3110 // It seems that TAppEncLayerCfg::parseCfg is not used 3111 for(UInt layer = 0; layer < m_numLayers; layer++) 3112 { 3113 if( cfg_colourRemapSEIFile[layer]->length() ) 3114 { 3115 FILE* fic; 3116 Int retval; 3117 if((fic = fopen(cfg_colourRemapSEIFile[layer]->c_str(),"r")) == (FILE*)NULL) 3118 { 3119 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", cfg_colourRemapSEIFile[layer]->c_str()); 3120 exit(EXIT_FAILURE); 3121 } 3122 Int tempCode; 3123 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIId ); 3124 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEICancelFlag = tempCode ? 1 : 0; 3125 if( !m_acLayerCfg[layer].m_colourRemapSEICancelFlag ) 3126 { 3127 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0; 3128 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0; 3129 if( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ) 3130 { 3131 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0; 3132 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 3133 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); 3134 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); 3135 } 3136 3137 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); 3138 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); 3139 3140 for( Int c=0 ; c<3 ; c++ ) 3141 { 3142 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ); 3143 if( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 3144 { 3145 m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 3146 m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 3147 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 3148 { 3149 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c][i] ); 3150 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c][i] ); 3151 } 3152 } 3153 } 3154 3155 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0; 3156 if( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ) 3157 { 3158 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 3159 for( Int c=0 ; c<3 ; c++ ) 3160 for( Int i=0 ; i<3 ; i++ ) 3161 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICoeffs[c][i] ); 3162 } 3163 3164 for( Int c=0 ; c<3 ; c++ ) 3165 { 3166 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ); 3167 if( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 3168 { 3169 m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 3170 m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 3171 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 3172 { 3173 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c][i] ); 3174 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c][i] ); 3175 } 3176 } 3177 } 3178 } 3179 3180 fclose( fic ); 3181 if( retval != 1 ) 3182 { 3183 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 3184 exit(EXIT_FAILURE); 3185 } 3186 } 3187 } 3188 #endif 3189 #endif 3001 3190 3002 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3191 3003 if (m_interLayerConstrainedTileSetsSEIEnabled) … … 4523 4335 } 4524 4336 #endif 4525 #if Q0074_COLOUR_REMAPPING_SEI4526 #if !SVC_EXTENSION4527 if ( m_colourRemapSEIFile && !m_colourRemapSEICancelFlag )4528 {4529 xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");4530 xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive");4531 for( Int c=0 ; c<3 ; c++)4532 {4533 xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");4534 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )4535 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++)4536 {4537 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive");4538 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");4539 }4540 xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");4541 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )4542 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++)4543 {4544 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");4545 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");4546 }4547 }4548 if ( m_colourRemapSEIMatrixPresentFlag )4549 {4550 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive");4551 for( Int c=0 ; c<3 ; c++)4552 for( Int i=0 ; i<3 ; i++)4553 xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive");4554 }4555 }4556 #endif4557 #endif4558 4337 4559 4338 #if RC_SHVC_HARMONIZATION -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1057 r1089 462 462 #if Q0074_COLOUR_REMAPPING_SEI 463 463 #if !SVC_EXTENSION 464 Char* m_colourRemapSEIFile; 465 Int m_colourRemapSEIId; 466 Bool m_colourRemapSEICancelFlag; 467 Bool m_colourRemapSEIPersistenceFlag; 468 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 469 Bool m_colourRemapSEIFullRangeFlag; 470 Int m_colourRemapSEIPrimaries; 471 Int m_colourRemapSEITransferFunction; 472 Int m_colourRemapSEIMatrixCoefficients; 473 Int m_colourRemapSEIInputBitDepth; 474 Int m_colourRemapSEIBitDepth; 475 Int m_colourRemapSEIPreLutNumValMinus1[3]; 476 Int* m_colourRemapSEIPreLutCodedValue[3]; 477 Int* m_colourRemapSEIPreLutTargetValue[3]; 478 Bool m_colourRemapSEIMatrixPresentFlag; 479 Int m_colourRemapSEILog2MatrixDenom; 480 Int m_colourRemapSEICoeffs[3][3]; 481 Int m_colourRemapSEIPostLutNumValMinus1[3]; 482 Int* m_colourRemapSEIPostLutCodedValue[3]; 483 Int* m_colourRemapSEIPostLutTargetValue[3]; 464 string m_colourRemapSEIFileRoot; 484 465 #endif 485 466 #endif -
branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r1030 r1089 50 50 #endif 51 51 #if Q0074_COLOUR_REMAPPING_SEI 52 , m_colourRemapSEIFile (string(""))52 , m_colourRemapSEIFileRoot(string("")) 53 53 #endif 54 54 { … … 149 149 #endif 150 150 #if Q0074_COLOUR_REMAPPING_SEI 151 string cfg_colourRemapSEIFile;151 string cfg_colourRemapSEIFileRoot; 152 152 #endif 153 153 … … 181 181 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") 182 182 #if Q0074_COLOUR_REMAPPING_SEI 183 ("SEIColourRemappingInfoFile ", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")183 ("SEIColourRemappingInfoFileRoot", cfg_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters file name") 184 184 #endif 185 185 ; … … 196 196 #endif 197 197 #if Q0074_COLOUR_REMAPPING_SEI 198 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str());198 m_colourRemapSEIFileRoot = cfg_colourRemapSEIFileRoot.empty() ? NULL : strdup(cfg_colourRemapSEIFileRoot.c_str()); 199 199 #endif 200 200 … … 216 216 } 217 217 } 218 219 #if Q0074_COLOUR_REMAPPING_SEI220 if( m_colourRemapSEIFile.size() > 0 )221 {222 FILE* fic;223 Int retval;224 if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL)225 {226 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str());227 exit(EXIT_FAILURE);228 }229 230 Int tempCode;231 retval = fscanf( fic, "%d", &m_colourRemapSEIId );232 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEICancelFlag = tempCode ? 1 : 0;233 if( !m_colourRemapSEICancelFlag )234 {235 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0;236 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0;237 if( m_colourRemapSEIVideoSignalInfoPresentFlag )238 {239 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0;240 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries );241 retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction );242 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients );243 }244 245 retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth );246 retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth );247 248 for( Int c=0 ; c<3 ; c++ )249 {250 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] );251 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )252 {253 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];254 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1];255 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ )256 {257 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] );258 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] );259 }260 }261 }262 263 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0;264 if( m_colourRemapSEIMatrixPresentFlag )265 {266 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom );267 for( Int c=0 ; c<3 ; c++ )268 for( Int i=0 ; i<3 ; i++ )269 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] );270 }271 272 for( Int c=0 ; c<3 ; c++ )273 {274 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] );275 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )276 {277 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];278 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1];279 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ )280 {281 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] );282 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] );283 }284 }285 }286 }287 288 fclose( fic );289 if( retval != 1 )290 {291 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n");292 exit(EXIT_FAILURE);293 }294 }295 #endif296 218 297 219 return true; … … 560 482 } 561 483 #endif 562 #if Q0074_COLOUR_REMAPPING_SEI563 if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag )564 {565 xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");566 xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive");567 for( Int c=0 ; c<3 ; c++)568 {569 xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");570 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 )571 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++)572 {573 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive");574 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");575 }576 xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive");577 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 )578 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++)579 {580 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");581 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive");582 }583 }584 if( m_colourRemapSEIMatrixPresentFlag )585 {586 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive");587 for( Int c=0 ; c<3 ; c++)588 for( Int i=0 ; i<3 ; i++)589 xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive");590 }591 }592 #endif593 484 594 485 #undef xConfirmPara -
branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r1057 r1089 132 132 #endif 133 133 #if Q0074_COLOUR_REMAPPING_SEI 134 string m_colourRemapSEIFile ; ///< Colour Remapping Information SEI message parameters file134 string m_colourRemapSEIFileRoot; ///< Colour Remapping Information SEI message parameters file 135 135 Int m_colourRemapSEIId; 136 136 Bool m_colourRemapSEICancelFlag; -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1085 r1089 675 675 #endif 676 676 #if Q0074_COLOUR_REMAPPING_SEI 677 m_acTEncTop[layer].setCRISEIFile ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) ); 678 m_acTEncTop[layer].setCRISEIId ( m_acLayerCfg[layer].m_colourRemapSEIId ); 679 m_acTEncTop[layer].setCRISEICancelFlag ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag ); 680 m_acTEncTop[layer].setCRISEIPersistenceFlag ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag ); 681 m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ); 682 m_acTEncTop[layer].setCRISEIFullRangeFlag ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag ); 683 m_acTEncTop[layer].setCRISEIPrimaries ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 684 m_acTEncTop[layer].setCRISEITransferFunction ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); 685 m_acTEncTop[layer].setCRISEIMatrixCoefficients ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); 686 m_acTEncTop[layer].setCRISEIInputBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); 687 m_acTEncTop[layer].setCRISEIBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); 688 m_acTEncTop[layer].setCRISEIPreLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 ); 689 m_acTEncTop[layer].setCRISEIPreLutCodedValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue ); 690 m_acTEncTop[layer].setCRISEIPreLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue ); 691 m_acTEncTop[layer].setCRISEIMatrixPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ); 692 m_acTEncTop[layer].setCRISEILog2MatrixDenom ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 693 m_acTEncTop[layer].setCRISEICoeffs ( m_acLayerCfg[layer].m_colourRemapSEICoeffs ); 694 m_acTEncTop[layer].setCRISEIPostLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 ); 695 m_acTEncTop[layer].setCRISEIPostLutCodedValue ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue ); 696 m_acTEncTop[layer].setCRISEIPostLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue ); 677 m_acTEncTop[layer].setCRISEIFileRoot ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFileRoot.c_str()) ); 697 678 #endif 698 679 #if LAYERS_NOT_PRESENT_SEI … … 1097 1078 m_cTEncTop.setMasteringDisplaySEI ( m_masteringDisplay ); 1098 1079 #if Q0074_COLOUR_REMAPPING_SEI 1099 m_cTEncTop.setCRISEIFile ( m_colourRemapSEIFile ); 1100 m_cTEncTop.setCRISEIId ( m_colourRemapSEIId ); 1101 m_cTEncTop.setCRISEICancelFlag ( m_colourRemapSEICancelFlag ); 1102 m_cTEncTop.setCRISEIPersistenceFlag ( m_colourRemapSEIPersistenceFlag ); 1103 m_cTEncTop.setCRISEIVideoSignalInfoPresentFlag ( m_colourRemapSEIVideoSignalInfoPresentFlag ); 1104 m_cTEncTop.setCRISEIFullRangeFlag ( m_colourRemapSEIFullRangeFlag ); 1105 m_cTEncTop.setCRISEIPrimaries ( m_colourRemapSEIPrimaries ); 1106 m_cTEncTop.setCRISEITransferFunction ( m_colourRemapSEITransferFunction ); 1107 m_cTEncTop.setCRISEIMatrixCoefficients ( m_colourRemapSEIMatrixCoefficients ); 1108 m_cTEncTop.setCRISEIInputBitDepth ( m_colourRemapSEIInputBitDepth ); 1109 m_cTEncTop.setCRISEIBitDepth ( m_colourRemapSEIBitDepth ); 1110 m_cTEncTop.setCRISEIPreLutNumValMinus1 ( m_colourRemapSEIPreLutNumValMinus1 ); 1111 m_cTEncTop.setCRISEIPreLutCodedValue ( m_colourRemapSEIPreLutCodedValue ); 1112 m_cTEncTop.setCRISEIPreLutTargetValue ( m_colourRemapSEIPreLutTargetValue ); 1113 m_cTEncTop.setCRISEIMatrixPresentFlag ( m_colourRemapSEIMatrixPresentFlag ); 1114 m_cTEncTop.setCRISEILog2MatrixDenom ( m_colourRemapSEILog2MatrixDenom ); 1115 m_cTEncTop.setCRISEICoeffs ( m_colourRemapSEICoeffs ); 1116 m_cTEncTop.setCRISEIPostLutNumValMinus1 ( m_colourRemapSEIPostLutNumValMinus1 ); 1117 m_cTEncTop.setCRISEIPostLutCodedValue ( m_colourRemapSEIPostLutCodedValue ); 1118 m_cTEncTop.setCRISEIPostLutTargetValue ( m_colourRemapSEIPostLutTargetValue ); 1080 m_cTEncTop.setCRISEIFileRoot ( const_cast<Char*>(m_colourRemapSEIFileRoot.c_str()) ); 1119 1081 #endif 1120 1082 #if LAYERS_NOT_PRESENT_SEI -
branches/SHM-dev/source/Lib/TLibCommon/SEI.cpp
r1037 r1089 169 169 } 170 170 } 171 172 #if Q0074_COLOUR_REMAPPING_SEI 173 Void SEIColourRemappingInfo::copyFrom( SEIColourRemappingInfo const * SeiCriInput) 174 { 175 m_colourRemapId = SeiCriInput->m_colourRemapId; 176 m_colourRemapCancelFlag = SeiCriInput->m_colourRemapCancelFlag; 177 m_colourRemapPersistenceFlag = SeiCriInput->m_colourRemapPersistenceFlag; 178 m_colourRemapVideoSignalInfoPresentFlag = SeiCriInput->m_colourRemapVideoSignalInfoPresentFlag; 179 m_colourRemapFullRangeFlag = SeiCriInput->m_colourRemapFullRangeFlag; 180 m_colourRemapPrimaries = SeiCriInput->m_colourRemapPrimaries; 181 m_colourRemapTransferFunction = SeiCriInput->m_colourRemapTransferFunction; 182 m_colourRemapMatrixCoefficients = SeiCriInput->m_colourRemapMatrixCoefficients; 183 m_colourRemapInputBitDepth = SeiCriInput->m_colourRemapInputBitDepth; 184 m_colourRemapBitDepth = SeiCriInput->m_colourRemapBitDepth; 185 186 for( Int c=0 ; c<3 ; c++ ) 187 { 188 m_preLutNumValMinus1[c] = SeiCriInput->m_preLutNumValMinus1[c]; 189 m_preLutCodedValue[c].resize(m_preLutNumValMinus1[c]+1); 190 m_preLutTargetValue[c].resize(m_preLutNumValMinus1[c]+1); 191 for ( Int i=0 ; i <= SeiCriInput->m_preLutNumValMinus1[c] ; i++ ) 192 { 193 m_preLutCodedValue[c][i] = SeiCriInput->m_preLutCodedValue[c][i]; 194 m_preLutTargetValue[c][i] = SeiCriInput->m_preLutTargetValue[c][i]; 195 } 196 } 197 198 m_colourRemapMatrixPresentFlag = SeiCriInput->m_colourRemapMatrixPresentFlag; 199 m_log2MatrixDenom = SeiCriInput->m_log2MatrixDenom; 200 201 for ( Int c=0 ; c<3 ; c++ ) 202 for ( Int i=0 ; i<3 ; i++ ) 203 m_colourRemapCoeffs[c][i] = SeiCriInput->m_colourRemapCoeffs[c][i]; 204 205 for( Int c=0 ; c<3 ; c++ ) 206 { 207 m_postLutNumValMinus1[c] = SeiCriInput->m_postLutNumValMinus1[c]; 208 m_postLutCodedValue[c].resize(m_postLutNumValMinus1[c]+1); 209 m_postLutTargetValue[c].resize(m_postLutNumValMinus1[c]+1); 210 for ( Int i=0 ; i <= m_postLutNumValMinus1[c] ; i++ ) 211 { 212 m_postLutCodedValue[c][i] = SeiCriInput->m_postLutCodedValue[c][i]; 213 m_postLutTargetValue[c][i] = SeiCriInput->m_postLutTargetValue[c][i]; 214 } 215 } 216 } 217 #endif -
branches/SHM-dev/source/Lib/TLibCommon/SEI.h
r1070 r1089 766 766 SEIColourRemappingInfo() {} 767 767 ~SEIColourRemappingInfo() {} 768 769 Void copyFrom( SEIColourRemappingInfo const * SeiCriInput); 768 770 769 771 Int m_colourRemapId; -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r1031 r1089 313 313 for (Int x = 0; x < width; x++ ) 314 314 { 315 Pel pix = Clip3<Pel>(0, (1 << bitDepth)-1, (pi[x]+offset)>>shift);315 Pel pix = pi[x]; 316 316 317 317 UChar uc = pix & 0xff; -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
r1049 r1089 64 64 //! \{ 65 65 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI); 66 #if Q0074_COLOUR_REMAPPING_SEI67 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 );68 static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI69 #endif70 66 // ==================================================================================================================== 71 67 // Constructor / destructor / initialization / destroy … … 258 254 thisLayerBuffer->push_back(*pcPic); 259 255 std::sort( thisLayerBuffer->begin(), thisLayerBuffer->end(), pocCompareFunction ); 260 }261 #endif262 #if Q0074_COLOUR_REMAPPING_SEI263 if (m_colourRemapSEIEnabled)264 {265 SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );266 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;267 if (colourRemappingInfo.size() > 1)268 {269 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");270 }271 applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfo272 #if SVC_EXTENSION273 , pcPic->getLayerId()274 #endif275 );276 256 } 277 257 #endif … … 354 334 } 355 335 356 #if Q0074_COLOUR_REMAPPING_SEI357 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )358 {359 for ( Int c=0 ; c<3 ; c++ )360 {361 Int bitDepth = c ? bitDepthC : bitDepthY ;362 preLut[c].resize(1 << bitDepth);363 postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth);364 365 Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth;366 Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth)367 if( bitDepthDiff<0 )368 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth);369 bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth;370 Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth)371 if( bitDepthDiff<0 )372 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth);373 374 //Fill preLut375 for ( Int k=0 ; k<(1<<bitDepth) ; k++ )376 {377 Int iSample = k << iShift1 ;378 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ )379 {380 Int iCodedPrev = pCriSEI->m_preLutCodedValue[c][iPivot] << iShift2; //Coded in CRInputBitdepth381 Int iCodedNext = pCriSEI->m_preLutCodedValue[c][iPivot+1] << iShift2; //Coded in CRInputBitdepth382 Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot]; //Coded in CRBitdepth383 Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth384 if ( iCodedPrev <= iSample && iSample <= iCodedNext )385 {386 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev);387 preLut[c][k] = (Int)( 0.5f + fInterpol );388 iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1;389 }390 }391 }392 393 //Fill postLut394 for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ )395 {396 Int iSample = k;397 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ )398 {399 Int iCodedPrev = pCriSEI->m_postLutCodedValue[c][iPivot]; //Coded in CRBitdepth400 Int iCodedNext = pCriSEI->m_postLutCodedValue[c][iPivot+1]; //Coded in CRBitdepth401 Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot]; //Coded in CRBitdepth402 Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth403 if ( iCodedPrev <= iSample && iSample <= iCodedNext )404 {405 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ;406 postLut[c][k] = (Int)( 0.5f + fInterpol );407 iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1;408 }409 }410 }411 }412 }413 414 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId )415 {416 if( !storeCriSEI.size() )417 #if SVC_EXTENSION418 storeCriSEI.resize(MAX_LAYERS);419 #else420 storeCriSEI.resize(1);421 #endif422 423 if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management)424 storeCriSEI[layerId] = *pCriSEI;425 426 if( !storeCriSEI[layerId].m_colourRemapCancelFlag )427 {428 Int iHeight = pic.getHeight(COMPONENT_Y);429 Int iWidth = pic.getWidth(COMPONENT_Y);430 Int iStride = pic.getStride(COMPONENT_Y);431 Int iCStride = pic.getStride(COMPONENT_Cb);432 433 Pel *YUVIn[3], *YUVOut[3];434 YUVIn[0] = pic.getAddr(COMPONENT_Y);435 YUVIn[1] = pic.getAddr(COMPONENT_Cb);436 YUVIn[2] = pic.getAddr(COMPONENT_Cr);437 438 TComPicYuv picColourRemapped;439 #if SVC_EXTENSION440 picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL );441 #else442 picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );443 #endif444 YUVOut[0] = picColourRemapped.getAddr(COMPONENT_Y);445 YUVOut[1] = picColourRemapped.getAddr(COMPONENT_Cb);446 YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr);447 448 #if SVC_EXTENSION449 Int bitDepthY = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];450 Int bitDepthC = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];451 452 assert( g_bitDepth[CHANNEL_TYPE_LUMA] == bitDepthY );453 assert( g_bitDepth[CHANNEL_TYPE_CHROMA] == bitDepthC );454 #else455 Int bitDepthY = g_bitDepth[CHANNEL_TYPE_LUMA];456 Int bitDepthC = g_bitDepth[CHANNEL_TYPE_CHROMA];457 #endif458 459 std::vector<Int> preLut[3];460 std::vector<Int> postLut[3];461 xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] );462 463 Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1));464 465 for( Int y = 0; y < iHeight ; y++ )466 {467 for( Int x = 0; x < iWidth ; x++ )468 {469 Int YUVPre[3], YUVMat[3];470 YUVPre[0] = preLut[0][ YUVIn[0][x] ];471 YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ];472 YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ];473 474 YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0]475 + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1]476 + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2]477 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );478 YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] );479 YUVOut[0][x] = postLut[0][ YUVMat[0] ];480 481 if( (y&1) && (x&1) )482 {483 for(Int c=1 ; c<3 ; c++)484 {485 YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0]486 + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1]487 + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2]488 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );489 YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] );490 YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ];491 }492 }493 }494 YUVIn[0] += iStride;495 YUVOut[0] += iStride;496 if( y&1 )497 {498 YUVIn[1] += iCStride;499 YUVIn[2] += iCStride;500 YUVOut[1] += iCStride;501 YUVOut[2] += iCStride;502 }503 }504 505 //Write remapped picture in decoding order506 Char cTemp[255];507 sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth );508 picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );509 510 picColourRemapped.destroy();511 512 storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence513 }514 }515 #endif516 336 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.h
r1049 r1089 80 80 Double m_dDecTime; 81 81 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 82 #if Q0074_COLOUR_REMAPPING_SEI 83 Bool m_colourRemapSEIEnabled; ///< Enable/disable Colour Remapping Information SEI message acting on decoded pictures 84 #endif 82 85 83 #if SVC_EXTENSION 86 84 UInt m_layerId; … … 114 112 115 113 Void setDecodedPictureHashSEIEnabled(Int enabled) { m_decodedPictureHashSEIEnabled = enabled; } 116 #if Q0074_COLOUR_REMAPPING_SEI117 Void setColourRemappingInfoSEIEnabled(Int enabled) { m_colourRemapSEIEnabled = enabled; }118 #endif119 114 #if SVC_EXTENSION 120 115 TDecTop* getLayerDec(UInt layerId) { return m_ppcTDecTop[layerId]; } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
r1084 r1089 203 203 204 204 Void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } 205 #if Q0074_COLOUR_REMAPPING_SEI206 void setColourRemappingInfoSEIEnabled(Bool enabled) { m_cGopDecoder.setColourRemappingInfoSEIEnabled(enabled); }207 #endif208 205 209 206 Void init(); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h
r1057 r1089 465 465 #endif //SVC_EXTENSION 466 466 #if Q0074_COLOUR_REMAPPING_SEI 467 Char* m_colourRemapSEIFile; ///< SEI Colour Remapping File (initialized from external file) 468 Int m_colourRemapSEIId; 469 Bool m_colourRemapSEICancelFlag; 470 Bool m_colourRemapSEIPersistenceFlag; 471 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 472 Bool m_colourRemapSEIFullRangeFlag; 473 Int m_colourRemapSEIPrimaries; 474 Int m_colourRemapSEITransferFunction; 475 Int m_colourRemapSEIMatrixCoefficients; 476 Int m_colourRemapSEIInputBitDepth; 477 Int m_colourRemapSEIBitDepth; 478 Int m_colourRemapSEIPreLutNumValMinus1[3]; 479 Int* m_colourRemapSEIPreLutCodedValue[3]; 480 Int* m_colourRemapSEIPreLutTargetValue[3]; 481 Bool m_colourRemapSEIMatrixPresentFlag; 482 Int m_colourRemapSEILog2MatrixDenom; 483 Int m_colourRemapSEICoeffs[3][3]; 484 Int m_colourRemapSEIPostLutNumValMinus1[3]; 485 Int* m_colourRemapSEIPostLutCodedValue[3]; 486 Int* m_colourRemapSEIPostLutTargetValue[3]; 467 Char* m_colourRemapSEIFileRoot; ///< SEI Colour Remapping File (initialized from external file) 487 468 #endif 488 469 … … 492 473 , m_tileRowHeight() 493 474 #if Q0074_COLOUR_REMAPPING_SEI 494 , m_colourRemapSEIFile (NULL)475 , m_colourRemapSEIFileRoot(NULL) 495 476 #endif 496 477 {} … … 1030 1011 #endif 1031 1012 #if Q0074_COLOUR_REMAPPING_SEI 1032 Void setCRISEIFile( Char* pch ) { m_colourRemapSEIFile = pch; } 1033 Char* getCRISEIFile() { return m_colourRemapSEIFile; } 1034 Void setCRISEIId(Int i) { m_colourRemapSEIId = i; } 1035 Int getCRISEIId() { return m_colourRemapSEIId; } 1036 Void setCRISEICancelFlag(Bool b) { m_colourRemapSEICancelFlag = b; } 1037 Bool getCRISEICancelFlag() { return m_colourRemapSEICancelFlag; } 1038 Void setCRISEIPersistenceFlag(Bool b) { m_colourRemapSEIPersistenceFlag = b; } 1039 Bool getCRISEIPersistenceFlag() { return m_colourRemapSEIPersistenceFlag; } 1040 Void setCRISEIVideoSignalInfoPresentFlag(Bool b) { m_colourRemapSEIVideoSignalInfoPresentFlag = b; } 1041 Bool getCRISEIVideoSignalInfoPresentFlag() { return m_colourRemapSEIVideoSignalInfoPresentFlag; } 1042 Void setCRISEIFullRangeFlag(Bool b) { m_colourRemapSEIFullRangeFlag = b; } 1043 Bool getCRISEIFullRangeFlag() { return m_colourRemapSEIFullRangeFlag; } 1044 Void setCRISEIPrimaries(Int i) { m_colourRemapSEIPrimaries = i; } 1045 Int getCRISEIPrimaries() { return m_colourRemapSEIPrimaries; } 1046 Void setCRISEITransferFunction(Int i) { m_colourRemapSEITransferFunction = i; } 1047 Int getCRISEITransferFunction() { return m_colourRemapSEITransferFunction; } 1048 Void setCRISEIMatrixCoefficients(Int i) { m_colourRemapSEIMatrixCoefficients = i; } 1049 Int getCRISEIMatrixCoefficients() { return m_colourRemapSEIMatrixCoefficients; } 1050 Void setCRISEIInputBitDepth(Int i) { m_colourRemapSEIInputBitDepth = i; } 1051 Int getCRISEIInputBitDepth() { return m_colourRemapSEIInputBitDepth; } 1052 Void setCRISEIBitDepth(Int i) { m_colourRemapSEIBitDepth = i; } 1053 Int getCRISEIBitDepth() { return m_colourRemapSEIBitDepth; } 1054 Void setCRISEIPreLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutNumValMinus1[c] = i[c]; } 1055 Int getCRISEIPreLutNumValMinus1(Int i) { return m_colourRemapSEIPreLutNumValMinus1[i]; } 1056 Void setCRISEIPreLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutCodedValue[c] = i[c]; } 1057 Int* getCRISEIPreLutCodedValue(Int i) { return m_colourRemapSEIPreLutCodedValue[i]; } 1058 Void setCRISEIPreLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutTargetValue[c] = i[c]; } 1059 Int* getCRISEIPreLutTargetValue(Int i) { return m_colourRemapSEIPreLutTargetValue[i]; } 1060 Void setCRISEIMatrixPresentFlag(Bool b) { m_colourRemapSEIMatrixPresentFlag = b; } 1061 Bool getCRISEIMatrixPresentFlag() { return m_colourRemapSEIMatrixPresentFlag; } 1062 Void setCRISEILog2MatrixDenom(Int i) { m_colourRemapSEILog2MatrixDenom = i; } 1063 Int getCRISEILog2MatrixDenom() { return m_colourRemapSEILog2MatrixDenom; } 1064 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]; } 1065 Int* getCRISEICoeffs(Int i) { return m_colourRemapSEICoeffs[i]; } 1066 Void setCRISEIPostLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutNumValMinus1[c] = i[c]; } 1067 Int getCRISEIPostLutNumValMinus1(Int i) { return m_colourRemapSEIPostLutNumValMinus1[i]; } 1068 Void setCRISEIPostLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutCodedValue[c] = i[c]; } 1069 Int* getCRISEIPostLutCodedValue(Int i) { return m_colourRemapSEIPostLutCodedValue[i]; } 1070 Void setCRISEIPostLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutTargetValue[c] = i[c]; } 1071 Int* getCRISEIPostLutTargetValue(Int i) { return m_colourRemapSEIPostLutTargetValue[i]; } 1013 Void setCRISEIFileRoot( Char* pch ) { m_colourRemapSEIFileRoot = pch; } 1014 Char* getCRISEIFileRoot() { return m_colourRemapSEIFileRoot; } 1072 1015 #endif 1073 1016 #if SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1085 r1089 127 127 #endif 128 128 #endif //SVC_EXTENSION 129 130 #if Q0074_COLOUR_REMAPPING_SEI 131 for( Int c=0 ; c<3 ; c++) 132 { 133 m_colourRemapSEIPreLutCodedValue[c] = NULL; 134 m_colourRemapSEIPreLutTargetValue[c] = NULL; 135 m_colourRemapSEIPostLutCodedValue[c] = NULL; 136 m_colourRemapSEIPostLutTargetValue[c] = NULL; 137 } 138 #endif 129 139 return; 130 140 } … … 642 652 } 643 653 644 #if Q0074_COLOUR_REMAPPING_SEI645 if(m_pcCfg->getCRISEIFile() && strlen(m_pcCfg->getCRISEIFile()))646 {647 SEIColourRemappingInfo *sei = xCreateSEIColourRemappingInfo ();648 649 #if SVC_EXTENSION650 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, sps->getLayerId()); // SEI-CRI is applied per layer651 #else652 nalu = NALUnit(NAL_UNIT_PREFIX_SEI);653 #endif654 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);655 #if O0164_MULTI_LAYER_HRD656 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);657 #else658 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);659 #endif660 writeRBSPTrailingBits(nalu.m_Bitstream);661 accessUnit.push_back(new NALUnitEBSP(nalu));662 delete sei;663 }664 #endif665 666 654 #if SVC_EXTENSION 667 655 #if LAYERS_NOT_PRESENT_SEI … … 732 720 #endif //SVC_EXTENSION 733 721 } 722 723 #if Q0074_COLOUR_REMAPPING_SEI 724 Void TEncGOP::freeColourCRI() 725 { 726 for( Int c=0 ; c<3 ; c++) 727 { 728 if ( m_colourRemapSEIPreLutCodedValue[c] != NULL) 729 { 730 delete[] m_colourRemapSEIPreLutCodedValue[c]; 731 m_colourRemapSEIPreLutCodedValue[c] = NULL; 732 } 733 if ( m_colourRemapSEIPreLutTargetValue[c] != NULL) 734 { 735 delete[] m_colourRemapSEIPreLutTargetValue[c]; 736 m_colourRemapSEIPreLutTargetValue[c] = NULL; 737 } 738 if ( m_colourRemapSEIPostLutCodedValue[c] != NULL) 739 { 740 delete[] m_colourRemapSEIPostLutCodedValue[c]; 741 m_colourRemapSEIPostLutCodedValue[c] = NULL; 742 } 743 if ( m_colourRemapSEIPostLutTargetValue[c] != NULL) 744 { 745 delete[] m_colourRemapSEIPostLutTargetValue[c]; 746 m_colourRemapSEIPostLutTargetValue[c] = NULL; 747 } 748 } 749 } 750 751 Int TEncGOP::readingCRIparameters(){ 752 753 // reading external Colour Remapping Information SEI message parameters from file 754 if( m_colourRemapSEIFile.c_str() ) 755 { 756 FILE* fic; 757 Int retval; 758 if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL) 759 { 760 //fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str()); 761 //exit(EXIT_FAILURE); 762 return (-1); 763 } 764 Int tempCode; 765 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 766 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEICancelFlag = tempCode ? 1 : 0; 767 if( !m_colourRemapSEICancelFlag ) 768 { 769 retval = fscanf( fic, "%d", &tempCode ); m_colourRemapSEIPersistenceFlag= tempCode ? 1 : 0; 770 retval = fscanf( fic, "%d", &tempCode); m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0; 771 if( m_colourRemapSEIVideoSignalInfoPresentFlag ) 772 { 773 retval = fscanf( fic, "%d", &tempCode ); m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0; 774 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 775 retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction ); 776 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients ); 777 } 778 779 retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth ); 780 retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth ); 781 782 for( Int c=0 ; c<3 ; c++ ) 783 { 784 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 785 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 786 { 787 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 788 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 789 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 790 { 791 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 792 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 793 } 794 } 795 } 796 797 retval = fscanf( fic, "%d", &tempCode ); m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0; 798 if( m_colourRemapSEIMatrixPresentFlag ) 799 { 800 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 801 for( Int c=0 ; c<3 ; c++ ) 802 for( Int i=0 ; i<3 ; i++ ) 803 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 804 } 805 806 for( Int c=0 ; c<3 ; c++ ) 807 { 808 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 809 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 810 { 811 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 812 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 813 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 814 { 815 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 816 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 817 } 818 } 819 } 820 } 821 822 fclose( fic ); 823 if( retval != 1 ) 824 { 825 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 826 exit(EXIT_FAILURE); 827 } 828 } 829 return 1; 830 } 831 Bool confirmParameter(Bool bflag, const Char* message); 832 // ==================================================================================================================== 833 // Private member functions 834 // ==================================================================================================================== 835 836 Void TEncGOP::xCheckParameter() 837 { 838 Bool check_failed = false; /* abort if there is a fatal configuration problem */ 839 #define xConfirmParameter(a,b) check_failed |= confirmParameter(a,b) 840 841 if ( m_colourRemapSEIFile.c_str() && !m_colourRemapSEICancelFlag ) 842 { 843 xConfirmParameter( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_coded_data_bit_depth shall be in the range of 8 to 16, inclusive"); 844 xConfirmParameter( m_colourRemapSEIBitDepth < 8 || (m_colourRemapSEIBitDepth > 16 && m_colourRemapSEIBitDepth < 255) , "colour_remap_target_bit_depth shall be in the range of 8 to 16, inclusive"); 845 for( Int c=0 ; c<3 ; c++) 846 { 847 xConfirmParameter( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 848 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 849 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) 850 { 851 xConfirmParameter( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_coded_data_bit_depth)-1, inclusive"); 852 xConfirmParameter( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 853 } 854 xConfirmParameter( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 855 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 856 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) 857 { 858 xConfirmParameter( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 859 xConfirmParameter( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_target_bit_depth)-1, inclusive"); 860 } 861 } 862 if ( m_colourRemapSEIMatrixPresentFlag ) 863 { 864 xConfirmParameter( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); 865 for( Int c=0 ; c<3 ; c++) 866 for( Int i=0 ; i<3 ; i++) 867 xConfirmParameter( 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"); 868 } 869 } 870 } 871 #endif 734 872 735 873 // ==================================================================================================================== … … 2834 2972 } 2835 2973 2974 // insert one CRI by picture (if the file exist) 2975 #if Q0074_COLOUR_REMAPPING_SEI 2976 2977 freeColourCRI(); 2978 2979 // building the CRI file name with poc num in suffix "_poc.txt" 2980 char suffix[10]; 2981 sprintf(suffix, "_%d.txt", pcSlice->getPOC()); 2982 string colourRemapSEIFileWithPoc(m_pcCfg->getCRISEIFileRoot()); 2983 colourRemapSEIFileWithPoc.append(suffix); 2984 setCRISEIFile( const_cast<Char*>(colourRemapSEIFileWithPoc.c_str()) ); 2985 2986 Int ret = readingCRIparameters(); 2987 2988 if(ret != -1 && m_pcCfg->getCRISEIFileRoot()) 2989 { 2990 // check validity of input parameters 2991 xCheckParameter(); 2992 2993 SEIColourRemappingInfo *sei = xCreateSEIColourRemappingInfo (); 2994 #if SVC_EXTENSION 2995 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, 0, pcSlice->getSPS()->getLayerId()); // SEI-CRI is applied per layer 2996 #else 2997 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 2998 #endif 2999 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 3000 #if SVC_EXTENSION 3001 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), pcSlice->getSPS() ); 3002 #else 3003 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, pcSlice->getSPS() ); 3004 #endif 3005 writeRBSPTrailingBits(nalu.m_Bitstream); 3006 accessUnit.push_back(new NALUnitEBSP(nalu)); 3007 delete sei; 3008 } 3009 #endif 3010 2836 3011 /* use the main bitstream buffer for storing the marshalled picture */ 2837 3012 m_pcEntropyCoder->setBitstream(NULL); … … 4486 4661 { 4487 4662 SEIColourRemappingInfo *seiColourRemappingInfo = new SEIColourRemappingInfo(); 4488 seiColourRemappingInfo->m_colourRemapId = m_pcCfg->getCRISEIId(); 4489 seiColourRemappingInfo->m_colourRemapCancelFlag = m_pcCfg->getCRISEICancelFlag(); 4663 seiColourRemappingInfo->m_colourRemapId = m_colourRemapSEIId; 4664 seiColourRemappingInfo->m_colourRemapCancelFlag = m_colourRemapSEICancelFlag; 4665 printf("xCreateSEIColourRemappingInfo - m_colourRemapId = %d m_colourRemapCancelFlag = %d \n",seiColourRemappingInfo->m_colourRemapId, seiColourRemappingInfo->m_colourRemapCancelFlag); 4666 4490 4667 if( !seiColourRemappingInfo->m_colourRemapCancelFlag ) 4491 4668 { 4492 seiColourRemappingInfo->m_colourRemapPersistenceFlag = m_ pcCfg->getCRISEIPersistenceFlag();4493 seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag = m_ pcCfg->getCRISEIVideoSignalInfoPresentFlag();4669 seiColourRemappingInfo->m_colourRemapPersistenceFlag = m_colourRemapSEIPersistenceFlag; 4670 seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag = m_colourRemapSEIVideoSignalInfoPresentFlag; 4494 4671 if( seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag ) 4495 4672 { 4496 seiColourRemappingInfo->m_colourRemapFullRangeFlag = m_ pcCfg->getCRISEIFullRangeFlag();4497 seiColourRemappingInfo->m_colourRemapPrimaries = m_ pcCfg->getCRISEIPrimaries();4498 seiColourRemappingInfo->m_colourRemapTransferFunction = m_ pcCfg->getCRISEITransferFunction();4499 seiColourRemappingInfo->m_colourRemapMatrixCoefficients = m_ pcCfg->getCRISEIMatrixCoefficients();4500 } 4501 seiColourRemappingInfo->m_colourRemapInputBitDepth = m_ pcCfg->getCRISEIInputBitDepth();4502 seiColourRemappingInfo->m_colourRemapBitDepth = m_ pcCfg->getCRISEIBitDepth();4673 seiColourRemappingInfo->m_colourRemapFullRangeFlag = m_colourRemapSEIFullRangeFlag; 4674 seiColourRemappingInfo->m_colourRemapPrimaries = m_colourRemapSEIPrimaries; 4675 seiColourRemappingInfo->m_colourRemapTransferFunction = m_colourRemapSEITransferFunction; 4676 seiColourRemappingInfo->m_colourRemapMatrixCoefficients = m_colourRemapSEIMatrixCoefficients; 4677 } 4678 seiColourRemappingInfo->m_colourRemapInputBitDepth = m_colourRemapSEIInputBitDepth; 4679 seiColourRemappingInfo->m_colourRemapBitDepth = m_colourRemapSEIBitDepth; 4503 4680 for( Int c=0 ; c<3 ; c++ ) 4504 4681 { 4505 seiColourRemappingInfo->m_preLutNumValMinus1[c] = m_ pcCfg->getCRISEIPreLutNumValMinus1(c);4682 seiColourRemappingInfo->m_preLutNumValMinus1[c] = m_colourRemapSEIPreLutNumValMinus1[c]; 4506 4683 if( seiColourRemappingInfo->m_preLutNumValMinus1[c]>0 ) 4507 4684 { … … 4510 4687 for( Int i=0 ; i<=seiColourRemappingInfo->m_preLutNumValMinus1[c] ; i++) 4511 4688 { 4512 seiColourRemappingInfo->m_preLutCodedValue[c][i] = (m_pcCfg->getCRISEIPreLutCodedValue(c))[i];4513 seiColourRemappingInfo->m_preLutTargetValue[c][i] = (m_pcCfg->getCRISEIPreLutTargetValue(c))[i];4514 } 4515 } 4516 } 4517 seiColourRemappingInfo->m_colourRemapMatrixPresentFlag = m_ pcCfg->getCRISEIMatrixPresentFlag();4689 seiColourRemappingInfo->m_preLutCodedValue[c][i] = m_colourRemapSEIPreLutCodedValue[c][i]; 4690 seiColourRemappingInfo->m_preLutTargetValue[c][i] = m_colourRemapSEIPreLutTargetValue[c][i]; 4691 } 4692 } 4693 } 4694 seiColourRemappingInfo->m_colourRemapMatrixPresentFlag = m_colourRemapSEIMatrixPresentFlag; 4518 4695 if( seiColourRemappingInfo->m_colourRemapMatrixPresentFlag ) 4519 4696 { 4520 seiColourRemappingInfo->m_log2MatrixDenom = m_ pcCfg->getCRISEILog2MatrixDenom();4697 seiColourRemappingInfo->m_log2MatrixDenom = m_colourRemapSEILog2MatrixDenom; 4521 4698 for( Int c=0 ; c<3 ; c++ ) 4522 4699 for( Int i=0 ; i<3 ; i++ ) 4523 seiColourRemappingInfo->m_colourRemapCoeffs[c][i] = (m_pcCfg->getCRISEICoeffs(c))[i];4700 seiColourRemappingInfo->m_colourRemapCoeffs[c][i] = m_colourRemapSEICoeffs[c][i]; 4524 4701 } 4525 4702 for( Int c=0 ; c<3 ; c++ ) 4526 4703 { 4527 seiColourRemappingInfo->m_postLutNumValMinus1[c] = m_ pcCfg->getCRISEIPostLutNumValMinus1(c);4704 seiColourRemappingInfo->m_postLutNumValMinus1[c] = m_colourRemapSEIPostLutNumValMinus1[c]; 4528 4705 if( seiColourRemappingInfo->m_postLutNumValMinus1[c]>0 ) 4529 4706 { … … 4532 4709 for( Int i=0 ; i<=seiColourRemappingInfo->m_postLutNumValMinus1[c] ; i++) 4533 4710 { 4534 seiColourRemappingInfo->m_postLutCodedValue[c][i] = (m_pcCfg->getCRISEIPostLutCodedValue(c))[i];4535 seiColourRemappingInfo->m_postLutTargetValue[c][i] = (m_pcCfg->getCRISEIPostLutTargetValue(c))[i];4711 seiColourRemappingInfo->m_postLutCodedValue[c][i] = m_colourRemapSEIPostLutCodedValue[c][i]; 4712 seiColourRemappingInfo->m_postLutTargetValue[c][i] = m_colourRemapSEIPostLutTargetValue[c][i]; 4536 4713 } 4537 4714 } … … 5433 5610 #endif //SVC_EXTENSION 5434 5611 5612 #if Q0074_COLOUR_REMAPPING_SEI 5613 Bool confirmParameter(Bool bflag, const Char* message) 5614 { 5615 if (!bflag) 5616 return false; 5617 5618 printf("Error: %s\n",message); 5619 return true; 5620 } 5621 #endif 5622 5435 5623 //! \} -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
r1037 r1089 88 88 #endif 89 89 90 #if Q0074_COLOUR_REMAPPING_SEI 91 string m_colourRemapSEIFile; 92 Int m_colourRemapSEIId; 93 Bool m_colourRemapSEICancelFlag; 94 Bool m_colourRemapSEIPersistenceFlag; 95 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 96 Bool m_colourRemapSEIFullRangeFlag; 97 Int m_colourRemapSEIPrimaries; 98 Int m_colourRemapSEITransferFunction; 99 Int m_colourRemapSEIMatrixCoefficients; 100 Int m_colourRemapSEIInputBitDepth; 101 Int m_colourRemapSEIBitDepth; 102 Int m_colourRemapSEIPreLutNumValMinus1[3]; 103 Int* m_colourRemapSEIPreLutCodedValue[3]; 104 Int* m_colourRemapSEIPreLutTargetValue[3]; 105 Bool m_colourRemapSEIMatrixPresentFlag; 106 Int m_colourRemapSEILog2MatrixDenom; 107 Int m_colourRemapSEICoeffs[3][3]; 108 Int m_colourRemapSEIPostLutNumValMinus1[3]; 109 Int* m_colourRemapSEIPostLutCodedValue[3]; 110 Int* m_colourRemapSEIPostLutTargetValue[3]; 111 #endif 90 112 // Access channel 91 113 TEncTop* m_pcEncTop; … … 245 267 246 268 #if Q0074_COLOUR_REMAPPING_SEI 269 Void setCRISEIFile( Char* pch ) { m_colourRemapSEIFile = pch; } 270 271 Void freeColourCRI(); 272 Int readingCRIparameters(); 273 Void xCheckParameter(); 274 247 275 SEIColourRemappingInfo* xCreateSEIColourRemappingInfo(); 248 276 #endif
Note: See TracChangeset for help on using the changeset viewer.