[x265-commits] [x265] fix warning C4701: potentially uninitialized local variab...

Min Chen chenm003 at 163.com
Tue May 5 20:54:29 CEST 2015


details:   http://hg.videolan.org/x265/rev/2decc5bb3ebf
branches:  
changeset: 10370:2decc5bb3ebf
user:      Min Chen <chenm003 at 163.com>
date:      Mon May 04 17:23:39 2015 -0700
description:
fix warning C4701: potentially uninitialized local variable 'scanPos' used
Subject: [x265] asm: avx2 code for sad 16x4,16x8,16x12,16x16,16x32 for 10bpp

details:   http://hg.videolan.org/x265/rev/d984cc421687
branches:  
changeset: 10371:d984cc421687
user:      Sumalatha Polureddy
date:      Tue May 05 11:54:26 2015 +0530
description:
asm: avx2 code for sad 16x4,16x8,16x12,16x16,16x32 for 10bpp

sse2:
sad[ 16x4]  2.78x    274.25          761.77
sad[ 16x8]  3.08x    455.14          1401.20
sad[16x12]  3.16x    644.93          2039.52
sad[16x16]  3.28x    830.14          2725.86
sad[16x32]  3.38x    1603.12         5415.46
avx2:
sad[ 16x4]  5.38x    140.91          758.03
sad[ 16x8]  6.14x    214.04          1313.60
sad[16x12]  6.44x    316.88          2039.84
sad[16x16]  6.82x    396.83          2705.34
sad[16x32]  7.13x    738.81          5268.11
Subject: [x265] rdcost: consistent clipping for chroma QP, combine conditionals

details:   http://hg.videolan.org/x265/rev/f8335da1174c
branches:  
changeset: 10372:f8335da1174c
user:      Steve Borho <steve at borho.org>
date:      Tue May 05 10:42:59 2015 -0500
description:
rdcost: consistent clipping for chroma QP, combine conditionals

clip chroma QP to QP_MIN..QP_MAX_MAX prior to g_chromaScale lookup, clip non-
i420 chroma QP to QP_MIN..QP_MAX_SPEC directly. So in either case chroma QP ends
up in spec range but in the case if I420 the chroma QP is scaled into the spec
range via the lookup table.
Subject: [x265] param: x265_free has no return code

details:   http://hg.videolan.org/x265/rev/9d9239258f3c
branches:  
changeset: 10373:9d9239258f3c
user:      Steve Borho <steve at borho.org>
date:      Tue May 05 12:46:23 2015 -0500
description:
param: x265_free has no return code

diffstat:

 source/common/param.cpp              |   2 +-
 source/common/quant.cpp              |   2 +-
 source/common/x86/asm-primitives.cpp |   4 ++
 source/common/x86/sad16-a.asm        |  59 ++++-------------------------------
 source/encoder/rdcost.h              |  17 ++++++----
 5 files changed, 23 insertions(+), 61 deletions(-)

diffs (155 lines):

diff -r f32e6464225a -r 9d9239258f3c source/common/param.cpp
--- a/source/common/param.cpp	Mon May 04 15:15:42 2015 -0500
+++ b/source/common/param.cpp	Tue May 05 12:46:23 2015 -0500
@@ -87,7 +87,7 @@ x265_param *x265_param_alloc()
 extern "C"
 void x265_param_free(x265_param* p)
 {
-    return x265_free(p);
+    x265_free(p);
 }
 
 extern "C"
