[x265] [PATCH] constant input on intra_pred

Min Chen chenm003 at 163.com
Wed Jan 14 06:30:30 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1421213422 -28800
# Node ID 4a2ae264edc30050e974fce90bea91ec55e7a8a1
# Parent  8c66a97cd442c2d3e4e83b1c3d5a86f90cbb7374
constant input on intra_pred
---
 source/common/IntraPred.cpp   |   23 +++++++++++++----------
 source/common/primitives.h    |    2 +-
 source/common/x86/intrapred.h |   18 +++++++++---------
 3 files changed, 23 insertions(+), 20 deletions(-)

diff -r 8c66a97cd442 -r 4a2ae264edc3 source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Tue Jan 13 21:34:38 2015 +0530
+++ b/source/common/intrapred.cpp	Wed Jan 14 13:30:22 2015 +0800
@@ -27,7 +27,7 @@
 using namespace x265;
 
 namespace {
-void dcPredFilter(pixel* above, pixel* left, pixel* dst, intptr_t dststride, int size)
+void dcPredFilter(const pixel* above, const pixel* left, pixel* dst, intptr_t dststride, int size)
 {
     // boundary pixels processing
     dst[0] = (pixel)((above[0] + left[0] + 2 * dst[0] + 2) >> 2);
@@ -44,7 +44,7 @@
 }
 
 template<int width>
-void intra_pred_dc_c(pixel* dst, intptr_t dstStride, pixel* srcPix, int /*dirMode*/, int bFilter)
+void intra_pred_dc_c(pixel* dst, intptr_t dstStride, const pixel* srcPix, int /*dirMode*/, int bFilter)
 {
     int k, l;
 
@@ -63,12 +63,12 @@
 }
 
 template<int log2Size>
-void planar_pred_c(pixel* dst, intptr_t dstStride, pixel* srcPix, int /*dirMode*/, int /*bFilter*/)
+void planar_pred_c(pixel* dst, intptr_t dstStride, const pixel* srcPix, int /*dirMode*/, int /*bFilter*/)
 {
     const int blkSize = 1 << log2Size;
 
-    pixel* above = srcPix + 1;
-    pixel* left  = srcPix + (2 * blkSize + 1);
+    const pixel* above = srcPix + 1;
+    const pixel* left  = srcPix + (2 * blkSize + 1);
 
     pixel topRight = above[blkSize];
     pixel bottomLeft = left[blkSize];
@@ -78,12 +78,13 @@
 }
 
 template<int width>
-void intra_pred_ang_c(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter)
+void intra_pred_ang_c(pixel* dst, intptr_t dstStride, const pixel *srcPix0, int dirMode, int bFilter)
 {
     int width2 = width << 1;
     // Flip the neighbours in the horizontal case.
     int horMode = dirMode < 18;
     pixel neighbourBuf[129];
+    const pixel *srcPix = srcPix0;
 
     if (horMode)
     {
@@ -121,14 +122,15 @@
     else // Angular prediction.
     {
         // Get the reference pixels. The reference base is the first pixel to the top (neighbourBuf[1]).
-        pixel refBuf[64], *ref;
+        pixel refBuf[64];
+        const pixel *ref;
 
         // Use the projected left neighbours and the top neighbours.
         if (angle < 0)
         {
             // Number of neighbours projected. 
             int nbProjected = -((width * angle) >> 5) - 1;
-            ref = refBuf + nbProjected + 1;
+            pixel *ref_pix = refBuf + nbProjected + 1;
 
             // Project the neighbours.
             int invAngle = invAngleTable[- angleOffset - 1];
@@ -136,12 +138,13 @@
             for (int i = 0; i < nbProjected; i++)
             {
                 invAngleSum += invAngle;
-                ref[- 2 - i] = srcPix[width2 + (invAngleSum >> 8)];
+                ref_pix[- 2 - i] = srcPix[width2 + (invAngleSum >> 8)];
             }
 
             // Copy the top-left and top pixels.
             for (int i = 0; i < width + 1; i++)
-                ref[-1 + i] = srcPix[i];
+                ref_pix[-1 + i] = srcPix[i];
+            ref = ref_pix;
         }
         else // Use the top and top-right neighbours.
             ref = srcPix + 1;
diff -r 8c66a97cd442 -r 4a2ae264edc3 source/common/primitives.h
--- a/source/common/primitives.h	Tue Jan 13 21:34:38 2015 +0530
+++ b/source/common/primitives.h	Wed Jan 14 13:30:22 2015 +0800
@@ -135,7 +135,7 @@
 typedef void (*pixelcmp_x3_t)(const pixel* fenc, const pixel* fref0, const pixel* fref1, const pixel* fref2, intptr_t frefstride, int32_t* res);
 typedef void (*blockfill_s_t)(int16_t* dst, intptr_t dstride, int16_t val);
 
-typedef void (*intra_pred_t)(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter);
+typedef void (*intra_pred_t)(pixel* dst, intptr_t dstStride, const pixel *srcPix, int dirMode, int bFilter);
 typedef void (*intra_allangs_t)(pixel *dst, pixel *refPix, pixel *filtPix, int bLuma);
 
 typedef void (*cpy2Dto1D_shl_t)(int16_t* dst, const int16_t* src, intptr_t srcStride, int shift);
diff -r 8c66a97cd442 -r 4a2ae264edc3 source/common/x86/intrapred.h
--- a/source/common/x86/intrapred.h	Tue Jan 13 21:34:38 2015 +0530
+++ b/source/common/x86/intrapred.h	Wed Jan 14 13:30:22 2015 +0800
@@ -26,18 +26,18 @@
 #ifndef X265_INTRAPRED_H
 #define X265_INTRAPRED_H
 
-void x265_intra_pred_dc4_sse4 (pixel* dst, intptr_t dstStride, pixel*srcPix, int, int filter);
-void x265_intra_pred_dc8_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
-void x265_intra_pred_dc16_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
-void x265_intra_pred_dc32_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
+void x265_intra_pred_dc4_sse4 (pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
+void x265_intra_pred_dc8_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
+void x265_intra_pred_dc16_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
+void x265_intra_pred_dc32_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
 
-void x265_intra_pred_planar4_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar8_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar16_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar32_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
+void x265_intra_pred_planar4_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar8_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar16_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar32_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
 
 #define DECL_ANG(bsize, mode, cpu) \
-    void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel* dst, intptr_t dstStride, pixel* above, int dirMode, int bFilter);
+    void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel* dst, intptr_t dstStride, const pixel* srcPix, int dirMode, int bFilter);
 
 DECL_ANG(4, 2, ssse3);
 DECL_ANG(4, 3, sse4);



More information about the x265-devel mailing list