[x264-devel] commit: remove x264_mc_clip1. (Loren Merritt )

Sean McGovern gseanmcg at gmail.com
Wed Mar 19 01:27:25 CET 2008


 This breaks build on powerpc platforms:

gcc -O2 -ffast-math  -Wall -I. -pg -DHAVE_MALLOC_H -m64 -DHAVE_LIBSPE2
-DARCH_PPC -DSYS_LINUX -DWORDS_BIGENDIAN -DHAVE_PTHREAD -maltivec
-mabi=altivec   -c -o common/ppc/mc.o common/ppc/mc.c
common/ppc/mc.c:37:26: error: common/clip1.h: No such file or directory
make: *** [common/ppc/mc.o] Error 1

Should check that no other files reference clip1.h now that it's gone.

-----Original Message-----
From: x264-devel-bounces at videolan.org
[mailto:x264-devel-bounces at videolan.org] On Behalf Of git version control
Sent: March 16, 2008 6:32 PM
To: x264-devel at videolan.org
Subject: [x264-devel] commit: remove x264_mc_clip1. (Loren Merritt )

x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Sun Mar 16
15:30:40 2008 -0600| [dafc72cc87c40d4972292d8255781fea70299650]

remove x264_mc_clip1.
it's wrong for sufficiently perverse inputs, and clip_uint8 is faster
anyway.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=dafc72cc87c40d
> 4972292d8255781fea70299650
---

 common/clip1.h         |   76
------------------------------------------------
 common/common.h        |    5 +++
 common/dct.c           |   12 +------
 common/mc.c            |    7 ++--
 common/pixel.c         |    1 -
 common/predict.c       |    1 -
 common/x86/predict-c.c |    1 -
 7 files changed, 10 insertions(+), 93 deletions(-)

diff --git a/common/clip1.h b/common/clip1.h deleted file mode 100644 index
84dad8b..0000000
--- a/common/clip1.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/**************************************************************************
***
- * clip1.h: h264 encoder library
-
****************************************************************************
*
- * Copyright (C) 2003 Laurent Aimar
- * $Id: clip1.h,v 1.1 2004/06/03 19:27:06 fenrir Exp $
- *
- * Authors: Laurent Aimar <fenrir at via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
-
****************************************************************************
*/
-
-#ifndef _CLIP1_H
-#define _CLIP1_H 1
-
-/* Clip1 table
- * XXX : only for tap filter.
- *
- * With tap filter (( 1, -5, 20, 20, -5, 1 ) + 16 )/ 32
- * -> (-2*5 * 255+16)/32 <= out <= (2*1*255 + 2*20*255+16)/32
- * -> -80 <= out <= 335
- * So we need a table of 80+335+1 = 416 entries
- */
-
-static const uint8_t x264_mc_clip1_table[80+1+335] = -{
-    /* -80 -> -1 */
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,
-    /* 0 -> 255 */
-    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17,
-    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
-    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
-    54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
-    72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
-    90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100,101,102,103,104,105,106,107,
-
108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
-
126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
-
162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
-
180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
-
198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
-
216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
-
234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
-    252,253,254,255,
-    /* 256 -> 340 */
-
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,
-};
-
-static inline uint8_t x264_mc_clip1( int x ) -{
-    return x264_mc_clip1_table[x+80];
-}
-
-static inline uint8_t x264_clip_uint8( int x ) -{
-    return x&(~255) ? (-x)>>31 : x;
-}
-
-#endif
diff --git a/common/common.h b/common/common.h index 2fbb069..d1c5e77 100644
--- a/common/common.h
+++ b/common/common.h
@@ -102,6 +102,11 @@ void x264_log( x264_t *h, int i_level, const char
*psz_fmt, ... );
 
 void x264_reduce_fraction( int *n, int *d );
 
+static inline uint8_t x264_clip_uint8( int x ) {
+    return x&(~255) ? (-x)>>31 : x;
+}
+
 static inline int x264_clip3( int v, int i_min, int i_max )  {
     return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v ); diff --git
a/common/dct.c b/common/dct.c index ae95ab5..74e5a91 100644
--- a/common/dct.c
+++ b/common/dct.c
@@ -32,14 +32,6 @@
 int x264_dct4_weight2_zigzag[2][16];
 int x264_dct8_weight2_zigzag[2][64];
 
-static inline int clip_uint8( int a )
-{
-    if (a&(~255))
-        return (-a)>>31;
-    else
-        return a;
-}
-
 /*
  * XXX For all dct dc : input could be equal to output so ...
  */
