[x265] [PATCH 2 of 2] improve ctuLumaLevel logic by Sad and CMOV
Steve Borho
steve at borho.org
Wed Aug 12 09:58:29 CEST 2015
On 08/11, Min Chen wrote:
> # HG changeset patch
> # User Min Chen <chenm003 at 163.com>
> # Date 1439331239 25200
> # Node ID 66b7f9300b8c392df7f1d597bec0fd099071c1af
> # Parent aeae99c6c24580b510cdaf119bb6921f62c78368
> improve ctuLumaLevel logic by Sad and CMOV
> ---
> source/encoder/frameencoder.cpp | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff -r aeae99c6c245 -r 66b7f9300b8c source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Tue Aug 11 15:13:55 2015 -0700
> +++ b/source/encoder/frameencoder.cpp Tue Aug 11 15:13:59 2015 -0700
> @@ -991,13 +991,14 @@
> }
>
> /* calculate maximum and average luma levels */
> - uint32_t ctuLumaLevel = 0;
> + static const pixel dummy_zero[MAX_CU_SIZE] = {0};
could use (pixel*)Search::zeroShort;
> + uint32_t ctuLumaLevel = primitives.pu[best.fencYuv->m_part].sad(best.fencYuv->m_buf[0], best.fencYuv->m_size, dummy_zero, 0);
using sad is clever.
> uint32_t ctuNoOfPixels = best.fencYuv->m_size * best.fencYuv->m_size;
> for (uint32_t i = 0; i < ctuNoOfPixels; i++)
> {
> pixel p = best.fencYuv->m_buf[0][i];
> - ctuLumaLevel += p;
> - curRow.rowStats.maxLumaLevel = X265_MAX(p, curRow.rowStats.maxLumaLevel);
> + if (p > curRow.rowStats.maxLumaLevel)
> + curRow.rowStats.maxLumaLevel = p;
I'm surprised this is faster.
> }
> curRow.rowStats.lumaLevel += (double)(ctuLumaLevel) / ctuNoOfPixels;
>
>
> _______________________________________________
> 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