[x265-commits] [x265] quant: typo

Steve Borho steve at borho.org
Thu Aug 14 22:39:00 CEST 2014


details:   http://hg.videolan.org/x265/rev/889f69d56b7e
branches:  
changeset: 7785:889f69d56b7e
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 13 23:43:20 2014 -0500
description:
quant: typo
Subject: [x265] fix HIGH_BIT_DEPTH compile on Windows

details:   http://hg.videolan.org/x265/rev/3d3bc732b9e7
branches:  
changeset: 7786:3d3bc732b9e7
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 13 23:59:41 2014 -0500
description:
fix HIGH_BIT_DEPTH compile on Windows

something included by predict.h breaks pixel-util.h for MSVC; so move the filter
table to common.h. It wasn't quite proper for asm-primitives.cpp to include a
header from encoder/ anyway.
Subject: [x265] slicetype: initialise lowmode to 4.

details:   http://hg.videolan.org/x265/rev/6b741cce14ac
branches:  
changeset: 7787:6b741cce14ac
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu Aug 14 12:53:52 2014 +0530
description:
slicetype: initialise lowmode to 4.
Subject: [x265] replace IntraFilterType[][] to IntraFilterFlags[] (aboid *35)

details:   http://hg.videolan.org/x265/rev/5ccdcc853810
branches:  
changeset: 7788:5ccdcc853810
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Thu Aug 14 11:42:28 2014 +0900
description:
replace IntraFilterType[][] to IntraFilterFlags[] (aboid *35)
Subject: [x265] quant: + has higher precedence than ?; use parens to fix unquantShift logic

details:   http://hg.videolan.org/x265/rev/e62f74712a16
branches:  
changeset: 7789:e62f74712a16
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 14 13:17:32 2014 -0500
description:
quant: + has higher precedence than ?; use parens to fix unquantShift logic
Subject: [x265] remove predict.h includes from TLibCommon/

details:   http://hg.videolan.org/x265/rev/e66dbb50403b
branches:  
changeset: 7790:e66dbb50403b
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 14 13:28:17 2014 -0500
description:
remove predict.h includes from TLibCommon/
Subject: [x265] analysis: white-space nits, possibly exposing a logic bug

details:   http://hg.videolan.org/x265/rev/e5083cf64df0
branches:  
changeset: 7791:e5083cf64df0
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 14 13:38:22 2014 -0500
description:
analysis: white-space nits, possibly exposing a logic bug
Subject: [x265] asm: fix HIGH_BIT_DEPTH build again

details:   http://hg.videolan.org/x265/rev/7da2b731de30
branches:  
changeset: 7792:7da2b731de30
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 14 15:33:34 2014 -0500
description:
asm: fix HIGH_BIT_DEPTH build again
Subject: [x265] nit

details:   http://hg.videolan.org/x265/rev/08e9d25e2c72
branches:  
changeset: 7793:08e9d25e2c72
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 14 15:33:51 2014 -0500
description:
nit

diffstat:

 source/Lib/TLibCommon/TComPattern.cpp          |   4 ++--
 source/Lib/TLibCommon/TComRom.cpp              |  10 ++++++++++
 source/Lib/TLibCommon/TComRom.h                |   3 +++
 source/Lib/TLibCommon/TComWeightPrediction.cpp |   3 ++-
 source/Lib/TLibCommon/TComYuv.cpp              |   2 +-
 source/common/common.h                         |   5 +++++
 source/common/intrapred.cpp                    |   6 ++----
 source/common/quant.cpp                        |   4 ++--
 source/common/x86/asm-primitives.cpp           |  18 ++++++++----------
 source/common/x86/pixel-util.h                 |   2 +-
 source/encoder/analysis.cpp                    |   8 +++-----
 source/encoder/predict.cpp                     |  11 +++++++----
 source/encoder/predict.h                       |  10 ----------
 source/encoder/slicetype.cpp                   |   2 +-
 14 files changed, 47 insertions(+), 41 deletions(-)

diffs (truncated from 333 to 300 lines):

diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -38,7 +38,7 @@
 #include "frame.h"
 #include "TComPattern.h"
 #include "TComDataCU.h"
-#include "predict.h"
+#include "TComRom.h"
 
 using namespace x265;
 
