Changeset 1427 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibVideoIO


Ignore:
Timestamp:
5 Aug 2015, 20:04:35 (10 years ago)
Author:
seregin
Message:

port rev 4583 and rev 4584

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r1354 r1427  
    9595}
    9696
     97static Void
     98copyPlane(const TComPicYuv &src, const ComponentID srcPlane, TComPicYuv &dest, const ComponentID destPlane);
    9799
    98100// ====================================================================================================================
     
    760762  if (ipCSC!=IPCOLOURSPACE_UNCHANGED)
    761763  {
    762     cPicYuvCSCd.create(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat(), pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), 0, false);
     764    cPicYuvCSCd.createWithoutCUInfo(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat() );
    763765    ColourSpaceConvert(*pPicYuvUser, cPicYuvCSCd, ipCSC, false);
    764766  }
     
    766768
    767769  // compute actual YUV frame size excluding padding size
    768   const Int   iStride444 = pPicYuv->getStride(COMPONENT_Y);
    769   const UInt width444  = pPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;
    770   const UInt height444 = pPicYuv->getHeight(COMPONENT_Y) -  confTop  - confBottom;
    771770  Bool is16bit = false;
    772771  Bool nonZeroBitDepthShift=false;
    773 
    774   if ((width444 == 0) || (height444 == 0))
    775   {
    776     printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);
    777   }
    778772
    779773  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     
    799793  {
    800794    dstPicYuv = new TComPicYuv;
    801     dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false );
    802     pPicYuv->copyToPic(dstPicYuv);
     795    dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() );
    803796
    804797    for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++)
     
    810803      const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    811804
     805      copyPlane(*pPicYuv, compID, *dstPicYuv, compID);
    812806      scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
    813807    }
     
    816810  {
    817811    dstPicYuv = pPicYuv;
     812  }
     813
     814  const Int  stride444 = dstPicYuv->getStride(COMPONENT_Y);
     815  const UInt width444  = dstPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;
     816  const UInt height444 = dstPicYuv->getHeight(COMPONENT_Y) -  confTop  - confBottom;
     817
     818  if ((width444 == 0) || (height444 == 0))
     819  {
     820    printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);
    818821  }
    819822
     
    822825    const ComponentID compID = ComponentID(comp);
    823826    const ChannelType ch=toChannelType(compID);
    824     const UInt csx = pPicYuv->getComponentScaleX(compID);
    825     const UInt csy = pPicYuv->getComponentScaleY(compID);
    826     const Int planeOffset =  (confLeft>>csx) + (confTop>>csy) * pPicYuv->getStride(compID);
    827     if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, iStride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))
     827    const UInt csx = dstPicYuv->getComponentScaleX(compID);
     828    const UInt csy = dstPicYuv->getComponentScaleY(compID);
     829    const Int planeOffset =  (confLeft>>csx) + (confTop>>csy) * dstPicYuv->getStride(compID);
     830    if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, stride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))
    828831    {
    829832      retval=false;
     
    849852  if (ipCSC!=IPCOLOURSPACE_UNCHANGED)
    850853  {
    851     cPicYuvTopCSCd   .create(pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), pPicYuvUserTop   ->getChromaFormat(), pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), 0, false);
    852     cPicYuvBottomCSCd.create(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat(), pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), 0, false);
     854    cPicYuvTopCSCd   .createWithoutCUInfo(pPicYuvUserTop   ->getWidth(COMPONENT_Y), pPicYuvUserTop   ->getHeight(COMPONENT_Y), pPicYuvUserTop   ->getChromaFormat() );
     855    cPicYuvBottomCSCd.createWithoutCUInfo(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat() );
    853856    ColourSpaceConvert(*pPicYuvUserTop,    cPicYuvTopCSCd,    ipCSC, false);
    854857    ColourSpaceConvert(*pPicYuvUserBottom, cPicYuvBottomCSCd, ipCSC, false);
     
    889892    {
    890893      dstPicYuv = new TComPicYuv;
    891       dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false );
    892       pPicYuv->copyToPic(dstPicYuv);
     894      dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() );
    893895
    894896      for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++)
     
    900902        const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1;
    901903
     904        copyPlane(*pPicYuv, compID, *dstPicYuv, compID);
    902905        scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval);
    903906      }
     
    913916  assert(dstPicYuvTop->getNumberValidComponents() == dstPicYuvBottom->getNumberValidComponents());
    914917  assert(dstPicYuvTop->getChromaFormat()          == dstPicYuvBottom->getChromaFormat()         );
    915   assert(dstPicYuvTop->getWidth(COMPONENT_Y)      == dstPicYuvBottom->getWidth(COMPONENT_Y)    );
    916   assert(dstPicYuvTop->getHeight(COMPONENT_Y)     == dstPicYuvBottom->getHeight(COMPONENT_Y)    );
    917   assert(dstPicYuvTop->getStride(COMPONENT_Y)     == dstPicYuvBottom->getStride(COMPONENT_Y)    );
    918918
    919919  for(UInt comp=0; retval && comp<dstPicYuvTop->getNumberValidComponents(); comp++)
     
    922922    const ChannelType ch=toChannelType(compID);
    923923
     924    assert(dstPicYuvTop->getWidth          (compID) == dstPicYuvBottom->getWidth          (compID));
     925    assert(dstPicYuvTop->getHeight         (compID) == dstPicYuvBottom->getHeight         (compID));
    924926    assert(dstPicYuvTop->getComponentScaleX(compID) == dstPicYuvBottom->getComponentScaleX(compID));
    925927    assert(dstPicYuvTop->getComponentScaleY(compID) == dstPicYuvBottom->getComponentScaleY(compID));
Note: See TracChangeset for help on using the changeset viewer.