[x265] [PATCH] ipfilter: Cleanups function names and Variables

gopu at multicorewareinc.com gopu at multicorewareinc.com
Tue Jul 9 08:20:01 CEST 2013


# HG changeset patch
# User ggopu
# Date 1373350787 -19800
# Node ID d5d5a3f73738b330b7c3345f8da9ea1ec3b1fd6e
# Parent  a5c300785b8ff4191bd2fb04addeeb89b2612117
ipfilter: Cleanups function names and Variables

diff -r a5c300785b8f -r d5d5a3f73738 source/common/common.cpp
--- a/source/common/common.cpp	Tue Jul 09 00:25:00 2013 -0500
+++ b/source/common/common.cpp	Tue Jul 09 11:49:47 2013 +0530
@@ -44,31 +44,31 @@
 const int x265_bit_depth = 8;
 #endif
 
-void x265_log(x265_param_t *param, int i_level, const char *fmt, ...)
+void x265_log(x265_param_t *param, int level, const char *fmt, ...)
 {
-    if (i_level > param->logLevel)
+    if (level > param->logLevel)
         return;
-    std::string s_level;
-    switch (i_level)
+    string log_level;
+    switch (level)
     {
     case X265_LOG_ERROR:
-        s_level = "error";
+        log_level = "error";
         break;
     case X265_LOG_WARNING:
-        s_level = "warning";
+        log_level = "warning";
         break;
     case X265_LOG_INFO:
-        s_level = "info";
+        log_level = "info";
         break;
     case X265_LOG_DEBUG:
-        s_level = "debug";
+        log_level = "debug";
         break;
     default:
-        s_level = "unknown";
+        log_level = "unknown";
         break;
     }
 
-    fprintf(stderr, "x265 [%s]: ", s_level.c_str());
+    fprintf(stderr, "x265 [%s]: ", log_level.c_str());
     va_list arg;
     va_start(arg, fmt);
     vfprintf(stderr, fmt, arg);
@@ -114,8 +114,7 @@
     if (!profile)
         return 0;
     if (!strcmp(profile, "main"))
-    {
-    }
+    {}
     else if (!strcmp(profile, "main10"))
     {
 #if HIGH_BIT_DEPTH
@@ -151,7 +150,7 @@
 {
 #define CONFIRM(expr, msg) check_failed |= _confirm(param, expr, msg)
     int check_failed = 0; /* abort if there is a fatal configuration problem */
-    uint32_t maxCUDepth = (uint32_t) g_aucConvertToBit[param->maxCUSize];
+    uint32_t maxCUDepth = (uint32_t)g_aucConvertToBit[param->maxCUSize];
     uint32_t tuQTMaxLog2Size = maxCUDepth + 2 - 1;
     uint32_t tuQTMinLog2Size = 2; //log2(4)
 
@@ -176,7 +175,7 @@
     CONFIRM(param->keyframeInterval < -1,
             "Keyframe interval must be -1 (open-GOP) 0 (auto) 1 (intra-only) or greater than 1");
     CONFIRM(param->maxCUdQPDepth > maxCUDepth - 1,
-	            "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth");
+            "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth");
 
     CONFIRM(param->cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12");
     CONFIRM(param->cbQpOffset >  12, "Max. Chroma Cb QP Offset is  12");
@@ -194,11 +193,9 @@
     CONFIRM((param->sourceHeight % (param->maxCUSize >> (maxCUDepth - 1))) != 0,
             "Resulting coded frame height must be a multiple of the minimum CU size");
 
-    
     CONFIRM((1u << tuQTMaxLog2Size) > param->maxCUSize,
             "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
 
-   
     CONFIRM(param->tuQTMaxInterDepth < 1,
             "QuadtreeTUMaxDepthInter must be greater than or equal to 1");
     CONFIRM(param->maxCUSize < (1u << (tuQTMinLog2Size + param->tuQTMaxInterDepth - 1)),
@@ -244,7 +241,7 @@
 
 void x265_set_globals(x265_param_t *param, uint32_t inputBitDepth)
 {
-    uint32_t maxCUDepth = (uint32_t) g_aucConvertToBit[param->maxCUSize];
+    uint32_t maxCUDepth = (uint32_t)g_aucConvertToBit[param->maxCUSize];
     uint32_t tuQTMinLog2Size = 2; //log2(4)
 
     // set max CU width & height
@@ -316,7 +313,7 @@
     TOOLOPT(param->bEnableFastMergeDecision, "fdm");
     TOOLOPT(param->bEnableCbfFastMode, "cfm");
     TOOLOPT(param->bEnableEarlySkip, "esd");
-    if(param->bEnableRDO)
+    if (param->bEnableRDO)
         fprintf(stderr, "rdo ");
     else
         fprintf(stderr, "no-rdo ");
diff -r a5c300785b8f -r d5d5a3f73738 source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp	Tue Jul 09 00:25:00 2013 -0500
+++ b/source/common/ipfilter.cpp	Tue Jul 09 11:49:47 2013 +0530
@@ -34,7 +34,7 @@
 
 namespace {
 template<int N>
-void filterVertical_short_pel(int bitDepth, short *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
+void filterVertical_s_p(int bitDepth, short *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
 {
     int cStride = srcStride;
 
@@ -89,7 +89,7 @@
 }
 
 template<int N>
-void filterHorizontal_pel_pel(int bitDepth, pixel *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
+void filterHorizontal_p_p(int bitDepth, pixel *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
 {
     int cStride = 1;
 
@@ -139,7 +139,7 @@
 }
 
 template<int N>
-void filterVertical_short_short(int /* bitDepth */, short *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
+void filterVertical_s_s(int /* bitDepth */, short *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
 {
     short c[8];
 
@@ -199,7 +199,7 @@
 }
 
 template<int N>
-void filterVertical_pel_short(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
+void filterVertical_p_s(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
 {
     short c[8];
 
@@ -221,8 +221,8 @@
         c[7] = coeff[7];
     }
 
-    int cStride =  srcStride;
-    src -= (N / 2 - 1) * cStride;
+    int Stride =  srcStride;
+    src -= (N / 2 - 1) * Stride;
     Int offset;
     Int headRoom = IF_INTERNAL_PREC - bitDepth;
     Int shift = IF_FILTER_PREC;
@@ -237,22 +237,22 @@
         {
             int sum;
 
-            sum  = src[col + 0 * cStride] * c[0];
-            sum += src[col + 1 * cStride] * c[1];
+            sum  = src[col + 0 * Stride] * c[0];
+            sum += src[col + 1 * Stride] * c[1];
             if (N >= 4)
             {
-                sum += src[col + 2 * cStride] * c[2];
-                sum += src[col + 3 * cStride] * c[3];
+                sum += src[col + 2 * Stride] * c[2];
+                sum += src[col + 3 * Stride] * c[3];
             }
             if (N >= 6)
             {
-                sum += src[col + 4 * cStride] * c[4];
-                sum += src[col + 5 * cStride] * c[5];
+                sum += src[col + 4 * Stride] * c[4];
+                sum += src[col + 5 * Stride] * c[5];
             }
             if (N == 8)
             {
-                sum += src[col + 6 * cStride] * c[6];
-                sum += src[col + 7 * cStride] * c[7];
+                sum += src[col + 6 * Stride] * c[6];
+                sum += src[col + 7 * Stride] * c[7];
             }
 
             short val = (short)((sum + offset) >> shift);
@@ -265,11 +265,11 @@
 }
 
 template<int N>
-void filterHorizontal_pel_short(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
+void filterHorizontal_p_s(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
 {
-    int cStride = 1;
+    int Stride = 1;
 
-    src -= (N / 2 - 1) * cStride;
+    src -= (N / 2 - 1) * Stride;
 
     int offset;
     int headRoom = IF_INTERNAL_PREC - bitDepth;
@@ -285,22 +285,22 @@
         {
             int sum;
 
-            sum  = src[col + 0 * cStride] * coeff[0];
-            sum += src[col + 1 * cStride] * coeff[1];
+            sum  = src[col + 0 * Stride] * coeff[0];
+            sum += src[col + 1 * Stride] * coeff[1];
             if (N >= 4)
             {
-                sum += src[col + 2 * cStride] * coeff[2];
-                sum += src[col + 3 * cStride] * coeff[3];
+                sum += src[col + 2 * Stride] * coeff[2];
+                sum += src[col + 3 * Stride] * coeff[3];
             }
             if (N >= 6)
             {
-                sum += src[col + 4 * cStride] * coeff[4];
-                sum += src[col + 5 * cStride] * coeff[5];
+                sum += src[col + 4 * Stride] * coeff[4];
+                sum += src[col + 5 * Stride] * coeff[5];
             }
             if (N == 8)
             {
-                sum += src[col + 6 * cStride] * coeff[6];
-                sum += src[col + 7 * cStride] * coeff[7];
+                sum += src[col + 6 * Stride] * coeff[6];
+                sum += src[col + 7 * Stride] * coeff[7];
             }
 
             short val = (short)(sum + offset) >> shift;
@@ -356,7 +356,7 @@
 }
 
 template<int N>
-void filterVertical_pel_pel(int bitDepth, pixel *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
+void filterVertical_p_p(int bitDepth, pixel *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff)
 {
     short c[8];
 
@@ -378,8 +378,8 @@
         c[7] = coeff[7];
     }
 
-    int cStride = srcStride;
-    src -= (N / 2 - 1) * cStride;
+    int Stride = srcStride;
+    src -= (N / 2 - 1) * Stride;
 
     int offset;
     short maxVal;
@@ -399,22 +399,22 @@
         {
             int sum;
 
-            sum  = src[col + 0 * cStride] * c[0];
-            sum += src[col + 1 * cStride] * c[1];
+            sum  = src[col + 0 * Stride] * c[0];
+            sum += src[col + 1 * Stride] * c[1];
             if (N >= 4)
             {
-                sum += src[col + 2 * cStride] * c[2];
-                sum += src[col + 3 * cStride] * c[3];
+                sum += src[col + 2 * Stride] * c[2];
+                sum += src[col + 3 * Stride] * c[3];
             }
             if (N >= 6)
             {
-                sum += src[col + 4 * cStride] * c[4];
-                sum += src[col + 5 * cStride] * c[5];
+                sum += src[col + 4 * Stride] * c[4];
+                sum += src[col + 5 * Stride] * c[5];
             }
             if (N == 8)
             {
-                sum += src[col + 6 * cStride] * c[6];
-                sum += src[col + 7 * cStride] * c[7];
+                sum += src[col + 6 * Stride] * c[6];
+                sum += src[col + 7 * Stride] * c[7];
             }
 
             short val = (short)((sum + offset) >> shift);
@@ -431,9 +431,9 @@
 
 void filterVertical_short_pel_multiplane(int bitDepth, short *src, int srcStride, pixel *dstE, pixel *dstI, pixel *dstP, int dstStride, int block_width, int block_height)
 {
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstI, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstE, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstP, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstI, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstE, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstP, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
 }
 
 void extendPicCompBorder(pixel* piTxt, int stride, int width, int height, int marginX, int marginY)
@@ -468,9 +468,9 @@
 
 void filterVerticalMultiplaneExtend(int bitDepth, short *src, int srcStride, pixel *dstE, pixel *dstI, pixel *dstP, int dstStride, int block_width, int block_height, int marginX, int marginY)
 {
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstI, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstE, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
-    filterVertical_short_pel<8>(bitDepth, src, srcStride, dstP, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstI, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstE, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
+    filterVertical_s_p<8>(bitDepth, src, srcStride, dstP, dstStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
     extendPicCompBorder(dstE, dstStride, block_width, block_height, marginX, marginY);
     extendPicCompBorder(dstI, dstStride, block_width, block_height, marginX, marginY);
     extendPicCompBorder(dstP, dstStride, block_width, block_height, marginX, marginY);
@@ -479,9 +479,9 @@
 void filterHorizontalMultiplaneExtend(int bitDepth, pixel *src, int srcStride, short *midF, short* midA, short* midB, short* midC, int midStride, pixel *pDstA, pixel *pDstB, pixel *pDstC, int pDstStride, int block_width, int block_height, int marginX, int marginY)
 {
     filterConvertPelToShort(bitDepth, src, srcStride, midF, midStride, block_width, block_height);
-    filterHorizontal_pel_short<8>(bitDepth, src, srcStride, midB, midStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
-    filterHorizontal_pel_short<8>(bitDepth, src, srcStride, midA, midStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
-    filterHorizontal_pel_short<8>(bitDepth, src, srcStride, midC, midStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
+    filterHorizontal_p_s<8>(bitDepth, src, srcStride, midB, midStride, block_width, block_height, TComPrediction::m_lumaFilter[2]);
+    filterHorizontal_p_s<8>(bitDepth, src, srcStride, midA, midStride, block_width, block_height, TComPrediction::m_lumaFilter[1]);
+    filterHorizontal_p_s<8>(bitDepth, src, srcStride, midC, midStride, block_width, block_height, TComPrediction::m_lumaFilter[3]);
     filterConvertShortToPel(bitDepth, midA, midStride, pDstA, pDstStride, block_width, block_height);
     filterConvertShortToPel(bitDepth, midB, midStride, pDstB, pDstStride, block_width, block_height);
     filterConvertShortToPel(bitDepth, midC, midStride, pDstC, pDstStride, block_width, block_height);
@@ -502,20 +502,18 @@
 
 void Setup_C_IPFilterPrimitives(EncoderPrimitives& p)
 {
-    p.ipfilter_pp[FILTER_H_P_P_8] = filterHorizontal_pel_pel<8>;
-    p.ipfilter_ps[FILTER_H_P_S_8] = filterHorizontal_pel_short<8>;
-    p.ipfilter_ps[FILTER_V_P_S_8] = filterVertical_pel_short<8>;
-    p.ipfilter_sp[FILTER_V_S_P_8] = filterVertical_short_pel<8>;
-    p.ipfilter_pp[FILTER_H_P_P_4] = filterHorizontal_pel_pel<4>;
-    p.ipfilter_ps[FILTER_H_P_S_4] = filterHorizontal_pel_short<4>;
-    p.ipfilter_ps[FILTER_V_P_S_4] = filterVertical_pel_short<4>;
-    p.ipfilter_sp[FILTER_V_S_P_4] = filterVertical_short_pel<4>;
-
-    p.ipfilter_pp[FILTER_V_P_P_8] = filterVertical_pel_pel<8>;
-    p.ipfilter_pp[FILTER_V_P_P_4] = filterVertical_pel_pel<4>;
-
-    p.ipfilter_ss[FILTER_V_S_S_8] = filterVertical_short_short<8>;
-    p.ipfilter_ss[FILTER_V_S_S_4] = filterVertical_short_short<4>;
+    p.ipfilter_pp[FILTER_H_P_P_8] = filterHorizontal_p_p<8>;
+    p.ipfilter_ps[FILTER_H_P_S_8] = filterHorizontal_p_s<8>;
+    p.ipfilter_ps[FILTER_V_P_S_8] = filterVertical_p_s<8>;
+    p.ipfilter_sp[FILTER_V_S_P_8] = filterVertical_s_p<8>;
+    p.ipfilter_pp[FILTER_H_P_P_4] = filterHorizontal_p_p<4>;
+    p.ipfilter_ps[FILTER_H_P_S_4] = filterHorizontal_p_s<4>;
+    p.ipfilter_ps[FILTER_V_P_S_4] = filterVertical_p_s<4>;
+    p.ipfilter_sp[FILTER_V_S_P_4] = filterVertical_s_p<4>;
+    p.ipfilter_pp[FILTER_V_P_P_8] = filterVertical_p_p<8>;
+    p.ipfilter_pp[FILTER_V_P_P_4] = filterVertical_p_p<4>;
+    p.ipfilter_ss[FILTER_V_S_S_8] = filterVertical_s_s<8>;
+    p.ipfilter_ss[FILTER_V_S_S_4] = filterVertical_s_s<4>;
 
     p.ipfilter_p2s = filterConvertPelToShort;
     p.ipfilter_s2p = filterConvertShortToPel;


More information about the x265-devel mailing list