[x265] [PATCH 2 of 8] yuv: modify yuv files to support 400 color space
mahesh at multicorewareinc.com
mahesh at multicorewareinc.com
Mon Dec 14 20:30:08 CET 2015
# HG changeset patch
# User Mahesh Pittala <mahesh at multicorewareinc.com>
# Date 1450016600 -19800
# Sun Dec 13 19:53:20 2015 +0530
# Node ID bc03a968117e5f3c242dd0f198c8281c6216587b
# Parent abda2f6740e1ab967b1a5464ffd22ad48ec90897
yuv: modify yuv files to support 400 color space
diff -r abda2f6740e1 -r bc03a968117e source/common/picyuv.cpp
--- a/source/common/picyuv.cpp Sun Dec 13 19:43:05 2015 +0530
+++ b/source/common/picyuv.cpp Sun Dec 13 19:53:20 2015 +0530
@@ -63,20 +63,27 @@
m_lumaMarginY = g_maxCUSize + 16; // margin for 8-tap filter and infinite padding
m_stride = (numCuInWidth * g_maxCUSize) + (m_lumaMarginX << 1);
- m_chromaMarginX = m_lumaMarginX; // keep 16-byte alignment for chroma CTUs
- m_chromaMarginY = m_lumaMarginY >> m_vChromaShift;
+ int maxHeight = numCuInHeight * g_maxCUSize;
+ CHECKED_MALLOC(m_picBuf[0], pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
+ m_picOrg[0] = m_picBuf[0] + m_lumaMarginY * m_stride + m_lumaMarginX;
- m_strideC = ((numCuInWidth * g_maxCUSize) >> m_hChromaShift) + (m_chromaMarginX * 2);
- int maxHeight = numCuInHeight * g_maxCUSize;
+ if (picCsp != X265_CSP_I400)
+ {
+ m_chromaMarginX = m_lumaMarginX; // keep 16-byte alignment for chroma CTUs
+ m_chromaMarginY = m_lumaMarginY >> m_vChromaShift;
+ m_strideC = ((numCuInWidth * g_maxCUSize) >> m_hChromaShift) + (m_chromaMarginX * 2);
- CHECKED_MALLOC(m_picBuf[0], pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
- CHECKED_MALLOC(m_picBuf[1], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
- CHECKED_MALLOC(m_picBuf[2], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
+ CHECKED_MALLOC(m_picBuf[1], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
+ CHECKED_MALLOC(m_picBuf[2], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
- m_picOrg[0] = m_picBuf[0] + m_lumaMarginY * m_stride + m_lumaMarginX;
- m_picOrg[1] = m_picBuf[1] + m_chromaMarginY * m_strideC + m_chromaMarginX;
- m_picOrg[2] = m_picBuf[2] + m_chromaMarginY * m_strideC + m_chromaMarginX;
-
+ m_picOrg[1] = m_picBuf[1] + m_chromaMarginY * m_strideC + m_chromaMarginX;
+ m_picOrg[2] = m_picBuf[2] + m_chromaMarginY * m_strideC + m_chromaMarginX;
+ }
+ else
+ {
+ m_picBuf[1] = m_picBuf[2] = NULL;
+ m_picOrg[1] = m_picOrg[2] = NULL;
+ }
return true;
fail:
@@ -89,27 +96,45 @@
bool PicYuv::createOffsets(const SPS& sps)
{
uint32_t numPartitions = 1 << (g_unitSizeDepth * 2);
- CHECKED_MALLOC(m_cuOffsetY, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
- CHECKED_MALLOC(m_cuOffsetC, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
- for (uint32_t cuRow = 0; cuRow < sps.numCuInHeight; cuRow++)
+
+ if (m_picCsp != X265_CSP_I400)
{
- for (uint32_t cuCol = 0; cuCol < sps.numCuInWidth; cuCol++)
+ CHECKED_MALLOC(m_cuOffsetY, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
+ CHECKED_MALLOC(m_cuOffsetC, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
+ for (uint32_t cuRow = 0; cuRow < sps.numCuInHeight; cuRow++)
{
- m_cuOffsetY[cuRow * sps.numCuInWidth + cuCol] = m_stride * cuRow * g_maxCUSize + cuCol * g_maxCUSize;
- m_cuOffsetC[cuRow * sps.numCuInWidth + cuCol] = m_strideC * cuRow * (g_maxCUSize >> m_vChromaShift) + cuCol * (g_maxCUSize >> m_hChromaShift);
+ for (uint32_t cuCol = 0; cuCol < sps.numCuInWidth; cuCol++)
+ {
+ m_cuOffsetY[cuRow * sps.numCuInWidth + cuCol] = m_stride * cuRow * g_maxCUSize + cuCol * g_maxCUSize;
+ m_cuOffsetC[cuRow * sps.numCuInWidth + cuCol] = m_strideC * cuRow * (g_maxCUSize >> m_vChromaShift) + cuCol * (g_maxCUSize >> m_hChromaShift);
+ }
+ }
+
+ CHECKED_MALLOC(m_buOffsetY, intptr_t, (size_t)numPartitions);
+ CHECKED_MALLOC(m_buOffsetC, intptr_t, (size_t)numPartitions);
+ for (uint32_t idx = 0; idx < numPartitions; ++idx)
+ {
+ intptr_t x = g_zscanToPelX[idx];
+ intptr_t y = g_zscanToPelY[idx];
+ m_buOffsetY[idx] = m_stride * y + x;
+ m_buOffsetC[idx] = m_strideC * (y >> m_vChromaShift) + (x >> m_hChromaShift);
}
}
+ else
+ {
+ CHECKED_MALLOC(m_cuOffsetY, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
+ for (uint32_t cuRow = 0; cuRow < sps.numCuInHeight; cuRow++)
+ for (uint32_t cuCol = 0; cuCol < sps.numCuInWidth; cuCol++)
+ m_cuOffsetY[cuRow * sps.numCuInWidth + cuCol] = m_stride * cuRow * g_maxCUSize + cuCol * g_maxCUSize;
- CHECKED_MALLOC(m_buOffsetY, intptr_t, (size_t)numPartitions);
- CHECKED_MALLOC(m_buOffsetC, intptr_t, (size_t)numPartitions);
- for (uint32_t idx = 0; idx < numPartitions; ++idx)
- {
- intptr_t x = g_zscanToPelX[idx];
- intptr_t y = g_zscanToPelY[idx];
- m_buOffsetY[idx] = m_stride * y + x;
- m_buOffsetC[idx] = m_strideC * (y >> m_vChromaShift) + (x >> m_hChromaShift);
+ CHECKED_MALLOC(m_buOffsetY, intptr_t, (size_t)numPartitions);
+ for (uint32_t idx = 0; idx < numPartitions; ++idx)
+ {
+ intptr_t x = g_zscanToPelX[idx];
+ intptr_t y = g_zscanToPelY[idx];
+ m_buOffsetY[idx] = m_stride * y + x;
+ }
}
-
return true;
fail:
@@ -159,28 +184,29 @@
#if (X265_DEPTH > 8)
{
pixel *yPixel = m_picOrg[0];
- pixel *uPixel = m_picOrg[1];
- pixel *vPixel = m_picOrg[2];
uint8_t *yChar = (uint8_t*)pic.planes[0];
- uint8_t *uChar = (uint8_t*)pic.planes[1];
- uint8_t *vChar = (uint8_t*)pic.planes[2];
int shift = (X265_DEPTH - 8);
primitives.planecopy_cp(yChar, pic.stride[0] / sizeof(*yChar), yPixel, m_stride, width, height, shift);
- primitives.planecopy_cp(uChar, pic.stride[1] / sizeof(*uChar), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift);
- primitives.planecopy_cp(vChar, pic.stride[2] / sizeof(*vChar), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift);
+
+ if (pic.colorSpace != X265_CSP_I400)
+ {
+ pixel *uPixel = m_picOrg[1];
+ pixel *vPixel = m_picOrg[2];
+
+ uint8_t *uChar = (uint8_t*)pic.planes[1];
+ uint8_t *vChar = (uint8_t*)pic.planes[2];
+
+ primitives.planecopy_cp(uChar, pic.stride[1] / sizeof(*uChar), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift);
+ primitives.planecopy_cp(vChar, pic.stride[2] / sizeof(*vChar), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift);
+ }
}
#else /* Case for (X265_DEPTH == 8) */
// TODO: Does we need this path? may merge into above in future
{
pixel *yPixel = m_picOrg[0];
- pixel *uPixel = m_picOrg[1];
- pixel *vPixel = m_picOrg[2];
-
uint8_t *yChar = (uint8_t*)pic.planes[0];
- uint8_t *uChar = (uint8_t*)pic.planes[1];
- uint8_t *vChar = (uint8_t*)pic.planes[2];
for (int r = 0; r < height; r++)
{
@@ -190,15 +216,24 @@
yChar += pic.stride[0] / sizeof(*yChar);
}
- for (int r = 0; r < height >> m_vChromaShift; r++)
+ if (pic.colorSpace != X265_CSP_I400)
{
- memcpy(uPixel, uChar, (width >> m_hChromaShift) * sizeof(pixel));
- memcpy(vPixel, vChar, (width >> m_hChromaShift) * sizeof(pixel));
+ pixel *uPixel = m_picOrg[1];
+ pixel *vPixel = m_picOrg[2];
- uPixel += m_strideC;
- vPixel += m_strideC;
- uChar += pic.stride[1] / sizeof(*uChar);
- vChar += pic.stride[2] / sizeof(*vChar);
+ uint8_t *uChar = (uint8_t*)pic.planes[1];
+ uint8_t *vChar = (uint8_t*)pic.planes[2];
+
+ for (int r = 0; r < height >> m_vChromaShift; r++)
+ {
+ memcpy(uPixel, uChar, (width >> m_hChromaShift) * sizeof(pixel));
+ memcpy(vPixel, vChar, (width >> m_hChromaShift) * sizeof(pixel));
+
+ uPixel += m_strideC;
+ vPixel += m_strideC;
+ uChar += pic.stride[1] / sizeof(*uChar);
+ vChar += pic.stride[2] / sizeof(*vChar);
+ }
}
}
#endif /* (X265_DEPTH > 8) */
@@ -209,36 +244,44 @@
uint16_t mask = (1 << X265_DEPTH) - 1;
int shift = abs(pic.bitDepth - X265_DEPTH);
pixel *yPixel = m_picOrg[0];
- pixel *uPixel = m_picOrg[1];
- pixel *vPixel = m_picOrg[2];
uint16_t *yShort = (uint16_t*)pic.planes[0];
- uint16_t *uShort = (uint16_t*)pic.planes[1];
- uint16_t *vShort = (uint16_t*)pic.planes[2];
if (pic.bitDepth > X265_DEPTH)
{
/* shift right and mask pixels to final size */
primitives.planecopy_sp(yShort, pic.stride[0] / sizeof(*yShort), yPixel, m_stride, width, height, shift, mask);
- primitives.planecopy_sp(uShort, pic.stride[1] / sizeof(*uShort), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
- primitives.planecopy_sp(vShort, pic.stride[2] / sizeof(*vShort), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
}
else /* Case for (pic.bitDepth <= X265_DEPTH) */
{
/* shift left and mask pixels to final size */
primitives.planecopy_sp_shl(yShort, pic.stride[0] / sizeof(*yShort), yPixel, m_stride, width, height, shift, mask);
- primitives.planecopy_sp_shl(uShort, pic.stride[1] / sizeof(*uShort), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
- primitives.planecopy_sp_shl(vShort, pic.stride[2] / sizeof(*vShort), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
+ }
+
+ if (pic.colorSpace != X265_CSP_I400)
+ {
+ pixel *uPixel = m_picOrg[1];
+ pixel *vPixel = m_picOrg[2];
+
+ uint16_t *uShort = (uint16_t*)pic.planes[1];
+ uint16_t *vShort = (uint16_t*)pic.planes[2];
+
+ if (pic.bitDepth > X265_DEPTH)
+ {
+ primitives.planecopy_sp(uShort, pic.stride[1] / sizeof(*uShort), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
+ primitives.planecopy_sp(vShort, pic.stride[2] / sizeof(*vShort), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
+ }
+ else /* Case for (pic.bitDepth <= X265_DEPTH) */
+ {
+ primitives.planecopy_sp_shl(uShort, pic.stride[1] / sizeof(*uShort), uPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
+ primitives.planecopy_sp_shl(vShort, pic.stride[2] / sizeof(*vShort), vPixel, m_strideC, width >> m_hChromaShift, height >> m_vChromaShift, shift, mask);
+ }
}
}
/* extend the right edge if width was not multiple of the minimum CU size */
-
+ uint64_t sumLuma;
pixel *Y = m_picOrg[0];
- pixel *U = m_picOrg[1];
- pixel *V = m_picOrg[2];
-
- uint64_t sumLuma;
m_maxLumaLevel = primitives.planeClipAndMax(Y, m_stride, width, height, &sumLuma, (pixel)param.minLuma, (pixel)param.maxLuma);
m_avgLumaLevel = (double)(sumLuma) / (m_picHeight * m_picWidth);
@@ -246,34 +289,39 @@
{
for (int x = 0; x < padx; x++)
Y[width + x] = Y[width - 1];
-
Y += m_stride;
}
- for (int r = 0; r < height >> m_vChromaShift; r++)
- {
- for (int x = 0; x < padx >> m_hChromaShift; x++)
- {
- U[(width >> m_hChromaShift) + x] = U[(width >> m_hChromaShift) - 1];
- V[(width >> m_hChromaShift) + x] = V[(width >> m_hChromaShift) - 1];
- }
-
- U += m_strideC;
- V += m_strideC;
- }
-
/* extend the bottom if height was not multiple of the minimum CU size */
Y = m_picOrg[0] + (height - 1) * m_stride;
- U = m_picOrg[1] + ((height >> m_vChromaShift) - 1) * m_strideC;
- V = m_picOrg[2] + ((height >> m_vChromaShift) - 1) * m_strideC;
-
for (int i = 1; i <= pady; i++)
memcpy(Y + i * m_stride, Y, (width + padx) * sizeof(pixel));
- for (int j = 1; j <= pady >> m_vChromaShift; j++)
+ if (pic.colorSpace != X265_CSP_I400)
{
- memcpy(U + j * m_strideC, U, ((width + padx) >> m_hChromaShift) * sizeof(pixel));
- memcpy(V + j * m_strideC, V, ((width + padx) >> m_hChromaShift) * sizeof(pixel));
+ pixel *U = m_picOrg[1];
+ pixel *V = m_picOrg[2];
+
+ for (int r = 0; r < height >> m_vChromaShift; r++)
+ {
+ for (int x = 0; x < padx >> m_hChromaShift; x++)
+ {
+ U[(width >> m_hChromaShift) + x] = U[(width >> m_hChromaShift) - 1];
+ V[(width >> m_hChromaShift) + x] = V[(width >> m_hChromaShift) - 1];
+ }
+
+ U += m_strideC;
+ V += m_strideC;
+ }
+
+ U = m_picOrg[1] + ((height >> m_vChromaShift) - 1) * m_strideC;
+ V = m_picOrg[2] + ((height >> m_vChromaShift) - 1) * m_strideC;
+
+ for (int j = 1; j <= pady >> m_vChromaShift; j++)
+ {
+ memcpy(U + j * m_strideC, U, ((width + padx) >> m_hChromaShift) * sizeof(pixel));
+ memcpy(V + j * m_strideC, V, ((width + padx) >> m_hChromaShift) * sizeof(pixel));
+ }
}
}
diff -r abda2f6740e1 -r bc03a968117e source/common/shortyuv.cpp
--- a/source/common/shortyuv.cpp Sun Dec 13 19:43:05 2015 +0530
+++ b/source/common/shortyuv.cpp Sun Dec 13 19:53:20 2015 +0530
@@ -40,19 +40,26 @@
bool ShortYuv::create(uint32_t size, int csp)
{
m_csp = csp;
+ m_size = size;
m_hChromaShift = CHROMA_H_SHIFT(csp);
m_vChromaShift = CHROMA_V_SHIFT(csp);
+ size_t sizeL = size * size;
- m_size = size;
- m_csize = size >> m_hChromaShift;
+ if (csp != X265_CSP_I400)
+ {
+ m_csize = size >> m_hChromaShift;
+ size_t sizeC = sizeL >> (m_hChromaShift + m_vChromaShift);
+ X265_CHECK((sizeC & 15) == 0, "invalid size");
- size_t sizeL = size * size;
- size_t sizeC = sizeL >> (m_hChromaShift + m_vChromaShift);
- X265_CHECK((sizeC & 15) == 0, "invalid size");
-
- CHECKED_MALLOC(m_buf[0], int16_t, sizeL + sizeC * 2);
- m_buf[1] = m_buf[0] + sizeL;
- m_buf[2] = m_buf[0] + sizeL + sizeC;
+ CHECKED_MALLOC(m_buf[0], int16_t, sizeL + sizeC * 2);
+ m_buf[1] = m_buf[0] + sizeL;
+ m_buf[2] = m_buf[0] + sizeL + sizeC;
+ }
+ else
+ {
+ CHECKED_MALLOC(m_buf[0], int16_t, sizeL);
+ m_buf[1] = m_buf[2] = NULL;
+ }
return true;
fail:
@@ -75,8 +82,11 @@
{
const int sizeIdx = log2Size - 2;
primitives.cu[sizeIdx].sub_ps(m_buf[0], m_size, srcYuv0.m_buf[0], srcYuv1.m_buf[0], srcYuv0.m_size, srcYuv1.m_size);
- primitives.chroma[m_csp].cu[sizeIdx].sub_ps(m_buf[1], m_csize, srcYuv0.m_buf[1], srcYuv1.m_buf[1], srcYuv0.m_csize, srcYuv1.m_csize);
- primitives.chroma[m_csp].cu[sizeIdx].sub_ps(m_buf[2], m_csize, srcYuv0.m_buf[2], srcYuv1.m_buf[2], srcYuv0.m_csize, srcYuv1.m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ primitives.chroma[m_csp].cu[sizeIdx].sub_ps(m_buf[1], m_csize, srcYuv0.m_buf[1], srcYuv1.m_buf[1], srcYuv0.m_csize, srcYuv1.m_csize);
+ primitives.chroma[m_csp].cu[sizeIdx].sub_ps(m_buf[2], m_csize, srcYuv0.m_buf[2], srcYuv1.m_buf[2], srcYuv0.m_csize, srcYuv1.m_csize);
+ }
}
void ShortYuv::copyPartToPartLuma(ShortYuv& dstYuv, uint32_t absPartIdx, uint32_t log2Size) const
diff -r abda2f6740e1 -r bc03a968117e source/common/yuv.cpp
--- a/source/common/yuv.cpp Sun Dec 13 19:43:05 2015 +0530
+++ b/source/common/yuv.cpp Sun Dec 13 19:53:20 2015 +0530
@@ -51,7 +51,7 @@
{
CHECKED_MALLOC(m_buf[0], pixel, size * size + 8);
m_buf[1] = m_buf[2] = 0;
- m_csize = MAX_INT;
+ m_csize = 0;
return true;
}
else
@@ -83,22 +83,26 @@
{
pixel* dstY = dstPic.getLumaAddr(cuAddr, absPartIdx);
primitives.cu[m_part].copy_pp(dstY, dstPic.m_stride, m_buf[0], m_size);
-
- pixel* dstU = dstPic.getCbAddr(cuAddr, absPartIdx);
- pixel* dstV = dstPic.getCrAddr(cuAddr, absPartIdx);
- primitives.chroma[m_csp].cu[m_part].copy_pp(dstU, dstPic.m_strideC, m_buf[1], m_csize);
- primitives.chroma[m_csp].cu[m_part].copy_pp(dstV, dstPic.m_strideC, m_buf[2], m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ pixel* dstU = dstPic.getCbAddr(cuAddr, absPartIdx);
+ pixel* dstV = dstPic.getCrAddr(cuAddr, absPartIdx);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(dstU, dstPic.m_strideC, m_buf[1], m_csize);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(dstV, dstPic.m_strideC, m_buf[2], m_csize);
+ }
}
void Yuv::copyFromPicYuv(const PicYuv& srcPic, uint32_t cuAddr, uint32_t absPartIdx)
{
const pixel* srcY = srcPic.getLumaAddr(cuAddr, absPartIdx);
primitives.cu[m_part].copy_pp(m_buf[0], m_size, srcY, srcPic.m_stride);
-
- const pixel* srcU = srcPic.getCbAddr(cuAddr, absPartIdx);
- const pixel* srcV = srcPic.getCrAddr(cuAddr, absPartIdx);
- primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[1], m_csize, srcU, srcPic.m_strideC);
- primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[2], m_csize, srcV, srcPic.m_strideC);
+ if (m_csp != X265_CSP_I400)
+ {
+ const pixel* srcU = srcPic.getCbAddr(cuAddr, absPartIdx);
+ const pixel* srcV = srcPic.getCrAddr(cuAddr, absPartIdx);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[1], m_csize, srcU, srcPic.m_strideC);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[2], m_csize, srcV, srcPic.m_strideC);
+ }
}
void Yuv::copyFromYuv(const Yuv& srcYuv)
@@ -106,8 +110,11 @@
X265_CHECK(m_size >= srcYuv.m_size, "invalid size\n");
primitives.cu[m_part].copy_pp(m_buf[0], m_size, srcYuv.m_buf[0], srcYuv.m_size);
- primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[1], m_csize, srcYuv.m_buf[1], srcYuv.m_csize);
- primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[2], m_csize, srcYuv.m_buf[2], srcYuv.m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[1], m_csize, srcYuv.m_buf[1], srcYuv.m_csize);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(m_buf[2], m_csize, srcYuv.m_buf[2], srcYuv.m_csize);
+ }
}
/* This version is intended for use by ME, which required FENC_STRIDE for luma fenc pixels */
@@ -131,11 +138,13 @@
{
pixel* dstY = dstYuv.getLumaAddr(absPartIdx);
primitives.cu[m_part].copy_pp(dstY, dstYuv.m_size, m_buf[0], m_size);
-
- pixel* dstU = dstYuv.getCbAddr(absPartIdx);
- pixel* dstV = dstYuv.getCrAddr(absPartIdx);
- primitives.chroma[m_csp].cu[m_part].copy_pp(dstU, dstYuv.m_csize, m_buf[1], m_csize);
- primitives.chroma[m_csp].cu[m_part].copy_pp(dstV, dstYuv.m_csize, m_buf[2], m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ pixel* dstU = dstYuv.getCbAddr(absPartIdx);
+ pixel* dstV = dstYuv.getCrAddr(absPartIdx);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(dstU, dstYuv.m_csize, m_buf[1], m_csize);
+ primitives.chroma[m_csp].cu[m_part].copy_pp(dstV, dstYuv.m_csize, m_buf[2], m_csize);
+ }
}
void Yuv::copyPartToYuv(Yuv& dstYuv, uint32_t absPartIdx) const
@@ -143,20 +152,25 @@
pixel* srcY = m_buf[0] + getAddrOffset(absPartIdx, m_size);
pixel* dstY = dstYuv.m_buf[0];
primitives.cu[dstYuv.m_part].copy_pp(dstY, dstYuv.m_size, srcY, m_size);
-
- pixel* srcU = m_buf[1] + getChromaAddrOffset(absPartIdx);
- pixel* srcV = m_buf[2] + getChromaAddrOffset(absPartIdx);
- pixel* dstU = dstYuv.m_buf[1];
- pixel* dstV = dstYuv.m_buf[2];
- primitives.chroma[m_csp].cu[dstYuv.m_part].copy_pp(dstU, dstYuv.m_csize, srcU, m_csize);
- primitives.chroma[m_csp].cu[dstYuv.m_part].copy_pp(dstV, dstYuv.m_csize, srcV, m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ pixel* srcU = m_buf[1] + getChromaAddrOffset(absPartIdx);
+ pixel* srcV = m_buf[2] + getChromaAddrOffset(absPartIdx);
+ pixel* dstU = dstYuv.m_buf[1];
+ pixel* dstV = dstYuv.m_buf[2];
+ primitives.chroma[m_csp].cu[dstYuv.m_part].copy_pp(dstU, dstYuv.m_csize, srcU, m_csize);
+ primitives.chroma[m_csp].cu[dstYuv.m_part].copy_pp(dstV, dstYuv.m_csize, srcV, m_csize);
+ }
}
void Yuv::addClip(const Yuv& srcYuv0, const ShortYuv& srcYuv1, uint32_t log2SizeL)
{
primitives.cu[log2SizeL - 2].add_ps(m_buf[0], m_size, srcYuv0.m_buf[0], srcYuv1.m_buf[0], srcYuv0.m_size, srcYuv1.m_size);
- primitives.chroma[m_csp].cu[log2SizeL - 2].add_ps(m_buf[1], m_csize, srcYuv0.m_buf[1], srcYuv1.m_buf[1], srcYuv0.m_csize, srcYuv1.m_csize);
- primitives.chroma[m_csp].cu[log2SizeL - 2].add_ps(m_buf[2], m_csize, srcYuv0.m_buf[2], srcYuv1.m_buf[2], srcYuv0.m_csize, srcYuv1.m_csize);
+ if (m_csp != X265_CSP_I400)
+ {
+ primitives.chroma[m_csp].cu[log2SizeL - 2].add_ps(m_buf[1], m_csize, srcYuv0.m_buf[1], srcYuv1.m_buf[1], srcYuv0.m_csize, srcYuv1.m_csize);
+ primitives.chroma[m_csp].cu[log2SizeL - 2].add_ps(m_buf[2], m_csize, srcYuv0.m_buf[2], srcYuv1.m_buf[2], srcYuv0.m_csize, srcYuv1.m_csize);
+ }
}
void Yuv::addAvg(const ShortYuv& srcYuv0, const ShortYuv& srcYuv1, uint32_t absPartIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
More information about the x265-devel
mailing list