[x265-commits] [x265] input: include nits
Steve Borho
steve at borho.org
Sun Nov 10 02:54:08 CET 2013
details: http://hg.videolan.org/x265/rev/620c2a377cf6
branches:
changeset: 4974:620c2a377cf6
user: Steve Borho <steve at borho.org>
date: Fri Nov 08 16:15:41 2013 -0600
description:
input: include nits
Subject: [x265] yuv: initialize pixelbytes as early as possible
details: http://hg.videolan.org/x265/rev/45c5ba1dc340
branches:
changeset: 4975:45c5ba1dc340
user: Steve Borho <steve at borho.org>
date: Fri Nov 08 16:23:51 2013 -0600
description:
yuv: initialize pixelbytes as early as possible
Subject: [x265] yuv: simplify framesize usage
details: http://hg.videolan.org/x265/rev/27486e340eac
branches:
changeset: 4976:27486e340eac
user: Steve Borho <steve at borho.org>
date: Fri Nov 08 16:31:38 2013 -0600
description:
yuv: simplify framesize usage
Subject: [x265] input: drop unthreaded reader paths for simplicity
details: http://hg.videolan.org/x265/rev/29ad451b3026
branches:
changeset: 4977:29ad451b3026
user: Steve Borho <steve at borho.org>
date: Fri Nov 08 16:46:22 2013 -0600
description:
input: drop unthreaded reader paths for simplicity
Subject: [x265] primitive: remove pixeladd_pp and TComYuv::addClip()
details: http://hg.videolan.org/x265/rev/57caf112acf9
branches:
changeset: 4978:57caf112acf9
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 08:15:59 2013 -0600
description:
primitive: remove pixeladd_pp and TComYuv::addClip()
These were used by the old HM bidir search
Subject: [x265] TComYuv: remove unused removeHighFreq()
details: http://hg.videolan.org/x265/rev/cd9b013529ad
branches:
changeset: 4979:cd9b013529ad
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 08:20:38 2013 -0600
description:
TComYuv: remove unused removeHighFreq()
Subject: [x265] pixel: remove AVX2 vector class SAD primitives
details: http://hg.videolan.org/x265/rev/af9ec83d864a
branches:
changeset: 4980:af9ec83d864a
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:10:37 2013 -0600
description:
pixel: remove AVX2 vector class SAD primitives
These are superceded by assembly - the ASM doesn't use AVX2 yet but it's already
faster
Subject: [x265] cli: file writers should validate output bitdepth, if any is specified
details: http://hg.videolan.org/x265/rev/5c3ecc48bf3b
branches:
changeset: 4981:5c3ecc48bf3b
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:21:51 2013 -0600
description:
cli: file writers should validate output bitdepth, if any is specified
Subject: [x265] TComPicYuv: remove unused dump function
details: http://hg.videolan.org/x265/rev/8774e07b9d8a
branches:
changeset: 4982:8774e07b9d8a
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:25:01 2013 -0600
description:
TComPicYuv: remove unused dump function
Subject: [x265] TComPicYuv: cleanup prefixes
details: http://hg.videolan.org/x265/rev/c05952a71525
branches:
changeset: 4983:c05952a71525
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:26:10 2013 -0600
description:
TComPicYuv: cleanup prefixes
Subject: [x265] TComPicYuv: remove unused copy methods
details: http://hg.videolan.org/x265/rev/ad8b9d120f8c
branches:
changeset: 4984:ad8b9d120f8c
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:27:26 2013 -0600
description:
TComPicYuv: remove unused copy methods
Subject: [x265] TComPicYuv: remove unused luma-oriented functions, cleanup destroy method
details: http://hg.videolan.org/x265/rev/9dece99f7faa
branches:
changeset: 4985:9dece99f7faa
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:30:56 2013 -0600
description:
TComPicYuv: remove unused luma-oriented functions, cleanup destroy method
Subject: [x265] csp: fix allocation size calculation of chroma planes
details: http://hg.videolan.org/x265/rev/99d934beca75
branches:
changeset: 4986:99d934beca75
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:35:02 2013 -0600
description:
csp: fix allocation size calculation of chroma planes
Subject: [x265] yuv: pic.stride should be in units of pixels, not bytes
details: http://hg.videolan.org/x265/rev/b2b455afd60e
branches:
changeset: 4987:b2b455afd60e
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:52:32 2013 -0600
description:
yuv: pic.stride should be in units of pixels, not bytes
Subject: [x265] TComPicYuv: add a comment for future optimizations
details: http://hg.videolan.org/x265/rev/2be9bd65f418
branches:
changeset: 4988:2be9bd65f418
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 09:52:49 2013 -0600
description:
TComPicYuv: add a comment for future optimizations
Subject: [x265] y4m: fix 8bpp build
details: http://hg.videolan.org/x265/rev/efb26544f8aa
branches:
changeset: 4989:efb26544f8aa
user: Steve Borho <steve at borho.org>
date: Sat Nov 09 19:39:30 2013 -0600
description:
y4m: fix 8bpp build
diffstat:
source/Lib/TLibCommon/TComPicYuv.cpp | 188 +---------
source/Lib/TLibCommon/TComPicYuv.h | 15 -
source/Lib/TLibCommon/TComYuv.cpp | 95 -----
source/Lib/TLibCommon/TComYuv.h | 9 +-
source/common/CMakeLists.txt | 9 -
source/common/pixel.cpp | 16 -
source/common/primitives.h | 2 -
source/common/vec/blockcopy-sse3.cpp | 78 ----
source/common/vec/pixel-avx2.cpp | 620 -----------------------------------
source/common/vec/vec-primitives.cpp | 7 -
source/input/input.h | 1 -
source/input/y4m.cpp | 71 +---
source/input/y4m.h | 17 +-
source/input/yuv.cpp | 153 ++------
source/input/yuv.h | 16 +-
source/output/output.cpp | 2 +-
source/output/y4m.cpp | 22 +-
source/output/y4m.h | 2 +-
source/output/yuv.cpp | 3 +-
source/test/pixelharness.cpp | 38 --
source/test/pixelharness.h | 1 -
source/x265.cpp | 11 +-
22 files changed, 97 insertions(+), 1279 deletions(-)
diffs (truncated from 2017 to 300 lines):
diff -r 4a824497b3f4 -r efb26544f8aa source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp Fri Nov 08 15:39:08 2013 -0600
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp Sat Nov 09 19:39:30 2013 -0600
@@ -82,20 +82,21 @@ void TComPicYuv::create(int picWidth, in
m_lumaMarginY = g_maxCUHeight + 16; // margin for 8-tap filter and infinite padding
m_stride = (m_numCuInWidth * g_maxCUWidth) + (m_lumaMarginX << 1);
- m_chromaMarginX = m_lumaMarginX; // keep 16-byte alignment for chroma CTUs
+ m_chromaMarginX = m_lumaMarginX; // keep 16-byte alignment for chroma CTUs
m_chromaMarginY = m_lumaMarginY >> m_vChromaShift;
m_strideC = ((m_numCuInWidth * g_maxCUWidth) >> m_hChromaShift) + (m_chromaMarginX * 2);
int maxHeight = m_numCuInHeight * g_maxCUHeight;
- m_picBufY = (Pel*)X265_MALLOC(Pel, m_stride * (maxHeight + (m_lumaMarginY << 1)));
- m_picBufU = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> 1) + (m_chromaMarginY << 1)));
- m_picBufV = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> 1) + (m_chromaMarginY << 1)));
+ m_picBufY = (Pel*)X265_MALLOC(Pel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
+ m_picBufU = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
+ m_picBufV = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
m_picOrgY = m_picBufY + m_lumaMarginY * getStride() + m_lumaMarginX;
m_picOrgU = m_picBufU + m_chromaMarginY * getCStride() + m_chromaMarginX;
m_picOrgV = m_picBufV + m_chromaMarginY * getCStride() + m_chromaMarginX;
+ /* TODO: these four buffers are the same for every TComPicYuv in the encoder */
m_cuOffsetY = new int[m_numCuInWidth * m_numCuInHeight];
m_cuOffsetC = new int[m_numCuInWidth * m_numCuInHeight];
for (int cuRow = 0; cuRow < m_numCuInHeight; cuRow++)
@@ -121,66 +122,24 @@ void TComPicYuv::create(int picWidth, in
void TComPicYuv::destroy()
{
- m_picOrgY = NULL;
- m_picOrgU = NULL;
- m_picOrgV = NULL;
-
- if (m_picBufY) { X265_FREE(m_picBufY); m_picBufY = NULL; }
- if (m_picBufU) { X265_FREE(m_picBufU); m_picBufU = NULL; }
- if (m_picBufV) { X265_FREE(m_picBufV); m_picBufV = NULL; }
-
+ X265_FREE(m_picBufY);
+ X265_FREE(m_picBufU);
+ X265_FREE(m_picBufV);
delete[] m_cuOffsetY;
delete[] m_cuOffsetC;
delete[] m_buOffsetY;
delete[] m_buOffsetC;
-}
-void TComPicYuv::createLuma(int picWidth, int picHeight, uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth)
-{
- m_picWidth = picWidth;
- m_picHeight = picHeight;
-
- m_cuWidth = maxCUWidth;
- m_cuHeight = maxCUHeight;
-
- int numCuInWidth = m_picWidth / m_cuWidth + (m_picWidth % m_cuWidth != 0);
- int numCuInHeight = m_picHeight / m_cuHeight + (m_picHeight % m_cuHeight != 0);
-
- m_lumaMarginX = g_maxCUWidth + 16; // for 16-byte alignment
- m_lumaMarginY = g_maxCUHeight + 16; // margin for 8-tap filter and infinite padding
-
- m_picBufY = (Pel*)X265_MALLOC(Pel, (m_picWidth + (m_lumaMarginX << 1)) * (m_picHeight + (m_lumaMarginY << 1)));
- m_picOrgY = m_picBufY + m_lumaMarginY * getStride() + m_lumaMarginX;
-
- m_cuOffsetY = new int[numCuInWidth * numCuInHeight];
+ m_picOrgY = NULL;
+ m_picOrgU = NULL;
+ m_picOrgV = NULL;
+ m_picBufY = NULL;
+ m_picBufU = NULL;
+ m_picBufV = NULL;
+ m_cuOffsetY = NULL;
m_cuOffsetC = NULL;
- for (int cuRow = 0; cuRow < numCuInHeight; cuRow++)
- {
- for (int cuCol = 0; cuCol < numCuInWidth; cuCol++)
- {
- m_cuOffsetY[cuRow * numCuInWidth + cuCol] = getStride() * cuRow * m_cuHeight + cuCol * m_cuWidth;
- }
- }
-
- m_buOffsetY = new int[(size_t)1 << (2 * maxCUDepth)];
+ m_buOffsetY = NULL;
m_buOffsetC = NULL;
- for (int buRow = 0; buRow < (1 << maxCUDepth); buRow++)
- {
- for (int buCol = 0; buCol < (1 << maxCUDepth); buCol++)
- {
- m_buOffsetY[(buRow << maxCUDepth) + buCol] = getStride() * buRow * (maxCUHeight >> maxCUDepth) + buCol * (maxCUWidth >> maxCUDepth);
- }
- }
-}
-
-void TComPicYuv::destroyLuma()
-{
- m_picOrgY = NULL;
-
- if (m_picBufY) { X265_FREE(m_picBufY); m_picBufY = NULL; }
-
- delete[] m_cuOffsetY;
- delete[] m_buOffsetY;
}
uint32_t TComPicYuv::getCUHeight(int rowNum)
@@ -194,134 +153,35 @@ uint32_t TComPicYuv::getCUHeight(int row
return height;
}
-void TComPicYuv::copyToPic(TComPicYuv* destPicYuv)
-{
- assert(m_picWidth == destPicYuv->getWidth());
- assert(m_picHeight == destPicYuv->getHeight());
-
- ::memcpy(destPicYuv->getBufY(), m_picBufY, sizeof(Pel) * (m_picWidth + (m_lumaMarginX << 1)) * (m_picHeight + (m_lumaMarginY << 1)));
- ::memcpy(destPicYuv->getBufU(), m_picBufU, sizeof(Pel) * ((m_picWidth >> m_hChromaShift) + (m_chromaMarginX << 1)) * ((m_picHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
- ::memcpy(destPicYuv->getBufV(), m_picBufV, sizeof(Pel) * ((m_picWidth >> m_hChromaShift) + (m_chromaMarginX << 1)) * ((m_picHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
-}
-
-void TComPicYuv::copyToPicLuma(TComPicYuv* destPicYuv)
-{
- assert(m_picWidth == destPicYuv->getWidth());
- assert(m_picHeight == destPicYuv->getHeight());
-
- ::memcpy(destPicYuv->getBufY(), m_picBufY, sizeof(Pel) * (m_picWidth + (m_lumaMarginX << 1)) * (m_picHeight + (m_lumaMarginY << 1)));
-}
-
-void TComPicYuv::copyToPicCb(TComPicYuv* destPicYuv)
-{
- assert(m_picWidth == destPicYuv->getWidth());
- assert(m_picHeight == destPicYuv->getHeight());
-
- ::memcpy(destPicYuv->getBufU(), m_picBufU, sizeof(Pel) * ((m_picWidth >> m_hChromaShift) + (m_chromaMarginX << 1)) * ((m_picHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
-}
-
-void TComPicYuv::copyToPicCr(TComPicYuv* destPicYuv)
-{
- assert(m_picWidth == destPicYuv->getWidth());
- assert(m_picHeight == destPicYuv->getHeight());
-
- ::memcpy(destPicYuv->getBufV(), m_picBufV, sizeof(Pel) * ((m_picWidth >> m_hChromaShift) + (m_chromaMarginX << 1)) * ((m_picHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
-}
-
-void TComPicYuv::xExtendPicCompBorder(Pel* recon, int stride, int width, int height, int iMarginX, int iMarginY)
+void TComPicYuv::xExtendPicCompBorder(Pel* recon, int stride, int width, int height, int marginX, int marginY)
{
int x, y;
/* TODO: this should become a performance primitive */
for (y = 0; y < height; y++)
{
- for (x = 0; x < iMarginX; x++)
+ for (x = 0; x < marginX; x++)
{
- recon[-iMarginX + x] = recon[0];
+ recon[-marginX + x] = recon[0];
recon[width + x] = recon[width - 1];
}
recon += stride;
}
- recon -= (stride + iMarginX);
- for (y = 0; y < iMarginY; y++)
+ recon -= (stride + marginX);
+ for (y = 0; y < marginY; y++)
{
- ::memcpy(recon + (y + 1) * stride, recon, sizeof(Pel) * (width + (iMarginX << 1)));
+ ::memcpy(recon + (y + 1) * stride, recon, sizeof(Pel) * (width + (marginX << 1)));
}
recon -= ((height - 1) * stride);
- for (y = 0; y < iMarginY; y++)
+ for (y = 0; y < marginY; y++)
{
- ::memcpy(recon - (y + 1) * stride, recon, sizeof(Pel) * (width + (iMarginX << 1)));
+ ::memcpy(recon - (y + 1) * stride, recon, sizeof(Pel) * (width + (marginX << 1)));
}
}
-void TComPicYuv::dump(char* pFileName, bool bAdd)
-{
- FILE* pFile;
-
- if (!bAdd)
- {
- pFile = fopen(pFileName, "wb");
- }
- else
- {
- pFile = fopen(pFileName, "ab");
- }
-
- int shift = X265_DEPTH - 8;
- int offset = (shift > 0) ? (1 << (shift - 1)) : 0;
-
- int x, y;
- UChar uc;
-
- Pel* pelY = getLumaAddr();
- Pel* pelCb = getCbAddr();
- Pel* pelCr = getCrAddr();
-
- for (y = 0; y < m_picHeight; y++)
- {
- for (x = 0; x < m_picWidth; x++)
- {
- uc = (UChar)Clip3<Pel>(0, 255, (pelY[x] + offset) >> shift);
-
- fwrite(&uc, sizeof(UChar), 1, pFile);
- }
-
- pelY += getStride();
- }
-
- shift = X265_DEPTH - 8;
- offset = (shift > 0) ? (1 << (shift - 1)) : 0;
-
- for (y = 0; y < m_picHeight >> m_vChromaShift; y++)
- {
- for (x = 0; x < m_picWidth >> m_hChromaShift; x++)
- {
- uc = (UChar)Clip3<Pel>(0, 255, (pelCb[x] + offset) >> shift);
- fwrite(&uc, sizeof(UChar), 1, pFile);
- }
-
- pelCb += getCStride();
- }
-
- for (y = 0; y < m_picHeight >> m_vChromaShift; y++)
- {
- for (x = 0; x < m_picWidth >> m_hChromaShift; x++)
- {
- uc = (UChar)Clip3<Pel>(0, 255, (pelCr[x] + offset) >> shift);
- fwrite(&uc, sizeof(UChar), 1, pFile);
- }
-
- pelCr += getCStride();
- }
-
- fclose(pFile);
-}
-
-//! \}
-
/* Copy pixels from an input picture (C structure) into internal TComPicYuv instance
* Upscale pixels from 8bits to 16 bits when required, but do not modify
* pixels. */
diff -r 4a824497b3f4 -r efb26544f8aa source/Lib/TLibCommon/TComPicYuv.h
--- a/source/Lib/TLibCommon/TComPicYuv.h Fri Nov 08 15:39:08 2013 -0600
+++ b/source/Lib/TLibCommon/TComPicYuv.h Sat Nov 09 19:39:30 2013 -0600
@@ -110,9 +110,6 @@ public:
void create(int picWidth, int picHeight, int csp, uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth);
void destroy();
- void createLuma(int picWidth, int picHeight, uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth);
- void destroyLuma();
-
// ------------------------------------------------------------------------------------------------
// Get information of picture
// ------------------------------------------------------------------------------------------------
@@ -166,19 +163,7 @@ public:
uint32_t getCUHeight(int rowNum);
- // ------------------------------------------------------------------------------------------------
- // Miscellaneous
- // ------------------------------------------------------------------------------------------------
-
- // Copy function to picture
- void copyToPic(TComPicYuv* destYuv);
- void copyToPicLuma(TComPicYuv* destYuv);
- void copyToPicCb(TComPicYuv* destYuv);
- void copyToPicCr(TComPicYuv* destYuv);
void copyFromPicture(const x265_picture&, int32_t *pad);
-
- // Dump picture
- void dump(char* pFileName, bool bAdd = false);
}; // END CLASS DEFINITION TComPicYuv
void updateChecksum(const Pel* plane, uint32_t& checksumVal, uint32_t height, uint32_t width, uint32_t stride, int row, uint32_t cu_Height);
diff -r 4a824497b3f4 -r efb26544f8aa source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Fri Nov 08 15:39:08 2013 -0600
+++ b/source/Lib/TLibCommon/TComYuv.cpp Sat Nov 09 19:39:30 2013 -0600
@@ -379,31 +379,12 @@ void TComYuv::copyPartToPartChroma(TShor
}
}
-void TComYuv::addClip(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- addClipLuma(srcYuv0, srcYuv1, trUnitIdx, partSize);
- addClipChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> m_hChromaShift);
-}
-
void TComYuv::addClip(TComYuv* srcYuv0, TShortYUV* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
{
addClipLuma(srcYuv0, srcYuv1, trUnitIdx, partSize);
addClipChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> m_hChromaShift);
More information about the x265-commits
mailing list