43 #include <malloc/malloc.h>
84 const Bool bUseMargin,
85 const UInt maxCUWidth,
86 const UInt maxCUHeight)
94 m_marginX = (bUseMargin?maxCUWidth:0) + 16;
95 m_marginY = (bUseMargin?maxCUHeight:0) + 16;
124 const UInt maxCUWidth,
125 const UInt maxCUHeight,
126 const UInt maxCUDepth,
127 const Bool bUseMargin)
130 createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight);
144 for (
Int cuRow = 0; cuRow < numCuInHeight; cuRow++)
146 for (
Int cuCol = 0; cuCol < numCuInWidth; cuCol++)
148 m_ctuOffsetInBuffer[chan][cuRow * numCuInWidth + cuCol] = stride * cuRow * ctuHeight + cuCol * ctuWidth;
154 const Int numSubBlockPartitions=(1<<maxCUDepth);
155 const Int minSubBlockHeight =(ctuHeight >> maxCUDepth);
156 const Int minSubBlockWidth =(ctuWidth >> maxCUDepth);
158 for (
Int buRow = 0; buRow < numSubBlockPartitions; buRow++)
160 for (
Int buCol = 0; buCol < numSubBlockPartitions; buCol++)
162 m_subCuOffsetInBuffer[chan][(buRow << maxCUDepth) + buCol] = stride * buRow * minSubBlockHeight + buCol * minSubBlockWidth;
208 assert(pcPicYuvDst->
getWidth(compId) == width);
209 assert(pcPicYuvDst->
getHeight(compId) == height);
210 if (strideSrc==pcPicYuvDst->
getStride(compId))
220 for(
Int y=0; y<height; y++, pSrc+=strideSrc, pDest+=strideDest)
222 ::memcpy(pDest, pSrc, width*
sizeof(
Pel));
248 for (
Int y = 0; y < height; y++)
250 for (
Int x = 0; x < marginX; x++ )
252 pi[ -marginX + x ] = pi[0];
253 pi[ width + x ] = pi[width-1];
259 pi -= (stride + marginX);
261 for (
Int y = 0; y < marginY; y++ )
263 ::memcpy( pi + (y+1)*stride, pi,
sizeof(
Pel)*(width + (marginX<<1)) );
267 pi -= ((height-1) * stride);
269 for (
Int y = 0; y < marginY; y++ )
271 ::memcpy( pi - (y+1)*stride, pi,
sizeof(
Pel)*(width + (marginX<<1)) );
283 FILE *pFile = fopen (fileName.c_str(), bAppend?
"ab":
"wb");
304 for (
Int y = 0; y < height; y++ )
306 for (
Int x = 0; x < width; x++ )
309 fwrite( &uc,
sizeof(
UChar), 1, pFile );
310 uc = (
UChar)((pi[x]>>8) & 0xff);
311 fwrite( &uc,
sizeof(
UChar), 1, pFile );
319 const Int offset = (shift>0)?(1<<(shift-1)):0;
320 for (
Int y = 0; y < height; y++ )
322 for (
Int x = 0; x < width; x++ )
324 UChar uc = (
UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
325 fwrite( &uc,
sizeof(
UChar), 1, pFile );
Int m_marginX
margin of Luma channel (chroma's may be smaller, depending on ratio)
Int m_picHeight
Height of picture in pixels.
Int getStride(const ComponentID id) const
Void createWithoutCUInfo(const Int picWidth, const Int picHeight, const ChromaFormat chromaFormatIDC, const Bool bUseMargin=false, const UInt maxCUWidth=0, const UInt maxCUHeight=0)
used for margin only
Int getHeight(const ComponentID id) const
Pel * m_apiPicBuf[MAX_NUM_COMPONENT]
Buffer (including margin)
Int recon[MAX_NUM_CHANNEL_TYPE]
the bit depth as indicated in the SPS
UInt getChannelTypeScaleY(const ChannelType id) const
YUV file I/O class (header)
Int * m_ctuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE]
Gives an offset in the buffer for a given CTU (and channel)
Int getWidth(const ComponentID id) const
UInt getComponentScaleY(const ComponentID id) const
UInt getComponentScaleX(const ComponentID id) const
Void copyToPic(TComPicYuv *pcPicYuvDst) const
Pel * m_piPicOrg[MAX_NUM_COMPONENT]
m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
Int getTotalHeight(const ComponentID id) const
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Int m_marginY
margin of Luma channel (chroma's may be smaller, depending on ratio)
picture YUV buffer class (header)
UInt getNumberValidComponents() const
Int * m_subCuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE]
Gives an offset in the buffer for a given sub-CU (and channel), relative to start of CTU...
#define xMalloc(type, len)
Int getMarginX(const ComponentID id) const
UInt getChannelTypeScaleX(const ChannelType id) const
Void dump(const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend=false, const Bool bForceTo8Bit=false) const
Pel * getAddr(const ComponentID ch)
Void create(const Int picWidth, const Int picHeight, const ChromaFormat chromaFormatIDC, const UInt maxCUWidth, const UInt maxCUHeight, const UInt maxCUDepth, const Bool bUseMargin)
if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image...
Int getMarginY(const ComponentID id) const
Int m_picWidth
Width of picture in pixels.
Pel * getBuf(const ComponentID ch)
ChromaFormat m_chromaFormatIDC
Chroma Format.
ChromaFormat getChromaFormat() const