[x265] [PATCH] lowres: cache the lowres maxNumBlocks and reuse this in other places
Steve Borho
steve at borho.org
Fri May 15 16:12:34 CEST 2015
On 05/15, gopu at multicorewareinc.com wrote:
> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1431665162 -19800
> # Fri May 15 10:16:02 2015 +0530
> # Node ID 484f7cac98c52cac5655b2e3de45a86e0f551269
> # Parent 8592bf81d0848279fa79cd1487406cb516dffe99
> lowres: cache the lowres maxNumBlocks and reuse this in other places
looks ok
> diff -r 8592bf81d084 -r 484f7cac98c5 source/common/lowres.cpp
> --- a/source/common/lowres.cpp Thu May 14 17:12:14 2015 +0530
> +++ b/source/common/lowres.cpp Fri May 15 10:16:02 2015 +0530
> @@ -36,13 +36,13 @@
> lumaStride = width + 2 * origPic->m_lumaMarginX;
> if (lumaStride & 31)
> lumaStride += 32 - (lumaStride & 31);
> - int cuWidth = (width + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> - int cuHeight = (lines + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> - int cuCount = cuWidth * cuHeight;
> + maxBlocksInRow = (width + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> + maxBlocksInCol = (lines + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> + int cuCount = maxBlocksInRow * maxBlocksInCol;
>
> /* rounding the width to multiple of lowres CU size */
> - width = cuWidth * X265_LOWRES_CU_SIZE;
> - lines = cuHeight * X265_LOWRES_CU_SIZE;
> + width = maxBlocksInRow * X265_LOWRES_CU_SIZE;
> + lines = maxBlocksInCol * X265_LOWRES_CU_SIZE;
>
> size_t planesize = lumaStride * (lines + 2 * origPic->m_lumaMarginY);
> size_t padoffset = lumaStride * origPic->m_lumaMarginY + origPic->m_lumaMarginX;
> @@ -74,7 +74,7 @@
> {
> for (int j = 0; j < bframes + 2; j++)
> {
> - CHECKED_MALLOC(rowSatds[i][j], int32_t, cuHeight);
> + CHECKED_MALLOC(rowSatds[i][j], int32_t, maxBlocksInCol);
> CHECKED_MALLOC(lowresCosts[i][j], uint16_t, cuCount);
> }
> }
> diff -r 8592bf81d084 -r 484f7cac98c5 source/common/lowres.h
> --- a/source/common/lowres.h Thu May 14 17:12:14 2015 +0530
> +++ b/source/common/lowres.h Fri May 15 10:16:02 2015 +0530
> @@ -130,6 +130,8 @@
> uint16_t(*lowresCosts[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2]);
> int32_t* lowresMvCosts[2][X265_BFRAME_MAX + 1];
> MV* lowresMvs[2][X265_BFRAME_MAX + 1];
> + uint32_t maxBlocksInRow;
> + uint32_t maxBlocksInCol;
>
> /* used for vbvLookahead */
> int plannedType[X265_LOOKAHEAD_MAX + 1];
> diff -r 8592bf81d084 -r 484f7cac98c5 source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp Thu May 14 17:12:14 2015 +0530
> +++ b/source/encoder/slicetype.cpp Fri May 15 10:16:02 2015 +0530
> @@ -94,9 +94,7 @@
> /* Actual adaptive quantization */
> int maxCol = curFrame->m_fencPic->m_picWidth;
> int maxRow = curFrame->m_fencPic->m_picHeight;
> - int blockWidth = ((param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> - int blockHeight = ((param->sourceHeight / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
> - int blockCount = blockWidth * blockHeight;
> + int blockCount = curFrame->m_lowres.maxBlocksInRow * curFrame->m_lowres.maxBlocksInCol;
>
> for (int y = 0; y < 3; y++)
> {
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list