[x265] [PATCH 3 of 6] reduce conditional jump in codeCoeffNxN()
Min Chen
chenm003 at 163.com
Tue Jun 9 20:06:03 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1433872868 25200
# Node ID d82b6f9e08e39b784ba8240e1843b9d6371dcee4
# Parent 838d45cde46091861dec549c464eb803d479bbbc
reduce conditional jump in codeCoeffNxN()
---
source/encoder/entropy.cpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff -r 838d45cde460 -r d82b6f9e08e3 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Tue Jun 09 11:01:05 2015 -0700
+++ b/source/encoder/entropy.cpp Tue Jun 09 11:01:08 2015 -0700
@@ -1438,7 +1438,7 @@
// compute number of significant coefficients
uint32_t numSig = primitives.cu[log2TrSize - 2].count_nonzero(coeff);
X265_CHECK(numSig > 0, "cbf check fail\n");
- bool bHideFirstSign = cu.m_slice->m_pps->bSignHideEnabled && !tqBypass;
+ bool bHideFirstSign = cu.m_slice->m_pps->bSignHideEnabled & !tqBypass;
if (log2TrSize <= MAX_LOG2_TS_SIZE && !tqBypass && cu.m_slice->m_pps->bTransformSkipEnabled)
codeTransformSkipFlags(cu.m_transformSkip[ttype][absPartIdx], ttype);
@@ -1487,9 +1487,11 @@
if (codingParameters.scanType == SCAN_VER)
std::swap(pos[0], pos[1]);
- int ctxIdx = bIsLuma ? (3 * (log2TrSize - 2) + ((log2TrSize - 1) >> 2)) : NUM_CTX_LAST_FLAG_XY_LUMA;
- int ctxShift = bIsLuma ? ((log2TrSize + 1) >> 2) : log2TrSize - 2;
+ int ctxIdx = bIsLuma ? (3 * (log2TrSize - 2) + (log2TrSize == 5)) : NUM_CTX_LAST_FLAG_XY_LUMA;
+ int ctxShift = (bIsLuma ? (log2TrSize > 2) : (log2TrSize - 2));
uint32_t maxGroupIdx = (log2TrSize << 1) - 1;
+ X265_CHECK(((log2TrSize - 1) >> 2) == (uint32_t)(log2TrSize == 5), "ctxIdx check failure\n");
+ X265_CHECK((uint32_t)ctxShift == (bIsLuma ? ((log2TrSize + 1) >> 2) : log2TrSize - 2), "ctxShift check failure\n");
uint8_t *ctx = &m_contextState[OFF_CTX_LAST_FLAG_X];
for (uint32_t i = 0; i < 2; i++, ctxIdx += NUM_CTX_LAST_FLAG_XY)
More information about the x265-devel
mailing list