[x265] [PATCH 1 of 2] Using int16_t rather than uint16_t in weightpUni primitive; inputs can be signed

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Fri Oct 4 13:53:47 CEST 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1380885004 -19800
#      Fri Oct 04 16:40:04 2013 +0530
# Node ID b54b030188bcb53f6c5c64fe99ac29a4d851eb78
# Parent  bf14f75b8cf99806c75cdc1a50b28b6cf265e3bd
Using int16_t rather than uint16_t in weightpUni primitive; inputs can be signed

diff -r bf14f75b8cf9 -r b54b030188bc source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp	Fri Oct 04 01:39:22 2013 -0500
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp	Fri Oct 04 16:40:04 2013 +0530
@@ -431,7 +431,7 @@
         srcStride = srcYuv0->m_width;
         dstStride  = outDstYuv->getStride();
 
-        primitives.weightpUni((uint16_t *)srcY0, dstY, srcStride, dstStride, width, height, w0, round, shift, offset);
+        primitives.weightpUni((int16_t *)srcY0, dstY, srcStride, dstStride, width, height, w0, round, shift, offset);
     }
 
     // Chroma U : --------------------------------------------
@@ -447,7 +447,7 @@
     width  >>= 1;
     height >>= 1;
 
-    primitives.weightpUni((uint16_t *)srcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset);
+    primitives.weightpUni((int16_t *)srcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset);
 
     // Chroma V : --------------------------------------------
     w0      = wp0[2].w;
@@ -455,7 +455,7 @@
     shift   = wp0[2].shift + shiftNum;
     round   = shift ? (1 << (shift - 1)) : 0;
 
-    primitives.weightpUni((uint16_t *)srcV0, dstV, srcStride, dstStride, width, height, w0, round, shift, offset);
+    primitives.weightpUni((int16_t *)srcV0, dstV, srcStride, dstStride, width, height, w0, round, shift, offset);
 }
 
 //=======================================================
@@ -669,5 +669,5 @@
     {
         getWpScaling(cu, -1, refIdx, pwpTmp, pwp);
     }
-    addWeightUni(srcYuv, partAddr, width, height, pwp, outPredYuv, true);
+    addWeightUni(srcYuv, partAddr, width, height, pwp, outPredYuv);
 }
diff -r bf14f75b8cf9 -r b54b030188bc source/common/pixel.cpp
--- a/source/common/pixel.cpp	Fri Oct 04 01:39:22 2013 -0500
+++ b/source/common/pixel.cpp	Fri Oct 04 16:40:04 2013 +0530
@@ -861,7 +861,7 @@
     p.transpose[4] = transpose<64>;
 
     p.weightpUniPixel = weightUnidir<pixel>;
-    p.weightpUni = weightUnidir<uint16_t>;
+    p.weightpUni = weightUnidir<int16_t>;
 
     p.pixelsub_sp = pixelsub_sp_c;
     p.pixeladd_pp = pixeladd_pp_c;
diff -r bf14f75b8cf9 -r b54b030188bc source/common/primitives.h
--- a/source/common/primitives.h	Fri Oct 04 01:39:22 2013 -0500
+++ b/source/common/primitives.h	Fri Oct 04 16:40:04 2013 +0530
@@ -231,7 +231,7 @@
 
 
 typedef void (*weightpUniPixel_t)(pixel *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);
-typedef void (*weightpUni_t)(uint16_t *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);
+typedef void (*weightpUni_t)(int16_t *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);
 typedef void (*scale_t)(pixel *dst, pixel *src, intptr_t stride);
 typedef void (*downscale_t)(pixel *src0, pixel *dstf, pixel *dsth, pixel *dstv, pixel *dstc,
                             intptr_t src_stride, intptr_t dst_stride, int width, int height);
diff -r bf14f75b8cf9 -r b54b030188bc source/common/vec/pixel.inc
--- a/source/common/vec/pixel.inc	Fri Oct 04 01:39:22 2013 -0500
+++ b/source/common/vec/pixel.inc	Fri Oct 04 16:40:04 2013 +0530
@@ -169,7 +169,7 @@
 #endif
 
     p.weightpUniPixel = weightUnidir<pixel>;
-    p.weightpUni = weightUnidir<uint16_t>;
+    p.weightpUni = weightUnidir<int16_t>;
 
     p.calcresidual[BLOCK_4x4] = getResidual4;
     p.calcresidual[BLOCK_8x8] = getResidual8;
diff -r bf14f75b8cf9 -r b54b030188bc source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Fri Oct 04 01:39:22 2013 -0500
+++ b/source/test/pixelharness.cpp	Fri Oct 04 16:40:04 2013 +0530
@@ -343,8 +343,8 @@
     int offset = (rand() % 256) - 128;
     for (int i = 0; i < ITERS; i++)
     {
-        opt((uint16_t*)sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
-        ref((uint16_t*)sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
+        opt((int16_t*)sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
+        ref((int16_t*)sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -806,7 +806,7 @@
     if (opt.weightpUni)
     {
         printf("WeightpUni");
-        REPORT_SPEEDUP(opt.weightpUni, ref.weightpUni, (uint16_t*)sbuf1, pbuf1, 64, 64, 32, 32, 128, 1 << 9, 10, 100);
+        REPORT_SPEEDUP(opt.weightpUni, ref.weightpUni, (int16_t*)sbuf1, pbuf1, 64, 64, 32, 32, 128, 1 << 9, 10, 100);
     }
 
     if (opt.pixelsub_sp)


More information about the x265-devel mailing list