[x265] [PATCH] update restrict in weight_pp_c reference code

Min Chen chenm003 at 163.com
Wed Dec 31 07:20:40 CET 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1420006750 -28800
# Node ID d0b7608c9cdaee99ff1ead3cffd9aa7f1768f570
# Parent  d01d3fad8fbbe97811da1de4e8bee59dc708025a
update restrict in weight_pp_c reference code

diff -r d01d3fad8fbb -r d0b7608c9cda source/common/pixel.cpp
--- a/source/common/pixel.cpp	Mon Dec 22 16:42:51 2014 +0530
+++ b/source/common/pixel.cpp	Wed Dec 31 14:19:10 2014 +0800
@@ -580,16 +580,20 @@
 {
     int x, y;
 
+    const int correction = (IF_INTERNAL_PREC - X265_DEPTH);
+
     X265_CHECK(!(width & 15), "weightp alignment error\n");
     X265_CHECK(!((w0 << 6) > 32767), "w0 using more than 16 bits, asm output will mismatch\n");
     X265_CHECK(!(round > 32767), "round using more than 16 bits, asm output will mismatch\n");
+    X265_CHECK((shift >= correction), "shift must be include factor correction, please update ASM ABI\n");
+    X265_CHECK(!(round & ((1 << correction) - 1)), "round must be include factor correction, please update ASM ABI\n");
 
     for (y = 0; y <= height - 1; y++)
     {
         for (x = 0; x <= width - 1; )
         {
             // simulating pixel to short conversion
-            int16_t val = src[x] << (IF_INTERNAL_PREC - X265_DEPTH);
+            int16_t val = src[x] << correction;
             dst[x] = (pixel)Clip3(0, ((1 << X265_DEPTH) - 1), ((w0 * (val) + round) >> shift) + offset);
             x++;
         }



More information about the x265-devel mailing list