[x265] [PATCH] fix for 420 binary mismatch for --preset=slower option

ashok at multicorewareinc.com ashok at multicorewareinc.com
Wed Feb 19 12:05:20 CET 2014


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1392807860 -19800
#      Wed Feb 19 16:34:20 2014 +0530
# Node ID f0e4f6aa075587f715a7cd48ef63f97d56caa21a
# Parent  8571d160aedb00e07a3f47016f04d8d9aeaa5856
fix for 420 binary mismatch for --preset=slower option

diff -r 8571d160aedb -r f0e4f6aa0755 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Feb 19 16:34:20 2014 +0530
@@ -2852,7 +2852,7 @@
                                        + (partWidth / m_pic->getMinCUWidth()) / 2];
 }
 
-uint32_t TComDataCU::getCoefScanIdx(uint32_t absPartIdx, uint32_t width, bool bIsLuma, bool bIsIntra)
+uint32_t TComDataCU::getCoefScanIdx(uint32_t absPartIdx, uint32_t width, uint32_t height, bool bIsLuma, bool bIsIntra)
 {
     uint32_t scanIdx;
     uint32_t dirMode;
@@ -2863,7 +2863,6 @@
     }
     //check that MDCS can be used for this TU
 
-    uint32_t height = width;
     if (bIsLuma)
     {
         const uint32_t maximumWidth  = MDCS_MAXIMUM_WIDTH;
diff -r 8571d160aedb -r f0e4f6aa0755 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Wed Feb 19 16:34:20 2014 +0530
@@ -473,7 +473,7 @@
 
     uint32_t&     getTotalNumPart()               { return m_numPartitions; }
 
-    uint32_t      getCoefScanIdx(uint32_t absPartIdx, uint32_t width, bool bIsLuma, bool bIsIntra);
+    uint32_t      getCoefScanIdx(uint32_t absPartIdx, uint32_t width, uint32_t height, bool bIsLuma, bool bIsIntra);
 
     // -------------------------------------------------------------------------------------------------------------------
     // member functions to support multiple color space formats
diff -r 8571d160aedb -r f0e4f6aa0755 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Feb 19 16:34:20 2014 +0530
@@ -502,7 +502,7 @@
     const uint32_t                 log2BlockWidth  = g_convertToBit[width]  + 2;
     const uint32_t                 log2BlockHeight = g_convertToBit[height] + 2;
 
-    result.scanType = COEFF_SCAN_TYPE(cu->getCoefScanIdx(absPartIdx, width, ttype == TEXT_LUMA, cu->isIntra(absPartIdx)));
+    result.scanType = COEFF_SCAN_TYPE(cu->getCoefScanIdx(absPartIdx, width, height, ttype == TEXT_LUMA, cu->isIntra(absPartIdx)));
 
     //set the group layout
     result.widthInGroups  = width  >> MLS_CG_LOG2_WIDTH;
@@ -516,19 +516,20 @@
     result.scanCG = g_scanOrder[SCAN_UNGROUPED][result.scanType][log2WidthInGroups][log2HeightInGroups];
 
     //set the significance map context selection parameters
+    TextType ctype = ttype == TEXT_LUMA ? TEXT_LUMA : TEXT_CHROMA;
     if ((width == 4) && (height == 4))
     {
-        result.firstSignificanceMapContext = significanceMapContextSetStart[ttype][CONTEXT_TYPE_4x4];
+        result.firstSignificanceMapContext = significanceMapContextSetStart[ctype][CONTEXT_TYPE_4x4];
     }
     else if ((width == 8) && (height == 8))
     {
-        result.firstSignificanceMapContext = significanceMapContextSetStart[ttype][CONTEXT_TYPE_8x8];
+        result.firstSignificanceMapContext = significanceMapContextSetStart[ctype][CONTEXT_TYPE_8x8];
         if (result.scanType != SCAN_DIAG)
-            result.firstSignificanceMapContext += nonDiagonalScan8x8ContextOffset[ttype];
+            result.firstSignificanceMapContext += nonDiagonalScan8x8ContextOffset[ctype];
     }
     else
     {
-        result.firstSignificanceMapContext = significanceMapContextSetStart[ttype][CONTEXT_TYPE_NxN];
+        result.firstSignificanceMapContext = significanceMapContextSetStart[ctype][CONTEXT_TYPE_NxN];
     }
 }
 
@@ -1124,8 +1125,8 @@
         }
 
         const bool notFirstGroup = ((posX >> MLS_CG_LOG2_WIDTH) + (posY >> MLS_CG_LOG2_HEIGHT)) > 0;
-
-        offset = (notFirstGroup ? notFirstGroupNeighbourhoodContextOffset[ttype] : 0) + cnt;
+        TextType ctype = ttype == TEXT_LUMA ? TEXT_LUMA : TEXT_CHROMA;
+        offset = (notFirstGroup ? notFirstGroupNeighbourhoodContextOffset[ctype] : 0) + cnt;
     }
     return codingParameters.firstSignificanceMapContext + offset;
 }
diff -r 8571d160aedb -r f0e4f6aa0755 source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Wed Feb 19 16:34:20 2014 +0530
@@ -942,7 +942,7 @@
 void TEncSbac::xCodeScalingList(TComScalingList* scalingList, uint32_t sizeId, uint32_t listId)
 {
     int coefNum = X265_MIN(MAX_MATRIX_COEF_NUM, (int)g_scalingListSize[sizeId]);
-    const uint32_t* scan  = (sizeId == 0) ? g_sigLastScan[SCAN_DIAG][1] :  g_sigLastScanCG32x32;
+    const uint32_t* scan  = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][sizeId==0 ? 2 : 3][sizeId==0 ? 2 : 3];
     int nextCoef = SCALING_LIST_START_VALUE;
     int data;
     int32_t *src = scalingList->getScalingListAddress(sizeId, listId);


More information about the x265-devel mailing list