[x265-commits] [x265] intra: use fixed buffer allocations

Steve Borho steve at borho.org
Fri Aug 29 14:31:19 CEST 2014


details:   http://hg.videolan.org/x265/rev/01f3a8e5fcc2
branches:  
changeset: 7902:01f3a8e5fcc2
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 15:22:15 2014 -0500
description:
intra: use fixed buffer allocations
Subject: [x265] testbench: move test benches from stack allocations to global

details:   http://hg.videolan.org/x265/rev/8a247934f2d1
branches:  
changeset: 7903:8a247934f2d1
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 15:22:34 2014 -0500
description:
testbench: move test benches from stack allocations to global
Subject: [x265] ipfilter: use fixed buffer allocations

details:   http://hg.videolan.org/x265/rev/d626070bc8c6
branches:  
changeset: 7904:d626070bc8c6
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 15:44:00 2014 -0500
description:
ipfilter: use fixed buffer allocations
Subject: [x265] pixel: use fixed buffer allocations

details:   http://hg.videolan.org/x265/rev/cc0887e5a958
branches:  
changeset: 7905:cc0887e5a958
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 15:57:31 2014 -0500
description:
pixel: use fixed buffer allocations
Subject: [x265] mbdstharness: remove completely unused arrays

details:   http://hg.videolan.org/x265/rev/8a20115abc04
branches:  
changeset: 7906:8a20115abc04
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:10:54 2014 -0500
description:
mbdstharness: remove completely unused arrays
Subject: [x265] mbdst: remove unused mbuf4, rename other short output buffers

details:   http://hg.videolan.org/x265/rev/e807dcd89eae
branches:  
changeset: 7907:e807dcd89eae
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:13:06 2014 -0500
description:
mbdst: remove unused mbuf4, rename other short output buffers
Subject: [x265] mbdst: remove redundant mintbuf buffers

details:   http://hg.videolan.org/x265/rev/1d3ba60370be
branches:  
changeset: 7908:1d3ba60370be
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:20:34 2014 -0500
description:
mbdst: remove redundant mintbuf buffers
Subject: [x265] mbdst: reshuffle varnames

details:   http://hg.videolan.org/x265/rev/58323bef4ae1
branches:  
changeset: 7909:58323bef4ae1
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:22:31 2014 -0500
description:
mbdst: reshuffle varnames
Subject: [x265] mbdst: fix memset lengths, change MEM_CMP_SIZE to MAX_TU_SIZE

details:   http://hg.videolan.org/x265/rev/bebafa8cf718
branches:  
changeset: 7910:bebafa8cf718
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:24:36 2014 -0500
description:
mbdst: fix memset lengths, change MEM_CMP_SIZE to MAX_TU_SIZE
Subject: [x265] mbdst: align buffers to 32byte boundary

details:   http://hg.videolan.org/x265/rev/6f620106312e
branches:  
changeset: 7911:6f620106312e
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:27:32 2014 -0500
description:
mbdst: align buffers to 32byte boundary
Subject: [x265] test: fix MSVC warnings

details:   http://hg.videolan.org/x265/rev/dd540cb2c6b6
branches:  
changeset: 7912:dd540cb2c6b6
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:36:05 2014 -0500
description:
test: fix MSVC warnings
Subject: [x265] mbdst: make buffers nice even size

details:   http://hg.videolan.org/x265/rev/2c70fa36659e
branches:  
changeset: 7913:2c70fa36659e
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:54:14 2014 -0500
description:
mbdst: make buffers nice even size
Subject: [x265] mbdst: cleanup dequant test

details:   http://hg.videolan.org/x265/rev/b18ae1fe86b8
branches:  
changeset: 7914:b18ae1fe86b8
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 16:54:39 2014 -0500
description:
mbdst: cleanup dequant test
Subject: [x265] cu-lossless: fix inter hash mistake

details:   http://hg.videolan.org/x265/rev/07291dff4048
branches:  
changeset: 7915:07291dff4048
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Aug 26 12:56:23 2014 +0530
description:
cu-lossless: fix inter hash mistake

The CU needs to be re-encoded if lossless is chosen as the best mode.
Subject: [x265] encoder: re-enable --cu-lossless