@@ -68,7 +68,7 @@ void TComPattern::initAdiPattern(TComDat
 
     fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
 
-    bool bUseFilteredPredictions = (dirMode == ALL_IDX || IntraFilterType[intraNeighbors.log2TrSize - 2][dirMode]);
+    bool bUseFilteredPredictions = (dirMode == ALL_IDX || (g_intraFilterFlags[dirMode] & tuSize));
 
     if (bUseFilteredPredictions && 8 <= tuSize && tuSize <= 32)
     {
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -491,5 +491,15 @@ const uint8_t x265_exp2_lut[64] =
     106,  110,  114,  118,  122,  126,  130,  135,  139,  143,  147,  152,  156,  161,  165,  170,
     175,  179,  184,  189,  194,  198,  203,  208,  214,  219,  224,  229,  234,  240,  245,  250
 };
+
+/* g_intraFilterFlags[dir] & trSize */
+const uint8_t g_intraFilterFlags[35] =
+{
+    0x38, 0x00,
+    0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x00, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+    0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x00, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+    0x38, 
+};
+
 }
 //! \}
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.h	Thu Aug 14 15:33:51 2014 -0500
@@ -148,6 +148,9 @@ extern const uint16_t x265_chroma_lambda
 extern const uint8_t g_lpsTable[64][4];
 extern const uint8_t x265_exp2_lut[64];
 
+// Intra tables
+extern const uint8_t g_intraFilterFlags[35];
+
 }
 
 #endif  //ifndef X265_TCOMROM_H
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -39,9 +39,10 @@
 
 #include "common.h"
 #include "primitives.h"
+#include "shortyuv.h"
 #include "slice.h"
 #include "TComWeightPrediction.h"
-#include "predict.h"
+#include "TComYuv.h"
 
 using namespace x265;
 
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -38,7 +38,7 @@
 
 #include "common.h"
 #include "TComYuv.h"
-#include "predict.h"
+#include "TComPicYuv.h"
 #include "shortyuv.h"
 #include "primitives.h"
 
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/common/common.h
--- a/source/common/common.h	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/common/common.h	Thu Aug 14 15:33:51 2014 -0500
@@ -179,6 +179,8 @@ typedef int32_t  coeff_t;      // transf
 #define X265_LOG2(x)  log2(x)
 #endif
 
+namespace x265 {
+
 // NOTE: MUST be alignment to 16 or 32 bytes for asm code
 struct NoiseReduction
 {
@@ -189,6 +191,8 @@ struct NoiseReduction
     uint32_t count[8];
 };
 
+}
+
 /* defined in common.cpp */
 int64_t x265_mdate(void);
 void x265_log(const x265_param *param, int level, const char *fmt, ...);
@@ -201,4 +205,5 @@ double x265_qScale2qp(double qScale);
 double x265_qp2qScale(double qp);
 uint32_t x265_picturePlaneSize(int csp, int width, int height, int plane);
 char* x265_slurp_file(const char *filename);
+
 #endif // ifndef X265_COMMON_H
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/common/intrapred.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -21,7 +21,6 @@
  * For more information, contact us at license @ x265.com.
  *****************************************************************************/
 
-#include "predict.h"
 #include "TLibCommon/TComRom.h"
 #include "primitives.h"
 
