Changeset 1323 in SHVCSoftware


Ignore:
Timestamp:
22 Jul 2015, 00:03:09 (9 years ago)
Author:
seregin
Message:

port rev 4401

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

Legend:

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

    r1301 r1323  
    124124#endif
    125125  ("OutputDecodedSEIMessagesFilename",  m_outputDecodedSEIMessagesFilename,    string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
     126  ("ClipOutputVideoToRec709Range",      m_bClipOutputVideoToRec709Range,  false, "If true then clip output video to the Rec. 709 Range on saving")
    126127#if Q0074_COLOUR_REMAPPING_SEI
    127128  ("SEIColourRemappingInfo,-cri", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n"
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.h

    r1282 r1323  
    8080#endif
    8181  std::string   m_outputDecodedSEIMessagesFilename;   ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details.
     82  Bool          m_bClipOutputVideoToRec709Range;      ///< If true, clip the output video to the Rec 709 range on saving.
    8283
    8384#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r1319 r1323  
    915915            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    916916            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    917             conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
     917            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(),
     918            NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range  );
    918919        }
    919920
     
    931932                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    932933                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    933                                          conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     934                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
     935                                         NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range  );
    934936        }
    935937
     
    11381140          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    11391141
    1140           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    1141             conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    1142             conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    1143             conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    1144             conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
     1142          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     1143                                                   m_outputColourSpaceConvert,
     1144                                                   conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
     1145                                                   conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     1146                                                   conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
     1147                                                   conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(),           
     1148                                                   NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
    11451149        }
    11461150
     
    11581162                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    11591163                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    1160                                          conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     1164                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
     1165                                         NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
    11611166        }
    11621167
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1322 r1323  
    11971197  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
    11981198  ("FramesToBeEncoded,f",                             m_framesToBeEncoded,                                  0, "Number of frames to be encoded (default=all)")
     1199  ("ClipInputVideoToRec709Range",                     m_bClipInputVideoToRec709Range,                   false, "If true then clip input video to the Rec. 709 Range on loading when InternalBitDepth is less than MSBExtendedBitDepth")
     1200  ("ClipOutputVideoToRec709Range",                    m_bClipOutputVideoToRec709Range,                  false, "If true then clip output video to the Rec. 709 Range on saving when OutputBitDepth is less than InternalBitDepth")
    11991201
    12001202  //Field coding parameters
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1322 r1323  
    123123  Bool      m_printSequenceMSE;
    124124  Bool      m_cabacZeroWordPaddingEnabled;
     125  Bool      m_bClipInputVideoToRec709Range;
     126  Bool      m_bClipOutputVideoToRec709Range;
    125127
    126128#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1322 r1323  
    17141714
    17151715        // read input YUV file
    1716         m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], ipCSC, m_acLayerCfg[layer].getPad(), m_acLayerCfg[layer].getInputChromaFormat() );
     1716        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], ipCSC, m_acLayerCfg[layer].getPad(), m_acLayerCfg[layer].getInputChromaFormat(), m_bClipInputVideoToRec709Range );
    17171717
    17181718#if AUXILIARY_PICTURES
     
    20512051
    20522052    // read input YUV file
    2053     m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC );
     2053    m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
    20542054
    20552055    // increase number of received frames
     
    22002200      if( !m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed() )
    22012201      {
    2202 #if SVC_EXTENSION
    22032202        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    2204           m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal );
    2205 #else
    2206         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
    2207           m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() );
    2208 #endif
     2203          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal,
     2204          NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range  );
    22092205      }
    22102206    }
     
    23402336      if (m_pchReconFile)
    23412337      {
    2342         m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     2338        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom,
     2339            NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range  );
    23432340      }
    23442341
  • branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h

    r1304 r1323  
    213213#define ADAPT_SR_SCALE              1           ///< division factor for adaptive search range
    214214
    215 #define CLIP_TO_709_RANGE           0
    216 
    217215// Early-skip threshold (encoder)
    218216#define EARLY_SKIP_THRES            1.50        ///< if RD < thres*avg[BestSkipRD]
  • branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r1320 r1323  
    678678 * @return true for success, false in case of error
    679679 */
    680 Bool TVideoIOYuv::read ( TComPicYuv*  pPicYuvUser, TComPicYuv* pPicYuvTrueOrg, const InputColourSpaceConversion ipcsc, Int aiPad[2], ChromaFormat format )
     680Bool TVideoIOYuv::read ( TComPicYuv*  pPicYuvUser, TComPicYuv* pPicYuvTrueOrg, const InputColourSpaceConversion ipcsc, Int aiPad[2], ChromaFormat format, const Bool bClipToRec709 )
    681681{
    682682  // check end-of-file
     
    720720    const Int desired_bitdepth = m_MSBExtendedBitDepth[chType] + m_bitdepthShift[chType];
    721721
    722 #if !CLIP_TO_709_RANGE
    723     const Pel minval = 0;
    724     const Pel maxval = (1 << desired_bitdepth) - 1;
    725 #else
    726     const Bool b709Compliance=(m_bitdepthShift[chType] < 0 && desired_bitdepth >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
     722    const Bool b709Compliance=(bClipToRec709) && (m_bitdepthShift[chType] < 0 && desired_bitdepth >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
    727723    const Pel minval = b709Compliance? ((   1 << (desired_bitdepth - 8))   ) : 0;
    728724    const Pel maxval = b709Compliance? ((0xff << (desired_bitdepth - 8)) -1) : (1 << desired_bitdepth) - 1;
    729 #endif
    730725
    731726    if (! readPlane(pPicYuv->getAddr(compID), m_cHandle, is16bit, stride444, width444, height444, pad_h444, pad_v444, compID, pPicYuv->getChromaFormat(), format, m_fileBitdepth[chType]))
     
    760755 * @return true for success, false in case of error
    761756 */
    762 Bool TVideoIOYuv::write( TComPicYuv* pPicYuvUser, const InputColourSpaceConversion ipCSC, Int confLeft, Int confRight, Int confTop, Int confBottom, ChromaFormat format )
     757Bool TVideoIOYuv::write( TComPicYuv* pPicYuvUser, const InputColourSpaceConversion ipCSC, Int confLeft, Int confRight, Int confTop, Int confBottom, ChromaFormat format, const Bool bClipToRec709 )
    763758{
    764759  TComPicYuv cPicYuvCSCd;
     
    811806      const ComponentID compID=ComponentID(comp);
    812807      const ChannelType ch=toChannelType(compID);
    813 #if !CLIP_TO_709_RANGE
    814       const Pel minval = 0;
    815       const Pel maxval = (1 << m_MSBExtendedBitDepth[ch]) - 1;
    816 #else
    817       const Bool b709Compliance=(-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
     808      const Bool b709Compliance = bClipToRec709 && (-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
    818809      const Pel minval = b709Compliance? ((   1 << (m_MSBExtendedBitDepth[ch] - 8))   ) : 0;
    819810      const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    820 #endif
    821811
    822812      scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
     
    852842}
    853843
    854 Bool TVideoIOYuv::write( TComPicYuv* pPicYuvUserTop, TComPicYuv* pPicYuvUserBottom, const InputColourSpaceConversion ipCSC, Int confLeft, Int confRight, Int confTop, Int confBottom, ChromaFormat format, const Bool isTff )
     844Bool TVideoIOYuv::write( TComPicYuv* pPicYuvUserTop, TComPicYuv* pPicYuvUserBottom, const InputColourSpaceConversion ipCSC, Int confLeft, Int confRight, Int confTop, Int confBottom, ChromaFormat format, const Bool isTff, const Bool bClipToRec709 )
    855845{
    856846
     
    906896        const ComponentID compID=ComponentID(comp);
    907897        const ChannelType ch=toChannelType(compID);
    908 #if !CLIP_TO_709_RANGE
    909         const Pel minval = 0;
    910         const Pel maxval = (1 << m_MSBExtendedBitDepth[ch]) - 1;
    911 #else
    912         const Bool b709Compliance=(-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
     898        const Bool b709Compliance=bClipToRec709 && (-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8);     /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
    913899        const Pel minval = b709Compliance? ((   1 << (m_MSBExtendedBitDepth[ch] - 8))   ) : 0;
    914900        const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    915 #endif
    916901
    917902        scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
  • branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.h

    r1307 r1323  
    7272
    7373
    74   Bool  read  ( TComPicYuv* pPicYuv, TComPicYuv* pPicYuvTrueOrg, const InputColourSpaceConversion ipcsc, Int aiPad[2], ChromaFormat fileFormat=NUM_CHROMA_FORMAT );     ///< read one frame with padding parameter
    75   Bool  write ( TComPicYuv* pPicYuv, const InputColourSpaceConversion ipCSC, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0, ChromaFormat fileFormat=NUM_CHROMA_FORMAT );     ///< write one YUV frame with padding parameter
    76   Bool  write ( TComPicYuv* pPicYuvTop, TComPicYuv* pPicYuvBottom, const InputColourSpaceConversion ipCSC, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0, ChromaFormat fileFormat=NUM_CHROMA_FORMAT, Bool isTff=false);
     74  // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuvTrueOrg
     75  Bool  read  ( TComPicYuv* pPicYuv, TComPicYuv* pPicYuvTrueOrg, const InputColourSpaceConversion ipcsc, Int aiPad[2], ChromaFormat fileFormat=NUM_CHROMA_FORMAT, const Bool bClipToRec709=false );     ///< read one frame with padding parameter
     76
     77  // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuv
     78  Bool  write ( TComPicYuv* pPicYuv, const InputColourSpaceConversion ipCSC, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0, ChromaFormat fileFormat=NUM_CHROMA_FORMAT, const Bool bClipToRec709=false );     ///< write one YUV frame with padding parameter
     79
     80  // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuvTop and pPicYuvBottom
     81  Bool  write ( TComPicYuv* pPicYuvTop, TComPicYuv* pPicYuvBottom, const InputColourSpaceConversion ipCSC, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0, ChromaFormat fileFormat=NUM_CHROMA_FORMAT, const Bool isTff=false, const Bool bClipToRec709=false);
    7782  static Void ColourSpaceConvert(const TComPicYuv &src, TComPicYuv &dest, const InputColourSpaceConversion conversion, Bool bIsForwards);
    7883
Note: See TracChangeset for help on using the changeset viewer.