[x265] [PATCH 3 of 3] TComPrediction: remove redundant colorspace information
Steve Borho
steve at borho.org
Wed Jul 23 05:20:54 CEST 2014
On 07/23, deepthi at multicorewareinc.com wrote:
> # HG changeset patch
> # User Deepthi Nandakumar <deepthi at multicorewareinc.com>
> # Date 1406039346 -19800
> # Tue Jul 22 19:59:06 2014 +0530
> # Node ID 30f41c3ef7d39a6e341bd149adf6d57267984ec7
> # Parent a5422a41c85ac06fc773f1179e6fbea1a80a5e98
> TComPrediction: remove redundant colorspace information
>
> m_csp is sufficient inside the TEncSearch, TComPrediction structures
>
> diff -r a5422a41c85a -r 30f41c3ef7d3 source/Lib/TLibCommon/TComPrediction.cpp
> --- a/source/Lib/TLibCommon/TComPrediction.cpp Tue Jul 22 17:03:38 2014 +0530
> +++ b/source/Lib/TLibCommon/TComPrediction.cpp Tue Jul 22 19:59:06 2014 +0530
> @@ -86,8 +86,6 @@
> void TComPrediction::initTempBuff(int csp)
> {
> m_csp = csp;
> - m_hChromaShift = CHROMA_H_SHIFT(csp);
> - m_vChromaShift = CHROMA_V_SHIFT(csp);
>
> if (m_predBuf == NULL)
> {
> @@ -470,8 +468,11 @@
> int refStride = refPic->getCStride();
> int dstStride = dstPic->getCStride();
>
> - int shiftHor = (2 + m_hChromaShift);
> - int shiftVer = (2 + m_vChromaShift);
> + int hChromaShift = CHROMA_H_SHIFT(m_csp);
> + int vChromaShift = CHROMA_V_SHIFT(m_csp);
ok
Somewhere down the line we should make a build option that makes
CHROMA_V_SHIFT() and CHROMA_H_SHIFT() and similar macros return
hard-coded 4:2:0 values, to squeeze out a few more ounces of perf when
the user is uninterested in 4:2:2 or 4:4:4.
> +
> + int shiftHor = (2 + hChromaShift);
> + int shiftVer = (2 + vChromaShift);
>
> int refOffset = (mv->x >> shiftHor) + (mv->y >> shiftVer) * refStride;
>
> @@ -493,25 +494,25 @@
> }
> else if (yFrac == 0)
> {
> - primitives.chroma[m_csp].filter_hpp[partEnum](refCb, refStride, dstCb, dstStride, xFrac << (1 - m_hChromaShift));
> - primitives.chroma[m_csp].filter_hpp[partEnum](refCr, refStride, dstCr, dstStride, xFrac << (1 - m_hChromaShift));
> + primitives.chroma[m_csp].filter_hpp[partEnum](refCb, refStride, dstCb, dstStride, xFrac << (1 - hChromaShift));
> + primitives.chroma[m_csp].filter_hpp[partEnum](refCr, refStride, dstCr, dstStride, xFrac << (1 - hChromaShift));
> }
> else if (xFrac == 0)
> {
> - primitives.chroma[m_csp].filter_vpp[partEnum](refCb, refStride, dstCb, dstStride, yFrac << (1 - m_vChromaShift));
> - primitives.chroma[m_csp].filter_vpp[partEnum](refCr, refStride, dstCr, dstStride, yFrac << (1 - m_vChromaShift));
> + primitives.chroma[m_csp].filter_vpp[partEnum](refCb, refStride, dstCb, dstStride, yFrac << (1 - vChromaShift));
> + primitives.chroma[m_csp].filter_vpp[partEnum](refCr, refStride, dstCr, dstStride, yFrac << (1 - vChromaShift));
> }
> else
> {
> - int extStride = m_width >> m_hChromaShift;
> + int extStride = m_width >> hChromaShift;
> int filterSize = NTAPS_CHROMA;
> int halfFilterSize = (filterSize >> 1);
>
> - primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride, xFrac << (1 - m_hChromaShift), 1);
> - primitives.chroma[m_csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, yFrac << (1 - m_vChromaShift));
> + primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride, xFrac << (1 - hChromaShift), 1);
> + primitives.chroma[m_csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, yFrac << (1 - vChromaShift));
>
> - primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, m_immedVals, extStride, xFrac << (1 - m_hChromaShift), 1);
> - primitives.chroma[m_csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, yFrac << (1 - m_vChromaShift));
> + primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, m_immedVals, extStride, xFrac << (1 - hChromaShift), 1);
> + primitives.chroma[m_csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, yFrac << (1 - vChromaShift));
> }
> }
>
> @@ -520,9 +521,11 @@
> {
> int refStride = refPic->getCStride();
> int dstStride = dstPic->m_cwidth;
> + int hChromaShift = CHROMA_H_SHIFT(m_csp);
> + int vChromaShift = CHROMA_V_SHIFT(m_csp);
>
> - int shiftHor = (2 + m_hChromaShift);
> - int shiftVer = (2 + m_vChromaShift);
> + int shiftHor = (2 + hChromaShift);
> + int shiftVer = (2 + vChromaShift);
>
> int refOffset = (mv->x >> shiftHor) + (mv->y >> shiftVer) * refStride;
>
> @@ -537,8 +540,8 @@
>
> int partEnum = partitionFromSizes(m_width, m_height);
>
> - uint32_t cxWidth = m_width >> m_hChromaShift;
> - uint32_t cxHeight = m_height >> m_vChromaShift;
> + uint32_t cxWidth = m_width >> hChromaShift;
> + uint32_t cxHeight = m_height >> vChromaShift;
>
> X265_CHECK(((cxWidth | cxHeight) % 2) == 0, "chroma block size expected to be multiple of 2\n");
>
> @@ -549,23 +552,23 @@
> }
> else if (yFrac == 0)
> {
> - primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, dstCb, dstStride, xFrac << (1 - m_hChromaShift), 0);
> - primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, dstCr, dstStride, xFrac << (1 - m_hChromaShift), 0);
> + primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, dstCb, dstStride, xFrac << (1 - hChromaShift), 0);
> + primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, dstCr, dstStride, xFrac << (1 - hChromaShift), 0);
> }
> else if (xFrac == 0)
> {
> - primitives.chroma[m_csp].filter_vps[partEnum](refCb, refStride, dstCb, dstStride, yFrac << (1 - m_vChromaShift));
> - primitives.chroma[m_csp].filter_vps[partEnum](refCr, refStride, dstCr, dstStride, yFrac << (1 - m_vChromaShift));
> + primitives.chroma[m_csp].filter_vps[partEnum](refCb, refStride, dstCb, dstStride, yFrac << (1 - vChromaShift));
> + primitives.chroma[m_csp].filter_vps[partEnum](refCr, refStride, dstCr, dstStride, yFrac << (1 - vChromaShift));
> }
> else
> {
> int extStride = cxWidth;
> int filterSize = NTAPS_CHROMA;
> int halfFilterSize = (filterSize >> 1);
> - primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride, xFrac << (1 - m_hChromaShift), 1);
> - primitives.chroma[m_csp].filter_vss[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, yFrac << (1 - m_vChromaShift));
> - primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, m_immedVals, extStride, xFrac << (1 - m_hChromaShift), 1);
> - primitives.chroma[m_csp].filter_vss[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, yFrac << (1 - m_vChromaShift));
> + primitives.chroma[m_csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride, xFrac << (1 - hChromaShift), 1);
> + primitives.chroma[m_csp].filter_vss[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, yFrac << (1 - vChromaShift));
> + primitives.chroma[m_csp].filter_hps[partEnum](refCr, refStride, m_immedVals, extStride, xFrac << (1 - hChromaShift), 1);
> + primitives.chroma[m_csp].filter_vss[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, yFrac << (1 - vChromaShift));
> }
> }
>
> diff -r a5422a41c85a -r 30f41c3ef7d3 source/Lib/TLibCommon/TComPrediction.h
> --- a/source/Lib/TLibCommon/TComPrediction.h Tue Jul 22 17:03:38 2014 +0530
> +++ b/source/Lib/TLibCommon/TComPrediction.h Tue Jul 22 19:59:06 2014 +0530
> @@ -69,9 +69,10 @@
> TComYuv m_predTempYuv;
>
> int16_t* m_immedVals;
> - int m_hChromaShift;
> - int m_vChromaShift;
> +
> + /* Slice information */
> int m_csp;
> + bool isPSlice;
isPSlice is unused, at least in this patch series.
<snipped the rest>
--
Steve Borho
More information about the x265-devel
mailing list