[x265] [PATCH 5 of 8] improve compute on baseLevel by 2-bits encode code

Min Chen chenm003 at 163.com
Thu Apr 30 12:49:37 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1430390941 -28800
# Node ID 124349f8cedf5ad62b60d732acb669b2adccb15d
# Parent  1980f573179d5aab749fcce40c9e4c8a7bdc10d6
improve compute on baseLevel by 2-bits encode code
---
 source/encoder/entropy.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -r 1980f573179d -r 124349f8cedf source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Apr 30 18:48:57 2015 +0800
+++ b/source/encoder/entropy.cpp	Thu Apr 30 18:49:01 2015 +0800
@@ -1770,13 +1770,16 @@
             {
                 uint32_t goRiceParam = 0;
                 int firstCoeff2 = 1;
+                uint32_t baseLevelN = 0x5555AAAA; // 2-bits encode format baseLevel
 
                 if (!m_bitIf)
                 {
                     // FastRd path
                     for (int idx = 0; idx < numNonZero; idx++)
                     {
-                        int baseLevel = (idx < C1FLAG_NUMBER) ? (2 + firstCoeff2) : 1;
+                        int baseLevel = (baseLevelN & 3) | firstCoeff2;
+                        X265_CHECK(baseLevel == ((idx < C1FLAG_NUMBER) ? (2 + firstCoeff2) : 1), "baseLevel check failurr\n");
+                        baseLevelN >>= 2;
                         int codeNumber = absCoeff[idx] - baseLevel;
 
                         if (codeNumber >= 0)
@@ -1813,7 +1816,9 @@
                     // Standard path
                     for (int idx = 0; idx < numNonZero; idx++)
                     {
-                        int baseLevel = (idx < C1FLAG_NUMBER) ? (2 + firstCoeff2) : 1;
+                        int baseLevel = (baseLevelN & 3) | firstCoeff2;
+                        X265_CHECK(baseLevel == ((idx < C1FLAG_NUMBER) ? (2 + firstCoeff2) : 1), "baseLevel check failurr\n");
+                        baseLevelN >>= 2;
 
                         if (absCoeff[idx] >= baseLevel)
                         {



More information about the x265-devel mailing list