Changeset 1572 in SHVCSoftware


Ignore:
Timestamp:
20 Jun 2016, 18:41:36 (8 years ago)
Author:
seregin
Message:

port rev 4752

Location:
branches/SHM-dev/source
Files:
14 edited

Legend:

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

    r1569 r1572  
    16191619  ("SEIPreferredTransferCharacterisics",              m_preferredTransferCharacteristics,                   -1, "Value for the preferred_transfer_characteristics field of the Alternative transfer characteristics SEI which will override the corresponding entry in the VUI. If negative, do not produce the respective SEI message")
    16201620#endif
     1621  ("SEIGreenMetadataType",                            m_greenMetadataType,                   0u, "Value for the green_metadata_type specifies the type of metadata that is present in the SEI message. If green_metadata_type is 1, then metadata enabling quality recovery after low-power encoding is present")
     1622  ("SEIXSDMetricType",                                m_xsdMetricType,                      0u, "Value for the xsd_metric_type indicates the type of the objective quality metric. PSNR is the only type currently supported")
    16211623
    16221624#if LAYERS_NOT_PRESENT_SEI
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1569 r1572  
    454454  Int       m_preferredTransferCharacteristics;
    455455#endif
     456  UInt      m_greenMetadataType;
     457  UInt      m_xsdMetricType;
    456458
    457459  // weighted prediction
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1569 r1572  
    812812  m_cTEncTop.setSEIPreferredTransferCharacteristics               ( UChar(m_preferredTransferCharacteristics) );
    813813#endif
     814  m_cTEncTop.setSEIGreenMetadataInfoSEIEnable                     ( m_greenMetadataType > 0 );
     815  m_cTEncTop.setSEIGreenMetadataType                              ( UChar(m_greenMetadataType) );
     816  m_cTEncTop.setSEIXSDMetricType                                  ( UChar(m_xsdMetricType) );
    814817
    815818  m_cTEncTop.setTileUniformSpacingFlag                            ( m_tileUniformSpacingFlag );
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.cpp

    r1550 r1572  
    136136    case SEI::FRAME_PACKING:                        return "Frame packing arrangement";
    137137    case SEI::DISPLAY_ORIENTATION:                  return "Display orientation";
     138    case SEI::GREEN_METADATA:                       return "Green metadata information";
    138139    case SEI::SOP_DESCRIPTION:                      return "Structure of pictures information";
    139140    case SEI::ACTIVE_PARAMETER_SETS:                return "Active parameter sets";
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.h

    r1550 r1572  
    7777    FRAME_PACKING                        = 45,
    7878    DISPLAY_ORIENTATION                  = 47,
     79    GREEN_METADATA                       = 56,
    7980    SOP_DESCRIPTION                      = 128,
    8081    ACTIVE_PARAMETER_SETS                = 129,
     
    650651#endif
    651652
     653class SEIGreenMetadataInfo : public SEI
     654{
     655public:
     656    PayloadType payloadType() const { return GREEN_METADATA; }
     657    SEIGreenMetadataInfo() {}
     658   
     659    virtual ~SEIGreenMetadataInfo() {}
     660   
     661    UInt m_greenMetadataType;
     662    UInt m_xsdMetricType;
     663    UInt m_xsdMetricValue;
     664};
     665
    652666#if P0123_ALPHA_CHANNEL_SEI
    653667class SEIAlphaChannelInfo : public SEI
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp

    r1549 r1572  
    414414        xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize, pDecodedMessageOutputStream);
    415415        break;
     416      case SEI::GREEN_METADATA:
     417        sei = new SEIGreenMetadataInfo;
     418        xParseSEIGreenMetadataInfo((SEIGreenMetadataInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     419        break;
    416420      default:
    417421        for (UInt i = 0; i < payloadSize; i++)
     
    14601464}
    14611465#endif
     1466
     1467Void SEIReader::xParseSEIGreenMetadataInfo(SEIGreenMetadataInfo& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream)
     1468{
     1469  UInt code;
     1470  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1471 
     1472  sei_read_code(pDecodedMessageOutputStream, 8, code, "green_metadata_type");
     1473  sei.m_greenMetadataType = code;
     1474 
     1475  sei_read_code(pDecodedMessageOutputStream, 8, code, "xsd_metric_type");
     1476  sei.m_xsdMetricType = code;
     1477 
     1478  sei_read_code(pDecodedMessageOutputStream, 16, code, "xsd_metric_value");
     1479  sei.m_xsdMetricValue = code;
     1480}
    14621481
    14631482#if SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.h

    r1549 r1572  
    112112  Void xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei,              UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
    113113#endif
     114  Void xParseSEIGreenMetadataInfo             (SEIGreenMetadataInfo& sei,             UInt payLoadSize,                     std::ostream *pDecodedMessageOutputStream);
    114115
    115116  Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName);
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.cpp

    r1549 r1572  
    680680#endif
    681681
     682Void SEIEncoder::initSEIGreenMetadataInfo(SEIGreenMetadataInfo *seiGreenMetadataInfo, UInt u)
     683{
     684    assert (m_isInitialized);
     685    assert (seiGreenMetadataInfo!=NULL);
     686
     687    seiGreenMetadataInfo->m_greenMetadataType = m_pcCfg->getSEIGreenMetadataType();
     688    seiGreenMetadataInfo->m_xsdMetricType = m_pcCfg->getSEIXSDMetricType();
     689    seiGreenMetadataInfo->m_xsdMetricValue = u;
     690}
     691
    682692#if LAYERS_NOT_PRESENT_SEI
    683693Void SEIEncoder::initSEILayersNotPresent(SEILayersNotPresent *seiLayersNotPresent)
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.h

    r1549 r1572  
    105105  Void initDecodedPictureHashSEI(SEIDecodedPictureHash *sei, TComPic *pcPic, std::string &rHashString, const BitDepths &bitDepths);
    106106  Void initTemporalLevel0IndexSEI(SEITemporalLevel0Index *sei, TComSlice *slice);
     107  Void initSEIGreenMetadataInfo(SEIGreenMetadataInfo *sei, UInt u);
    107108
    108109private:
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r1549 r1572  
    163163    break;
    164164#endif
     165  case SEI::GREEN_METADATA:
     166      xWriteSEIGreenMetadataInfo(*static_cast<const SEIGreenMetadataInfo*>(&sei));
     167    break;
    165168
    166169#if SVC_EXTENSION
     
    10861089#endif
    10871090
     1091Void SEIWriter::xWriteSEIGreenMetadataInfo(const SEIGreenMetadataInfo& sei)
     1092{
     1093  WRITE_CODE(sei.m_greenMetadataType, 8, "green_metadata_type");
     1094 
     1095  WRITE_CODE(sei.m_xsdMetricType, 8, "xsd_metric_type");
     1096  WRITE_CODE(sei.m_xsdMetricValue, 16, "xsd_metric_value");
     1097}
     1098
    10881099#if SVC_EXTENSION
    10891100#if LAYERS_NOT_PRESENT_SEI
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.h

    r1549 r1572  
    9494  Void xWriteSEIAlternativeTransferCharacteristics(const SEIAlternativeTransferCharacteristics& sei);
    9595#endif
     96  Void xWriteSEIGreenMetadataInfo(const SEIGreenMetadataInfo &sei);
    9697
    9798#if O0164_MULTI_LAYER_HRD
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1569 r1572  
    348348  UChar     m_preferredTransferCharacteristics;
    349349#endif
     350  Bool      m_greenMetadataInfoSEIEnabled;
     351  UChar     m_greenMetadataType;
     352  UChar     m_xsdMetricType;
    350353  //====== Weighted Prediction ========
    351354  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    958961  UChar getSEIPreferredTransferCharacteristics() const               { return m_preferredTransferCharacteristics; }
    959962#endif
     963  Void  setSEIGreenMetadataInfoSEIEnable( Bool b)                    { m_greenMetadataInfoSEIEnabled = b;    }
     964  Bool  getSEIGreenMetadataInfoSEIEnable( ) const                    { return m_greenMetadataInfoSEIEnabled; }
     965  Void  setSEIGreenMetadataType(UChar v)                             { m_greenMetadataType = v;    }
     966  UChar getSEIGreenMetadataType() const                              { return m_greenMetadataType; }
     967  Void  setSEIXSDMetricType(UChar v)                                 { m_xsdMetricType = v;    }
     968  UChar getSEIXSDMetricType() const                                  { return m_xsdMetricType; }
     969
    960970  const TComSEIMasteringDisplay &getMasteringDisplaySEI() const      { return m_masteringDisplay; }
    961971  Void         setUseWP               ( Bool b )                     { m_useWeightedPred   = b;    }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1570 r1572  
    27462746    }
    27472747
     2748    m_pcCfg->setEncodedFlag(iGOPid, true);
     2749
     2750    Double PSNR_Y;
     2751    xCalculateAddPSNRs( isField, isTff, iGOPid, pcPic, accessUnit, rcListPic, dEncTime, snr_conversion, printFrameMSE, &PSNR_Y );
     2752   
     2753    // Only produce the Green Metadata SEI message with the last picture.
     2754    if( m_pcCfg->getSEIGreenMetadataInfoSEIEnable() && pcSlice->getPOC() == ( m_pcCfg->getFramesToBeEncoded() - 1 )  )
     2755    {
     2756      SEIGreenMetadataInfo *seiGreenMetadataInfo = new SEIGreenMetadataInfo;
     2757      m_seiEncoder.initSEIGreenMetadataInfo(seiGreenMetadataInfo, (UInt)(PSNR_Y * 100 + 0.5));
     2758      trailingSeiMessages.push_back(seiGreenMetadataInfo);
     2759    }
     2760   
    27482761#if O0164_MULTI_LAYER_HRD
    27492762    xWriteTrailingSEIMessages(trailingSeiMessages, accessUnit, pcSlice->getTLayer(), pcSlice->getVPS(), pcSlice->getSPS());
     
    27512764    xWriteTrailingSEIMessages(trailingSeiMessages, accessUnit, pcSlice->getTLayer(), pcSlice->getSPS());
    27522765#endif
    2753 
    2754     m_pcCfg->setEncodedFlag(iGOPid, true);
    2755 
    2756     xCalculateAddPSNRs( isField, isTff, iGOPid, pcPic, accessUnit, rcListPic, dEncTime, snr_conversion, printFrameMSE );
    2757 
     2766       
    27582767    printHash(m_pcCfg->getDecodedPictureHashSEIType(), digestStr);
    27592768
     
    30213030}
    30223031
    3023 Void TEncGOP::xCalculateAddPSNRs( const Bool isField, const Bool isFieldTopFieldFirst, const Int iGOPid, TComPic* pcPic, const AccessUnit&accessUnit, TComList<TComPic*> &rcListPic, const Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE )
    3024 {
    3025   xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE );
     3032Void TEncGOP::xCalculateAddPSNRs( const Bool isField, const Bool isFieldTopFieldFirst, const Int iGOPid, TComPic* pcPic, const AccessUnit&accessUnit, TComList<TComPic*> &rcListPic, const Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, Double* PSNR_Y )
     3033{
     3034  xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE, PSNR_Y );
    30263035
    30273036  //In case of field coding, compute the interlaced PSNR for both fields
     
    30783087      if( (pcPic->isTopField() && isFieldTopFieldFirst) || (!pcPic->isTopField() && !isFieldTopFieldFirst))
    30793088      {
    3080         xCalculateInterlacedAddPSNR(pcPic, correspondingFieldPic, pcPic->getPicYuvRec(), correspondingFieldPic->getPicYuvRec(), snr_conversion, printFrameMSE );
     3089        xCalculateInterlacedAddPSNR(pcPic, correspondingFieldPic, pcPic->getPicYuvRec(), correspondingFieldPic->getPicYuvRec(), snr_conversion, printFrameMSE, PSNR_Y );
    30813090      }
    30823091      else
    30833092      {
    3084         xCalculateInterlacedAddPSNR(correspondingFieldPic, pcPic, correspondingFieldPic->getPicYuvRec(), pcPic->getPicYuvRec(), snr_conversion, printFrameMSE );
    3085       }
    3086     }
    3087   }
    3088 }
    3089 
    3090 Void TEncGOP::xCalculateAddPSNR( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion conversion, const Bool printFrameMSE )
     3093        xCalculateInterlacedAddPSNR(correspondingFieldPic, pcPic, correspondingFieldPic->getPicYuvRec(), pcPic->getPicYuvRec(), snr_conversion, printFrameMSE, PSNR_Y );
     3094      }
     3095    }
     3096  }
     3097}
     3098
     3099Void TEncGOP::xCalculateAddPSNR( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit& accessUnit, Double dEncTime, const InputColourSpaceConversion conversion, const Bool printFrameMSE, Double* PSNR_Y )
    30913100{
    30923101  Double  dPSNR[MAX_NUM_COMPONENT];
     
    31663175  {
    31673176    m_gcAnalyzeI.addResult (dPSNR, (Double)uibits, MSEyuvframe);
     3177    *PSNR_Y = dPSNR[COMPONENT_Y];
    31683178  }
    31693179  if (pcSlice->isInterP())
    31703180  {
    31713181    m_gcAnalyzeP.addResult (dPSNR, (Double)uibits, MSEyuvframe);
     3182    *PSNR_Y = dPSNR[COMPONENT_Y];
    31723183  }
    31733184  if (pcSlice->isInterB())
    31743185  {
    31753186    m_gcAnalyzeB.addResult (dPSNR, (Double)uibits, MSEyuvframe);
     3187    *PSNR_Y = dPSNR[COMPONENT_Y];
    31763188  }
    31773189
     
    32823294Void TEncGOP::xCalculateInterlacedAddPSNR( TComPic* pcPicOrgFirstField, TComPic* pcPicOrgSecondField,
    32833295                                           TComPicYuv* pcPicRecFirstField, TComPicYuv* pcPicRecSecondField,
    3284                                            const InputColourSpaceConversion conversion, const Bool printFrameMSE )
     3296                                           const InputColourSpaceConversion conversion, const Bool printFrameMSE, Double* PSNR_Y )
    32853297{
    32863298  const TComSPS &sps=pcPicOrgFirstField->getPicSym()->getSPS();
     
    33553367  //===== add PSNR =====
    33563368  m_gcAnalyzeAll_in.addResult (dPSNR, (Double)uibits, MSEyuvframe);
     3369
     3370  *PSNR_Y = dPSNR[COMPONENT_Y];
    33573371
    33583372  printf("\n                                      Interlaced frame %d: [Y %6.4lf dB    U %6.4lf dB    V %6.4lf dB]", pcPicOrgSecondField->getPOC()/2 , dPSNR[COMPONENT_Y], dPSNR[COMPONENT_Cb], dPSNR[COMPONENT_Cr] );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1549 r1572  
    228228  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, Bool isField );
    229229
    230   Void  xCalculateAddPSNRs         ( const Bool isField, const Bool isFieldTopFieldFirst, const Int iGOPid, TComPic* pcPic, const AccessUnit&accessUnit, TComList<TComPic*> &rcListPic, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
    231   Void  xCalculateAddPSNR          ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
     230  Void  xCalculateAddPSNRs         ( const Bool isField, const Bool isFieldTopFieldFirst, const Int iGOPid, TComPic* pcPic, const AccessUnit&accessUnit, TComList<TComPic*> &rcListPic, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, Double* PSNR_Y );
     231  Void  xCalculateAddPSNR          ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, Double* PSNR_Y );
    232232  Void  xCalculateInterlacedAddPSNR( TComPic* pcPicOrgFirstField, TComPic* pcPicOrgSecondField,
    233233                                     TComPicYuv* pcPicRecFirstField, TComPicYuv* pcPicRecSecondField,
    234                                      const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE );
     234                                     const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, Double* PSNR_Y );
    235235
    236236  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths);
Note: See TracChangeset for help on using the changeset viewer.