details:   http://hg.videolan.org/x265/rev/c21ddfe6a6d9
branches:  
changeset: 7916:c21ddfe6a6d9
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 25 17:07:45 2014 -0500
description:
encoder: re-enable --cu-lossless
Subject: [x265] sao: fix signed loop bounds bug

details:   http://hg.videolan.org/x265/rev/4e2d9ac6d489
branches:  
changeset: 7917:4e2d9ac6d489
user:      Steve Borho <steve at borho.org>
date:      Fri Aug 29 11:12:49 2014 +0200
description:
sao: fix signed loop bounds bug

diffstat:

 source/Lib/TLibEncoder/TEncSearch.cpp |  15 +++++
 source/encoder/encoder.cpp            |   5 -
 source/encoder/sao.cpp                |  31 +++++------
 source/test/intrapredharness.cpp      |  40 +++-----------
 source/test/intrapredharness.h        |  20 ++----
 source/test/ipfilterharness.cpp       |  95 ++++++++--------------------------
 source/test/ipfilterharness.h         |  21 +++++--
 source/test/mbdstharness.cpp          |  55 ++++++++-----------
 source/test/mbdstharness.h            |  26 ++++-----
 source/test/pixelharness.cpp          |  91 ++-------------------------------
 source/test/pixelharness.h            |  37 ++++++++++--
 source/test/testbench.cpp             |  10 +-
 source/test/testharness.h             |   4 +
 13 files changed, 161 insertions(+), 289 deletions(-)

diffs (truncated from 945 to 300 lines):

diff -r 5426270aee62 -r 4e2d9ac6d489 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Aug 29 11:12:49 2014 +0200
@@ -2324,6 +2324,7 @@ void TEncSearch::encodeResAndCalcRdInter
     }
 
     uint64_t bestCost = MAX_INT64;
