[x265] [PATCH 2 of 2] improve ctuLumaLevel logic by Sad and CMOV
Min Chen
chenm003 at 163.com
Wed Aug 12 00:24:38 CEST 2015
# 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};
+ uint32_t ctuLumaLevel = primitives.pu[best.fencYuv->m_part].sad(best.fencYuv->m_buf[0], best.fencYuv->m_size, dummy_zero, 0);
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;
}
curRow.rowStats.lumaLevel += (double)(ctuLumaLevel) / ctuNoOfPixels;
More information about the x265-devel
mailing list