@@ -232,7 +224,7 @@ static void add4x4_idct( uint8_t *p_dst, int16_t
dct[4][4] )
     {
         for( x = 0; x < 4; x++ )
         {
-            p_dst[x] = clip_uint8( p_dst[x] + d[y][x] );
+            p_dst[x] = x264_clip_uint8( p_dst[x] + d[y][x] );
         }
         p_dst += FDEC_STRIDE;
     }
@@ -356,7 +348,7 @@ static void add8x8_idct8( uint8_t *dst, int16_t
dct[8][8] )  #undef DST
 
 #define SRC(x)     dct[i][x]
-#define DST(x,rhs) dst[i + x*FDEC_STRIDE] = clip_uint8( dst[i +
x*FDEC_STRIDE] + ((rhs) >> 6) );
+#define DST(x,rhs) dst[i + x*FDEC_STRIDE] = x264_clip_uint8( dst[i + 
+x*FDEC_STRIDE] + ((rhs) >> 6) );
     for( i = 0; i < 8; i++ )
         IDCT8_1D
 #undef SRC
diff --git a/common/mc.c b/common/mc.c
index 1fd3aec..488c541 100644
--- a/common/mc.c
+++ b/common/mc.c
@@ -22,7 +22,6 @@
 
****************************************************************************
*/
 
 #include "common.h"
-#include "clip1.h"
 
 #ifdef HAVE_MMX
 #include "x86/mc.h"
@@ -163,7 +162,7 @@ static inline void mc_hh( uint8_t *src, int
i_src_stride, uint8_t *dst, int i_ds
     {
         for( x = 0; x < i_width; x++ )
         {
-            dst[x] = x264_mc_clip1( ( x264_tapfilter1( &src[x] ) + 16 ) >>
5 );
+            dst[x] = x264_clip_uint8( ( x264_tapfilter1( &src[x] ) + 16 
+ ) >> 5 );
         }
         src += i_src_stride;
         dst += i_dst_stride;
@@ -177,7 +176,7 @@ static inline void mc_hv( uint8_t *src, int
i_src_stride, uint8_t *dst, int i_ds
     {
         for( x = 0; x < i_width; x++ )
         {
-            dst[x] = x264_mc_clip1( ( x264_tapfilter( &src[x], i_src_stride
) + 16 ) >> 5 );
+            dst[x] = x264_clip_uint8( ( x264_tapfilter( &src[x], 
+ i_src_stride ) + 16 ) >> 5 );
         }
         src += i_src_stride;
         dst += i_dst_stride;
@@ -206,7 +205,7 @@ static inline void mc_hc( uint8_t *src, int
i_src_stride, uint8_t *dst, int i_ds
         {
             tap[5] = x264_tapfilter1( &pix[ 3*i_src_stride] );
 
-            *out = x264_mc_clip1( ( tap[0] - 5*tap[1] + 20 * tap[2] + 20 *
tap[3] -5*tap[4] + tap[5] + 512 ) >> 10 );
+            *out = x264_clip_uint8( ( tap[0] - 5*tap[1] + 20 * tap[2] + 
+ 20 * tap[3] -5*tap[4] + tap[5] + 512 ) >> 10 );
 
             /* Next line */
             pix += i_src_stride;
diff --git a/common/pixel.c b/common/pixel.c index 9103941..5200c66 100644
--- a/common/pixel.c
+++ b/common/pixel.c
@@ -22,7 +22,6 @@
 
****************************************************************************
*/
 
 #include "common.h"
-#include "clip1.h"
 
 #ifdef HAVE_MMX
 #   include "x86/pixel.h"
diff --git a/common/predict.c b/common/predict.c index 1ffa522..d6cb2a5
100644
--- a/common/predict.c
+++ b/common/predict.c
@@ -26,7 +26,6 @@
 
 
 #include "common.h"
-#include "clip1.h"
 
 #ifdef _MSC_VER
 #undef HAVE_MMX  /* not finished now */ diff --git a/common/x86/predict-c.c
b/common/x86/predict-c.c index 8768fbf..ac33ce8 100644
--- a/common/x86/predict-c.c
+++ b/common/x86/predict-c.c
@@ -22,7 +22,6 @@
 
****************************************************************************
*/
 
 #include "common/common.h"
-#include "common/clip1.h"
 #include "predict.h"
 #include "pixel.h"
 

_______________________________________________
x264-devel mailing list
x264-devel at videolan.org
http://mailman.videolan.org/listinfo/x264-devel



More information about the x264-devel mailing list