[x265] [PATCH 2 of 2] split scale_t to scale1D_t and scale2D_t

Min Chen chenm003 at 163.com
Sat Mar 28 01:42:51 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1427503360 25200
# Node ID 94e50ddfb851ff339df59dba4baebfec8dd758b0
# Parent  6c739f92b1b18bf20531afea00480c86db1a9f0e
split scale_t to scale1D_t and scale2D_t
---
 source/common/pixel.cpp        |    2 +-
 source/common/primitives.h     |    7 ++++---
 source/common/x86/pixel-util.h |    4 ++--
 source/encoder/search.cpp      |    4 ++--
 source/test/pixelharness.cpp   |   33 +++++++++++++++++++++++++++++----
 source/test/pixelharness.h     |    3 ++-
 6 files changed, 40 insertions(+), 13 deletions(-)

diff -r 6c739f92b1b1 -r 94e50ddfb851 source/common/pixel.cpp
--- a/source/common/pixel.cpp	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/common/pixel.cpp	Fri Mar 27 17:42:40 2015 -0700
@@ -582,7 +582,7 @@
     }
 }
 
-void scale1D_128to64(pixel *dst, const pixel *src, intptr_t /*stride*/)
+void scale1D_128to64(pixel *dst, const pixel *src)
 {
     int x;
     const pixel* src1 = src;
diff -r 6c739f92b1b1 -r 94e50ddfb851 source/common/primitives.h
--- a/source/common/primitives.h	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/common/primitives.h	Fri Mar 27 17:42:40 2015 -0700
@@ -140,7 +140,8 @@
 typedef int(*count_nonzero_t)(const int16_t* quantCoeff);
 typedef void (*weightp_pp_t)(const pixel* src, pixel* dst, intptr_t stride, int width, int height, int w0, int round, int shift, int offset);
 typedef void (*weightp_sp_t)(const 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, const pixel* src, intptr_t stride);
+typedef void (*scale1D_t)(pixel* dst, const pixel* src);
+typedef void (*scale2D_t)(pixel* dst, const pixel* src, intptr_t stride);
 typedef void (*downscale_t)(const pixel* src0, pixel* dstf, pixel* dsth, pixel* dstv, pixel* dstc,
                             intptr_t src_stride, intptr_t dst_stride, int width, int height);
 typedef void (*extendCURowBorder_t)(pixel* txt, intptr_t stride, int width, int height, int marginX);
@@ -266,8 +267,8 @@
     dequant_scaling_t     dequant_scaling;
     dequant_normal_t      dequant_normal;
     denoiseDct_t          denoiseDct;
-    scale_t               scale1D_128to64;
-    scale_t               scale2D_64to32;
+    scale1D_t             scale1D_128to64;
+    scale2D_t             scale2D_64to32;
 
     ssim_4x4x2_core_t     ssim_4x4x2_core;
     ssim_end4_t           ssim_end_4;
diff -r 6c739f92b1b1 -r 94e50ddfb851 source/common/x86/pixel-util.h
--- a/source/common/x86/pixel-util.h	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/common/x86/pixel-util.h	Fri Mar 27 17:42:40 2015 -0700
@@ -73,8 +73,8 @@
 float x265_pixel_ssim_end4_sse2(int sum0[5][4], int sum1[5][4], int width);
 float x265_pixel_ssim_end4_avx(int sum0[5][4], int sum1[5][4], int width);
 
-void x265_scale1D_128to64_ssse3(pixel*, const pixel*, intptr_t);
-void x265_scale1D_128to64_avx2(pixel*, const pixel*, intptr_t);
+void x265_scale1D_128to64_ssse3(pixel*, const pixel*);
+void x265_scale1D_128to64_avx2(pixel*, const pixel*);
 void x265_scale2D_64to32_ssse3(pixel*, const pixel*, intptr_t);
 
 int x265_findPosLast_x64(const uint16_t *scan, const coeff_t *coeff, uint16_t *coeffSign, uint16_t *coeffFlag, uint8_t *coeffNum, int numSig);
diff -r 6c739f92b1b1 -r 94e50ddfb851 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/encoder/search.cpp	Fri Mar 27 17:42:40 2015 -0700
@@ -1231,7 +1231,7 @@
 
         pixel nScale[129];
         intraNeighbourBuf[1][0] = intraNeighbourBuf[0][0];
-        primitives.scale1D_128to64(nScale + 1, intraNeighbourBuf[0] + 1, 0);
+        primitives.scale1D_128to64(nScale + 1, intraNeighbourBuf[0] + 1);
 
         // we do not estimate filtering for downscaled samples
         memcpy(&intraNeighbourBuf[0][1], &nScale[1], 2 * 64 * sizeof(pixel));   // Top & Left pixels
@@ -1460,7 +1460,7 @@
 
                     pixel nScale[129];
                     intraNeighbourBuf[1][0] = intraNeighbourBuf[0][0];
-                    primitives.scale1D_128to64(nScale + 1, intraNeighbourBuf[0] + 1, 0);
+                    primitives.scale1D_128to64(nScale + 1, intraNeighbourBuf[0] + 1);
 
                     memcpy(&intraNeighbourBuf[0][1], &nScale[1], 2 * 64 * sizeof(pixel));
                     memcpy(&intraNeighbourBuf[1][1], &nScale[1], 2 * 64 * sizeof(pixel));
diff -r 6c739f92b1b1 -r 94e50ddfb851 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/test/pixelharness.cpp	Fri Mar 27 17:42:40 2015 -0700
@@ -666,7 +666,32 @@
     return true;
 }
 