@@ -249,11 +248,10 @@ template<int log2Size>
 void all_angs_pred_c(pixel *dest, pixel *above0, pixel *left0, pixel *above1, pixel *left1, int bLuma)
 {
     const int size = 1 << log2Size;
-    const int sizeIdx = log2Size - 2;
     for (int mode = 2; mode <= 34; mode++)
     {
-        pixel *left = (IntraFilterType[sizeIdx][mode] ? left1 : left0);
-        pixel *above = (IntraFilterType[sizeIdx][mode] ? above1 : above0);
+        pixel *left  = (g_intraFilterFlags[mode] & size ? left1  : left0);
+        pixel *above = (g_intraFilterFlags[mode] & size ? above1 : above0);
         pixel *out = dest + ((mode - 2) << (log2Size * 2));
 
         intra_pred_ang_c<size>(out, size, left, above, mode, bLuma);
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/common/quant.cpp
--- a/source/common/quant.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/common/quant.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -495,12 +495,12 @@ uint32_t Quant::rdoQuant(TComDataCU* cu,
 
     uint32_t trSize = 1 << log2TrSize;
 
-    /* unquant constants for measuring distortion. Sscaling list quant coefficients have a (1 << 4)
+    /* unquant constants for measuring distortion. Scaling list quant coefficients have a (1 << 4)
      * scale applied that must be removed during unquant. Note that in real dequant there is clipping
      * at several stages. We skip the clipping when measuring RD cost */
 #define UNQUANT(lvl) (((lvl) * (unquantScale[blkPos] << per) + unquantRound) >> unquantShift)
     int32_t *unquantScale = m_scalingList->m_dequantCoef[log2TrSize - 2][scalingListType][rem];
-    int unquantShift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift + m_scalingList->m_bEnabled ? 4 : 0;
+    int unquantShift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift + (m_scalingList->m_bEnabled ? 4 : 0);
     int unquantRound = (unquantShift > per) ? 1 << (unquantShift - per - 1) : 0;
 
 #define SIGCOST(bits)   ((lambda2 * (bits)) >> 8)
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/common/x86/asm-primitives.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -26,9 +26,7 @@
 #include "primitives.h"
 #include "x265.h"
 #include "cpu.h"
-#if HIGH_BIT_DEPTH
-#include "predict.h"
-#endif
+#include "TLibCommon/TComRom.h"
 
 extern "C" {
 #include "pixel.h"
@@ -525,7 +523,7 @@ extern "C" {
     SETUP_CHROMA_SS_FUNC_DEF_444(64, 48, cpu); \
     SETUP_CHROMA_SS_FUNC_DEF_444(48, 64, cpu); \
     SETUP_CHROMA_SS_FUNC_DEF_444(64, 16, cpu); \
-    SETUP_CHROMA_SS_FUNC_DEF_444(16, 64, cpu)
+    SETUP_CHROMA_SS_FUNC_DEF_444(16, 64, cpu);
 
 #if HIGH_BIT_DEPTH    // temporary, until all 10bit functions are completed
 #define SETUP_LUMA_FUNC_DEF(W, H, cpu) \
@@ -1139,7 +1137,7 @@ extern "C" {
     SETUP_CHROMA_VERT_FUNC_DEF_444(64, 48, cpu); \
     SETUP_CHROMA_VERT_FUNC_DEF_444(48, 64, cpu); \
     SETUP_CHROMA_VERT_FUNC_DEF_444(64, 16, cpu); \
-    SETUP_CHROMA_VERT_FUNC_DEF_444(16, 64, cpu)
+    SETUP_CHROMA_VERT_FUNC_DEF_444(16, 64, cpu);
 
 #define SETUP_CHROMA_HORIZ_FUNC_DEF(W, H, cpu) \
     p.chroma[X265_CSP_I420].filter_hpp[CHROMA_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
@@ -1169,7 +1167,7 @@ extern "C" {
     SETUP_CHROMA_HORIZ_FUNC_DEF(32, 24, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF(24, 32, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF(32, 8, cpu); \
-    SETUP_CHROMA_HORIZ_FUNC_DEF(8, 32, cpu)
+    SETUP_CHROMA_HORIZ_FUNC_DEF(8, 32, cpu);
 
 #define SETUP_CHROMA_HORIZ_FUNC_DEF_422(W, H, cpu) \
     p.chroma[X265_CSP_I422].filter_hpp[CHROMA422_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
@@ -1199,7 +1197,7 @@ extern "C" {
     SETUP_CHROMA_HORIZ_FUNC_DEF_422(32, 48, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF_422(24, 64, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF_422(32, 16, cpu); \
-    SETUP_CHROMA_HORIZ_FUNC_DEF_422(8, 64, cpu)
+    SETUP_CHROMA_HORIZ_FUNC_DEF_422(8, 64, cpu);
 
 #define SETUP_CHROMA_HORIZ_FUNC_DEF_444(W, H, cpu) \
     p.chroma[X265_CSP_I444].filter_hpp[LUMA_ ## W ## x ## H] = x265_interp_4tap_horiz_pp_ ## W ## x ## H ## cpu; \
@@ -1229,7 +1227,7 @@ extern "C" {
     SETUP_CHROMA_HORIZ_FUNC_DEF_444(64, 48, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF_444(48, 64, cpu); \
     SETUP_CHROMA_HORIZ_FUNC_DEF_444(64, 16, cpu); \
-    SETUP_CHROMA_HORIZ_FUNC_DEF_444(16, 64, cpu)
+    SETUP_CHROMA_HORIZ_FUNC_DEF_444(16, 64, cpu);
 
 namespace x265 {
 // private x265 namespace
@@ -1245,8 +1243,8 @@ void intra_allangs(pixel *dest, pixel *a
 
     for (int mode = 2; mode <= 34; mode++)
     {
-        pixel *left = (IntraFilterType[sizeIdx][mode] ? left1 : left0);
-        pixel *above = (IntraFilterType[sizeIdx][mode] ? above1 : above0);
+        pixel *left  = (g_intraFilterFlags[mode] & size ? left1  : left0);
+        pixel *above = (g_intraFilterFlags[mode] & size ? above1 : above0);
         pixel *out = dest + ((mode - 2) << (log2Size * 2));
 
         if (mode < 18)
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/common/x86/pixel-util.h
--- a/source/common/x86/pixel-util.h	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/common/x86/pixel-util.h	Thu Aug 14 15:33:51 2014 -0500
@@ -71,7 +71,7 @@ void x265_scale2D_64to32_ssse3(pixel *, 
 #define CHROMA_PIXELSUB_DEF(cpu) \
     SETUP_CHROMA_PIXELSUB_PS_FUNC(4, 4, cpu); \
     SETUP_CHROMA_PIXELSUB_PS_FUNC(8, 8, cpu); \
-    SETUP_CHROMA_PIXELSUB_PS_FUNC(16, 16, cpu);
+    SETUP_CHROMA_PIXELSUB_PS_FUNC(16, 16, cpu); \
     SETUP_CHROMA_PIXELSUB_PS_FUNC(32, 32, cpu);
 
 #define CHROMA_PIXELSUB_DEF_422(cpu) \
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/encoder/analysis.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -693,7 +693,7 @@ void Analysis::compressInterCU_rd0_4(TCo
                         if (m_param->rdLevel > 2)
                         {
                             encodeIntraInInter(m_intraInInterCU[depth], m_origYuv[depth], m_modePredYuv[5][depth],
-                                                m_tmpResiYuv[depth],  m_tmpRecoYuv[depth]);
+                                               m_tmpResiYuv[depth], m_tmpRecoYuv[depth]);
                             intraInInterCost = m_rdCost.m_psyRd ? m_intraInInterCU[depth]->m_totalPsyCost : m_intraInInterCU[depth]->m_totalRDCost;
                             bestCost = m_rdCost.m_psyRd ? outBestCU->m_totalPsyCost : outBestCU->m_totalRDCost;
                         }
@@ -701,7 +701,6 @@ void Analysis::compressInterCU_rd0_4(TCo
                         {
                             intraInInterCost = m_intraInInterCU[depth]->m_sa8dCost;
                             bestCost = outBestCU->m_sa8dCost;
-
                         }
                         if (intraInInterCost < bestCost)
                         {
@@ -709,9 +708,7 @@ void Analysis::compressInterCU_rd0_4(TCo
                             std::swap(m_bestPredYuv[depth], m_modePredYuv[5][depth]);
                             std::swap(m_bestRecoYuv[depth], m_tmpRecoYuv[depth]);
                             if (m_param->rdLevel > 2)
-                            {
                                 m_rdEntropyCoders[depth][CI_TEMP_BEST].store(m_rdEntropyCoders[depth][CI_NEXT_BEST]);
-                            }
                         }
                     }
                 }
@@ -738,7 +735,8 @@ void Analysis::compressInterCU_rd0_4(TCo
                     }
                     else if (outBestCU->getPredictionMode(0) == MODE_INTRA)
                         encodeIntraInInter(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],  m_bestRecoYuv[depth]);
-                        m_rdEntropyCoders[depth][CI_TEMP_BEST].store(m_rdEntropyCoders[depth][CI_NEXT_BEST]);
+
+                    m_rdEntropyCoders[depth][CI_TEMP_BEST].store(m_rdEntropyCoders[depth][CI_NEXT_BEST]);
                 }
                 else if (m_param->rdLevel == 1)
                 {
diff -r 7c7d35fe1a14 -r 08e9d25e2c72 source/encoder/predict.cpp
--- a/source/encoder/predict.cpp	Wed Aug 13 23:23:57 2014 -0500
+++ b/source/encoder/predict.cpp	Thu Aug 14 15:33:51 2014 -0500
@@ -77,10 +77,13 @@ void Predict::predIntraLumaAng(uint32_t 
     int tuSize = 1 << log2TrSize;
 
     pixel *refLft, *refAbv;
-    refLft = m_refLeft + tuSize - 1;
-    refAbv = m_refAbove + tuSize - 1;
 
-    if (IntraFilterType[log2TrSize - 2][dirMode])
+    if (!(g_intraFilterFlags[dirMode] & tuSize))
+    {
+        refLft = m_refLeft + tuSize - 1;
+        refAbv = m_refAbove + tuSize - 1;
+    }
+    else
     {
         refLft = m_refLeftFlt + tuSize - 1;
         refAbv = m_refAboveFlt + tuSize - 1;
@@ -101,7 +104,7 @@ void Predict::predIntraChromaAng(pixel* 
     pixel refAbv[3 * MAX_CU_SIZE];
     pixel refLft[3 * MAX_CU_SIZE];
 
-    bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && IntraFilterType[log2TrSizeC - 2][dirMode]);
+    bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && (g_intraFilterFlags[dirMode] & tuSize));
 
     if (bUseFilteredPredictions)


More information about the x265-commits mailing list