diff -r f32e6464225a -r 9d9239258f3c source/common/quant.cpp
--- a/source/common/quant.cpp	Mon May 04 15:15:42 2015 -0500
+++ b/source/common/quant.cpp	Tue May 05 12:46:23 2015 -0500
@@ -592,7 +592,7 @@ uint32_t Quant::rdoQuant(const CUData& c
     /* TODO: update bit estimates if dirty */
     EstBitsSbac& estBitsSbac = m_entropyCoder->m_estBitsSbac;
 
-    uint32_t scanPos;
+    uint32_t scanPos = 0;
     uint32_t c1 = 1;
 
     // process trail all zero Coeff Group
diff -r f32e6464225a -r 9d9239258f3c source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon May 04 15:15:42 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Tue May 05 12:46:23 2015 -0500
@@ -1239,7 +1239,11 @@ void setupAssemblyPrimitives(EncoderPrim
         p.chroma[X265_CSP_I422].cu[BLOCK_422_16x32].sub_ps = x265_pixel_sub_ps_16x32_avx2;
         p.chroma[X265_CSP_I422].cu[BLOCK_422_32x64].sub_ps = x265_pixel_sub_ps_32x64_avx2;
 
+        p.pu[LUMA_16x4].sad = x265_pixel_sad_16x4_avx2;
         p.pu[LUMA_16x8].sad = x265_pixel_sad_16x8_avx2;
+        p.pu[LUMA_16x12].sad = x265_pixel_sad_16x12_avx2;
+        p.pu[LUMA_16x16].sad = x265_pixel_sad_16x16_avx2;
+        p.pu[LUMA_16x32].sad = x265_pixel_sad_16x32_avx2;
 
         p.pu[LUMA_16x4].convert_p2s = x265_filterPixelToShort_16x4_avx2;
         p.pu[LUMA_16x8].convert_p2s = x265_filterPixelToShort_16x8_avx2;
diff -r f32e6464225a -r 9d9239258f3c source/common/x86/sad16-a.asm
--- a/source/common/x86/sad16-a.asm	Mon May 04 15:15:42 2015 -0500
+++ b/source/common/x86/sad16-a.asm	Tue May 05 12:46:23 2015 -0500
@@ -385,6 +385,13 @@ SAD  8,  8
 SAD  8, 16
 SAD  8, 32
 
+INIT_YMM avx2
+SAD  16,  4
+SAD  16,  8
+SAD  16, 12
+SAD  16, 16
+SAD  16, 32
+
 ;------------------------------------------------------------------
 ; int pixel_sad_32xN( uint16_t *, intptr_t, uint16_t *, intptr_t )
 ;------------------------------------------------------------------
@@ -772,58 +779,6 @@ cglobal pixel_vsad, 3,3
 %endif
     movd     eax, xm0
     RET
-
-INIT_YMM avx2
-cglobal pixel_sad_16x8, 4,7,7
-    xorps           m0, m0
-    xorps           m6, m6
-    movu            m5, [pw_1]
-    mov             r4d, 8/4
-    add             r1d, r1d
-    add             r3d, r3d
-    lea             r5, [r1 * 3]
-    lea             r6, [r3 * 3]
-.loop
-    movu            m1, [r0]               ; row 0 of pix0
-    movu            m2, [r2]               ; row 0 of pix1
-    movu            m3, [r0 + r1]          ; row 1 of pix0
-    movu            m4, [r2 + r3]          ; row 1 of pix1
-    psubw           m1, m2
-    pabsw           m1, m1
-    pmaddwd         m1, m5
-    psubw           m3, m4
-    pabsw           m3, m3
-    pmaddwd         m3, m5
-    paddd           m0, m1
-    paddd           m6, m3
-
-    movu            m1, [r0 + 2 * r1]      ; row 2 of pix0
-    movu            m2, [r2 + 2 * r3]      ; row 2 of pix1
-    movu            m3, [r0 + r5]          ; row 3 of pix0
-    movu            m4, [r2 + r6]          ; row 3 of pix1
-    psubw           m1, m2
-    pabsw           m1, m1
-    pmaddwd         m1, m5
-    psubw           m3, m4
-    pabsw           m3, m3
-    pmaddwd         m3, m5
-    paddd           m0, m1
-    paddd           m6, m3
-    lea     r2,     [r2 + 4 * r3]
-    lea     r0,     [r0 + 4 * r1]
-
-    dec             r4d
-    jnz             .loop
-
-    paddd           m0, m6
-    vextracti128    xm1, m0, 1
-    paddd           xm0, xm1
-    movhlps         xm1, xm0
-    paddd           xm0, xm1
-    pshufd          xm1, xm0, 1
-    paddd           xm0, xm1
-    movd            eax, xm0
-    RET
 ;-----------------------------------------------------------------------------
 ; void pixel_sad_xN_WxH( uint16_t *fenc, uint16_t *pix0, uint16_t *pix1,
 ;                        uint16_t *pix2, intptr_t i_stride, int scores[3] )
diff -r f32e6464225a -r 9d9239258f3c source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Mon May 04 15:15:42 2015 -0500
+++ b/source/encoder/rdcost.h	Tue May 05 12:46:23 2015 -0500
@@ -48,6 +48,7 @@ public:
     {
         x265_emms(); /* TODO: if the lambda tables were ints, this would not be necessary */
         m_qp = qp;
+        setLambda(x265_lambda2_tab[qp], x265_lambda_tab[qp]);
 
         /* Scale PSY RD factor by a slice type factor */
         static const uint32_t psyScaleFix8[3] = { 300, 256, 96 }; /* B, P, I */
@@ -61,19 +62,21 @@ public:
         }
 
         int qpCb, qpCr;
-        setLambda(x265_lambda2_tab[qp], x265_lambda_tab[qp]);
         if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)
-            qpCb = x265_clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[0]]);
+        {
+            qpCb = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[0])];
+            qpCr = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[1])];
+        }
         else
-            qpCb = X265_MIN(qp + slice.m_pps->chromaQpOffset[0], QP_MAX_SPEC);
+        {
+            qpCb = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[0]);
+            qpCr = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[1]);
+        }
+
         int chroma_offset_idx = X265_MIN(qp - qpCb + 12, MAX_CHROMA_LAMBDA_OFFSET);
         uint16_t lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
         m_chromaDistWeight[0] = lambdaOffset;
 
-        if (slice.m_sps->chromaFormatIdc == X265_CSP_I420)
-            qpCr = x265_clip3(QP_MIN, QP_MAX_MAX, (int)g_chromaScale[qp + slice.m_pps->chromaQpOffset[1]]);
-        else
-            qpCr = X265_MIN(qp + slice.m_pps->chromaQpOffset[1], QP_MAX_SPEC);
         chroma_offset_idx = X265_MIN(qp - qpCr + 12, MAX_CHROMA_LAMBDA_OFFSET);
         lambdaOffset = m_psyRd ? x265_chroma_lambda2_offset_tab[chroma_offset_idx] : 256;
         m_chromaDistWeight[1] = lambdaOffset;


More information about the x265-commits mailing list