-bool PixelHarness::check_scale_pp(scale_t ref, scale_t opt)
+bool PixelHarness::check_scale1D_pp(scale1D_t ref, scale1D_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+    memset(ref_dest, 0, sizeof(ref_dest));
+    memset(opt_dest, 0, sizeof(opt_dest));
+
+    int j = 0;
+    for (int i = 0; i < ITERS; i++)
+    {
+        int index = i % TEST_CASES;
+        checked(opt, opt_dest, pixel_test_buff[index] + j);
+        ref(ref_dest, pixel_test_buff[index] + j);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
+            return false;
+
+        reportfail();
+        j += INCR;
+    }
+
+    return true;
+}
+
+bool PixelHarness::check_scale2D_pp(scale2D_t ref, scale2D_t opt)
 {
     ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
     ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
@@ -1603,7 +1628,7 @@
 
     if (opt.scale1D_128to64)
     {
-        if (!check_scale_pp(ref.scale1D_128to64, opt.scale1D_128to64))
+        if (!check_scale1D_pp(ref.scale1D_128to64, opt.scale1D_128to64))
         {
             printf("scale1D_128to64 failed!\n");
             return false;
@@ -1612,7 +1637,7 @@
 
     if (opt.scale2D_64to32)
     {
-        if (!check_scale_pp(ref.scale2D_64to32, opt.scale2D_64to32))
+        if (!check_scale2D_pp(ref.scale2D_64to32, opt.scale2D_64to32))
         {
             printf("scale2D_64to32 failed!\n");
             return false;
@@ -2003,7 +2028,7 @@
     if (opt.scale1D_128to64)
     {
         HEADER0("scale1D_128to64");
-        REPORT_SPEEDUP(opt.scale1D_128to64, ref.scale1D_128to64, pbuf2, pbuf1, 64);
+        REPORT_SPEEDUP(opt.scale1D_128to64, ref.scale1D_128to64, pbuf2, pbuf1);
     }
 
     if (opt.scale2D_64to32)
diff -r 6c739f92b1b1 -r 94e50ddfb851 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Fri Mar 27 17:42:36 2015 -0700
+++ b/source/test/pixelharness.h	Fri Mar 27 17:42:40 2015 -0700
@@ -76,7 +76,8 @@
     bool check_pixelavg_pp(pixelavg_pp_t ref, pixelavg_pp_t opt);
     bool check_pixel_sub_ps(pixel_sub_ps_t ref, pixel_sub_ps_t opt);
     bool check_pixel_add_ps(pixel_add_ps_t ref, pixel_add_ps_t opt);
-    bool check_scale_pp(scale_t ref, scale_t opt);
+    bool check_scale1D_pp(scale1D_t ref, scale1D_t opt);
+    bool check_scale2D_pp(scale2D_t ref, scale2D_t opt);
     bool check_ssd_s(pixel_ssd_s_t ref, pixel_ssd_s_t opt);
     bool check_blockfill_s(blockfill_s_t ref, blockfill_s_t opt);
     bool check_calresidual(calcresidual_t ref, calcresidual_t opt);



More information about the x265-devel mailing list