+    uint32_t bestMode = 0;
 
     for (uint32_t modeId = 0; modeId < numModes; modeId++)
     {
@@ -2391,6 +2392,7 @@ void TEncSearch::encodeResAndCalcRdInter
             if (cu->getQtRootCbf(0))
                 xSetResidualQTData(cu, 0, outBestResiYuv, depth, true);
 
+            bestMode = modeId; //0 for lossless
             bestBits = bits;
             bestCost = cost;
             bestCoeffBits = cu->m_coeffBits;
@@ -2400,6 +2402,19 @@ void TEncSearch::encodeResAndCalcRdInter
 
     X265_CHECK(bestCost != MAX_INT64, "no best cost\n");
 
+    if (bIsTQBypassEnable && !bestMode)
+    {
+        cu->setCUTransquantBypassSubParts(true, 0, depth);
+        m_entropyCoder->load(m_rdEntropyCoders[depth][CI_CURR_BEST]);
+        uint64_t cost = 0;
+        uint32_t zeroDistortion = 0;
+        uint32_t bits = 0;
+        uint32_t distortion = 0;
+        xEstimateResidualQT(cu, 0, fencYuv, predYuv, outResiYuv, depth, cost, bits, distortion, &zeroDistortion);
+        xSetResidualQTData(cu, 0, NULL, depth, false);
+        m_entropyCoder->store(m_rdEntropyCoders[depth][CI_TEMP_BEST]);
+    }
+
     if (cu->getQtRootCbf(0))
         outReconYuv->addClip(predYuv, outBestResiYuv, log2CUSize);
     else
diff -r 5426270aee62 -r 4e2d9ac6d489 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/encoder/encoder.cpp	Fri Aug 29 11:12:49 2014 +0200
@@ -1244,11 +1244,6 @@ void Encoder::configure(x265_param *p)
     {
         x265_log(p, X265_LOG_INFO, "Warning: picture-based SAO used with frame parallelism\n");
     }
-    if (p->bCULossless)
-    {
-        x265_log(p, X265_LOG_WARNING, "CU-Lossless is disabled in this release of x265\n");
-        p->bCULossless = 0;
-    }
 
     if (p->keyframeMax < 0)
     {
diff -r 5426270aee62 -r 4e2d9ac6d489 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/encoder/sao.cpp	Fri Aug 29 11:12:49 2014 +0200
@@ -661,9 +661,8 @@ void SAO::processSaoUnitAll(SaoLcuParam*
 
     memcpy(m_tmpU1[plane], rec, sizeof(pixel) * picWidthTmp);
 
-    uint32_t i;
+    int typeIdx;
     uint32_t edgeType;
-    int typeIdx;
 
     int offset[LUMA_GROUP_NUM + 1];
     int idxX;
@@ -694,7 +693,7 @@ void SAO::processSaoUnitAll(SaoLcuParam*
             picWidthTmp = m_param->sourceWidth >> m_hChromaShift;
         }
         uint32_t cuHeightTmp = isChroma ? (g_maxCUSize >> m_vChromaShift) : g_maxCUSize;
-        for (i = 0; i < cuHeightTmp + 1; i++)
+        for (uint32_t i = 0; i < cuHeightTmp + 1; i++)
         {
             m_tmpL1[i] = rec[0];
             rec += stride;
@@ -724,18 +723,18 @@ void SAO::processSaoUnitAll(SaoLcuParam*
                 {
                     if (typeIdx == SAO_BO)
                     {
-                        for (i = 0; i < SAO_MAX_BO_CLASSES + 1; i++)
+                        for (int i = 0; i < SAO_MAX_BO_CLASSES + 1; i++)
                             offset[i] = 0;
 
-                        for (i = 0; i < (uint32_t)saoLcuParam[addr].length; i++)
+                        for (int i = 0; i < saoLcuParam[addr].length; i++)
                             offset[(saoLcuParam[addr].subTypeIdx + i) % SAO_MAX_BO_CLASSES  + 1] = saoLcuParam[addr].offset[i] << SAO_BIT_INC;
 
-                        for (i = 0; i < (1 << X265_DEPTH); i++)
+                        for (int i = 0; i < (1 << X265_DEPTH); i++)
                             offsetBo[i] = m_clipTable[i + offset[m_tableBo[i]]];
                     }
                     if (typeIdx == SAO_EO_0 || typeIdx == SAO_EO_1 || typeIdx == SAO_EO_2 || typeIdx == SAO_EO_3)
                     {
-                        for (i = 0; i < (uint32_t)saoLcuParam[addr].length; i++)
+                        for (int i = 0; i < saoLcuParam[addr].length; i++)
                             offset[i + 1] = saoLcuParam[addr].offset[i] << SAO_BIT_INC;
 
                         for (edgeType = 0; edgeType < 6; edgeType++)
@@ -760,7 +759,7 @@ void SAO::processSaoUnitAll(SaoLcuParam*
                     }
 
                     int widthShift = isChroma ? (g_maxCUSize >> m_hChromaShift) : g_maxCUSize;
-                    for (i = 0; i < cuHeightTmp + 1; i++)
+                    for (uint32_t i = 0; i < cuHeightTmp + 1; i++)
                     {
                         m_tmpL1[i] = rec[widthShift - 1];
                         rec += stride;
@@ -793,7 +792,6 @@ void SAO::processSaoUnitRow(SaoLcuParam*
     if (!idxY)
         memcpy(m_tmpU1[plane], rec, sizeof(pixel) * picWidthTmp);
 
-    int i;
     int typeIdx;
 
     int offset[LUMA_GROUP_NUM + 1];
@@ -801,7 +799,6 @@ void SAO::processSaoUnitRow(SaoLcuParam*
     int addr;
     int frameWidthInCU = m_pic->getFrameWidthInCU();
     int stride;
-    uint32_t edgeType;
     bool isChroma = !!plane;
     bool mergeLeftFlag;
 
@@ -822,7 +819,7 @@ void SAO::processSaoUnitRow(SaoLcuParam*
         picWidthTmp = m_param->sourceWidth;
     }
     int maxCUHeight = isChroma ? (g_maxCUSize >> m_vChromaShift) : g_maxCUSize;
-    for (i = 0; i < maxCUHeight + 1; i++)
+    for (int i = 0; i < maxCUHeight + 1; i++)
     {
         m_tmpL1[i] = rec[0];
         rec += stride;
@@ -845,21 +842,21 @@ void SAO::processSaoUnitRow(SaoLcuParam*
             {
                 if (typeIdx == SAO_BO)
                 {
-                    for (i = 0; i < SAO_MAX_BO_CLASSES + 1; i++)
+                    for (int i = 0; i < SAO_MAX_BO_CLASSES + 1; i++)
                         offset[i] = 0;
 
-                    for (i = 0; i < saoLcuParam[addr].length; i++)
+                    for (int i = 0; i < saoLcuParam[addr].length; i++)
                         offset[(saoLcuParam[addr].subTypeIdx + i) % SAO_MAX_BO_CLASSES  + 1] = saoLcuParam[addr].offset[i] << SAO_BIT_INC;
 
-                    for (i = 0; i < (1 << X265_DEPTH); i++)
+                    for (int i = 0; i < (1 << X265_DEPTH); i++)
                         offsetBo[i] = m_clipTable[i + offset[m_tableBo[i]]];
                 }
                 if (typeIdx == SAO_EO_0 || typeIdx == SAO_EO_1 || typeIdx == SAO_EO_2 || typeIdx == SAO_EO_3)
                 {
-                    for (i = 0; i < saoLcuParam[addr].length; i++)
+                    for (int i = 0; i < saoLcuParam[addr].length; i++)
                         offset[i + 1] = saoLcuParam[addr].offset[i] << SAO_BIT_INC;
 
-                    for (edgeType = 0; edgeType < 6; edgeType++)
+                    for (uint32_t edgeType = 0; edgeType < 6; edgeType++)
                         m_offsetEo[edgeType] = (int8_t)offset[s_eoTable[edgeType]];
                 }
             }
@@ -881,7 +878,7 @@ void SAO::processSaoUnitRow(SaoLcuParam*
                 }
 
                 int widthShift = isChroma ? (g_maxCUSize >> m_hChromaShift) : g_maxCUSize;
-                for (i = 0; i < maxCUHeight + 1; i++)
+                for (int i = 0; i < maxCUHeight + 1; i++)
                 {
                     m_tmpL1[i] = rec[widthShift - 1];
                     rec += stride;
diff -r 5426270aee62 -r 4e2d9ac6d489 source/test/intrapredharness.cpp
--- a/source/test/intrapredharness.cpp	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/test/intrapredharness.cpp	Fri Aug 29 11:12:49 2014 +0200
@@ -29,32 +29,10 @@ using namespace x265;
 
 IntraPredHarness::IntraPredHarness()
 {
-    CHECKED_MALLOC(pixel_buff, pixel, ip_t_size);
-    CHECKED_MALLOC(pixel_out_c, pixel, out_size);
-    CHECKED_MALLOC(pixel_out_vec, pixel, out_size);
-    CHECKED_MALLOC(pixel_out_33_c, pixel, out_size_33);
-    CHECKED_MALLOC(pixel_out_33_vec, pixel, out_size_33);
-
-    // Initialize input buffer
-    for (int i = 0; i < ip_t_size; i++)
-    {
+    for (int i = 0; i < INPUT_SIZE; i++)
         pixel_buff[i] = rand() % PIXEL_MAX;
-    }
 
     initROM();
-    return;
-
-fail:
-    exit(1);
-}
-
-IntraPredHarness::~IntraPredHarness()
-{
-    X265_FREE(pixel_buff);
-    X265_FREE(pixel_out_c);
-    X265_FREE(pixel_out_vec);
-    X265_FREE(pixel_out_33_c);
-    X265_FREE(pixel_out_33_vec);
 }
 
 bool IntraPredHarness::check_dc_primitive(intra_pred_t ref, intra_pred_t opt, int width)
@@ -63,8 +41,8 @@ bool IntraPredHarness::check_dc_primitiv
     intptr_t stride = FENC_STRIDE;
 
 #if _DEBUG
-    memset(pixel_out_vec, 0xCD, out_size);
-    memset(pixel_out_c, 0xCD, out_size);
+    memset(pixel_out_vec, 0xCD, OUTPUT_SIZE);
+    memset(pixel_out_c, 0xCD, OUTPUT_SIZE);
 #endif
 
     for (int i = 0; i <= 100; i++)
@@ -101,8 +79,8 @@ bool IntraPredHarness::check_planar_prim
     intptr_t stride = FENC_STRIDE;
 
 #if _DEBUG
-    memset(pixel_out_vec, 0xCD, out_size);
-    memset(pixel_out_c, 0xCD, out_size);
+    memset(pixel_out_vec, 0xCD, OUTPUT_SIZE);
+    memset(pixel_out_c, 0xCD, OUTPUT_SIZE);
 #endif
 
     for (int i = 0; i <= 100; i++)
@@ -135,8 +113,8 @@ bool IntraPredHarness::check_angular_pri
     intptr_t stride = FENC_STRIDE;
 
 #if _DEBUG
-    memset(pixel_out_vec, 0xCD, out_size);
-    memset(pixel_out_c, 0xCD, out_size);
+    memset(pixel_out_vec, 0xCD, OUTPUT_SIZE);
+    memset(pixel_out_c, 0xCD, OUTPUT_SIZE);
 #endif
 
     for (int size = 2; size <= 5; size++)
@@ -179,8 +157,8 @@ bool IntraPredHarness::check_allangs_pri
     int isLuma;
 
 #if _DEBUG
-    memset(pixel_out_33_vec, 0xCD, out_size_33);
-    memset(pixel_out_33_c, 0xCD, out_size_33);
+    memset(pixel_out_33_vec, 0xCD, OUTPUT_SIZE_33);
+    memset(pixel_out_33_c, 0xCD, OUTPUT_SIZE_33);
 #endif
 
     for (int size = 2; size <= 5; size++)
diff -r 5426270aee62 -r 4e2d9ac6d489 source/test/intrapredharness.h
--- a/source/test/intrapredharness.h	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/test/intrapredharness.h	Fri Aug 29 11:12:49 2014 +0200
@@ -31,17 +31,15 @@ class IntraPredHarness : public TestHarn
 {
 protected:
 
-    pixel *pixel_buff;
-    pixel *pixel_out_c;
-    pixel *pixel_out_vec;
-    pixel *pixel_out_33_c;
-    pixel *pixel_out_33_vec;
+    enum { INPUT_SIZE = 4 * 65 * 65 * 100 };
+    enum { OUTPUT_SIZE = 64 * FENC_STRIDE };
+    enum { OUTPUT_SIZE_33 = 33 * OUTPUT_SIZE };
 
-    pixel *IP_vec_output_p, *IP_C_output_p;
-
-    static const int ip_t_size = 4 * 65 * 65 * 100;
-    static const int out_size = 64 * FENC_STRIDE;
-    static const int out_size_33 = 33 * 64 * FENC_STRIDE;
+    ALIGN_VAR_16(pixel, pixel_buff[INPUT_SIZE]);
+    pixel pixel_out_c[OUTPUT_SIZE];
+    pixel pixel_out_vec[OUTPUT_SIZE];
+    pixel pixel_out_33_c[OUTPUT_SIZE_33];
+    pixel pixel_out_33_vec[OUTPUT_SIZE_33];
 
     bool check_dc_primitive(intra_pred_t ref, intra_pred_t opt, int width);
     bool check_planar_primitive(intra_pred_t ref, intra_pred_t opt, int width);
@@ -52,8 +50,6 @@ public:
 
     IntraPredHarness();
 
-    virtual ~IntraPredHarness();
-
     const char *getName() const { return "intrapred"; }
 
     bool testCorrectness(const EncoderPrimitives& ref, const EncoderPrimitives& opt);
diff -r 5426270aee62 -r 4e2d9ac6d489 source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp	Wed Aug 27 14:54:30 2014 -0500
+++ b/source/test/ipfilterharness.cpp	Fri Aug 29 11:12:49 2014 +0200
@@ -28,41 +28,14 @@
 #include "common.h"
 #include "ipfilterharness.h"
 
-#define ITERS  100
-#define TEST_CASES 3
-#define SMAX (1 << 12)
-#define SMIN (-1 << 12)


More information about the x265-commits mailing list