[x265] [PATCH 3 of 3] fix bug in chroma_p2s and testbench

Min Chen chenm003 at 163.com
Mon Nov 4 12:05:33 CET 2013


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1383563118 -28800
# Node ID 56b6a672edd290d629c81126d298c4b333b912a2
# Parent  539ad4851359f96591f612f8b7b6fb0483e5a48c
fix bug in chroma_p2s and testbench

diff -r 539ad4851359 -r 56b6a672edd2 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Mon Nov 04 19:05:04 2013 +0800
+++ b/source/common/x86/ipfilter8.asm	Mon Nov 04 19:05:18 2013 +0800
@@ -2574,11 +2574,14 @@
     jmp         .loopW
 
 .width4:
-    cmp         r3d, 4
-    jl          .width2
+    test        r3d, 4
+    jz          .width2
+    test        r3d, 2
     movh        [r6 + FENC_STRIDE / 2 * 0 - 16], m0
     movh        [r6 + FENC_STRIDE / 2 * 2 - 16], m1
     lea         r6, [r6 + 8]
+    pshufd      m0, m0, 2
+    pshufd      m1, m1, 2
     jz          .nextH
 
 .width2:
diff -r 539ad4851359 -r 56b6a672edd2 source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp	Mon Nov 04 19:05:04 2013 +0800
+++ b/source/test/ipfilterharness.cpp	Mon Nov 04 19:05:18 2013 +0800
@@ -245,6 +245,7 @@
 {
     intptr_t rand_srcStride;
     const int min_size = isChroma ? 2 : 4;
+    const int max_size = isChroma ? (MAX_CU_SIZE >> 1) : MAX_CU_SIZE;
 
     for (int i = 0; i <= 1000; i++)
     {
@@ -258,13 +259,11 @@
         if (rand_srcStride < rand_width)
             rand_srcStride = rand_width;
 
-        rand_width %= min_size;
-        if (rand_width < min_size)
-            rand_width = min_size;
+        rand_width &= ~(min_size - 1);
+        rand_width = Clip3(min_size, max_size, rand_width);
 
-        rand_height %= min_size;
-        if (rand_height < min_size)
-            rand_height = min_size;
+        rand_height &= ~(min_size - 1);
+        rand_height = Clip3(min_size, max_size, rand_height);
 
         ref(pixel_buff,
             rand_srcStride,



More information about the x265-devel mailing list