<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 2, 2013 at 6:47 AM, Shazeb Khan <span dir="ltr"><<a href="mailto:shazeb@multicorewareinc.com" target="_blank">shazeb@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im"># HG changeset patch<br># User Shazeb Nawaz Khan <<a href="mailto:shazeb@multicorewareinc.com" target="_blank">shazeb@multicorewareinc.com</a>><br>
</div># Date 1380713440 -19800<br># Node ID 09de1a4441d6b00c36c79c6ed90e296cbe144004<br>
# Parent c5dc3e37d76772b5e26c6996ab0df5ce325f54a7<div class="im"><br>Templating weightUnidir primitive to support pixel inputs<br></div></div></blockquote><div><br></div><div>queued, but it required a lot of fixups because the patch was line-wrapped like crazy by your MTA</div>
<div><br></div><div>it's best to use hg email or the thg email tool to send patches.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div class="im"></div>diff -r c5dc3e37d767 -r 09de1a4441d6 source/Lib/TLibCommon/TComWeightPrediction.cpp<br>--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp Tue Oct 01 17:28:19 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp Wed Oct 02 17:00:40 2013 +0530<br>@@ -431,7 +431,7 @@<br> srcStride = srcYuv0->m_width;<br> dstStride = outDstYuv->getStride();<br> <br>- primitives.weightpUni(srcY0, dstY, srcStride, dstStride, width, height, w0, round, shift, offset);<br>
+ primitives.weightpUni((uint16_t *)srcY0, dstY, srcStride, dstStride, width, height, w0, round, shift, offset);<br> }<br> <br> // Chroma U : --------------------------------------------<br>@@ -447,7 +447,7 @@<br>
width >>= 1;<br> height >>= 1;<br> <br>- primitives.weightpUni(srcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset);<br>+ primitives.weightpUni((uint16_t *)srcU0, dstU, srcStride, dstStride, width, height, w0, round, shift, offset);<br>
<br> // Chroma V : --------------------------------------------<br> w0 = wp0[2].w;<br>@@ -455,7 +455,7 @@<br> shift = wp0[2].shift + shiftNum;<br> round = shift ? (1 << (shift - 1)) : 0;<br>
<br>- primitives.weightpUni(srcV0, dstV, srcStride, dstStride, width, height, w0, round, shift, offset);<br>+ primitives.weightpUni((uint16_t *)srcV0, dstV, srcStride, dstStride, width, height, w0, round, shift, offset);<br>
}<br> <br> //=======================================================<br>diff -r c5dc3e37d767 -r 09de1a4441d6 source/common/pixel.cpp<br>--- a/source/common/pixel.cpp Tue Oct 01 17:28:19 2013 +0530<br>+++ b/source/common/pixel.cpp Wed Oct 02 17:00:40 2013 +0530<br>
@@ -514,7 +514,8 @@<div class="im"><br> }<br> }<br> <br>-void weightUnidir(short *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset)<br>+template <typename T><br>
</div>
+void weightUnidir(T *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset)<div class="im"><br> {<br> int x, y;<br> for (y = height - 1; y >= 0; y--)<br>
</div>@@ -842,7 +843,8 @@<div class="im"><br>
p.transpose[3] = transpose<32>;<br> p.transpose[4] = transpose<64>;<br> <br>- p.weightpUni = weightUnidir;<br>+ p.weightpUniPixel = weightUnidir<pixel>;<br></div>+ p.weightpUni = weightUnidir<uint16_t>;<div class="im">
<br>
<br> p.pixelsub_sp = pixelsub_sp_c;<br> p.pixeladd_pp = pixeladd_pp_c;<br></div>diff -r c5dc3e37d767 -r 09de1a4441d6 source/common/primitives.h<br>--- a/source/common/primitives.h Tue Oct 01 17:28:19 2013 +0530<br>
+++ b/source/common/primitives.h Wed Oct 02 17:00:40 2013 +0530<br>
@@ -228,8 +228,8 @@<div class="im"><br> typedef void (*filterRowV_N_t)(short *midA, intptr_t midStride, pixel *dstA, pixel *dstB, pixel *dstC, intptr_t dstStride, int width, int height, int marginX, int marginY, int row, int isLastRow);<br>
typedef void (*extendCURowBorder_t)(pixel* txt, intptr_t stride, int width, int height, int marginX);<br> <br>-<br>-typedef void (*weightpUni_t)(short *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset);<br>
</div>
+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);<br>+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);<div class="im">
<br>
typedef void (*scale_t)(pixel *dst, pixel *src, intptr_t stride);<br> typedef void (*downscale_t)(pixel *src0, pixel *dstf, pixel *dsth, pixel *dstv, pixel *dstc,<br> intptr_t src_stride, intptr_t dst_stride, int width, int height);<br>
</div>
@@ -286,6 +286,7 @@<div class="im"><br> calcrecon_t calcrecon[NUM_SQUARE_BLOCKS];<br> transpose_t transpose[NUM_SQUARE_BLOCKS];<br> <br></div>+ weightpUniPixel_t weightpUniPixel;<div class="im"><br>
weightpUni_t weightpUni;<br> pixelsub_sp_t pixelsub_sp;<br>
pixeladd_ss_t pixeladd_ss;<br></div>diff -r c5dc3e37d767 -r 09de1a4441d6 source/common/vec/pixel.inc<br>--- a/source/common/vec/pixel.inc Tue Oct 01 17:28:19 2013 +0530<br>+++ b/source/common/vec/pixel.inc Wed Oct 02 17:00:40 2013 +0530<div class="im">
<br>
@@ -469,7 +469,9 @@<br> p.transpose[2] = transpose16;<br> p.transpose[3] = transpose32;<br> p.transpose[4] = transpose<64>;<br>- p.weightpUni = weightUnidir;<br>+ p.weightpUniPixel = weightUnidir<pixel>;<br>
</div>
+ p.weightpUni = weightUnidir<uint16_t>;<br>+<br> #endif<br> <br> #if !HIGH_BIT_DEPTH<br>diff -r c5dc3e37d767 -r 09de1a4441d6 source/common/vec/pixel8.inc<br>--- a/source/common/vec/pixel8.inc Tue Oct 01 17:28:19 2013 +0530<br>
+++ b/source/common/vec/pixel8.inc Wed Oct 02 17:00:40 2013 +0530<br>@@ -8573,7 +8573,8 @@<div class="im"><br> }<br> }<br> <br>-void weightUnidir(short *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset)<br>
+template <typename T><br></div>+void weightUnidir(T *src, pixel *dst, intptr_t srcStride, intptr_t dstStride, int width, int height, int w0, int round, int shift, int offset)<div class="im"><br> {<br> int x, y;<br>
Vec8s tmp;<br></div>
diff -r c5dc3e37d767 -r 09de1a4441d6 source/test/pixelharness.cpp<br>--- a/source/test/pixelharness.cpp Tue Oct 01 17:28:19 2013 +0530<br>+++ b/source/test/pixelharness.cpp Wed Oct 02 17:00:40 2013 +0530<br>@@ -343,8 +343,8 @@<br>
int offset = (rand() % 256) - 128;<br> for (int i = 0; i < ITERS; i++)<br> {<br>- opt(sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);<br>- ref(sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);<br>
+ opt((uint16_t*)sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);<br>+ ref((uint16_t*)sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);<br> <br> if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))<br>
return false;<br>@@ -355,6 +355,34 @@<br> return true;<br> }<br> <br>+bool PixelHarness::check_weightpUni(weightpUniPixel_t ref, weightpUniPixel_t opt)<br>+{<br>+ ALIGN_VAR_16(pixel, ref_dest[64 * 64]);<br>
+ ALIGN_VAR_16(pixel, opt_dest[64 * 64]);<br>+<br>+ memset(ref_dest, 0, 64 * 64 * sizeof(pixel));<br>+ memset(opt_dest, 0, 64 * 64 * sizeof(pixel));<br>+ int j = 0;<br>+ int width = (2 * rand()) % 64;<br>+ int height = 8;<br>
+ int w0 = rand() % 256;<br>+ int shift = rand() % 12;<br>+ int round = shift ? (1 << (shift - 1)) : 0;<br>+ int offset = (rand() % 256) - 128;<br>+ for (int i = 0; i < ITERS; i++)<br>+ {<br>+ opt((pixel *)sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);<br>
+ ref((pixel *)sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);<br>+<br>+ if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))<br>+ return false;<br>+<br>+ j += INCR;<br>
+ }<br>+ <br>+ return true;<br>+}<br>+ <br> bool PixelHarness::check_pixelsub_sp(pixelsub_sp_t ref, pixelsub_sp_t opt)<br> {<br> ALIGN_VAR_16(short, ref_dest[64 * 64]);<br>@@ -604,6 +632,24 @@<br> }<br>
}<br> <br>+ if (opt.weightpUniPixel)<br>+ {<br>+ if (!check_weightpUni(ref.weightpUniPixel, opt.weightpUniPixel))<br>+ {<br>+ printf("Weighted Prediction for Unidir failed!\n");<br>
+ return false;<br>+ }<br>+ }<br>+<br>+ if (opt.weightpUniPixel)<br>+ {<br>+ if (!check_weightpUni(ref.weightpUniPixel, opt.weightpUniPixel))<br>+ {<br>+ printf("Weighted Prediction for Unidir failed!\n");<br>
+ return false;<br>+ }<br>+ }<br>+<br> if (opt.weightpUni)<br> {<br> if (!check_weightpUni(ref.weightpUni, opt.weightpUni))<br>@@ -751,10 +797,16 @@<br> REPORT_SPEEDUP(opt.blockcpy_sc, ref.blockcpy_sc, 64, 64, (short*)pbuf1, FENC_STRIDE, (uint8_t*)pbuf2, STRIDE);<br>
}<br> <br>+ if (opt.weightpUniPixel)<br>+ {<br>+ printf("WeightpUni");<br>+ REPORT_SPEEDUP(opt.weightpUniPixel, ref.weightpUniPixel, pbuf1, pbuf2, 64, 64, 32, 32, 128, 1 << 9, 10, 100);<br>
+ }<br>+<br> if (opt.weightpUni)<br> {<br> printf("WeightpUni");<br>- REPORT_SPEEDUP(opt.weightpUni, ref.weightpUni, sbuf1, pbuf1, 64, 64, 32, 32, 128, 1 << 9, 10, 100);<br>+ REPORT_SPEEDUP(opt.weightpUni, ref.weightpUni, (uint16_t*)sbuf1, pbuf1, 64, 64, 32, 32, 128, 1 << 9, 10, 100);<br>
}<br> <br> if (opt.pixelsub_sp)<br>diff -r c5dc3e37d767 -r 09de1a4441d6 source/test/pixelharness.h<br>--- a/source/test/pixelharness.h Tue Oct 01 17:28:19 2013 +0530<br>+++ b/source/test/pixelharness.h Wed Oct 02 17:00:40 2013 +0530<br>
@@ -46,6 +46,7 @@<br> bool check_block_copy_s_c(blockcpy_sc_t ref, blockcpy_sc_t opt);<br> bool check_calresidual(calcresidual_t ref, calcresidual_t opt);<br> bool check_calcrecon(calcrecon_t ref, calcrecon_t opt);<br>
+ bool check_weightpUni(weightpUniPixel_t ref, weightpUniPixel_t opt);<br> bool check_weightpUni(weightpUni_t ref, weightpUni_t opt);<br> bool check_pixelsub_sp(pixelsub_sp_t ref, pixelsub_sp_t opt);<br> bool check_pixeladd_ss(pixeladd_ss_t ref, pixeladd_ss_t opt);<br>
</div>
<br>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>