[x265] [PATCH 1 of 4] optimize: reduce scan table size by uint32_t -> uint16_t

Min Chen chenm003 at 163.com
Wed Mar 12 19:03:21 CET 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1394647269 25200
# Node ID 7b671ec7308cad5e6995e2d9721840994e9c92a3
# Parent  e40524d079b4b6dddc33957a288ad3ebfc437120
optimize: reduce scan table size by uint32_t -> uint16_t

diff -r e40524d079b4 -r 7b671ec7308c source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Mon Mar 10 23:03:05 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.cpp	Wed Mar 12 11:01:09 2014 -0700
@@ -43,7 +43,7 @@
 //! \ingroup TLibCommon
 //! \{
 // scanning order table
-uint32_t* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH];
+uint16_t* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH];
 
 class ScanGenerator
 {
@@ -155,7 +155,7 @@
         for (uint32_t scanTypeIndex = 0; scanTypeIndex < SCAN_NUMBER_OF_TYPES; scanTypeIndex++)
         {
             const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex);
-            g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockSize] = X265_MALLOC(uint32_t, totalValues);
+            g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockSize] = X265_MALLOC(uint16_t, totalValues);
             ScanGenerator fullBlockScan(blockWidth, blockHeight, blockWidth, scanType);
 
             for (uint32_t scanPosition = 0; scanPosition < totalValues; scanPosition++)
@@ -177,7 +177,7 @@
         {
             const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex);
 
-            g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockSize] = X265_MALLOC(uint32_t, totalValues);
+            g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockSize] = X265_MALLOC(uint16_t, totalValues);
 
             ScanGenerator fullBlockScan(widthInGroups, heightInGroups, groupWidth, scanType);
 
diff -r e40524d079b4 -r 7b671ec7308c source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Mon Mar 10 23:03:05 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.h	Wed Mar 12 11:01:09 2014 -0700
@@ -76,7 +76,7 @@
 // flexible conversion from relative to absolute index
 extern uint32_t g_zscanToRaster[MAX_NUM_SPU_W * MAX_NUM_SPU_W];
 extern uint32_t g_rasterToZscan[MAX_NUM_SPU_W * MAX_NUM_SPU_W];
-extern uint32_t*  g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH];
+extern uint16_t*  g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH];
 void initZscanToRaster(int maxDepth, int depth, uint32_t startVal, uint32_t*& curIdx);
 void initRasterToZscan(uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth);
 
diff -r e40524d079b4 -r 7b671ec7308c source/Lib/TLibCommon/TypeDef.h
--- a/source/Lib/TLibCommon/TypeDef.h	Mon Mar 10 23:03:05 2014 -0500
+++ b/source/Lib/TLibCommon/TypeDef.h	Wed Mar 12 11:01:09 2014 -0700
@@ -173,8 +173,8 @@
 //TU settings for entropy encoding
 struct TUEntropyCodingParameters
 {
-    const uint32_t            *scan;
-    const uint32_t            *scanCG;
+    const uint16_t            *scan;
+    const uint16_t            *scanCG;
     COEFF_SCAN_TYPE      scanType;
     uint32_t             log2TrSizeCG;
     uint32_t             firstSignificanceMapContext;
diff -r e40524d079b4 -r 7b671ec7308c source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Mon Mar 10 23:03:05 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Wed Mar 12 11:01:09 2014 -0700
@@ -895,7 +895,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 = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][sizeId == 0 ? 2 : 3];
+    const uint16_t* scan = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][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