[x265-commits] [x265] rest: fix tpyo

Steve Borho steve at borho.org
Fri Mar 28 06:40:28 CET 2014


details:   http://hg.videolan.org/x265/rev/5ec673a3e635
branches:  
changeset: 6619:5ec673a3e635
user:      Steve Borho <steve at borho.org>
date:      Thu Mar 27 17:26:53 2014 -0500
description:
rest: fix tpyo
Subject: [x265] common: move clip templates to common.h

details:   http://hg.videolan.org/x265/rev/c2fdc391d226
branches:  
changeset: 6620:c2fdc391d226
user:      Steve Borho <steve at borho.org>
date:      Thu Mar 27 23:46:21 2014 -0500
description:
common: move clip templates to common.h
Subject: [x265] common: combine duplicate ClipY and ClipC templates, return pixel type

details:   http://hg.videolan.org/x265/rev/b9a62f4491a7
branches:  
changeset: 6621:b9a62f4491a7
user:      Steve Borho <steve at borho.org>
date:      Fri Mar 28 00:11:10 2014 -0500
description:
common: combine duplicate ClipY and ClipC templates, return pixel type

and fix some hungarian prefixes I encountered
Subject: [x265] move buffer outside parenthesis

details:   http://hg.videolan.org/x265/rev/9b378e860ddb
branches:  
changeset: 6622:9b378e860ddb
user:      Min Chen <chenm003 at 163.com>
date:      Thu Mar 27 18:14:55 2014 -0700
description:
move buffer outside parenthesis

diffstat:

 doc/reST/cli.rst                               |   4 +-
 source/Lib/TLibCommon/TComLoopFilter.cpp       |  12 +++++-----
 source/Lib/TLibCommon/TComRom.h                |  15 -------------
 source/Lib/TLibCommon/TComWeightPrediction.cpp |   8 +++---
 source/Lib/TLibCommon/TComYuv.cpp              |  16 +++++++-------
 source/Lib/TLibEncoder/TEncSearch.cpp          |  10 ++++----
 source/common/common.h                         |  12 +++++++++++
 source/common/pixel.cpp                        |  28 +++++++++++++-------------
 8 files changed, 51 insertions(+), 54 deletions(-)

diffs (267 lines):

diff -r e3b1fb25c1d5 -r 9b378e860ddb doc/reST/cli.rst
--- a/doc/reST/cli.rst	Thu Mar 27 17:21:37 2014 -0500
+++ b/doc/reST/cli.rst	Thu Mar 27 18:14:55 2014 -0700
@@ -12,8 +12,8 @@ Preset and tune have special implication
 x265_param_default_preset() with the preset and tune parameters they
 wish to use, prior to calling x265_param_parse() to set any additional
 fields. The CLI does this for the user implicitly, so all CLI options
-are applied after the user's preset and tune choices, regarless of the
-order of the options on the command line.
+are applied after the user's preset and tune choices, regardless of the
+order of the arguments on the command line.
 
 If there is an extra command line argument (not an option or an option
 value) the CLI will treat it as the input filename.  This effectively
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Mar 27 18:14:55 2014 -0700
@@ -782,19 +782,19 @@ inline void TComLoopFilter::xPelFilterLu
         if (abs(delta) < thrCut)
         {
             delta = Clip3(-tc, tc, delta);
-            src[-offset] = (pixel)ClipY((m3 + delta));
-            src[0] = (pixel)ClipY((m4 - delta));
+            src[-offset] = Clip(m3 + delta);
+            src[0] = Clip(m4 - delta);
 
             int tc2 = tc >> 1;
             if (bFilterSecondP)
             {
                 int delta1 = Clip3(-tc2, tc2, ((((m1 + m3 + 1) >> 1) - m2 + delta) >> 1));
-                src[-offset * 2] = (pixel)ClipY((m2 + delta1));
+                src[-offset * 2] = Clip(m2 + delta1);
             }
             if (bFilterSecondQ)
             {
                 int delta2 = Clip3(-tc2, tc2, ((((m6 + m4 + 1) >> 1) - m5 - delta) >> 1));
-                src[offset] = (pixel)ClipY((m5 + delta2));
+                src[offset] = Clip(m5 + delta2);
             }
         }
     }
