Changeset 1460 in SHVCSoftware for branches/SHM-dev/source/App


Ignore:
Timestamp:
20 Aug 2015, 20:54:17 (9 years ago)
Author:
seregin
Message:

port rev 4594

Location:
branches/SHM-dev/source/App
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.cpp

    r1442 r1460  
    113113  ("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.")
    114114  ("RespectDefDispWindow,w",    m_respectDefDispWindow,                0,          "Only output content inside the default display window\n")
     115#if Q0074_COLOUR_REMAPPING_SEI
     116  ("SEIColourRemappingInfoFilename",  m_colourRemapSEIFileName,        string(""), "Colour Remapping YUV output file name. If empty, no remapping is applied (ignore SEI message)\n")
     117#endif
    115118#if O0043_BEST_EFFORT_DECODING
    116119  ("ForceDecodeBitDepth",       m_forceDecodeBitDepth,                 0U,         "Force the decoder to operate at a particular bit-depth (best effort decoding)")
     
    118121  ("OutputDecodedSEIMessagesFilename",  m_outputDecodedSEIMessagesFilename,    string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
    119122  ("ClipOutputVideoToRec709Range",      m_bClipOutputVideoToRec709Range,  false, "If true then clip output video to the Rec. 709 Range on saving")
    120 #if Q0074_COLOUR_REMAPPING_SEI
    121   ("SEIColourRemappingInfo,-cri", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n"
    122                                               "\t1: apply colour remapping on decoded pictures if available in the bitstream\n"
    123                                               "\t0: ignore SEI message")
    124 #endif
    125123  ;
    126124
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.h

    r1445 r1460  
    7171  Bool          m_decodedNoDisplaySEIEnabled;         ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message
    7272#if Q0074_COLOUR_REMAPPING_SEI
    73   Bool          m_colourRemapSEIEnabled;              ///< Enable the Colour Remapping Information SEI message if available (remapping decoded pictures)
     73  std::string   m_colourRemapSEIFileName;             ///< output Colour Remapping file name
    7474#endif
    75 
    7675  std::vector<Int> m_targetDecLayerIdSet;             ///< set of LayerIds to be included in the sub-bitstream extraction process.
    7776  Int           m_respectDefDispWindow;               ///< Only output content inside the default display window
     
    110109  , m_decodedNoDisplaySEIEnabled(false)
    111110#if Q0074_COLOUR_REMAPPING_SEI
    112   , m_colourRemapSEIEnabled(false)
     111  , m_colourRemapSEIFileName()
    113112#endif
    114113  , m_targetDecLayerIdSet()
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r1445 r1460  
    6363TAppDecTop::TAppDecTop()
    6464#if Q0074_COLOUR_REMAPPING_SEI
    65 : seiColourRemappingInfoPrevious(NULL)
     65: m_pcSeiColourRemappingInfoPrevious(NULL)
     66, m_pcPicYuvColourRemapped(NULL)
    6667#endif
    6768{
     
    7879: m_iPOCLastDisplay(-MAX_INT)
    7980#if Q0074_COLOUR_REMAPPING_SEI
    80 , seiColourRemappingInfoPrevious(NULL)
     81 ,m_pcSeiColourRemappingInfoPrevious(NULL)
     82 ,m_pcPicYuvColourRemapped(NULL)
    8183#endif
    8284{
     
    117119#else
    118120  m_reconFileName.clear();
    119 #endif
    120 #if Q0074_COLOUR_REMAPPING_SEI
    121   if (seiColourRemappingInfoPrevious != NULL)
    122   {
    123     delete seiColourRemappingInfoPrevious;
    124   }
    125121#endif
    126122}
     
    688684  }
    689685#endif
     686#if Q0074_COLOUR_REMAPPING_SEI
     687  if (m_pcSeiColourRemappingInfoPrevious != NULL)
     688  {
     689    delete m_pcSeiColourRemappingInfoPrevious;
     690    m_pcSeiColourRemappingInfoPrevious = NULL;
     691  }
     692  if (m_pcPicYuvColourRemapped != NULL)
     693  {
     694    m_pcPicYuvColourRemapped->destroy();
     695    delete m_pcPicYuvColourRemapped;
     696    m_pcPicYuvColourRemapped  = NULL;
     697  }
     698#endif
    690699}
    691700
     
    919928
    920929#if Q0074_COLOUR_REMAPPING_SEI
    921         if (m_colourRemapSEIEnabled)
    922         {
    923           SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
    924           const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
    925           const TComSPS *sps = pcPic->getSlice(0)->getSPS();
    926 
    927           if (colourRemappingInfo.size() > 1)
    928           {
    929             printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
    930           }
    931           if (seiColourRemappingInfo)
    932           {
    933             xApplyColourRemapping(sps, *pcPic->getPicYuvRec(), seiColourRemappingInfo);
    934           }
    935           else  // using the last CRI SEI received
    936           {
    937             const SEIColourRemappingInfo *seiColourRemappingInfoCopy;
    938             seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious;
    939             xApplyColourRemapping(sps, *pcPic->getPicYuvRec(), seiColourRemappingInfoCopy);
    940           }
    941 
    942           // save the last CRI SEI received
    943           if( seiColourRemappingInfo != NULL){
    944             if (seiColourRemappingInfoPrevious != NULL)
    945             {
    946               delete seiColourRemappingInfoPrevious;
    947               seiColourRemappingInfoPrevious = NULL;
    948             }
    949             if (seiColourRemappingInfo->m_colourRemapPersistenceFlag)
    950             {
    951               seiColourRemappingInfoPrevious = new SEIColourRemappingInfo();
    952               seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo);
    953             }
    954           }
     930        if (!m_colourRemapSEIFileName.empty())
     931        {
     932          xOutputColourRemapPic(pcPic, activeSPS);
    955933        }
    956934#endif
     
    11221100
    11231101#if Q0074_COLOUR_REMAPPING_SEI
    1124         if (m_colourRemapSEIEnabled)
    1125         {
    1126           SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
    1127           const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
    1128           const TComSPS *sps = pcPic->getSlice(0)->getSPS();
    1129 
    1130           if (colourRemappingInfo.size() > 1)
    1131           {
    1132             printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
    1133           }
    1134           if (seiColourRemappingInfo)
    1135           {
    1136             xApplyColourRemapping( sps, *pcPic->getPicYuvRec(), seiColourRemappingInfo );
    1137           }
    1138           else  // using the last CRI SEI received
    1139           {
    1140             const SEIColourRemappingInfo *seiColourRemappingInfoCopy;
    1141             seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious;
    1142             xApplyColourRemapping( sps, *pcPic->getPicYuvRec(), seiColourRemappingInfoCopy );
    1143           }
    1144 
    1145           // save the last CRI SEI received
    1146           if( seiColourRemappingInfo != NULL){
    1147             if (seiColourRemappingInfoPrevious != NULL)
    1148             {
    1149               delete seiColourRemappingInfoPrevious;
    1150               seiColourRemappingInfoPrevious = NULL;
    1151             }
    1152             if (seiColourRemappingInfo->m_colourRemapPersistenceFlag)
    1153             {
    1154               seiColourRemappingInfoPrevious = new SEIColourRemappingInfo();
    1155               seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo);
    1156             }
    1157           }
     1102        if (!m_colourRemapSEIFileName.empty())
     1103        {
     1104          xOutputColourRemapPic(pcPic, &(pcPic->getPicSym()->getSPS()));
    11581105        }
    11591106#endif
     
    12151162  return false;
    12161163}
     1164
     1165#if Q0074_COLOUR_REMAPPING_SEI
     1166
     1167Void TAppDecTop::xOutputColourRemapPic(TComPic* pcPic, const TComSPS* activeSPS)
     1168{
     1169  SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
     1170  SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
     1171
     1172  if (colourRemappingInfo.size() > 1)
     1173  {
     1174    printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
     1175  }
     1176  if (seiColourRemappingInfo)
     1177  {
     1178    applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfo, *activeSPS);
     1179  }
     1180  else  // using the last CRI SEI received
     1181  {
     1182    if (m_pcSeiColourRemappingInfoPrevious != NULL)
     1183    {
     1184      if (m_pcSeiColourRemappingInfoPrevious->m_colourRemapPersistenceFlag == false)
     1185      {
     1186        printf("Warning No SEI-CRI message is present for the current picture, persistence of the CRI is not managed\n");
     1187      }
     1188      SEIColourRemappingInfo *seiColourRemappingInfoCopy;
     1189      seiColourRemappingInfoCopy = m_pcSeiColourRemappingInfoPrevious;
     1190      applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfoCopy, *activeSPS);
     1191    }
     1192  }
     1193
     1194  // save the last CRI SEI received
     1195  if( seiColourRemappingInfo != NULL)
     1196  {
     1197    if (m_pcSeiColourRemappingInfoPrevious != NULL)
     1198    {
     1199      delete m_pcSeiColourRemappingInfoPrevious;
     1200      m_pcSeiColourRemappingInfoPrevious = NULL;
     1201    }
     1202    m_pcSeiColourRemappingInfoPrevious = new SEIColourRemappingInfo();
     1203    m_pcSeiColourRemappingInfoPrevious->copyFrom(*seiColourRemappingInfo);
     1204  }
     1205}
     1206
     1207// compute lut from SEI
     1208// use at lutPoints points aligned on a power of 2 value
     1209// SEI Lut must be in ascending values of coded Values
     1210static std::vector<Int>
     1211initColourRemappingInfoLut(const Int                                          bitDepth_in,     // bit-depth of the input values of the LUT
     1212                           const Int                                          nbDecimalValues, // Position of the fixed point
     1213                           const std::vector<SEIColourRemappingInfo::CRIlut> &lut,
     1214                           const Int                                          maxValue, // maximum output value
     1215                           const Int                                          lutOffset)
     1216{
     1217  const Int lutPoints = (1 << bitDepth_in) + 1 ;
     1218  std::vector<Int> retLut(lutPoints);
     1219
     1220  // missing values: need to define default values before first definition (check codedValue[0] == 0)
     1221  Int iTargetPrev = (lut.size() && lut[0].codedValue == 0) ? lut[0].targetValue: 0;
     1222  Int startPivot = (lut.size())? ((lut[0].codedValue == 0)? 1: 0): 1;
     1223  Int iCodedPrev  = 0;
     1224  // set max value with the coded bit-depth
     1225  // + ((1 << nbDecimalValues) - 1) is for the added bits
     1226  const Int maxValueFixedPoint = (maxValue << nbDecimalValues) + ((1 << nbDecimalValues) - 1);
     1227
     1228  Int iValue = 0;
     1229
     1230  for ( Int iPivot=startPivot ; iPivot < (Int)lut.size(); iPivot++ )
     1231  {
     1232    Int iCodedNext  = lut[iPivot].codedValue;
     1233    Int iTargetNext = lut[iPivot].targetValue;
     1234
     1235    // ensure correct bit depth and avoid overflow in lut address
     1236    Int iCodedNext_bitDepth = std::min(iCodedNext, (1 << bitDepth_in));
     1237
     1238    const Int divValue =  (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1;
     1239    const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues;
     1240    const Int roundValue = divValue / 2;
     1241    for ( ; iValue<iCodedNext_bitDepth; iValue++ )
     1242    {
     1243      Int value = iValue;
     1244      Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue;               
     1245      retLut[iValue]  = std::min(lutValInit + interpol , maxValueFixedPoint);
     1246    }
     1247    iCodedPrev  = iCodedNext;
     1248    iTargetPrev = iTargetNext;
     1249  }
     1250  // fill missing values if necessary
     1251  if(iCodedPrev < (1 << bitDepth_in)+1)
     1252  {
     1253    Int iCodedNext  = (1 << bitDepth_in);
     1254    Int iTargetNext = (1 << bitDepth_in) - 1;
     1255
     1256    const Int divValue =  (iCodedNext - iCodedPrev > 0)? (iCodedNext - iCodedPrev): 1;
     1257    const Int lutValInit = (lutOffset + iTargetPrev) << nbDecimalValues;
     1258    const Int roundValue = divValue / 2;
     1259
     1260    for ( ; iValue<=iCodedNext; iValue++ )
     1261    {
     1262      Int value = iValue;
     1263      Int interpol = ((((value-iCodedPrev) * (iTargetNext - iTargetPrev)) << nbDecimalValues) + roundValue) / divValue;
     1264      retLut[iValue]  = std::min(lutValInit + interpol , maxValueFixedPoint);
     1265    }
     1266  }
     1267  return retLut;
     1268}
     1269
     1270static Void
     1271initColourRemappingInfoLuts(std::vector<Int>      (&preLut)[3],
     1272                            std::vector<Int>      (&postLut)[3],
     1273                            SEIColourRemappingInfo &pCriSEI,
     1274                            const Int               maxBitDepth)
     1275{
     1276  Int internalBitDepth = pCriSEI.m_colourRemapBitDepth;
     1277  for ( Int c=0 ; c<3 ; c++ )
     1278  {
     1279    std::sort(pCriSEI.m_preLut[c].begin(), pCriSEI.m_preLut[c].end()); // ensure preLut is ordered in ascending values of codedValues   
     1280    preLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapInputBitDepth, maxBitDepth - pCriSEI.m_colourRemapInputBitDepth, pCriSEI.m_preLut[c], ((1 << internalBitDepth) - 1), 0); //Fill preLut
     1281
     1282    std::sort(pCriSEI.m_postLut[c].begin(), pCriSEI.m_postLut[c].end()); // ensure postLut is ordered in ascending values of codedValues       
     1283    postLut[c] = initColourRemappingInfoLut(pCriSEI.m_colourRemapBitDepth, maxBitDepth - pCriSEI.m_colourRemapBitDepth, pCriSEI.m_postLut[c], (1 << internalBitDepth) - 1, 0); //Fill postLut
     1284  }
     1285}
     1286
     1287// apply lut.
     1288// Input lut values are aligned on power of 2 boundaries
     1289static Int
     1290applyColourRemappingInfoLut1D(Int inVal, const std::vector<Int> &lut, const Int inValPrecisionBits)
     1291{
     1292  const Int roundValue = (inValPrecisionBits)? 1 << (inValPrecisionBits - 1): 0;
     1293  inVal = std::min(std::max(0, inVal), (Int)(((lut.size()-1) << inValPrecisionBits)));
     1294  Int index  = (Int) std::min((inVal >> inValPrecisionBits), (Int)(lut.size()-2));
     1295  Int outVal = (( inVal - (index<<inValPrecisionBits) ) * (lut[index+1] - lut[index]) + roundValue) >> inValPrecisionBits;
     1296  outVal +=  lut[index] ;
     1297
     1298  return outVal;
     1299
     1300
     1301static Int
     1302applyColourRemappingInfoMatrix(const Int (&colourRemapCoeffs)[3], const Int postOffsetShift, const Int p0, const Int p1, const Int p2, const Int offset)
     1303{
     1304  Int YUVMat = (colourRemapCoeffs[0]* p0 + colourRemapCoeffs[1]* p1 + colourRemapCoeffs[2]* p2  + offset) >> postOffsetShift;
     1305  return YUVMat;
     1306}
     1307
     1308static Void
     1309setColourRemappingInfoMatrixOffset(Int (&matrixOffset)[3], Int offset0, Int offset1, Int offset2)
     1310{
     1311  matrixOffset[0] = offset0;
     1312  matrixOffset[1] = offset1;
     1313  matrixOffset[2] = offset2;
     1314}
     1315
     1316static Void
     1317setColourRemappingInfoMatrixOffsets(      Int  (&matrixInputOffset)[3],
     1318                                          Int  (&matrixOutputOffset)[3],
     1319                                    const Int  bitDepth,
     1320                                    const Bool crInputFullRangeFlag,
     1321                                    const Int  crInputMatrixCoefficients,
     1322                                    const Bool crFullRangeFlag,
     1323                                    const Int  crMatrixCoefficients)
     1324{
     1325  // set static matrix offsets
     1326  Int crInputOffsetLuma = (crInputFullRangeFlag)? 0:-(16 << (bitDepth-8));
     1327  Int crOffsetLuma = (crFullRangeFlag)? 0:(16 << (bitDepth-8));
     1328  Int crInputOffsetChroma = 0;
     1329  Int crOffsetChroma = 0;
     1330
     1331  switch(crInputMatrixCoefficients)
     1332  {
     1333    case MATRIX_COEFFICIENTS_RGB:
     1334      crInputOffsetChroma = 0;
     1335      if(!crInputFullRangeFlag)
     1336      {
     1337        fprintf(stderr, "WARNING: crInputMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n");
     1338        crInputOffsetLuma = 0;
     1339      }
     1340      break;
     1341    case MATRIX_COEFFICIENTS_UNSPECIFIED:
     1342    case MATRIX_COEFFICIENTS_BT709:
     1343    case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE:
     1344      crInputOffsetChroma = -(1 << (bitDepth-1));
     1345      break;
     1346    default:
     1347      fprintf(stderr, "WARNING: crInputMatrixCoefficients set to undefined value: %d\n", crInputMatrixCoefficients);
     1348  }
     1349
     1350  switch(crMatrixCoefficients)
     1351  {
     1352    case MATRIX_COEFFICIENTS_RGB:
     1353      crOffsetChroma = 0;
     1354      if(!crFullRangeFlag)
     1355      {
     1356        fprintf(stderr, "WARNING: crMatrixCoefficients set to MATRIX_COEFFICIENTS_RGB and crInputFullRangeFlag not set\n");
     1357        crOffsetLuma = 0;
     1358      }
     1359      break;
     1360    case MATRIX_COEFFICIENTS_UNSPECIFIED:
     1361    case MATRIX_COEFFICIENTS_BT709:
     1362    case MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE:
     1363      crOffsetChroma = (1 << (bitDepth-1));
     1364      break;
     1365    default:
     1366      fprintf(stderr, "WARNING: crMatrixCoefficients set to undefined value: %d\n", crMatrixCoefficients);
     1367  }
     1368
     1369  setColourRemappingInfoMatrixOffset(matrixInputOffset, crInputOffsetLuma, crInputOffsetChroma, crInputOffsetChroma);
     1370  setColourRemappingInfoMatrixOffset(matrixOutputOffset, crOffsetLuma, crOffsetChroma, crOffsetChroma);
     1371}
     1372
     1373Void TAppDecTop::applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& criSEI, const TComSPS &activeSPS)
     1374
     1375  const Int maxBitDepth = 16;
     1376  Bool firstPicture = true;
     1377
     1378  // create colour remapped picture
     1379  if ( m_pcPicYuvColourRemapped == NULL )
     1380  {
     1381    const ChromaFormat chromaFormatIDC = activeSPS.getChromaFormatIdc();
     1382    const Int          iWidth          = activeSPS.getPicWidthInLumaSamples();
     1383    const Int          iHeight         = activeSPS.getPicHeightInLumaSamples();
     1384    const UInt         uiMaxCuWidth    = activeSPS.getMaxCUWidth();
     1385    const UInt         uiMaxCuHeight   = activeSPS.getMaxCUHeight();
     1386    const UInt         uiMaxDepth      = activeSPS.getMaxTotalCUDepth();
     1387    m_pcPicYuvColourRemapped  = new TComPicYuv;
     1388    m_pcPicYuvColourRemapped->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     1389  }
     1390  else
     1391  {
     1392    firstPicture = false;
     1393  }
     1394
     1395  if( !criSEI.m_colourRemapCancelFlag )
     1396  {
     1397    const Int  iHeight  = pic.getHeight(COMPONENT_Y);
     1398    const Int  iWidth   = pic.getWidth(COMPONENT_Y);
     1399    const Int  iStride  = pic.getStride(COMPONENT_Y);
     1400    const Int  iCStride = pic.getStride(COMPONENT_Cb);
     1401    const Bool b444     = ( pic.getChromaFormat() == CHROMA_444 );
     1402    const Bool b422     = ( pic.getChromaFormat() == CHROMA_422 );
     1403    const Bool b420     = ( pic.getChromaFormat() == CHROMA_420 );
     1404
     1405    std::vector<Int> preLut[3];
     1406    std::vector<Int> postLut[3];
     1407    Int matrixInputOffset[3];
     1408    Int matrixOutputOffset[3];
     1409    const Pel *YUVIn[MAX_NUM_COMPONENT];
     1410    Pel *YUVOut[MAX_NUM_COMPONENT];
     1411    YUVIn[COMPONENT_Y]  = pic.getAddr(COMPONENT_Y);
     1412    YUVIn[COMPONENT_Cb] = pic.getAddr(COMPONENT_Cb);
     1413    YUVIn[COMPONENT_Cr] = pic.getAddr(COMPONENT_Cr);
     1414    YUVOut[COMPONENT_Y]  = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Y);
     1415    YUVOut[COMPONENT_Cb] = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Cb);
     1416    YUVOut[COMPONENT_Cr] = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Cr);
     1417
     1418    Int bitDepthY = activeSPS.getBitDepth(CHANNEL_TYPE_LUMA);
     1419    assert(bitDepthY == activeSPS.getBitDepth(CHANNEL_TYPE_CHROMA)); // Different bitdepth is not implemented
     1420
     1421    const Int postOffsetShift = criSEI.m_log2MatrixDenom;
     1422    const Int matrixRound = 1 << (postOffsetShift - 1);
     1423    const Int postLutInputPrecision = (maxBitDepth - criSEI.m_colourRemapBitDepth);
     1424
     1425    if ( ! criSEI.m_colourRemapVideoSignalInfoPresentFlag ) // setting default
     1426    {
     1427      setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth,
     1428          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(),
     1429          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients());
     1430    }
     1431    else
     1432    {
     1433      setColourRemappingInfoMatrixOffsets(matrixInputOffset, matrixOutputOffset, maxBitDepth,
     1434          activeSPS.getVuiParameters()->getVideoFullRangeFlag(), activeSPS.getVuiParameters()->getMatrixCoefficients(),
     1435          criSEI.m_colourRemapFullRangeFlag, criSEI.m_colourRemapMatrixCoefficients);
     1436    }
     1437
     1438    // add matrix rounding to output matrix offsets
     1439    matrixOutputOffset[0] = (matrixOutputOffset[0] << postOffsetShift) + matrixRound;
     1440    matrixOutputOffset[1] = (matrixOutputOffset[1] << postOffsetShift) + matrixRound;
     1441    matrixOutputOffset[2] = (matrixOutputOffset[2] << postOffsetShift) + matrixRound;
     1442
     1443    // Merge   matrixInputOffset and matrixOutputOffset to matrixOutputOffset
     1444    matrixOutputOffset[0] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     1445    matrixOutputOffset[1] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     1446    matrixOutputOffset[2] += applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], 0, matrixInputOffset[0], matrixInputOffset[1], matrixInputOffset[2], 0);
     1447
     1448    // rescaling output: include CRI/output frame difference
     1449    const Int scaleShiftOut_neg = abs(bitDepthY - maxBitDepth);
     1450    const Int scaleOut_round = 1 << (scaleShiftOut_neg-1);
     1451
     1452    initColourRemappingInfoLuts(preLut, postLut, criSEI, maxBitDepth);
     1453
     1454    assert(pic.getChromaFormat() != CHROMA_400);
     1455    const Int hs = pic.getComponentScaleX(ComponentID(COMPONENT_Cb));
     1456
     1457    for( Int y = 0; y < iHeight; y++ )
     1458    {
     1459      for( Int x = 0; x < iWidth; x++ )
     1460      {
     1461        const Int xc = (x>>hs);
     1462        Bool computeChroma = b444 || ((b422 || !(y&1)) && !(x&1));
     1463
     1464        Int YUVPre_0 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Y][x], preLut[0], 0);
     1465        Int YUVPre_1 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cb][xc], preLut[1], 0);
     1466        Int YUVPre_2 = applyColourRemappingInfoLut1D(YUVIn[COMPONENT_Cr][xc], preLut[2], 0);
     1467
     1468        Int YUVMat_0 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[0], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[0]);
     1469        Int YUVLutB_0 = applyColourRemappingInfoLut1D(YUVMat_0, postLut[0], postLutInputPrecision);
     1470        YUVOut[COMPONENT_Y][x] = (YUVLutB_0 + scaleOut_round) >> scaleShiftOut_neg; // scaling output
     1471
     1472        if( computeChroma )
     1473        {
     1474          Int YUVMat_1 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[1], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[1]);
     1475          Int YUVLutB_1 = applyColourRemappingInfoLut1D(YUVMat_1, postLut[1], postLutInputPrecision);
     1476          YUVOut[COMPONENT_Cb][xc] = (YUVLutB_1 + scaleOut_round) >> scaleShiftOut_neg; // scaling output
     1477
     1478          Int YUVMat_2 = applyColourRemappingInfoMatrix(criSEI.m_colourRemapCoeffs[2], postOffsetShift, YUVPre_0, YUVPre_1, YUVPre_2, matrixOutputOffset[2]);
     1479          Int YUVLutB_2 = applyColourRemappingInfoLut1D(YUVMat_2, postLut[2], postLutInputPrecision);
     1480          YUVOut[COMPONENT_Cr][xc] = (YUVLutB_2 + scaleOut_round) >> scaleShiftOut_neg; // scaling output
     1481        }
     1482      }
     1483
     1484      YUVIn[COMPONENT_Y]  += iStride;
     1485      YUVOut[COMPONENT_Y] += iStride;
     1486      if( !(b420 && !(y&1)) )
     1487      {
     1488         YUVIn[COMPONENT_Cb]  += iCStride;
     1489         YUVIn[COMPONENT_Cr]  += iCStride;
     1490         YUVOut[COMPONENT_Cb] += iCStride;
     1491         YUVOut[COMPONENT_Cr] += iCStride;
     1492      }
     1493    }
     1494    //Write remapped picture in display order
     1495    m_pcPicYuvColourRemapped->dump( m_colourRemapSEIFileName, activeSPS.getBitDepths(), !firstPicture );
     1496  }
     1497}
     1498#endif
    12171499
    12181500#if ALIGNED_BUMPING
     
    12381520
    12391521#if Q0074_COLOUR_REMAPPING_SEI
    1240     if( m_colourRemapSEIEnabled )
    1241     {
    1242       const TComSPS *sps = pic->getSlice(0)->getSPS();
    1243       SEIMessages colourRemappingInfo = getSeisByType(pic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
    1244       const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
    1245 
    1246       if (colourRemappingInfo.size() > 1)
    1247       {
    1248         printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
    1249       }
    1250 
    1251       if (seiColourRemappingInfo)
    1252       {
    1253         //printf ("\n\nColour Remapping is applied to POC : %d and LayerId : %d ",pic->getPOC(), pic->getLayerId());
    1254         xApplyColourRemapping( sps, *pic->getPicYuvRec(), seiColourRemappingInfo, pic->getLayerId() );
    1255       }
    1256       else  // using the last CRI SEI received
    1257       {
    1258         const SEIColourRemappingInfo *seiColourRemappingInfoCopy;
    1259         seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious;
    1260         xApplyColourRemapping( sps, *pic->getPicYuvRec(), seiColourRemappingInfoCopy, pic->getLayerId() );
    1261       }
    1262 
    1263       // save the last CRI SEI received
    1264       if( seiColourRemappingInfo != NULL){
    1265         if (seiColourRemappingInfoPrevious != NULL)
    1266         {
    1267           delete seiColourRemappingInfoPrevious;
    1268           seiColourRemappingInfoPrevious = NULL;
    1269         }
    1270         if (seiColourRemappingInfo->m_colourRemapPersistenceFlag)
    1271         {
    1272           seiColourRemappingInfoPrevious = new SEIColourRemappingInfo();
    1273           seiColourRemappingInfoPrevious->copyFrom(seiColourRemappingInfo);
    1274         }
    1275       }
    1276     }
    1277 
     1522    if (!m_colourRemapSEIFileName.empty())
     1523    {
     1524      xOutputColourRemapPic(pic, pic->getSlice(0)->getSPS());
     1525    }
    12781526#endif
    12791527  }
     
    17952043#endif //ALIGNED_BUMPING
    17962044
    1797 #if Q0074_COLOUR_REMAPPING_SEI
    1798 Void TAppDecTop::xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )
    1799 {
    1800   for ( Int c=0 ; c<3 ; c++ )
    1801   { 
    1802     Int bitDepth = bitDepths.recon[toChannelType(ComponentID(c))];
    1803     preLut[c].resize(1 << bitDepth);
    1804     postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth);
    1805    
    1806     Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth;
    1807     Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth)
    1808     if( bitDepthDiff<0 )
    1809       printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth);
    1810     bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth;
    1811     Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth)
    1812     if( bitDepthDiff<0 )
    1813       printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth);
    1814 
    1815     //Fill preLut
    1816     for ( Int k=0 ; k<(1<<bitDepth) ; k++ )
    1817     {
    1818       Int iSample = k << iShift1 ;
    1819       for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ )
    1820       {
    1821         Int iCodedPrev  = pCriSEI->m_preLutCodedValue[c][iPivot]    << iShift2; //Coded in CRInputBitdepth
    1822         Int iCodedNext  = pCriSEI->m_preLutCodedValue[c][iPivot+1]  << iShift2; //Coded in CRInputBitdepth
    1823         Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot];              //Coded in CRBitdepth
    1824         Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1];            //Coded in CRBitdepth
    1825         if ( iCodedPrev <= iSample && iSample <= iCodedNext )
    1826         {
    1827           Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev);
    1828           preLut[c][k]  = (Int)( 0.5f + fInterpol );
    1829           iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1;
    1830         }
    1831       }
    1832     }
    1833    
    1834     //Fill postLut
    1835     for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ )
    1836     {
    1837       Int iSample = k;
    1838       for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ )
    1839       {
    1840         Int iCodedPrev  = pCriSEI->m_postLutCodedValue[c][iPivot];    //Coded in CRBitdepth
    1841         Int iCodedNext  = pCriSEI->m_postLutCodedValue[c][iPivot+1];  //Coded in CRBitdepth
    1842         Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot];   //Coded in CRBitdepth
    1843         Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth
    1844         if ( iCodedPrev <= iSample && iSample <= iCodedNext )
    1845         {
    1846           Float fInterpol =  (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ;
    1847           postLut[c][k]  = (Int)( 0.5f + fInterpol );
    1848           iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1;
    1849         }
    1850       }
    1851     }
    1852   }
    1853 }
    1854 
    1855 Void TAppDecTop::xApplyColourRemapping( const TComSPS *sps, TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId )
    1856 {
    1857   const BitDepths& bitDpeths = sps->getBitDepths();
    1858 
    1859   if( !storeCriSEI.size() )
    1860   {
    1861 #if SVC_EXTENSION
    1862     storeCriSEI.resize(MAX_LAYERS);
    1863 #else
    1864     storeCriSEI.resize(1);
    1865 #endif
    1866   }
    1867 
    1868   if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management)
    1869   {
    1870     storeCriSEI[layerId] = *pCriSEI;
    1871   }
    1872 
    1873   if( !storeCriSEI[layerId].m_colourRemapCancelFlag && pCriSEI)
    1874   {
    1875     Int iHeight  = pic.getHeight(COMPONENT_Y);
    1876     Int iWidth   = pic.getWidth(COMPONENT_Y);
    1877     Int iStride  = pic.getStride(COMPONENT_Y);
    1878     Int iCStride = pic.getStride(COMPONENT_Cb);
    1879 
    1880     Pel *YUVIn[3], *YUVOut[3];
    1881     YUVIn[0] = pic.getAddr(COMPONENT_Y);
    1882     YUVIn[1] = pic.getAddr(COMPONENT_Cb);
    1883     YUVIn[2] = pic.getAddr(COMPONENT_Cr);
    1884    
    1885     TComPicYuv picColourRemapped;
    1886 
    1887 #if SVC_EXTENSION
    1888 #if AUXILIARY_PICTURES
    1889     picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), true, NULL );
    1890 #else
    1891     picColourRemapped.create( pic.getWidth(), pic.getHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), true, NULL );
    1892 #endif
    1893 #else
    1894     picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), true );
    1895 #endif
    1896     YUVOut[0] = picColourRemapped.getAddr(COMPONENT_Y);
    1897     YUVOut[1] = picColourRemapped.getAddr(COMPONENT_Cb);
    1898     YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr);
    1899 
    1900     std::vector<Int> preLut[3];
    1901     std::vector<Int> postLut[3];
    1902     xInitColourRemappingLut( bitDpeths, preLut, postLut, &storeCriSEI[layerId] );
    1903    
    1904     Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1));
    1905 
    1906     for( Int y = 0; y < iHeight ; y++ )
    1907     {
    1908       for( Int x = 0; x < iWidth ; x++ )
    1909       {
    1910         Int YUVPre[3], YUVMat[3];
    1911         YUVPre[0] = preLut[0][ YUVIn[0][x]   ];
    1912         YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ];
    1913         YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ];
    1914 
    1915         YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0]
    1916                     + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1]
    1917                     + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2]
    1918                     + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
    1919         YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] );
    1920         YUVOut[0][x] = postLut[0][ YUVMat[0] ];
    1921 
    1922         if( (y&1) && (x&1) )
    1923         {
    1924           for(Int c=1 ; c<3 ; c++)
    1925           {
    1926             YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0]
    1927                         + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1]
    1928                         + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2]
    1929                         + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
    1930             YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] );
    1931             YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ];   
    1932           }
    1933         }
    1934       }
    1935       YUVIn[0]  += iStride;
    1936       YUVOut[0] += iStride;
    1937       if( y&1 )
    1938       {
    1939         YUVIn[1]  += iCStride;
    1940         YUVIn[2]  += iCStride;
    1941         YUVOut[1] += iCStride;
    1942         YUVOut[2] += iCStride;
    1943       }
    1944     }
    1945 
    1946     //Write remapped picture in decoding order
    1947     TChar  cTemp[255];
    1948     sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth );
    1949     picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
    1950 
    1951     picColourRemapped.destroy();
    1952 
    1953     storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence
    1954   }
    1955   else
    1956   {
    1957     //Write no remapped picture in decoding order
    1958     if (storeCriSEI[layerId].m_colourRemapBitDepth == 8 || storeCriSEI[layerId].m_colourRemapBitDepth == 10)
    1959     {
    1960       TChar  cTemp[255];
    1961       sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), storeCriSEI[layerId].m_colourRemapBitDepth );
    1962       pic.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
    1963     }
    1964   }
    1965 }
    1966 #endif
    19672045//! \}
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.h

    r1442 r1460  
    6666  TDecTop*                        m_apcTDecTop[MAX_NUM_LAYER_IDS];                     ///< decoder point class
    6767  TVideoIOYuv*                    m_apcTVideoIOYuvReconFile[MAX_NUM_LAYER_IDS];        ///< reconstruction YUV class
     68#if CONFORMANCE_BITSTREAM_MODE
     69  TVideoIOYuv                     m_confReconFile[63];        ///< decode YUV files
     70#endif
     71  // for output control
     72  Int                             m_aiPOCLastDisplay [MAX_LAYERS]; ///< last POC in display order
    6873#else
    6974  TDecTop                         m_cTDecTop;                     ///< decoder class
    7075  TVideoIOYuv                     m_cTVideoIOYuvReconFile;        ///< reconstruction YUV class
     76
     77  // for output control
     78  Int                             m_iPOCLastDisplay;              ///< last POC in display order
    7179#endif
    72  
    73   // for output control 
     80
    7481  std::ofstream                   m_seiMessageFileStream;         ///< Used for outputing SEI messages.
    7582
    76 #if SVC_EXTENSION
    77 #if CONFORMANCE_BITSTREAM_MODE
    78   TVideoIOYuv                     m_confReconFile[63];        ///< decode YUV files
    79 #endif
    80   Int                             m_aiPOCLastDisplay [MAX_LAYERS]; ///< last POC in display order
    81 #else
    82   Int                             m_iPOCLastDisplay;              ///< last POC in display order
    83 #endif
    8483#if Q0074_COLOUR_REMAPPING_SEI
    85   std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI
    86   SEIColourRemappingInfo *seiColourRemappingInfoPrevious;
     84  SEIColourRemappingInfo*         m_pcSeiColourRemappingInfoPrevious;
     85  TComPicYuv*                     m_pcPicYuvColourRemapped;       ///< Colour Remapped picture
    8786#endif
    8887
     
    117116  Void  xDestroyDecLib    (); ///< destroy internal classes
    118117  Void  xInitDecLib       (); ///< initialize decoder class
    119  
    120 #if Q0074_COLOUR_REMAPPING_SEI
    121   Void  xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI );
    122   Void  xApplyColourRemapping( const TComSPS *sps, TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId = 0 );
    123 #endif
     118
    124119#if SVC_EXTENSION
    125120  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId ); ///< write YUV to file
     
    130125#endif
    131126  Bool  isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
     127
     128#if Q0074_COLOUR_REMAPPING_SEI
     129private:
     130  Void applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& pCriSEI, const TComSPS &activeSPS);
     131  Void xOutputColourRemapPic(TComPic* pcPic, const TComSPS* activeSPS);
     132#endif
    132133#if ALIGNED_BUMPING
    133134  Void checkOutputBeforeDecoding(Int layerIdx);
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1459 r1460  
    774774  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
    775775#if Q0074_COLOUR_REMAPPING_SEI
    776   string* cfg_colourRemapSEIFileName[MAX_LAYERS];
     776  string* cfg_colourRemapSEIFileRoot[MAX_LAYERS];
    777777#endif
    778778  Bool*   cfg_entropyCodingSyncEnabledFlag[MAX_LAYERS];
     
    793793    cfg_fQP[layer]          = &m_apcLayerCfg[layer]->m_fQP;
    794794#if Q0074_COLOUR_REMAPPING_SEI
    795     cfg_colourRemapSEIFileName[layer] = &m_apcLayerCfg[layer]->m_colourRemapSEIFileName;
     795    cfg_colourRemapSEIFileRoot[layer] = &m_apcLayerCfg[layer]->m_colourRemapSEIFileRoot;
    796796#endif
    797797    cfg_repFormatIdx[layer]         = &m_apcLayerCfg[layer]->m_repFormatIdx;
     
    10731073  ("PhaseVerChroma%d",                              cfg_phaseVerChromaPtr,            string(""), m_numLayers, "chroma shift in the vertical   direction used in resampling proces")
    10741074#if Q0074_COLOUR_REMAPPING_SEI
    1075   ("SEIColourRemappingInfoFileRoot%d",              cfg_colourRemapSEIFileName,       string(""), m_numLayers, "Colour Remapping Information SEI parameters file name for layer %d")
     1075  ("SEIColourRemappingInfoFileRoot%d,-cri",         cfg_colourRemapSEIFileRoot,       string(""), m_numLayers, "Colour Remapping Information SEI parameters root file name (wo num ext)")
    10761076#endif
    10771077  ("InputBitDepth%d",                                cfg_InputBitDepth[CHANNEL_TYPE_LUMA],     8, m_numLayers, "Bit-depth of input file for layer %d")
     
    11411141#if !SVC_EXTENSION
    11421142  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
    1143 #if Q0074_COLOUR_REMAPPING_SEI
    1144   ("SEIColourRemappingInfoFileRoot",                  m_colourRemapSEIFileName,                    string(""), "Colour Remapping Information SEI parameters file name")
    1145 #endif
    1146 #endif //SVC_EXTENSION
     1143#endif
    11471144  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
    11481145  ("FramesToBeEncoded,f",                             m_framesToBeEncoded,                                  0, "Number of frames to be encoded (default=all)")
     
    14621459  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
    14631460  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
     1461#if !SVC_EXTENSION
     1462#if Q0074_COLOUR_REMAPPING_SEI
     1463  ("SEIColourRemappingInfoFileRoot,-cri",             m_colourRemapSEIFileRoot,                    string(""), "Colour Remapping Information SEI parameters root file name (wo num ext)")
     1464#endif
     1465#endif
    14641466  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                        false, "Control generation of recovery point SEI messages")
    14651467  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                      false, "Control generation of buffering period SEI messages")
     
    15661568  ("SEIMasteringDisplayPrimaries",                    cfg_DisplayPrimariesCode,       cfg_DisplayPrimariesCode, "Mastering display primaries for all three colour planes in CIE xy coordinates in increments of 1/50000 (results in the ranges 0 to 50000 inclusive)")
    15671569  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
    1568  
     1570
    15691571#if LAYERS_NOT_PRESENT_SEI
    15701572  ("SEILayersNotPresent",                             m_layersNotPresentSEIEnabled,             0, "Control generation of layers not present SEI message")
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1459 r1460  
    457457  Int       m_log2MaxMvLengthHorizontal;                      ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
    458458  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
     459#if !SVC_EXTENSION
     460#if Q0074_COLOUR_REMAPPING_SEI
     461  std::string m_colourRemapSEIFileRoot;
     462#endif
     463#endif
    459464
    460465  std::string m_summaryOutFilename;                           ///< filename to use for producing summary output file.
     
    486491  Bool      m_elRapSliceBEnabled;
    487492#endif
    488 #if Q0074_COLOUR_REMAPPING_SEI
    489 #if !SVC_EXTENSION
    490   string    m_colourRemapSEIFileName;
    491 #endif
    492 #endif
     493
    493494  // internal member functions
    494495#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r1451 r1460  
    3131, m_repFormatIdx(-1)
    3232{
    33 #if Q0074_COLOUR_REMAPPING_SEI
    34   memset( m_colourRemapSEIPreLutCodedValue,   0, sizeof(m_colourRemapSEIPreLutCodedValue) );
    35   memset( m_colourRemapSEIPreLutTargetValue,  0, sizeof(m_colourRemapSEIPreLutTargetValue) );
    36   memset( m_colourRemapSEIPostLutCodedValue,  0, sizeof(m_colourRemapSEIPostLutCodedValue) );
    37   memset( m_colourRemapSEIPostLutTargetValue, 0, sizeof(m_colourRemapSEIPostLutTargetValue) );
    38 #endif
    3933  m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0;
    4034  m_aiPad[1] = m_aiPad[0] = 0;
     
    6458    delete[] m_aidQP;
    6559  }
    66 #if Q0074_COLOUR_REMAPPING_SEI
    67   for( Int c=0 ; c<3 ; c++)
    68   {
    69     if ( m_colourRemapSEIPreLutCodedValue[c] )
    70     {
    71       delete[] m_colourRemapSEIPreLutCodedValue[c];
    72     }
    73     if ( m_colourRemapSEIPreLutTargetValue[c] )
    74     {
    75       delete[] m_colourRemapSEIPreLutTargetValue[c];
    76     }
    77     if ( m_colourRemapSEIPostLutCodedValue[c] )
    78     {
    79       delete[] m_colourRemapSEIPostLutCodedValue[c];
    80     }
    81     if ( m_colourRemapSEIPostLutTargetValue[c] )
    82     {
    83       delete[] m_colourRemapSEIPostLutTargetValue[c];
    84     }
    85   }
    86 #endif
    8760}
    8861
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r1459 r1460  
    135135  Int       m_repFormatIdx;
    136136#if Q0074_COLOUR_REMAPPING_SEI
    137   string    m_colourRemapSEIFileName;                         ///< Colour Remapping Information SEI message parameters file
    138   Int       m_colourRemapSEIId;
    139   Bool      m_colourRemapSEICancelFlag;
    140   Bool      m_colourRemapSEIPersistenceFlag;
    141   Bool      m_colourRemapSEIVideoSignalInfoPresentFlag;
    142   Bool      m_colourRemapSEIFullRangeFlag;
    143   Int       m_colourRemapSEIPrimaries;
    144   Int       m_colourRemapSEITransferFunction;
    145   Int       m_colourRemapSEIMatrixCoefficients;
    146   Int       m_colourRemapSEIInputBitDepth;
    147   Int       m_colourRemapSEIBitDepth;
    148   Int       m_colourRemapSEIPreLutNumValMinus1[3];
    149   Int*      m_colourRemapSEIPreLutCodedValue[3];
    150   Int*      m_colourRemapSEIPreLutTargetValue[3];
    151   Bool      m_colourRemapSEIMatrixPresentFlag;
    152   Int       m_colourRemapSEILog2MatrixDenom;
    153   Int       m_colourRemapSEICoeffs[3][3];
    154   Int       m_colourRemapSEIPostLutNumValMinus1[3];
    155   Int*      m_colourRemapSEIPostLutCodedValue[3];
    156   Int*      m_colourRemapSEIPostLutTargetValue[3];
     137  string    m_colourRemapSEIFileRoot;
    157138#endif
    158139
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1459 r1460  
    505505    Bool&          m_bUseSAO                                    = m_apcLayerCfg[layer]->m_bUseSAO;
    506506
    507     string&        m_colourRemapSEIFileName                     = m_apcLayerCfg[layer]->m_colourRemapSEIFileName;
    508 
    509507    GOPEntry*      m_GOPList                                    = m_apcLayerCfg[layer]->m_GOPList;
    510508    Int&           m_extraRPSs                                  = m_apcLayerCfg[layer]->m_extraRPSs;
    511509    Int&           m_maxTempLayer                               = m_apcLayerCfg[layer]->m_maxTempLayer;
     510
     511#if Q0074_COLOUR_REMAPPING_SEI
     512    string&        m_colourRemapSEIFileRoot                     = m_apcLayerCfg[layer]->m_colourRemapSEIFileRoot;
     513#endif
    512514#endif
    513515
     
    542544  m_cTEncTop.setGopList                                           ( m_GOPList );
    543545  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSs );
    544 
    545546  for(Int i = 0; i < MAX_TLAYER; i++)
    546547  {
     
    765766  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
    766767  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     768#if Q0074_COLOUR_REMAPPING_SEI
     769  m_cTEncTop.setColourRemapInfoSEIFileRoot                        ( m_colourRemapSEIFileRoot );
     770#endif
    767771  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    768772
     
    842846  m_cTEncTop.setSummaryVerboseness                                ( m_summaryVerboseness );
    843847
    844 #if Q0074_COLOUR_REMAPPING_SEI
    845   m_cTEncTop.xSetCRISEIFileRoot                                   ( m_colourRemapSEIFileName );
    846 #endif
    847848#if LAYERS_NOT_PRESENT_SEI
    848849  m_cTEncTop.setLayersNotPresentSEIEnabled                        ( m_layersNotPresentSEIEnabled );
Note: See TracChangeset for help on using the changeset viewer.