@@ -832,8 +832,8 @@ inline void TComLoopFilter::xPelFilterCh
     int16_t m2  = (int16_t)src[-offset * 2];
 
     delta = Clip3(-tc, tc, ((((m4 - m3) << 2) + m2 - m5 + 4) >> 3));
-    src[-offset] = (pixel)ClipC(m3 + delta);
-    src[0] = (pixel)ClipC(m4 - delta);
+    src[-offset] = Clip(m3 + delta);
+    src[0] = Clip(m4 - delta);
 
     if (bPartPNoFilter)
     {
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.h	Thu Mar 27 18:14:55 2014 -0700
@@ -152,21 +152,6 @@ extern const uint8_t g_goRiceRange[5];  
 //extern const uint8_t g_goRicePrefixLen[5];  //!< prefix length for each maximum value
 
 // ====================================================================================================================
-// Bit-depth
-// ====================================================================================================================
-
-/** clip x, such that 0 <= x <= #g_maxLumaVal */
-template<typename T>
-inline T ClipY(T x) { return std::min<T>(T((1 << X265_DEPTH) - 1), std::max<T>(T(0), x)); }
-
-template<typename T>
-inline T ClipC(T x) { return std::min<T>(T((1 << X265_DEPTH) - 1), std::max<T>(T(0), x)); }
-
-/** clip a, such that minVal <= a <= maxVal */
-template<typename T>
-inline T Clip3(T minVal, T maxVal, T a) { return std::min<T>(std::max<T>(minVal, a), maxVal); } ///< general min/max clip
-
-// ====================================================================================================================
 // Misc.
 // ====================================================================================================================
 
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Thu Mar 27 18:14:55 2014 -0700
@@ -45,22 +45,22 @@ using namespace x265;
 
 static inline pixel weightBidirY(int w0, int16_t P0, int w1, int16_t P1, int round, int shift, int offset)
 {
-    return ClipY(((w0 * (P0 + IF_INTERNAL_OFFS) + w1 * (P1 + IF_INTERNAL_OFFS) + round + (offset << (shift - 1))) >> shift));
+    return Clip((w0 * (P0 + IF_INTERNAL_OFFS) + w1 * (P1 + IF_INTERNAL_OFFS) + round + (offset << (shift - 1))) >> shift);
 }
 
 static inline pixel weightBidirC(int w0, int16_t P0, int w1, int16_t P1, int round, int shift, int offset)
 {
-    return ClipC(((w0 * (P0 + IF_INTERNAL_OFFS) + w1 * (P1 + IF_INTERNAL_OFFS) + round + (offset << (shift - 1))) >> shift));
+    return Clip((w0 * (P0 + IF_INTERNAL_OFFS) + w1 * (P1 + IF_INTERNAL_OFFS) + round + (offset << (shift - 1))) >> shift);
 }
 
 static inline pixel weightUnidirY(int w0, int16_t P0, int round, int shift, int offset)
 {
-    return ClipY(((w0 * (P0 + IF_INTERNAL_OFFS) + round) >> shift) + offset);
+    return Clip(((w0 * (P0 + IF_INTERNAL_OFFS) + round) >> shift) + offset);
 }
 
 static inline pixel weightUnidirC(int w0, int16_t P0, int round, int shift, int offset)
 {
-    return ClipC(((w0 * (P0 + IF_INTERNAL_OFFS) + round) >> shift) + offset);
+    return Clip(((w0 * (P0 + IF_INTERNAL_OFFS) + round) >> shift) + offset);
 }
 
 // ====================================================================================================================
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.cpp	Thu Mar 27 18:14:55 2014 -0700
@@ -308,10 +308,10 @@ void TComYuv::addAvg(TComYuv* srcYuv0, T
         {
             for (x = 0; x < width; x += 4)
             {
-                dstY[x + 0] = ClipY((srcY0[x + 0] + srcY1[x + 0] + offset) >> shiftNum);
-                dstY[x + 1] = ClipY((srcY0[x + 1] + srcY1[x + 1] + offset) >> shiftNum);
-                dstY[x + 2] = ClipY((srcY0[x + 2] + srcY1[x + 2] + offset) >> shiftNum);
-                dstY[x + 3] = ClipY((srcY0[x + 3] + srcY1[x + 3] + offset) >> shiftNum);
+                dstY[x + 0] = Clip((srcY0[x + 0] + srcY1[x + 0] + offset) >> shiftNum);
+                dstY[x + 1] = Clip((srcY0[x + 1] + srcY1[x + 1] + offset) >> shiftNum);
+                dstY[x + 2] = Clip((srcY0[x + 2] + srcY1[x + 2] + offset) >> shiftNum);
+                dstY[x + 3] = Clip((srcY0[x + 3] + srcY1[x + 3] + offset) >> shiftNum);
             }
 
             srcY0 += src0Stride;
@@ -336,11 +336,11 @@ void TComYuv::addAvg(TComYuv* srcYuv0, T
             for (x = width - 1; x >= 0; )
             {
                 // note: chroma min width is 2
-                dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);
-                dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);
+                dstU[x] = Clip((srcU0[x] + srcU1[x] + offset) >> shiftNum);
+                dstV[x] = Clip((srcV0[x] + srcV1[x] + offset) >> shiftNum);
                 x--;
-                dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);
-                dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);
+                dstU[x] = Clip((srcU0[x] + srcU1[x] + offset) >> shiftNum);
+                dstV[x] = Clip((srcV0[x] + srcV1[x] + offset) >> shiftNum);
                 x--;
             }
 
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Mar 27 18:14:55 2014 -0700
@@ -1515,6 +1515,11 @@ void TEncSearch::estIntraPredQT(TComData
             // 33 Angle modes once
             ALIGN_VAR_32(pixel, buf_trans[32 * 32]);
             ALIGN_VAR_32(pixel, tmp[33 * 32 * 32]);
+            ALIGN_VAR_32(pixel, bufScale[32 * 32]);
+            pixel _above[4 * 32 + 1];
+            pixel _left[4 * 32 + 1];
+            pixel *aboveScale  = _above + 2 * 32;
+            pixel *leftScale   = _left + 2 * 32;
             int scaleSize = puSize;
             int scaleStride = stride;
             int costShift = 0;
@@ -1522,16 +1527,11 @@ void TEncSearch::estIntraPredQT(TComData
             if (puSize > 32)
             {
                 // origin is 64x64, we scale to 32x32 and setup required parameters
-                ALIGN_VAR_32(pixel, bufScale[32 * 32]);
                 primitives.scale2D_64to32(bufScale, fenc, stride);
                 fenc = bufScale;
 
                 // reserve space in case primitives need to store data in above
                 // or left buffers
-                pixel _above[4 * 32 + 1];
-                pixel _left[4 * 32 + 1];
-                pixel *aboveScale  = _above + 2 * 32;
-                pixel *leftScale   = _left + 2 * 32;
                 aboveScale[0] = leftScale[0] = above[0];
                 primitives.scale1D_128to64(aboveScale + 1, above + 1, 0);
                 primitives.scale1D_128to64(leftScale + 1, left + 1, 0);
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/common/common.h
--- a/source/common/common.h	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/common/common.h	Thu Mar 27 18:14:55 2014 -0700
@@ -67,6 +67,18 @@ typedef uint32_t pixel4;
 #define X265_DEPTH 8           // compile time configurable bit depth
 #endif // if HIGH_BIT_DEPTH
 
+template<typename T>
+inline pixel Clip(T x)
+{
+    return (pixel)std::min<T>(T((1 << X265_DEPTH) - 1), std::max<T>(T(0), x));
+}
+
+template<typename T>
+inline T Clip3(T minVal, T maxVal, T a)
+{
+    return std::min<T>(std::max<T>(minVal, a), maxVal);
+}
+
 typedef int32_t  coeff_t;      // transform coefficient
 
 #define X265_MIN(a, b) ((a) < (b) ? (a) : (b))
diff -r e3b1fb25c1d5 -r 9b378e860ddb source/common/pixel.cpp
--- a/source/common/pixel.cpp	Thu Mar 27 17:21:37 2014 -0500
+++ b/source/common/pixel.cpp	Thu Mar 27 18:14:55 2014 -0700
@@ -446,11 +446,11 @@ void convert32to16_shr(int16_t *dst, int
 template<int blockSize>
 void getResidual(pixel *fenc, pixel *pred, int16_t *residual, intptr_t stride)
 {
-    for (int uiY = 0; uiY < blockSize; uiY++)
+    for (int y = 0; y < blockSize; y++)
     {
-        for (int uiX = 0; uiX < blockSize; uiX++)
+        for (int x = 0; x < blockSize; x++)
         {
-            residual[uiX] = static_cast<int16_t>(fenc[uiX]) - static_cast<int16_t>(pred[uiX]);
+            residual[x] = static_cast<int16_t>(fenc[x]) - static_cast<int16_t>(pred[x]);
         }
 
         fenc += stride;
@@ -468,17 +468,17 @@ void calcRecons(pixel* pred, int16_t* re
 #endif
                 int16_t* recqt, pixel* recipred, int stride, int qtstride, int ipredstride)
 {
-    for (int uiY = 0; uiY < blockSize; uiY++)
+    for (int y = 0; y < blockSize; y++)
     {
-        for (int uiX = 0; uiX < blockSize; uiX++)
+        for (int x = 0; x < blockSize; x++)
         {
 #if NEW_CALCRECON
-            recqt[uiX] = (int16_t)ClipY(static_cast<int16_t>(pred[uiX]) + residual[uiX]);
-            recipred[uiX] = (pixel)recqt[uiX];
+            recqt[x] = (int16_t)Clip(static_cast<int16_t>(pred[x]) + residual[x]);
+            recipred[x] = (pixel)recqt[x];
 #else
-            recon[uiX] = (pixel)ClipY(static_cast<int16_t>(pred[uiX]) + residual[uiX]);
-            recqt[uiX] = (int16_t)recon[uiX];
-            recipred[uiX] = recon[uiX];
+            recon[x] = Clip(static_cast<int16_t>(pred[x]) + residual[x]);
+            recqt[x] = (int16_t)recon[x];
+            recipred[x] = recon[x];
 #endif
         }
 
@@ -549,7 +549,7 @@ void pixeladd_ss_c(int bx, int by, int16
     {
         for (int x = 0; x < bx; x++)
         {
-            a[x] = (int16_t)ClipY(b0[x] + b1[x]);
+            a[x] = (int16_t)Clip(b0[x] + b1[x]);
         }
 
         b0 += sstride0;
@@ -822,7 +822,7 @@ void pixel_add_ps_c(pixel *a, intptr_t d
     {
         for (int x = 0; x < bx; x++)
         {
-            a[x] = (pixel)ClipY(b0[x] + b1[x]);
+            a[x] = Clip(b0[x] + b1[x]);
         }
 
         b0 += sstride0;
@@ -843,8 +843,8 @@ void addAvg(int16_t* src0, int16_t* src1
     {
         for (int x = 0; x < bx; x += 2)
         {
-            dst[x + 0] = (pixel)ClipY((src0[x + 0] + src1[x + 0] + offset) >> shiftNum);
-            dst[x + 1] = (pixel)ClipY((src0[x + 1] + src1[x + 1] + offset) >> shiftNum);
+            dst[x + 0] = Clip((src0[x + 0] + src1[x + 0] + offset) >> shiftNum);
+            dst[x + 1] = Clip((src0[x + 1] + src1[x + 1] + offset) >> shiftNum);
         }
 
         src0 += src0Stride;


More information about the x265-commits mailing list