]> git.sesse.net Git - x264/commitdiff
cosmetics: remove #if0'ed code
authorLoren Merritt <pengvado@videolan.org>
Sun, 16 Oct 2005 05:44:50 +0000 (05:44 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 16 Oct 2005 05:44:50 +0000 (05:44 +0000)
patch by Robert Swain.

git-svn-id: svn://svn.videolan.org/x264/trunk@332 df754926-b1dd-0310-bc7b-ec298dee348c

16 files changed:
common/bs.h
common/cpu.c
common/i386/dct-c.c
common/i386/mc-c.c
common/i386/predict.c
common/mc.c
common/set.h
encoder/encoder.c
encoder/macroblock.c
encoder/ratecontrol.c
encoder/set.c
encoder/slicetype_decision.c
extras/getopt.c
vfw/driverproc.c
x264.c
x264.h

index d95efab4d96624a2b4018e2a2a9bb0ae57602184..67c1778db346609d02a04333698c47243e477a26 100644 (file)
@@ -97,48 +97,6 @@ static inline uint32_t bs_read( bs_t *s, int i_count )
     return( i_result );
 }
 
-#if 0
-/* Only > i386 */
-static uint32_t bswap32( uint32_t x )
-{
-    asm( "bswap   %0": "=r" (x):"0" (x));
-    return x;
-}
-/* work only for i_count <= 32 - 7 */
-static inline uint32_t bs_read( bs_t *s, int i_count )
-{
-    if( s->p < s->p_end && i_count > 0 )
-    {
-#if 0
-        uint32_t i_cache = ((s->p[0] << 24)+(s->p[1] << 16)+(s->p[2] << 8)+s->p[3]) << (8-s->i_left);
-#else
-        uint32_t i_cache = bswap32( *((uint32_t*)s->p) ) << (8-s->i_left);
-#endif
-        uint32_t i_ret = i_cache >> ( 32 - i_count);
-
-        s->i_left -= i_count;
-#if 0
-        if( s->i_left <= 0 )
-        {
-            int i_skip = (8-s->i_left) >> 3;
-
-            s->p += i_skip;
-
-            s->i_left += i_skip << 3;
-        }
-#else
-        while( s->i_left <= 0 )
-        {
-            s->p++;
-            s->i_left += 8;
-        }
-#endif
-        return i_ret;
-    }
-    return 0;
-}
-
-#endif
 static inline uint32_t bs_read1( bs_t *s )
 {
 
@@ -160,17 +118,12 @@ static inline uint32_t bs_read1( bs_t *s )
 }
 static inline uint32_t bs_show( bs_t *s, int i_count )
 {
-#if 0
-    bs_t     s_tmp = *s;
-    return bs_read( &s_tmp, i_count );
-#else
     if( s->p < s->p_end && i_count > 0 )
     {
         uint32_t i_cache = ((s->p[0] << 24)+(s->p[1] << 16)+(s->p[2] << 8)+s->p[3]) << (8-s->i_left);
         return( i_cache >> ( 32 - i_count) );
     }
     return 0;
-#endif
 }
 
 /* TODO optimize */
index 5731ad8161ece7744980512657ec966866df2369..7a8bc4fe17f71f2384f0f930358049323916d018 100644 (file)
@@ -106,99 +106,6 @@ void     x264_cpu_restore( uint32_t cpu )
     }
 }
 
-
-#if 0
-/*
- * XXX: adapted from libmpeg2 */
-#if 0
-#define cpuid(op,eax,ebx,ecx,edx)   \
-    __asm__ ("push %%ebx\n\t"       \
-             "cpuid\n\t"            \
-             "movl %%ebx,%1\n\t"    \
-             "pop %%ebx"        \
-             : "=a" (eax),      \
-               "=r" (ebx),      \
-               "=c" (ecx),      \
-               "=d" (edx)       \
-             : "a" (op)         \
-             : "cc")
-#endif
-
-uint32_t x264_cpu_detect( void )
-{
-    uint32_t cpu = 0;
-
-    uint32_t eax, ebx, ecx, edx;
-    int      b_amd;
-
-
-    /* Test if cpuid is supported */
-    asm volatile(
-        "pushf\n"
-        "pushf\n"
-        "pop %0\n"
-        "movl %0,%1\n"
-        "xorl $0x200000,%0\n"
-        "push %0\n"
-        "popf\n"
-        "pushf\n"
-        "pop %0\n"
-        "popf\n"
-         : "=r" (eax), "=r" (ebx) : : "cc");
-
-    if( eax == ebx )
-    {
-        /* No cpuid */
-        return 0;
-    }
-
-    cpuid( 0, eax, ebx, ecx, edx);
-    if( eax == 0 )
-    {
-        return 0;
-    }
-    b_amd   = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
-
-    cpuid( 1, eax, ebx, ecx, edx );
-    if( (edx&0x00800000) == 0 )
-    {
-        /* No MMX */
-        return 0;
-    }
-    cpu = X264_CPU_MMX;
-    if( (edx&0x02000000) )
-    {
-        /* SSE - identical to AMD MMX extensions */
-        cpu |= X264_CPU_MMXEXT|X264_CPU_SSE;
-    }
-    if( (edx&0x04000000) )
-    {
-        /* Is it OK ? */
-        cpu |= X264_CPU_SSE2;
-    }
-
-    cpuid( 0x80000000, eax, ebx, ecx, edx );
-    if( eax < 0x80000001 )
-    {
-        /* no extended capabilities */
-        return cpu;
-    }
-
-    cpuid( 0x80000001, eax, ebx, ecx, edx );
-    if( edx&0x80000000 )
-    {
-        cpu |= X264_CPU_3DNOW;
-    }
-    if( b_amd && (edx&0x00400000) )
-    {
-        /* AMD MMX extensions */
-        cpu |= X264_CPU_MMXEXT;
-    }
-
-    return cpu;
-}
-#endif
-
 #elif defined( ARCH_PPC )
 
 #ifdef SYS_MACOSX
@@ -244,4 +151,3 @@ void     x264_cpu_restore( uint32_t cpu )
 }
 
 #endif
-
index 40a8e126eec6bf2c66b46bef928c0f0186fbb058..ac4f4c9d49e5a8128ffe88ebce0c3cb4891546b0 100644 (file)
 #include "dct.h"
 
 
-#if 0
-#define MMX_ZERO( MMZ ) \
-    asm volatile( "pxor " #MMZ ", " #MMZ "\n" :: )
-
-/* MMP : diff,  MMT: temp */
-#define MMX_LOAD_DIFF_4P( MMP, MMT, MMZ, pix1, pix2 ) \
-    asm volatile( "movd (%0), " #MMP "\n" \
-                  "punpcklbw  " #MMZ ", " #MMP "\n" \
-                  "movd (%1), " #MMT "\n" \
-                  "punpcklbw  " #MMZ ", " #MMT "\n" \
-                  "psubw      " #MMT ", " #MMP "\n" : : "r"(pix1), "r"(pix2) )
-
-/* in: out: mma=mma+mmb, mmb=mmb-mma */
-#define MMX_SUMSUB_BA( MMA, MMB ) \
-    asm volatile( "paddw " #MMB ", " #MMA "\n"\
-                  "paddw " #MMB ", " #MMB "\n"\
-                  "psubw " #MMA ", " #MMB "\n" :: )
-
-#define MMX_SUMSUB_BADC( MMA, MMB, MMC, MMD ) \
-    asm volatile( "paddw " #MMB ", " #MMA "\n"\
-                  "paddw " #MMD ", " #MMC "\n"\
-                  "paddw " #MMB ", " #MMB "\n"\
-                  "paddw " #MMD ", " #MMD "\n"\
-                  "psubw " #MMA ", " #MMB "\n"\
-                  "psubw " #MMC ", " #MMD "\n" :: )
-
-/* inputs MMA, MMB output MMA MMT */
-#define MMX_SUMSUB2_AB( MMA, MMB, MMT ) \
-    asm volatile( "movq  " #MMA ", " #MMT "\n" \
-                  "paddw " #MMA ", " #MMA "\n" \
-                  "paddw " #MMB ", " #MMA "\n" \
-                  "psubw " #MMB ", " #MMT "\n" \
-                  "psubw " #MMB ", " #MMT "\n" :: )
-
-/* inputs MMA, MMB output MMA MMS */
-#define MMX_SUMSUBD2_AB( MMA, MMB, MMT, MMS ) \
-    asm volatile( "movq  " #MMA ", " #MMS "\n" \
-                  "movq  " #MMB ", " #MMT "\n" \
-                  "psraw   $1    , " #MMB "\n"       \
-                  "psraw   $1    , " #MMS "\n"       \
-                  "paddw " #MMB ", " #MMA "\n" \
-                  "psubw " #MMT ", " #MMS "\n" :: )
-
-#define SBUTTERFLYwd(a,b,t )\
-    asm volatile( "movq " #a ", " #t "        \n\t" \
-                  "punpcklwd " #b ", " #a "   \n\t" \
-                  "punpckhwd " #b ", " #t "   \n\t" :: )
-
-#define SBUTTERFLYdq(a,b,t )\
-    asm volatile( "movq " #a ", " #t "        \n\t" \
-                  "punpckldq " #b ", " #a "   \n\t" \
-                  "punpckhdq " #b ", " #t "   \n\t" :: )
-
-/* input ABCD output ADTC */
-#define MMX_TRANSPOSE( MMA, MMB, MMC, MMD, MMT ) \
-        SBUTTERFLYwd( MMA, MMB, MMT ); \
-        SBUTTERFLYwd( MMC, MMD, MMB ); \
-        SBUTTERFLYdq( MMA, MMC, MMD ); \
-        SBUTTERFLYdq( MMT, MMB, MMC )
-
-#define MMX_STORE_DIFF_4P( MMP, MMT, MM32, MMZ, dst ) \
-    asm volatile( "paddw     " #MM32 "," #MMP "\n" \
-                  "psraw       $6,     " #MMP "\n" \
-                  "movd        (%0),   " #MMT "\n" \
-                  "punpcklbw " #MMZ ", " #MMT "\n" \
-                  "paddsw    " #MMT ", " #MMP "\n" \
-                  "packuswb  " #MMZ ", " #MMP "\n" \
-                  "movd      " #MMP ",   (%0)\n" :: "r"(dst) )
-
-#define UNUSED_LONGLONG( foo ) \
-    static const unsigned long long foo __asm__ (#foo)  __attribute__((unused)) __attribute__((aligned(16)))
-
-UNUSED_LONGLONG( x264_mmx_32 ) = 0x0020002000200020ULL;
-UNUSED_LONGLONG( x264_mmx_1 ) = 0x0001000100010001ULL;
-
-
-/*
- * XXX For all dct dc : input could be equal to output so ...
- */
-void x264_dct4x4dc_mmxext( int16_t d[4][4] )
-{
-    /* load DCT */
-    asm volatile(
-        "movq   (%0), %%mm0\n"
-        "movq  8(%0), %%mm1\n"
-        "movq 16(%0), %%mm2\n"
-        "movq 24(%0), %%mm3\n" :: "r"(d) );
-
-    MMX_SUMSUB_BADC( %%mm1, %%mm0, %%mm3, %%mm2 );  /* mm1=s01  mm0=d01  mm3=s23  mm2=d23 */
-    MMX_SUMSUB_BADC( %%mm3, %%mm1, %%mm2, %%mm0 );  /* mm3=s01+s23  mm1=s01-s23  mm2=d01+d23  mm0=d01-d23 */
-
-    /* in: mm3, mm1, mm0, mm2  out: mm3, mm2, mm4, mm0 */
-    MMX_TRANSPOSE  ( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 );
-
-    MMX_SUMSUB_BADC( %%mm2, %%mm3, %%mm0, %%mm4 );  /* mm2=s01  mm3=d01  mm0=s23  mm4=d23 */
-    MMX_SUMSUB_BADC( %%mm0, %%mm2, %%mm4, %%mm3 );  /* mm0=s01+s23  mm2=s01-s23  mm4=d01+d23  mm3=d01-d23 */
-
-    /* in: mm0, mm2, mm3, mm4  out: mm0, mm4, mm1, mm3 */
-    MMX_TRANSPOSE  ( %%mm0, %%mm2, %%mm3, %%mm4, %%mm1 );
-
-
-    asm volatile( "movq x264_mmx_1, %%mm6" :: );
-
-    /* Store back */
-    asm volatile(
-        "paddw %%mm6, %%mm0\n"
-        "paddw %%mm6, %%mm4\n"
-
-        "psraw $1,    %%mm0\n"
-        "movq  %%mm0,   (%0)\n"
-        "psraw $1,    %%mm4\n"
-        "movq  %%mm4,  8(%0)\n"
-
-        "paddw %%mm6, %%mm1\n"
-        "paddw %%mm6, %%mm3\n"
-
-        "psraw $1,    %%mm1\n"
-        "movq  %%mm1, 16(%0)\n"
-        "psraw $1,    %%mm3\n"
-        "movq  %%mm3, 24(%0)\n" :: "r"(d) );
-}
-
-void x264_idct4x4dc_mmxext( int16_t d[4][4] )
-{
-    /* load DCT */
-    asm volatile(
-        "movq   (%0), %%mm0\n"
-        "movq  8(%0), %%mm1\n"
-        "movq 16(%0), %%mm2\n" 
-        "movq 24(%0), %%mm3\n" :: "r"(d) );
-
-    MMX_SUMSUB_BADC( %%mm1, %%mm0, %%mm3, %%mm2 );  /* mm1=s01  mm0=d01  mm3=s23  mm2=d23 */
-    MMX_SUMSUB_BADC( %%mm3, %%mm1, %%mm2, %%mm0 );  /* mm3=s01+s23 mm1=s01-s23 mm2=d01+d23 mm0=d01-d23 */
-
-    /* in: mm3, mm1, mm0, mm2  out: mm3, mm2, mm4, mm0 */
-    MMX_TRANSPOSE( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 );
-
-    MMX_SUMSUB_BADC( %%mm2, %%mm3, %%mm0, %%mm4 );  /* mm2=s01  mm3=d01  mm0=s23  mm4=d23 */
-    MMX_SUMSUB_BADC( %%mm0, %%mm2, %%mm4, %%mm3 );  /* mm0=s01+s23 mm2=s01-s23 mm4=d01+d23 mm3=d01-d23 */
-
-    /* in: mm0, mm2, mm3, mm4  out: mm0, mm4, mm1, mm3 */
-    MMX_TRANSPOSE( %%mm0, %%mm2, %%mm3, %%mm4, %%mm1 );
-
-    /* Store back */
-    asm volatile(
-        "movq %%mm0,   (%0)\n"
-        "movq %%mm4,  8(%0)\n"
-        "movq %%mm1, 16(%0)\n" 
-        "movq %%mm3, 24(%0)\n" :: "r"(d) );
-}
-
-/****************************************************************************
- * subXxX_dct:
- ****************************************************************************/
-inline void x264_sub4x4_dct_mmxext( int16_t dct[4][4], uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 )
-{
-    /* Reset mm7 */
-    MMX_ZERO( %%mm7 );
-
-    /* Load 4 lines */
-    MMX_LOAD_DIFF_4P( %%mm0, %%mm6, %%mm7, &pix1[0*i_pix1], &pix2[0*i_pix2] );
-    MMX_LOAD_DIFF_4P( %%mm1, %%mm6, %%mm7, &pix1[1*i_pix1], &pix2[1*i_pix2] );
-    MMX_LOAD_DIFF_4P( %%mm2, %%mm6, %%mm7, &pix1[2*i_pix1], &pix2[2*i_pix2] );
-    MMX_LOAD_DIFF_4P( %%mm3, %%mm6, %%mm7, &pix1[3*i_pix1], &pix2[3*i_pix2] );
-
-    MMX_SUMSUB_BADC( %%mm3, %%mm0, %%mm2, %%mm1 );  /* mm3=s03  mm0=d03  mm2=s12  mm1=d12 */
-
-    MMX_SUMSUB_BA(  %%mm2, %%mm3 );                 /* mm2=s03+s12      mm3=s03-s12 */
-    MMX_SUMSUB2_AB( %%mm0, %%mm1, %%mm4 );          /* mm0=2.d03+d12    mm4=d03-2.d12 */
-
-    /* transpose in: mm2, mm0, mm3, mm4, out: mm2, mm4, mm1, mm3 */
-    MMX_TRANSPOSE( %%mm2, %%mm0, %%mm3, %%mm4, %%mm1 );
-
-    MMX_SUMSUB_BADC( %%mm3, %%mm2, %%mm1, %%mm4 );  /* mm3=s03  mm2=d03  mm1=s12  mm4=d12 */
-
-    MMX_SUMSUB_BA(  %%mm1, %%mm3 );                 /* mm1=s03+s12      mm3=s03-s12 */
-    MMX_SUMSUB2_AB( %%mm2, %%mm4, %%mm0 );          /* mm2=2.d03+d12    mm0=d03-2.d12 */
-
-    /* transpose in: mm1, mm2, mm3, mm0, out: mm1, mm0, mm4, mm3 */
-    MMX_TRANSPOSE( %%mm1, %%mm2, %%mm3, %%mm0, %%mm4 );
-
-    /* Store back */
-    asm volatile(
-        "movq %%mm1, (%0)\n"
-        "movq %%mm0, 8(%0)\n"
-        "movq %%mm4, 16(%0)\n"
-        "movq %%mm3, 24(%0)\n" :: "r"(dct) );
-}
-#endif
-
 void x264_sub8x8_dct_mmxext( int16_t dct[4][4][4], uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 )
 {
     x264_sub4x4_dct_mmxext( dct[0], &pix1[0], i_pix1, &pix2[0], i_pix2 );
@@ -246,41 +56,6 @@ void x264_sub16x16_dct_mmxext( int16_t dct[16][4][4], uint8_t *pix1, int i_pix1,
 /****************************************************************************
  * addXxX_idct:
  ****************************************************************************/
-#if 0
-inline void x264_add4x4_idct_mmxext( uint8_t *p_dst, int i_dst, int16_t dct[4][4] )
-{
-    /* Load dct coeffs */
-    asm volatile(
-        "movq   (%0), %%mm0\n"
-        "movq  8(%0), %%mm1\n"
-        "movq 16(%0), %%mm2\n"
-        "movq 24(%0), %%mm3\n" :: "r"(dct) );
-
-    MMX_SUMSUB_BA  ( %%mm2, %%mm0 );                /* mm2=s02  mm0=d02 */
-    MMX_SUMSUBD2_AB( %%mm1, %%mm3, %%mm5, %%mm4 );  /* mm1=s13  mm4=d13 ( well 1 + 3>>1 and 1>>1 + 3) */
-
-    MMX_SUMSUB_BADC( %%mm1, %%mm2, %%mm4, %%mm0 );  /* mm1=s02+s13  mm2=s02-s13  mm4=d02+d13  mm0=d02-d13 */
-
-    /* in: mm1, mm4, mm0, mm2  out: mm1, mm2, mm3, mm0 */
-    MMX_TRANSPOSE  ( %%mm1, %%mm4, %%mm0, %%mm2, %%mm3 );
-
-    MMX_SUMSUB_BA  ( %%mm3, %%mm1 );                /* mm3=s02  mm1=d02 */
-    MMX_SUMSUBD2_AB( %%mm2, %%mm0, %%mm5, %%mm4 );  /* mm2=s13  mm4=d13 ( well 1 + 3>>1 and 1>>1 + 3) */
-
-    MMX_SUMSUB_BADC( %%mm2, %%mm3, %%mm4, %%mm1 );  /* mm2=s02+s13  mm3=s02-s13  mm4=d02+d13  mm1=d02-d13 */
-
-    /* in: mm2, mm4, mm1, mm3  out: mm2, mm3, mm0, mm1 */
-    MMX_TRANSPOSE  ( %%mm2, %%mm4, %%mm1, %%mm3, %%mm0 );
-
-    MMX_ZERO( %%mm7 );
-    asm volatile( "movq x264_mmx_32, %%mm6\n" :: );
-
-    MMX_STORE_DIFF_4P( %%mm2, %%mm4, %%mm6, %%mm7, &p_dst[0*i_dst] );
-    MMX_STORE_DIFF_4P( %%mm3, %%mm4, %%mm6, %%mm7, &p_dst[1*i_dst] );
-    MMX_STORE_DIFF_4P( %%mm0, %%mm4, %%mm6, %%mm7, &p_dst[2*i_dst] );
-    MMX_STORE_DIFF_4P( %%mm1, %%mm4, %%mm6, %%mm7, &p_dst[3*i_dst] );
-}
-#endif
 
 void x264_add8x8_idct_mmxext( uint8_t *p_dst, int i_dst, int16_t dct[4][4][4] )
 {
index 7af01c46f520e43a6871936a1f93fbf353328a93..521c86616248dcde37a96a39bebf904969ff0c2f 100644 (file)
@@ -75,983 +75,6 @@ AVG_WEIGHT(8,16)
 AVG_WEIGHT(8,8)
 AVG_WEIGHT(8,4)
 
-#if 0
-
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
-#define USED_UINT64(foo) \
-    static const uint64_t foo __asm__ (#foo) __attribute__((used))
-#else
-#define USED_UINT64(foo) \
-    static const uint64_t foo __asm__ (#foo) __attribute__((unused))
-#endif
-
-USED_UINT64( x264_w0x10 ) = 0x0010001000100010ULL;
-
-
-#define MMX_ZERO( MMZ ) \
-    asm volatile( "pxor " #MMZ ", " #MMZ "\n" :: )
-
-#define MMX_INIT( MMV, NAME ) \
-    asm volatile( "movq " #NAME ", " #MMV "\n" :: )
-
-#define MMX_SAVE_4P( MMP, MMZ, dst ) \
-    asm volatile( "packuswb " #MMZ  "," #MMP "\n" \
-                  "movd " #MMP ", (%0)" :: "r"(dst) )
-
-#define MMX_LOAD_4P( MMP, MMZ, pix ) \
-    asm volatile( "movd (%0), " #MMP "\n" \
-                  "punpcklbw  " #MMZ ", " #MMP "\n" : : "r"(pix) )
-
-#define MMX_LOAD_4x4( MMP1, MMP2, MMP3, MMP4, MMZ, pix, i_pix )\
-    MMX_LOAD_4P( MMP1, MMZ, &(pix)[0*(i_pix)] ); \
-    MMX_LOAD_4P( MMP2, MMZ, &(pix)[1*(i_pix)] ); \
-    MMX_LOAD_4P( MMP3, MMZ, &(pix)[2*(i_pix)] ); \
-    MMX_LOAD_4P( MMP4, MMZ, &(pix)[3*(i_pix)] )
-
-#define MMX_LOAD_2x4( MMP1, MMP2, MMZ, pix, i_pix )\
-    MMX_LOAD_4P( MMP1, MMZ, &(pix)[0*(i_pix)] ); \
-    MMX_LOAD_4P( MMP2, MMZ, &(pix)[1*(i_pix)] )
-
-#define MMX_SAVEPACK_8P( MMP1, MMP2, MMZ, dst ) \
-    asm volatile( "packuswb " #MMP2  "," #MMP1 "\n" \
-                  "movq " #MMP1 ", (%0)\n" :: "r"(dst) )
-
-
-#define MMX_LOAD_8P( MMP1, MMP2, MMZ, pix ) \
-    asm volatile( "movq         (%0)   , " #MMP1 "\n" \
-                  "movq       " #MMP1 ", " #MMP2 "\n" \
-                  "punpcklbw  " #MMZ  ", " #MMP1 "\n" \
-                  "punpckhbw  " #MMZ  ", " #MMP2 "\n" : : "r"(pix) )
-
-#define MMX_LOAD_2x8( MMP1, MMP2, MMP3, MMP4, MMZ, pix, i_pix )\
-    MMX_LOAD_8P( MMP1, MMP2, MMZ, &(pix)[0*(i_pix)] ); \
-    MMX_LOAD_8P( MMP3, MMP4, MMZ, &(pix)[1*(i_pix)] )
-
-#define SBUTTERFLYwd(a,b,t )\
-    asm volatile( "movq " #a ", " #t "        \n\t" \
-                  "punpcklwd " #b ", " #a "   \n\t" \
-                  "punpckhwd " #b ", " #t "   \n\t" :: )
-
-#define SBUTTERFLYdq(a,b,t )\
-    asm volatile( "movq " #a ", " #t "        \n\t" \
-                  "punpckldq " #b ", " #a "   \n\t" \
-                  "punpckhdq " #b ", " #t "   \n\t" :: )
-
-/* input ABCD output ADTC  ( or 0?31-2->0123 ) */
-#define MMX_TRANSPOSE( MMA, MMB, MMC, MMD, MMT ) \
-        SBUTTERFLYwd( MMA, MMB, MMT ); \
-        SBUTTERFLYwd( MMC, MMD, MMB ); \
-        SBUTTERFLYdq( MMA, MMC, MMD ); \
-        SBUTTERFLYdq( MMT, MMB, MMC )
-
-/* first pass MM0 = MM0 -5*MM1 */
-#define MMX_FILTERTAP_P1( MMP0, MMP1 ) \
-    asm volatile( "psubw    " #MMP1 "," #MMP0 "\n" \
-                  "psllw      $2,     " #MMP1 "\n" \
-                  "psubw    " #MMP1 "," #MMP0 "\n" :: )
-                                                   \
-/* second pass MM0 = MM0 + 20*(MM2+MM3) */
-#define MMX_FILTERTAP_P2( MMP0, MMP2, MMP3 ) \
-    asm volatile( "paddw    " #MMP3 "," #MMP2 "\n" \
-                                                 \
-                  "psllw      $2,     " #MMP2 "\n" \
-                  "paddw    " #MMP2 "," #MMP0 "\n" \
-                  "psllw      $2,     " #MMP2 "\n" \
-                  "paddw    " #MMP2 "," #MMP0 "\n" :: )
-
-/* last pass: MM0 = ( MM0 -5*MM1 + MM2 + MMV ) >> 5 */
-#define MMX_FILTERTAP_P3( MMP0, MMP1, MMP2, MMV, MMZ ) \
-    asm volatile( "psubw    " #MMP1 "," #MMP0 "\n" \
-                  "psllw      $2,     " #MMP1 "\n" \
-                  "psubw    " #MMP1 "," #MMP0 "\n" \
-                                                   \
-                  "paddw    " #MMP2 "," #MMP0 "\n" \
-                  "paddw    " #MMV  "," #MMP0 "\n" \
-                  "psraw      $5,     " #MMP0 "\n" :: )
-
-#define MMX_FILTERTAP2_P1( MMP0, MMP1, MMP2, MMP3 ) \
-    asm volatile( "psubw    " #MMP1 "," #MMP0 "\n" \
-                  "psubw    " #MMP3 "," #MMP2 "\n" \
-                  "psllw      $2,     " #MMP1 "\n" \
-                  "psllw      $2,     " #MMP3 "\n" \
-                  "psubw    " #MMP1 "," #MMP0 "\n" \
-                  "psubw    " #MMP3 "," #MMP2 "\n" :: )
-
-/* second pass MM0 = MM0 + 20*(MM1+MM2) */
-#define MMX_FILTERTAP2_P2( MMP0, MMP1, MMP2, MMP3, MMP4, MMP5 ) \
-    asm volatile( "paddw    " #MMP2 "," #MMP1 "\n" \
-                  "paddw    " #MMP5 "," #MMP4 "\n" \
-                                                 \
-                  "psllw      $2,     " #MMP1 "\n" \
-                  "psllw      $2,     " #MMP4 "\n" \
-                  "paddw    " #MMP1 "," #MMP0 "\n" \
-                  "paddw    " #MMP4 "," #MMP3 "\n" \
-                  "psllw      $2,     " #MMP1 "\n" \
-                  "psllw      $2,     " #MMP4 "\n" \
-                  "paddw    " #MMP1 "," #MMP0 "\n" \
-                  "paddw    " #MMP4 "," #MMP3 "\n" :: )
-
-#define MMX_LOAD_1r( m1, dst ) \
-    asm volatile( "movq (%0), " #m1 "\n" :: "r"(dst) ); \
-
-#define MMX_SAVE_1r( m1, dst ) \
-    asm volatile( "movq " #m1 ", (%0)\n" :: "r"(dst) ); \
-
-#define MMX_LOAD_2r( m1, m2, dst, i_dst ) \
-    asm volatile( "movq (%0), " #m1 "\n" :: "r"(&((uint8_t*)dst)[0*(i_dst)]) ); \
-    asm volatile( "movq (%0), " #m2 "\n" :: "r"(&((uint8_t*)dst)[1*(i_dst)]) )
-
-#define MMX_SAVE_2r( m1, m2, dst, i_dst ) \
-    asm volatile( "movq " #m1 ", (%0)\n" :: "r"(&((uint8_t*)dst)[0*(i_dst)]) ); \
-    asm volatile( "movq " #m2 ", (%0)\n" :: "r"(&((uint8_t*)dst)[1*(i_dst)]) )
-
-#define MMX_SAVE_4r( m1, m2, m3, m4, dst, i_dst ) \
-    asm volatile( "movq " #m1 ", (%0)\n" :: "r"(&((uint8_t*)dst)[0*(i_dst)]) ); \
-    asm volatile( "movq " #m2 ", (%0)\n" :: "r"(&((uint8_t*)dst)[1*(i_dst)]) ); \
-    asm volatile( "movq " #m3 ", (%0)\n" :: "r"(&((uint8_t*)dst)[2*(i_dst)]) ); \
-    asm volatile( "movq " #m4 ", (%0)\n" :: "r"(&((uint8_t*)dst)[3*(i_dst)]) )
-
-#define MMX_LOAD_4r( m1, m2, m3, m4, dst, i_dst ) \
-    asm volatile( "movq (%0), " #m1 "\n" :: "r"(&((uint8_t*)dst)[0*(i_dst)]) ); \
-    asm volatile( "movq (%0), " #m2 "\n" :: "r"(&((uint8_t*)dst)[1*(i_dst)]) ); \
-    asm volatile( "movq (%0), " #m3 "\n" :: "r"(&((uint8_t*)dst)[2*(i_dst)]) ); \
-    asm volatile( "movq (%0), " #m4 "\n" :: "r"(&((uint8_t*)dst)[3*(i_dst)]) )
-
-
-static inline int x264_tapfilter( uint8_t *pix, int i_pix_next )
-{
-    return pix[-2*i_pix_next] - 5*pix[-1*i_pix_next] + 20*(pix[0] + pix[1*i_pix_next]) - 5*pix[ 2*i_pix_next] + pix[ 3*i_pix_next];
-}
-static inline int x264_tapfilter1( uint8_t *pix )
-{
-    return pix[-2] - 5*pix[-1] + 20*(pix[0] + pix[1]) - 5*pix[ 2] + pix[ 3];
-}
-
-typedef void (*pf_mc_t)(uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height );
-
-/* Macro to define NxM functions */
-/* mc I+H */
-#define MC_IH( name, cpu, width, height, off )  \
-static void name##_w##width##_##cpu( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height ) \
-{                                                               \
-    DECLARE_ALIGNED( uint8_t, tmp[width*height], width );       \
-                                                                \
-    mc_hh_w##width( src, i_src_stride, tmp, width, i_height );  \
-    x264_pixel_avg_w##width##_##cpu( dst, i_dst_stride,         \
-                                     src+(off), i_src_stride,   \
-                                     tmp, width, i_height );    \
-}
-
-/* mc I+V */
-#define MC_IV( name, cpu, width, height, off )  \
-static void name##_w##width##_##cpu( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height ) \
-{                                                               \
-    DECLARE_ALIGNED( uint8_t, tmp[width*height], width );       \
-                                                                \
-    mc_hv_w##width( src, i_src_stride, tmp, width, i_height );  \
-    x264_pixel_avg_w##width##_##cpu( dst, i_dst_stride,         \
-                                     src+(off), i_src_stride,   \
-                                     tmp, width, i_height );    \
-}
-
-/* mc H+V */
-#define MC_HV( name, cpu, width, height, off1, off2 ) \
-static void name##_w##width##_##cpu( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height ) \
-{                                                               \
-    DECLARE_ALIGNED( uint8_t, tmp1[width*height], width );      \
-    DECLARE_ALIGNED( uint8_t, tmp2[width*height], width );      \
-                                                                \
-    mc_hv_w##width( src+(off1), i_src_stride, tmp1, width, i_height );  \
-    mc_hh_w##width( src+(off2), i_src_stride, tmp2, width, i_height );  \
-    x264_pixel_avg_w##width##_##cpu( dst, i_dst_stride,         \
-                                     tmp1, width, tmp2, width,  \
-                                     i_height );                \
-}
-
-/* mc C+H */
-#define MC_CH( name, cpu, width, height, off ) \
-static void name##_w##width##_##cpu( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height ) \
-{                                                               \
-    DECLARE_ALIGNED( uint8_t, tmp1[width*height], width );      \
-    DECLARE_ALIGNED( uint8_t, tmp2[width*height], width );      \
-                                                                \
-    mc_hc_w##width( src,       i_src_stride, tmp1, width, i_height );  \
-    mc_hh_w##width( src+(off), i_src_stride, tmp2, width, i_height );  \
-    x264_pixel_avg_w##width##_##cpu( dst, i_dst_stride,         \
-                                     tmp1, width, tmp2, width,  \
-                                     i_height );                \
-}
-
-/* mc C+V */
-#define MC_CV( name, cpu, width, height, off ) \
-static void name##_w##width##_##cpu( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height ) \
-{                                                               \
-    DECLARE_ALIGNED( uint8_t, tmp1[width*height], width );      \
-    DECLARE_ALIGNED( uint8_t, tmp2[width*height], width );      \
-                                                                \
-    mc_hc_w##width( src,       i_src_stride, tmp1, width, i_height );  \
-    mc_hv_w##width( src+(off), i_src_stride, tmp2, width, i_height );  \
-    x264_pixel_avg_w##width##_##cpu( dst, i_dst_stride,         \
-                                     tmp1, width, tmp2, width,  \
-                                     i_height );                \
-}
-
-
-/*****************************************************************************
- * MC with width == 4 (height <= 8)
- *****************************************************************************/
-
-static inline void mc_hh_w4( uint8_t *src, int i_src, uint8_t *dst, int i_dst, int i_height )
-{
-    const int h4 = i_height / 4;
-    uint8_t  srct[4*8*3];
-    uint64_t tmp[4];
-    int y;
-
-    src -= 2;
-
-    MMX_ZERO( %%mm7 );
-    MMX_INIT( %%mm6, x264_w0x10 );
-
-    for( y = 0; y < h4; y++ )
-    {
-        int i;
-
-        /* Preload data and transpose them */
-        MMX_LOAD_4x4 ( %%mm0, %%mm4, %%mm3, %%mm1, %%mm7, &src[0], i_src );
-        MMX_TRANSPOSE( %%mm0, %%mm4, %%mm3, %%mm1, %%mm2 ); /* 0123 */
-        MMX_SAVE_4r( %%mm0, %%mm1, %%mm2, %%mm3, &srct[4*8*0], 8 );
-
-        MMX_LOAD_4x4 ( %%mm0, %%mm4, %%mm3, %%mm1, %%mm7, &src[4], i_src );
-        MMX_TRANSPOSE( %%mm0, %%mm4, %%mm3, %%mm1, %%mm2 ); /* 0123 */
-        MMX_SAVE_4r( %%mm0, %%mm1, %%mm2, %%mm3, &srct[4*8*1], 8 );
-
-        /* we read 2 more bytes that needed */
-        MMX_LOAD_4x4 ( %%mm0, %%mm4, %%mm3, %%mm1, %%mm7, &src[8], i_src );
-        MMX_TRANSPOSE( %%mm0, %%mm4, %%mm3, %%mm1, %%mm2 ); /* 0123 */
-        MMX_SAVE_2r( %%mm0, %%mm1, &srct[4*8*2], 8 );
-
-        /* tap filter */
-        for( i = 0; i < 4; i++ )
-        {
-            MMX_LOAD_4r( %%mm0, %%mm1, %%mm2, %%mm3, &srct[8*(i+0)], 8 );
-            MMX_FILTERTAP_P1( %%mm0, %%mm1 );
-            MMX_FILTERTAP_P2( %%mm0, %%mm2, %%mm3 );
-
-            MMX_LOAD_2r( %%mm1, %%mm2, &srct[8*(i+4)], 8 );
-            MMX_FILTERTAP_P3( %%mm0, %%mm1, %%mm2, %%mm6, %%mm7 );
-
-            MMX_SAVE_1r( %%mm0, &tmp[i] );
-        }
-
-        MMX_LOAD_4r( %%mm0, %%mm4, %%mm3, %%mm1, tmp, 8 );
-        MMX_TRANSPOSE( %%mm0, %%mm4, %%mm3, %%mm1, %%mm2 ); /* 0123 */
-        MMX_SAVE_4P( %%mm0, %%mm7, &dst[0*i_dst] );
-        MMX_SAVE_4P( %%mm1, %%mm7, &dst[1*i_dst] );
-        MMX_SAVE_4P( %%mm2, %%mm7, &dst[2*i_dst] );
-        MMX_SAVE_4P( %%mm3, %%mm7, &dst[3*i_dst] );
-
-        src += 4 * i_src;
-        dst += 4 * i_dst;
-    }
-}
-static inline void mc_hv_w4( uint8_t *src, int i_src, uint8_t *dst, int i_dst, int i_height )
-{
-    int y;
-
-    src -= 2 * i_src;
-
-    MMX_ZERO( %%mm7 );
-    MMX_INIT( %%mm6, x264_w0x10 );
-
-    for( y = 0; y < i_height; y++ )
-    {
-        MMX_LOAD_4x4( %%mm0, %%mm1, %%mm2, %%mm3, %%mm7, src, i_src );
-        MMX_FILTERTAP_P1( %%mm0, %%mm1 );
-        MMX_FILTERTAP_P2( %%mm0, %%mm2, %%mm3 );
-
-        MMX_LOAD_2x4( %%mm4, %%mm5, %%mm7, &src[4*i_src], i_src );
-        MMX_FILTERTAP_P3( %%mm0, %%mm4, %%mm5, %%mm6, %%mm7 );
-        MMX_SAVE_4P( %%mm0, %%mm7, dst );
-
-        src += i_src;
-        dst += i_dst;
-    }
-}
-
-static inline void mc_hc_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    int i, x, y;
-
-    for( y = 0; y < i_height; y++ )
-    {
-        int16_t tap[5+4];
-
-        for( i = 0; i < 5+4; i++ )
-        {
-            tap[i] = x264_tapfilter( &src[-2+i], i_src_stride );
-        }
-
-        for( x = 0; x < 4; x++ )
-        {
-            dst[x] = x264_mc_clip1( ( tap[0+x] - 5*tap[1+x] + 20 * tap[2+x] + 20 * tap[3+x] -5*tap[4+x] + tap[5+x] + 512 ) >> 10 );
-        }
-
-        src += i_src_stride;
-        dst += i_dst_stride;
-    }
-}
-
-MC_IH( mc_xy10, mmxext, 4, 8, 0 )
-MC_IH( mc_xy30, mmxext, 4, 8, 1 )
-
-MC_IV( mc_xy01, mmxext, 4, 8, 0 )
-MC_IV( mc_xy03, mmxext, 4, 8, i_src_stride )
-
-MC_HV( mc_xy11, mmxext, 4, 8, 0, 0 )
-MC_HV( mc_xy31, mmxext, 4, 8, 1, 0 )
-MC_HV( mc_xy13, mmxext, 4, 8, 0, i_src_stride )
-MC_HV( mc_xy33, mmxext, 4, 8, 1, i_src_stride )
-
-MC_CH( mc_xy21, mmxext, 4, 8, 0 )
-MC_CH( mc_xy23, mmxext, 4, 8, i_src_stride )
-
-MC_CV( mc_xy12, mmxext, 4, 8, 0 )
-MC_CV( mc_xy32, mmxext, 4, 8, 1 )
-
-#if 0
-static void mc_xy10_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[4*8];
-    mc_hh_w4( src, i_src_stride, tmp, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, src, i_src_stride, tmp, 4, i_height );
-}
-static void mc_xy30_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[4*8];
-    mc_hh_w4( src, i_src_stride, tmp, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, src+1, i_src_stride, tmp, 4, i_height );
-}
-
-static void mc_xy01_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[4*8];
-    mc_hv_w4( src, i_src_stride, tmp, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, src, i_src_stride, tmp, 4, i_height );
-}
-static void mc_xy03_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[4*8];
-    mc_hv_w4( src, i_src_stride, tmp, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, src+i_src_stride, i_src_stride, tmp, 4, i_height );
-}
-
-static void mc_xy11_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hv_w4( src, i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-static void mc_xy31_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hv_w4( src+1, i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src,   i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-static void mc_xy13_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hv_w4( src,              i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src+i_src_stride, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-static void mc_xy33_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hv_w4( src+1,            i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src+i_src_stride, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-
-static void mc_xy21_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hc_w4( src, i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-static void mc_xy23_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hc_w4( src,              i_src_stride, tmp1, 4, i_height );
-    mc_hh_w4( src+i_src_stride, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-
-static void mc_xy12_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hc_w4( src, i_src_stride, tmp1, 4, i_height );
-    mc_hv_w4( src, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-static void mc_xy32_w4( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[4*8];
-    uint8_t tmp2[4*8];
-
-    mc_hc_w4( src,   i_src_stride, tmp1, 4, i_height );
-    mc_hv_w4( src+1, i_src_stride, tmp2, 4, i_height );
-    pixel_avg_w4( dst, i_dst_stride, tmp1, 4, tmp2, 4, i_height );
-}
-#endif
-
-/*****************************************************************************
- * MC with width == 8 (height <= 16)
- *****************************************************************************/
-
-static inline void mc_hh_w8( uint8_t *src, int i_src, uint8_t *dst, int i_dst, int i_height )
-{
-    mc_hh_w4( &src[0], i_src, &dst[0], i_dst, i_height );
-    mc_hh_w4( &src[4], i_src, &dst[4], i_dst, i_height );
-}
-static inline void mc_hv_w8( uint8_t *src, int i_src, uint8_t *dst, int i_dst, int i_height )
-{
-    int y;
-
-    src -= 2 * i_src;
-
-    MMX_ZERO( %%mm7 );
-    MMX_INIT( %%mm6, x264_w0x10 );
-
-    for( y = 0; y < i_height; y++ )
-    {
-        MMX_LOAD_2x8( %%mm0, %%mm5, %%mm1, %%mm2, %%mm7,  &src[0*i_src], i_src );
-        MMX_FILTERTAP2_P1( %%mm0, %%mm1, %%mm5, %%mm2 );
-
-
-        MMX_LOAD_2x8( %%mm1, %%mm3, %%mm2, %%mm4, %%mm7,  &src[2*i_src], i_src );
-        MMX_FILTERTAP2_P2( %%mm0, %%mm1, %%mm2, %%mm5, %%mm3, %%mm4 );
-
-        MMX_LOAD_2x8( %%mm1, %%mm3, %%mm2, %%mm4, %%mm7,  &src[4*i_src], i_src );
-        MMX_FILTERTAP_P3( %%mm0, %%mm1, %%mm2, %%mm6, %%mm7 );
-        MMX_FILTERTAP_P3( %%mm5, %%mm3, %%mm4, %%mm6, %%mm7 );
-
-        MMX_SAVEPACK_8P( %%mm0, %%mm5, %%mm7, dst );
-
-        src += i_src;
-        dst += i_dst;
-    }
-}
-
-static inline void mc_hc_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    int x, y;
-
-    asm volatile( "pxor %%mm7,        %%mm7\n" : : );
-
-    for( y = 0; y < i_height; y++ )
-    {
-        int16_t tap[5+8];
-
-        /* first 8 */
-        asm volatile(
-            "leal   (%0, %1),   %%eax\n"
-
-            "movq       (%0),   %%mm0\n"    /* load pix-2 */
-            "movq       %%mm0,  %%mm2\n"
-            "punpcklbw  %%mm7,  %%mm0\n"
-            "punpckhbw  %%mm7,  %%mm2\n"
-
-            "movq       (%%eax),%%mm1\n"    /* load pix-1 */
-            "movq       %%mm1,  %%mm3\n"
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "punpckhbw  %%mm7,  %%mm3\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psubw      %%mm3,  %%mm2\n"
-            "psllw      $2,     %%mm3\n"
-            "psubw      %%mm3,  %%mm2\n"
-
-            "movq       (%%eax,%1),%%mm1\n"  /* load pix */
-            "movq       %%mm1,  %%mm3\n"
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "punpckhbw  %%mm7,  %%mm3\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm3\n"
-            "paddw      %%mm3,  %%mm2\n"
-            "psllw      $2,     %%mm3\n"
-            "paddw      %%mm3,  %%mm2\n"
-
-            "movq       (%%eax,%1,2),%%mm1\n"  /* load pix+1 */
-            "movq       %%mm1,  %%mm3\n"
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "punpckhbw  %%mm7,  %%mm3\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm3\n"
-            "paddw      %%mm3,  %%mm2\n"
-            "psllw      $2,     %%mm3\n"
-            "paddw      %%mm3,  %%mm2\n"
-
-            "movq       (%0,%1,4),%%mm1\n"  /* load pix+2 */
-            "movq       %%mm1,  %%mm3\n"
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "punpckhbw  %%mm7,  %%mm3\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psubw      %%mm3,  %%mm2\n"
-            "psllw      $2,     %%mm3\n"
-            "psubw      %%mm3,  %%mm2\n"
-
-            "movq       (%%eax,%1,4),%%mm1\n"  /* load pix+3 */
-            "movq       %%mm1,  %%mm3\n"
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "punpckhbw  %%mm7,  %%mm3\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "paddw      %%mm3,  %%mm2\n"
-
-            "movq       %%mm0,   (%2)\n"
-            "movq       %%mm2,  8(%2)\n"
-
-
-            "addl   $8,         %%eax\n"
-            "addl   $8,         %0\n"
-
-
-            "movd       (%0),   %%mm0\n"    /* load pix-2 */
-            "punpcklbw  %%mm7,  %%mm0\n"
-
-            "movd       (%%eax),%%mm1\n"    /* load pix-1 */
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-
-            "movd       (%%eax,%1),%%mm1\n"  /* load pix */
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-
-            "movd       (%%eax,%1,2),%%mm1\n"  /* load pix+1 */
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-
-            "movd       (%0,%1,4),%%mm1\n"  /* load pix+2 */
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-            "psllw      $2,     %%mm1\n"
-            "psubw      %%mm1,  %%mm0\n"
-
-            "movd       (%%eax,%1,4),%%mm1\n"  /* load pix+3 */
-            "punpcklbw  %%mm7,  %%mm1\n"
-            "paddw      %%mm1,  %%mm0\n"
-
-            "movq       %%mm0,  16(%2)\n"
-            : : "r"(src-2*i_src_stride-2), "r"(i_src_stride), "r"(&tap[0]) : "%eax" );
-
-        /* last one */
-        tap[8+4] = x264_tapfilter( &src[-2+8+4], i_src_stride );
-
-        for( x = 0; x < 8; x++ )
-        {
-            dst[x] = x264_mc_clip1( ( tap[0+x] - 5*tap[1+x] + 20 * tap[2+x] + 20 * tap[3+x] -5*tap[4+x] + tap[5+x] + 512 ) >> 10 );
-        }
-
-        src += i_src_stride;
-        dst += i_dst_stride;
-    }
-}
-
-MC_IH( mc_xy10, mmxext, 8, 16, 0 )
-MC_IH( mc_xy30, mmxext, 8, 16, 1 )
-
-MC_IV( mc_xy01, mmxext, 8, 16, 0 )
-MC_IV( mc_xy03, mmxext, 8, 16, i_src_stride )
-
-MC_HV( mc_xy11, mmxext, 8, 16, 0, 0 )
-MC_HV( mc_xy31, mmxext, 8, 16, 1, 0 )
-MC_HV( mc_xy13, mmxext, 8, 16, 0, i_src_stride )
-MC_HV( mc_xy33, mmxext, 8, 16, 1, i_src_stride )
-
-MC_CH( mc_xy21, mmxext, 8, 16, 0 )
-MC_CH( mc_xy23, mmxext, 8, 16, i_src_stride )
-
-MC_CV( mc_xy12, mmxext, 8, 16, 0 )
-MC_CV( mc_xy32, mmxext, 8, 16, 1 )
-
-#if 0
-/* mc I+H */
-static void mc_xy10_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[8*16];
-    mc_hh_w8( src, i_src_stride, tmp, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, src, i_src_stride, tmp, 8, i_height );
-}
-static void mc_xy30_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[8*16];
-    mc_hh_w8( src, i_src_stride, tmp, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, src+1, i_src_stride, tmp, 8, i_height );
-}
-/* mc I+V */
-static void mc_xy01_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[8*16];
-    mc_hv_w8( src, i_src_stride, tmp, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, src, i_src_stride, tmp, 8, i_height );
-}
-static void mc_xy03_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp[8*16];
-    mc_hv_w8( src, i_src_stride, tmp, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, src+i_src_stride, i_src_stride, tmp, 8, i_height );
-}
-/* H+V */
-static void mc_xy11_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hv_w8( src, i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy31_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hv_w8( src+1, i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src,   i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy13_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hv_w8( src,              i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src+i_src_stride, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy33_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hv_w8( src+1,            i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src+i_src_stride, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy21_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hc_w8( src, i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy12_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hc_w8( src, i_src_stride, tmp1, 8, i_height );
-    mc_hv_w8( src, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy32_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hc_w8( src,   i_src_stride, tmp1, 8, i_height );
-    mc_hv_w8( src+1, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-static void mc_xy23_w8( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    uint8_t tmp1[8*16];
-    uint8_t tmp2[8*16];
-
-    mc_hc_w8( src,              i_src_stride, tmp1, 8, i_height );
-    mc_hh_w8( src+i_src_stride, i_src_stride, tmp2, 8, i_height );
-    pixel_avg_w8( dst, i_dst_stride, tmp1, 8, tmp2, 8, i_height );
-}
-#endif
-
-/*****************************************************************************
- * MC with width == 16 (height <= 16)
- *****************************************************************************/
-
-static inline void mc_hh_w16( uint8_t *src, int i_src, uint8_t *dst, int i_dst, int i_height )
-{
-    mc_hh_w4( &src[ 0], i_src, &dst[ 0], i_dst, i_height );
-    mc_hh_w4( &src[ 4], i_src, &dst[ 4], i_dst, i_height );
-    mc_hh_w4( &src[ 8], i_src, &dst[ 8], i_dst, i_height );
-    mc_hh_w4( &src[12], i_src, &dst[12], i_dst, i_height );
-}
-static inline void mc_hv_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    mc_hv_w8( src,     i_src_stride, dst,     i_dst_stride, i_height );
-    mc_hv_w8( &src[8], i_src_stride, &dst[8], i_dst_stride, i_height );
-}
-
-static inline void mc_hc_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    mc_hc_w8( src,     i_src_stride, dst,     i_dst_stride, i_height );
-    mc_hc_w8( &src[8], i_src_stride, &dst[8], i_dst_stride, i_height );
-}
-
-/* MMX avg/copy */
-MC_IH( mc_xy10, mmxext, 16, 16, 0 )
-MC_IH( mc_xy30, mmxext, 16, 16, 1 )
-
-MC_IV( mc_xy01, mmxext, 16, 16, 0 )
-MC_IV( mc_xy03, mmxext, 16, 16, i_src_stride )
-
-MC_HV( mc_xy11, mmxext, 16, 16, 0, 0 )
-MC_HV( mc_xy31, mmxext, 16, 16, 1, 0 )
-MC_HV( mc_xy13, mmxext, 16, 16, 0, i_src_stride )
-MC_HV( mc_xy33, mmxext, 16, 16, 1, i_src_stride )
-
-MC_CH( mc_xy21, mmxext, 16, 16, 0 )
-MC_CH( mc_xy23, mmxext, 16, 16, i_src_stride )
-
-MC_CV( mc_xy12, mmxext, 16, 16, 0 )
-MC_CV( mc_xy32, mmxext, 16, 16, 1 )
-
-/* SSE2 avg/copy */
-MC_IH( mc_xy10, sse2, 16, 16, 0 )
-MC_IH( mc_xy30, sse2, 16, 16, 1 )
-
-MC_IV( mc_xy01, sse2, 16, 16, 0 )
-MC_IV( mc_xy03, sse2, 16, 16, i_src_stride )
-
-MC_HV( mc_xy11, sse2, 16, 16, 0, 0 )
-MC_HV( mc_xy31, sse2, 16, 16, 1, 0 )
-MC_HV( mc_xy13, sse2, 16, 16, 0, i_src_stride )
-MC_HV( mc_xy33, sse2, 16, 16, 1, i_src_stride )
-
-MC_CH( mc_xy21, sse2, 16, 16, 0 )
-MC_CH( mc_xy23, sse2, 16, 16, i_src_stride )
-
-MC_CV( mc_xy12, sse2, 16, 16, 0 )
-MC_CV( mc_xy32, sse2, 16, 16, 1 )
-
-
-#if 0
-/* mc I+H */
-static void mc_xy10_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp[16*16], 16);
-    mc_hh_w16( src, i_src_stride, tmp, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, src, i_src_stride, tmp, 16, i_height );
-}
-static void mc_xy30_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp[16*16], 16);
-    mc_hh_w16( src, i_src_stride, tmp, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, src+1, i_src_stride, tmp, 16, i_height );
-}
-/* mc I+V */
-static void mc_xy01_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp[16*16], 16);
-    mc_hv_w16( src, i_src_stride, tmp, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, src, i_src_stride, tmp, 16, i_height );
-}
-static void mc_xy03_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp[16*16], 16);
-    mc_hv_w16( src, i_src_stride, tmp, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, src+i_src_stride, i_src_stride, tmp, 16, i_height );
-}
-/* H+V */
-static void mc_xy11_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hv_w16( src, i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy31_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hv_w16( src+1, i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src,   i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy13_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hv_w16( src,              i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src+i_src_stride, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy33_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hv_w16( src+1,            i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src+i_src_stride, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy21_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hc_w16( src, i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy12_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hc_w16( src, i_src_stride, tmp1, 16, i_height );
-    mc_hv_w16( src, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy32_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hc_w16( src,   i_src_stride, tmp1, 16, i_height );
-    mc_hv_w16( src+1, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-static void mc_xy23_w16( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_height )
-{
-    DECLARE_ALIGNED(uint8_t, tmp1[16*16], 16);
-    DECLARE_ALIGNED(uint8_t, tmp2[16*16], 16);
-
-    mc_hc_w16( src,              i_src_stride, tmp1, 16, i_height );
-    mc_hh_w16( src+i_src_stride, i_src_stride, tmp2, 16, i_height );
-    pixel_avg_w16( dst, i_dst_stride, tmp1, 16, tmp2, 16, i_height );
-}
-#endif
-
-#define MOTION_COMPENSATION_LUMA \
-    src += (mvy >> 2) * i_src_stride + (mvx >> 2);  \
-    if( i_width == 4 )                              \
-    {                                               \
-        pf_mc[0][mvy&0x03][mvx&0x03]( src, i_src_stride, dst, i_dst_stride, i_height ); \
-    }                                               \
-    else if( i_width == 8 )                         \
-    {                                               \
-        pf_mc[1][mvy&0x03][mvx&0x03]( src, i_src_stride, dst, i_dst_stride, i_height ); \
-    }                                               \
-    else if( i_width == 16 )                        \
-    {                                               \
-        pf_mc[2][mvy&0x03][mvx&0x03]( src, i_src_stride, dst, i_dst_stride, i_height ); \
-    }                                               \
-    else                                            \
-    {                                               \
-        fprintf( stderr, "Error: motion_compensation_luma called with invalid width" ); \
-    }
-
-static void motion_compensation_luma_mmxext( uint8_t *src, int i_src_stride,
-                                             uint8_t *dst, int i_dst_stride,
-                                             int mvx,int mvy,
-                                             int i_width, int i_height )
-{
-    static const pf_mc_t pf_mc[3][4][4] =    /*XXX [dqy][dqx] */
-    {
-        {
-            { x264_mc_copy_w4_mmxext,   mc_xy10_w4_mmxext,    mc_hh_w4,             mc_xy30_w4_mmxext },
-            { mc_xy01_w4_mmxext,        mc_xy11_w4_mmxext,    mc_xy21_w4_mmxext,    mc_xy31_w4_mmxext },
-            { mc_hv_w4,                 mc_xy12_w4_mmxext,    mc_hc_w4,             mc_xy32_w4_mmxext },
-            { mc_xy03_w4_mmxext,        mc_xy13_w4_mmxext,    mc_xy23_w4_mmxext,    mc_xy33_w4_mmxext },
-        },
-        {
-            { x264_mc_copy_w8_mmxext,   mc_xy10_w8_mmxext,    mc_hh_w8,             mc_xy30_w8_mmxext },
-            { mc_xy01_w8_mmxext,        mc_xy11_w8_mmxext,    mc_xy21_w8_mmxext,    mc_xy31_w8_mmxext },
-            { mc_hv_w8,                 mc_xy12_w8_mmxext,    mc_hc_w8,             mc_xy32_w8_mmxext },
-            { mc_xy03_w8_mmxext,        mc_xy13_w8_mmxext,    mc_xy23_w8_mmxext,    mc_xy33_w8_mmxext },
-        },
-        {
-            { x264_mc_copy_w16_mmxext,   mc_xy10_w16_mmxext,    mc_hh_w16,             mc_xy30_w16_mmxext },
-            { mc_xy01_w16_mmxext,        mc_xy11_w16_mmxext,    mc_xy21_w16_mmxext,    mc_xy31_w16_mmxext },
-            { mc_hv_w16,                 mc_xy12_w16_mmxext,    mc_hc_w16,             mc_xy32_w16_mmxext },
-            { mc_xy03_w16_mmxext,        mc_xy13_w16_mmxext,    mc_xy23_w16_mmxext,    mc_xy33_w16_mmxext },
-        }
-    };
-
-    MOTION_COMPENSATION_LUMA
-}
-
-static void motion_compensation_luma_sse2( uint8_t *src, int i_src_stride,
-                                           uint8_t *dst, int i_dst_stride,
-                                           int mvx,int mvy,
-                                           int i_width, int i_height )
-{
-    static const pf_mc_t pf_mc[3][4][4] =    /*XXX [dqy][dqx] */
-    {
-        {
-            { x264_mc_copy_w4_mmxext,   mc_xy10_w4_mmxext,    mc_hh_w4,             mc_xy30_w4_mmxext },
-            { mc_xy01_w4_mmxext,        mc_xy11_w4_mmxext,    mc_xy21_w4_mmxext,    mc_xy31_w4_mmxext },
-            { mc_hv_w4,                 mc_xy12_w4_mmxext,    mc_hc_w4,             mc_xy32_w4_mmxext },
-            { mc_xy03_w4_mmxext,        mc_xy13_w4_mmxext,    mc_xy23_w4_mmxext,    mc_xy33_w4_mmxext },
-        },
-        {
-            { x264_mc_copy_w8_mmxext,   mc_xy10_w8_mmxext,    mc_hh_w8,             mc_xy30_w8_mmxext },
-            { mc_xy01_w8_mmxext,        mc_xy11_w8_mmxext,    mc_xy21_w8_mmxext,    mc_xy31_w8_mmxext },
-            { mc_hv_w8,                 mc_xy12_w8_mmxext,    mc_hc_w8,             mc_xy32_w8_mmxext },
-            { mc_xy03_w8_mmxext,        mc_xy13_w8_mmxext,    mc_xy23_w8_mmxext,    mc_xy33_w8_mmxext },
-        },
-        {
-            { x264_mc_copy_w16_sse2,   mc_xy10_w16_sse2,    mc_hh_w16,             mc_xy30_w16_sse2 },
-            { mc_xy01_w16_sse2,        mc_xy11_w16_sse2,    mc_xy21_w16_sse2,    mc_xy31_w16_sse2 },
-            { mc_hv_w16,                 mc_xy12_w16_sse2,    mc_hc_w16,             mc_xy32_w16_sse2 },
-            { mc_xy03_w16_sse2,        mc_xy13_w16_sse2,    mc_xy23_w16_sse2,    mc_xy33_w16_sse2 },
-        }
-    };
-    MOTION_COMPENSATION_LUMA
-}
-
-#endif
-
 void mc_luma_mmx( uint8_t *src[4], int i_src_stride,
               uint8_t *dst,    int i_dst_stride,
               int mvx,int mvy,
@@ -1180,19 +203,3 @@ void x264_mc_sse2_init( x264_mc_functions_t *pf )
     pf->mc_luma   = mc_luma_mmx;
     pf->get_ref   = get_ref_mmx;
 }
-
-#if 0
-void get_funcs_mmx(pf_mc_t *int_h, pf_mc_t *int_v, pf_mc_t *int_hv)
-{
-    *int_h = mc_hh_w16;
-    *int_v = mc_hv_w16;
-    *int_hv = mc_hc_w16;
-}
-
-void get_funcs_sse2(pf_mc_t *int_h, pf_mc_t *int_v, pf_mc_t *int_hv)
-{
-    *int_h = mc_hh_w16;
-    *int_v = mc_hv_w16;
-    *int_hv = mc_hc_w16;
-}
-#endif
index 4b55596f99bf9783cb308d820ff154de1b59aee1..8bc7f674742619e681cb4ec6a169710bf7ecab9a 100644 (file)
@@ -155,24 +155,6 @@ static void predict_16x16_h( uint8_t *src, int i_stride )
 
 extern void predict_16x16_v_mmx( uint8_t *src, int i_stride );
 
-#if 0
-static void predict_16x16_v( uint8_t *src, int i_stride )
-{
-    int i;
-
-    asm volatile(
-        "movq  (%0), %%mm0\n"
-        "movq 8(%0), %%mm1\n" :: "r"(&src[-i_stride]) );
-
-    for( i = 0; i < 16; i++ )
-    {
-        asm volatile(
-            "movq %%mm0,  (%0)\n"
-            "movq %%mm1, 8(%0)\n" :: "r"(src) );
-        src += i_stride;
-    }
-}
-#endif
 
 /****************************************************************************
  * 8x8 prediction for intra chroma block DC, H, V, P
@@ -309,21 +291,6 @@ static void predict_8x8c_h( uint8_t *src, int i_stride )
 
 extern void predict_8x8c_v_mmx( uint8_t *src, int i_stride );
 
-#if 0
-static void predict_8x8c_v( uint8_t *src, int i_stride )
-{
-    int i;
-
-    asm volatile( "movq  (%0), %%mm0\n" :: "r"(&src[-i_stride]) );
-
-    for( i = 0; i < 8; i++ )
-    {
-        asm volatile( "movq %%mm0,  (%0)\n" :: "r"(src) );
-        src += i_stride;
-    }
-}
-#endif
-
 
 /****************************************************************************
  * 4x4 prediction for intra luma block
index 15d4498dc977daf427adb783ac919dc5f1f98077..2bc34c4a186fc3d7467966349b57e20ca546435f 100644 (file)
@@ -234,125 +234,6 @@ static inline void mc_hc( uint8_t *src, int i_src_stride, uint8_t *dst, int i_ds
     }
 }
 
-#if 0
-/* mc I+H */
-static void mc_xy10( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp[16*16];
-    mc_hh( src, i_src_stride, tmp, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, src, i_src_stride, tmp, i_width, i_width, i_height );
-}
-static void mc_xy30( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp[16*16];
-    mc_hh( src, i_src_stride, tmp, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, src+1, i_src_stride, tmp, i_width, i_width, i_height );
-}
-/* mc I+V */
-static void mc_xy01( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp[16*16];
-    mc_hv( src, i_src_stride, tmp, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, src, i_src_stride, tmp, i_width, i_width, i_height );
-}
-static void mc_xy03( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp[16*16];
-    mc_hv( src, i_src_stride, tmp, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, src+i_src_stride, i_src_stride, tmp, i_width, i_width, i_height );
-}
-/* H+V */
-static void mc_xy11( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hv( src, i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy31( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hv( src+1, i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src,   i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy13( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hv( src,              i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src+i_src_stride, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy33( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hv( src+1,            i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src+i_src_stride, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy21( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hc( src, i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy12( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hc( src, i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hv( src, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy32( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hc( src,   i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hv( src+1, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-static void mc_xy23( uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride, int i_width, int i_height )
-{
-    uint8_t tmp1[16*16];
-    uint8_t tmp2[16*16];
-
-    mc_hc( src,              i_src_stride, tmp1, i_width, i_width, i_height );
-    mc_hh( src+i_src_stride, i_src_stride, tmp2, i_width, i_width, i_height );
-    pixel_avg( dst, i_dst_stride, tmp1, i_width, tmp2, i_width, i_width, i_height );
-}
-
-static void motion_compensation_luma( uint8_t *src, int i_src_stride,
-                                      uint8_t *dst, int i_dst_stride,
-                                      int mvx,int mvy,
-                                      int i_width, int i_height )
-{
-    static pf_mc_t pf_mc[4][4] =    /*XXX [dqy][dqx] */
-    {
-        { mc_copy,  mc_xy10,    mc_hh,      mc_xy30 },
-        { mc_xy01,  mc_xy11,    mc_xy21,    mc_xy31 },
-        { mc_hv,    mc_xy12,    mc_hc,      mc_xy32 },
-        { mc_xy03,  mc_xy13,    mc_xy23,    mc_xy33 },
-    };
-
-    src += (mvy >> 2) * i_src_stride + (mvx >> 2);
-    pf_mc[mvy&0x03][mvx&0x03]( src, i_src_stride, dst, i_dst_stride, i_width, i_height );
-}
-#endif
-
 static void mc_luma( uint8_t *src[4], int i_src_stride,
                      uint8_t *dst,    int i_dst_stride,
                      int mvx,int mvy,
@@ -517,11 +398,6 @@ void x264_mc_init( int cpu, x264_mc_functions_t *pf )
 #endif
 }
 
-#if 0
-void get_funcs_mmx(pf_mc_t*, pf_mc_t*, pf_mc_t*);
-void get_funcs_sse2(pf_mc_t*, pf_mc_t*, pf_mc_t*);
-#endif
-
 extern void x264_horizontal_filter_mmxext( uint8_t *dst, int i_dst_stride,
                                            uint8_t *src, int i_src_stride,
                                            int i_width, int i_height );
@@ -540,18 +416,6 @@ void x264_frame_filter( int cpu, x264_frame_t *frame )
     pf_mc_t int_v = mc_hv;
     pf_mc_t int_hv = mc_hc;
 
-#if 0
-#ifdef HAVE_MMXEXT
-    if( cpu&X264_CPU_MMXEXT )
-        get_funcs_mmx(&int_h, &int_v, &int_hv);
-#endif
-
-#ifdef HAVE_SSE2
-    if( cpu&X264_CPU_SSE2 )
-        get_funcs_sse2(&int_h, &int_v, &int_hv);
-#endif
-#endif
-
 #ifdef HAVE_MMXEXT
     if ( cpu & X264_CPU_MMXEXT )
     {
index f22b183364c65ee35b55677343183c980d06e292..c17e95f843f06717433d6ee10a08b40b31aba744 100644 (file)
@@ -141,23 +141,6 @@ typedef struct
     int b_pic_order;
     int i_num_slice_groups;
 
-#if 0
-    /* FIXME: if this stuff is ever needed, move SPS/PPS from x264_t
-     * to the heap, to avoid excessive memcpy'ing with threads. */
-    int i_slice_group_map_type;
-    /* i_slice_group_map_type == 0 */
-    int i_run_length[256];      /* FIXME */
-    /* i_slice_group_map_type == 2 */
-    int i_top_left[256];        /* FIXME */
-    int i_bottom_right[256];    /* FIXME */
-    /* i_slice_group_map_type == 3, 4, 5 */
-    int b_slice_group_change_direction;
-    int i_slice_group_change_rate;
-    /* i_slice_group_map_type == 6 */
-    int i_pic_size_in_map_units;
-    int i_slice_group_id[256];  /* FIXME */
-#endif
-
     int i_num_ref_idx_l0_active;
     int i_num_ref_idx_l1_active;
 
index 6f32938a9794fee06101e3da7f4acaad31f8d15e..7017400aff371e973240b9d355a996a8560296bd 100644 (file)
@@ -301,16 +301,6 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal
         bs_write_ue( s, sh->i_cabac_init_idc );
     }
     bs_write_se( s, sh->i_qp_delta );      /* slice qp delta */
-#if 0
-    if( sh->i_type == SLICE_TYPE_SP || sh->i_type == SLICE_TYPE_SI )
-    {
-        if( sh->i_type == SLICE_TYPE_SP )
-        {
-            bs_write1( s, sh->b_sp_for_swidth );
-        }
-        bs_write_se( s, sh->i_qs_delta );
-    }
-#endif
 
     if( sh->pps->b_deblocking_filter_control )
     {
@@ -1037,23 +1027,6 @@ static int x264_slice_write( x264_t *h )
     {
         x264_cabac_encode_flush( &h->cabac );
 
-#if 0
-        /* The standard doesn't explain why one should perform cabac byte stuffing,
-         * and I see no possible reason. Decoding works fine without it;
-         * JM and libavcodec don't even check whether it's present.
-         * Stuffing can cost up to 25% of the total bitrate and 3% of encode time
-         * in lossless mode. */
-
-        int i_cabac_word = ((h->cabac.i_sym_cnt
-                             - 96 * h->sps->i_mb_width * h->sps->i_mb_height) * 3/32
-                           - bs_pos(&h->out.bs)/8)/3;
-
-        while( i_cabac_word > 0 )
-        {
-            bs_write( &h->out.bs, 16, 0x0000 );
-            i_cabac_word--;
-        }
-#endif
     }
     else
     {
@@ -1600,16 +1573,6 @@ do_encode:
 #ifdef DEBUG_DUMP_FRAME
     /* Dump reconstructed frame */
     x264_frame_dump( h, frame_psnr, "fdec.yuv" );
-#endif
-#if 0
-    if( h->i_ref0 > 0 )
-    {
-        x264_frame_dump( h, h->fref0[0], "ref0.yuv" );
-    }
-    if( h->i_ref1 > 0 )
-    {
-        x264_frame_dump( h, h->fref1[0], "ref1.yuv" );
-    }
 #endif
     return 0;
 }
index c25538cf8eb064c90feda28a667388b2b17083db..708197038c487b69266233d5e018d4bad389882b 100644 (file)
@@ -147,108 +147,6 @@ static void quant_2x2_dc( x264_t *h, int16_t dct[2][2], int quant_mf[6][4][4], i
     h->quantf.quant_2x2_dc_core( dct, quant_mf[i_mf][0][0], i_qbits, f );
 }
 
-#if 0
-/* From a JVT doc */
-static const int f_deadzone_intra[4][4][2] = /* [num][den] */
-{
-    { {1,2}, {3,7}, {2,5}, {1,3} },
-    { {3,7}, {2,5}, {1,3}, {1,4} },
-    { {2,5}, {1,3}, {1,4}, {1,5} },
-    { {1,3}, {1,4}, {1,5}, {1,5} }
-};
-static const int f_deadzone_inter[4][4][2] = /* [num][den] */
-{
-    { {1,3}, {2,7}, {4,15},{2,9} },
-    { {2,7}, {4,15},{2,9}, {1,6} },
-    { {4,15},{2,9}, {1,6}, {1,7} },
-    { {2,9}, {1,6}, {1,7}, {2,15} }
-};
-
-
-static void quant_4x4( int16_t dct[4][4], int i_qscale, int b_intra )
-{
-    const int(*f_deadzone)[4][4][2] = b_intra ? &f_deadzone_intra : &f_deadzone_inter;
-    const int i_qbits = 15 + i_qscale / 6;
-    const int i_mf = i_qscale % 6;
-
-    int x,y;
-    for( y = 0; y < 4; y++ )
-    {
-        for( x = 0; x < 4; x++ )
-        {
-#if 0
-            const int f = b_intra ?
-                          (f_deadzone_intra[y][x][0] * ( 1 << i_qbits ) / f_deadzone_intra[y][x][1])
-                          :
-                          (f_deadzone_inter[y][x][0] * ( 1 << i_qbits ) / f_deadzone_inter[y][x][1]);
-#else
-            const int f = (*f_deadzone)[y][x][0] * ( 1 << i_qbits ) / (*f_deadzone)[y][x][1];
-#endif
-
-            if( dct[y][x] > 0 )
-            {
-                dct[y][x] =( f + dct[y][x]  * quant_mf[i_mf][y][x] ) >> i_qbits;
-            }
-            else
-            {
-                dct[y][x] = - ( ( f - dct[y][x]  * quant_mf[i_mf][y][x] ) >> i_qbits );
-            }
-        }
-    }
-}
-
-static void quant_4x4_dc( int16_t dct[4][4], int i_qscale )
-{
-    const int i_qbits = 15 + i_qscale / 6;
-    const int i_qmf = quant_mf[i_qscale%6][0][0];
-    const int f2 = f_deadzone_intra[0][0][0] * ( 2 << i_qbits ) / f_deadzone_intra[0][0][1];
-    int x,y;
-
-    for( y = 0; y < 4; y++ )
-    {
-        for( x = 0; x < 4; x++ )
-        {
-
-            if( dct[y][x] > 0 )
-            {
-                dct[y][x] =( f2 + dct[y][x]  * i_qmf) >> ( 1 + i_qbits );
-            }
-            else
-            {
-                dct[y][x] = - ( ( f2 - dct[y][x]  * i_qmf ) >> (1 + i_qbits ) );
-            }
-        }
-    }
-}
-
-static void quant_2x2_dc( int16_t dct[2][2], int i_qscale, int b_intra )
-{
-    int const i_qbits = 15 + i_qscale / 6;
-    const int i_qmf = quant_mf[i_qscale%6][0][0];
-    const int f2 = b_intra ?
-                   (f_deadzone_intra[0][0][0] * ( 2 << i_qbits ) / f_deadzone_intra[0][0][1])
-                   :
-                   (f_deadzone_inter[0][0][0] * ( 2 << i_qbits ) / f_deadzone_inter[0][0][1]);
-    int x,y;
-    for( y = 0; y < 2; y++ )
-    {
-        for( x = 0; x < 2; x++ )
-        {
-            if( dct[y][x] > 0 )
-            {
-                dct[y][x] =( f2 + dct[y][x]  * i_qmf) >> ( 1 + i_qbits );
-            }
-            else
-            {
-                dct[y][x] = - ( ( f2 - dct[y][x]  * i_qmf ) >> (1 + i_qbits ) );
-            }
-        }
-    }
-}
-
-
-#endif
-
 /* (ref: JVT-B118)
  * x264_mb_decimate_score: given dct coeffs it returns a score to see if we could empty this dct coeffs
  * to 0 (low score means set it to null)
index e36741bd381b569f6d0127931e47c1fcb5ae5bd6..808a129946d9907aa27d1a61ce444487847d969f 100644 (file)
@@ -162,16 +162,6 @@ static inline double qscale2bits(ratecontrol_entry_t *rce, double qscale)
            + rce->mv_bits * pow( X264_MAX(rce->qscale, 12) / X264_MAX(qscale, 12), 0.5 );
 }
 
-/* There is no analytical inverse to the above formula. */
-#if 0
-static inline double bits2qscale(ratecontrol_entry_t *rce, double bits)
-{
-    if(bits<1.0)
-        bits = 1.0;
-    return (rce->i_tex_bits + rce->p_tex_bits + rce->mv_bits + .1) * rce->qscale / bits;
-}
-#endif
-
 
 int x264_ratecontrol_new( x264_t *h )
 {
@@ -249,12 +239,6 @@ int x264_ratecontrol_new( x264_t *h )
         rc->pred[i].count= 1.0;
         rc->pred[i].decay= 0.5;
     }
-#if 0 // FIXME: do we want to assign lmin/lmax based on ip_factor, or leave them all the same?
-    rc->lmin[SLICE_TYPE_I] /= fabs(h->param.f_ip_factor);
-    rc->lmax[SLICE_TYPE_I] /= fabs(h->param.f_ip_factor);
-    rc->lmin[SLICE_TYPE_B] *= fabs(h->param.f_pb_factor);
-    rc->lmax[SLICE_TYPE_B] *= fabs(h->param.f_pb_factor);
-#endif
 
     if( parse_zones( h ) < 0 )
         return -1;
index 7ee0b432fe4c15f44561d2dcc11cc7aeb2f27adf..9877989873a3922bf98a49e695de3655910aa2e4 100644 (file)
@@ -366,41 +366,6 @@ void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *
     pps->b_pic_order = 0;
     pps->i_num_slice_groups = 1;
 
-#if 0
-    if( pps->i_num_slice_groups > 1 )
-    {
-        pps->i_slice_group_map_type = 0;
-        if( pps->i_slice_group_map_type == 0 )
-        {
-            for( i = 0; i < pps->i_num_slice_groups; i++ )
-            {
-                pps->i_run_length[i] = 1;
-            }
-        }
-        else if( pps->i_slice_group_map_type == 2 )
-        {
-            for( i = 0; i < pps->i_num_slice_groups; i++ )
-            {
-                pps->i_top_left[i] = 0;
-                pps->i_bottom_right[i] = 0;
-            }
-        }
-        else if( pps->i_slice_group_map_type >= 3 &&
-                 pps->i_slice_group_map_type <= 5 )
-        {
-            pps->b_slice_group_change_direction = 0;
-            pps->i_slice_group_change_rate = 0;
-        }
-        else if( pps->i_slice_group_map_type == 6 )
-        {
-            pps->i_pic_size_in_map_units = 1;
-            for( i = 0; i < pps->i_pic_size_in_map_units; i++ )
-            {
-                pps->i_slice_group_id[i] = 0;
-            }
-        }
-    }
-#endif
     pps->i_num_ref_idx_l0_active = 1;
     pps->i_num_ref_idx_l1_active = 1;
 
@@ -452,47 +417,6 @@ void x264_pps_write( bs_t *s, x264_pps_t *pps )
     bs_write( s, 1, pps->b_pic_order );
     bs_write_ue( s, pps->i_num_slice_groups - 1 );
 
-#if 0
-    if( pps->i_num_slice_groups > 1 )
-    {
-        int i;
-
-        bs_write_ue( s, pps->i_slice_group_map_type );
-        if( pps->i_slice_group_map_type == 0 )
-        {
-            for( i = 0; i < pps->i_num_slice_groups; i++ )
-            {
-                bs_write_ue( s, pps->i_run_length[i] - 1 );
-            }
-        }
-        else if( pps->i_slice_group_map_type == 2 )
-        {
-            for( i = 0; i < pps->i_num_slice_groups; i++ )
-            {
-                bs_write_ue( s, pps->i_top_left[i] );
-                bs_write_ue( s, pps->i_bottom_right[i] );
-            }
-        }
-        else if( pps->i_slice_group_map_type >= 3 &&
-                 pps->i_slice_group_map_type <= 5 )
-        {
-            bs_write( s, 1, pps->b_slice_group_change_direction );
-            bs_write_ue( s, pps->b_slice_group_change_direction - 1 );
-        }
-        else if( pps->i_slice_group_map_type == 6 )
-        {
-            bs_write_ue( s, pps->i_pic_size_in_map_units - 1 );
-            for( i = 0; i < pps->i_pic_size_in_map_units; i++ )
-            {
-                /* FIXME */
-                /* bs_write( s, ceil( log2( pps->i_pic_size_in_map_units +1 ) ),
-                 *              pps->i_slice_group_id[i] );
-                 */
-            }
-        }
-    }
-#endif
-
     bs_write_ue( s, pps->i_num_ref_idx_l0_active - 1 );
     bs_write_ue( s, pps->i_num_ref_idx_l1_active - 1 );
     bs_write( s, 1, pps->b_weighted_pred );
index 5226f547f017c35cc43d19229885520b64c81a92..476b8006b3b7b7bd14a6728548a4de5ad70fc01f 100644 (file)
@@ -259,6 +259,8 @@ void x264_slicetype_analyse( x264_t *h )
     int num_frames;
     int keyint_limit;
     int j;
+    int i_mb_count = (h->sps->i_mb_width - 2) * (h->sps->i_mb_height - 2);
+    int cost1p0, cost2p0, cost1b1, cost2p1;
 
     if( !h->frames.last_nonb )
         return;
@@ -278,91 +280,38 @@ no_b_frames:
 
     x264_lowres_context_init( h, &a );
 
-#if 0
-    /* BFS over possible frame types for minimum total SATD cost.
-     * requires higher encoding delay to be effective. */
-    {
-        int p0, p1, b;
-        struct {
-            int64_t score;
-            char path[X264_BFRAME_MAX+1];
-        } paths[X264_BFRAME_MAX+1];
-
-        for( p1 = 1; frames[p1]; p1++ )
-            for( p0 = X264_MAX(0, p1 - h->param.i_bframe - 1); p0 < p1; p0++ )
-                for( b = p0+1; b <= p1; b++ )
-                    x264_slicetype_frame_cost( h, &a, frames, p0, p1, b );
-        p1--;
+    cost2p1 = x264_slicetype_frame_cost( h, &a, frames, 0, 2, 2 );
+    if( frames[2]->i_intra_mbs[2] > i_mb_count / 2 )
+        goto no_b_frames;
 
-        paths[0].score = 0;
-
-        for( j = 1; j <= p1; j++ )
-        {
-            int k, i;
-            paths[j].score = INT_MAX;
-            
-            for( k = 1; k <= X264_MIN( j, h->param.i_bframe + 1 ); k++ )
-            {
-                int64_t sum = paths[j-k].score;
-                for( i = 0; i < k; i++ )
-                    sum += frames[j-k+i+1]->i_cost_est[(j-k+i+1) - (j-k)][j - (j-k+i+1)];
-                if( sum < paths[j].score )
-                {
-                    paths[j].score = sum;
-                    for( i = 0; i < j-k; i++ )
-                        paths[j].path[i] = paths[j-k].path[i];
-                    for( i = j-k; i < j-1; i++ )
-                        paths[j].path[i] = 'B';
-                    paths[j].path[j-1] = 'P';
-                    paths[j].path[j] = 0;
-                    fprintf( stderr, "path: %-8s %7lld \n", paths[j].path, sum );
-                }
-            }
-        }
-
-        for( j = 0; paths[p1].path[j] == 'B'; j++ )
-            frames[j+1]->i_type = X264_TYPE_B;
-        frames[j+1]->i_type = X264_TYPE_P;
-    }
-#else
-    {
-        int i_mb_count = (h->sps->i_mb_width - 2) * (h->sps->i_mb_height - 2);
-        int cost1p0, cost2p0, cost1b1, cost2p1;
-
-        cost2p1 = x264_slicetype_frame_cost( h, &a, frames, 0, 2, 2 );
-        if( frames[2]->i_intra_mbs[2] > i_mb_count / 2 )
-            goto no_b_frames;
-
-        cost2p0 = x264_slicetype_frame_cost( h, &a, frames, 1, 2, 2 );
-        cost1p0 = x264_slicetype_frame_cost( h, &a, frames, 0, 1, 1 );
-        cost1b1 = x264_slicetype_frame_cost( h, &a, frames, 0, 2, 1 );
-//      fprintf( stderr, "PP: %d + %d <=> BP: %d + %d \n",
-//               cost1p0, cost2p0, cost1b1, cost2p1 );
-        if( cost1p0 + cost2p0 < cost1b1 + cost2p1 )
-            goto no_b_frames;
+    cost2p0 = x264_slicetype_frame_cost( h, &a, frames, 1, 2, 2 );
+    cost1p0 = x264_slicetype_frame_cost( h, &a, frames, 0, 1, 1 );
+    cost1b1 = x264_slicetype_frame_cost( h, &a, frames, 0, 2, 1 );
+//  fprintf( stderr, "PP: %d + %d <=> BP: %d + %d \n",
+//           cost1p0, cost2p0, cost1b1, cost2p1 );
+    if( cost1p0 + cost2p0 < cost1b1 + cost2p1 )
+        goto no_b_frames;
 
 // arbitrary and untuned
 #define INTER_THRESH 300
 #define P_SENS_BIAS (50 - h->param.i_bframe_bias)
-        frames[1]->i_type = X264_TYPE_B;
+    frames[1]->i_type = X264_TYPE_B;
 
-        for( j = 2; j <= X264_MIN( h->param.i_bframe, num_frames-1 ); j++ )
+    for( j = 2; j <= X264_MIN( h->param.i_bframe, num_frames-1 ); j++ )
+    {
+        int pthresh = X264_MAX(INTER_THRESH - P_SENS_BIAS * (j-1), INTER_THRESH/10);
+        int pcost = x264_slicetype_frame_cost( h, &a, frames, 0, j+1, j+1 );
+//      fprintf( stderr, "frm%d+%d: %d <=> %d, I:%d/%d \n",
+//               frames[0]->i_frame, j-1, pthresh, pcost/i_mb_count,
+//               frames[j+1]->i_intra_mbs[j+1], i_mb_count );
+        if( pcost > pthresh*i_mb_count || frames[j+1]->i_intra_mbs[j+1] > i_mb_count/3 )
         {
-            int pthresh = X264_MAX(INTER_THRESH - P_SENS_BIAS * (j-1), INTER_THRESH/10);
-            int pcost = x264_slicetype_frame_cost( h, &a, frames, 0, j+1, j+1 );
-//          fprintf( stderr, "frm%d+%d: %d <=> %d, I:%d/%d \n",
-//                   frames[0]->i_frame, j-1, pthresh, pcost/i_mb_count,
-//                   frames[j+1]->i_intra_mbs[j+1], i_mb_count );
-            if( pcost > pthresh*i_mb_count || frames[j+1]->i_intra_mbs[j+1] > i_mb_count/3 )
-            {
-                frames[j]->i_type = X264_TYPE_P;
-                break;
-            }
-            else
-                frames[j]->i_type = X264_TYPE_B;
+            frames[j]->i_type = X264_TYPE_P;
+            break;
         }
+        else
+            frames[j]->i_type = X264_TYPE_B;
     }
-#endif
 }
 
 void x264_slicetype_decide( x264_t *h )
index 8ff165f869bdb82a53d331fad9392e128477f79f..e938f554c6e014bc55094a501295515e13a9e2c3 100644 (file)
@@ -63,15 +63,7 @@ char *optarg;        /* argument associated with option */
 __weak_alias(getopt_long,_getopt_long)
 #endif
 
-#if 0
-#ifndef __CYGWIN__
-#define __progname __argv[0]
-#else
-extern char *__progname;
-#endif
-#else
 char *__progname = "x264";
-#endif
 
 #define IGNORE_FIRST   (*options == '-' || *options == '+')
 #define PRINT_ERROR    ((opterr) && ((*options != ':') \
index 35bfc34206467e527c3f562170860ee47dbd40a7..518b70d36617fe779dd6a6910dcac5dc81e68844 100644 (file)
@@ -199,22 +199,6 @@ LRESULT WINAPI DriverProc( DWORD dwDriverId, HDRVR hDriver, UINT uMsg, LPARAM lP
         case ICM_DECOMPRESSEX:
             return ICERR_UNSUPPORTED;
 
-#if 0
-        /* VFWEXT entry point : XXX what's that ? */
-        case ICM_USER+0x0fff :
-            if (lParam1 == VFWEXT_CONFIGURE_INFO) {
-                VFWEXT_CONFIGURE_INFO_T * info = (VFWEXT_CONFIGURE_INFO_T*)lParam2;
-                DPRINTF("%i %i %i %i %i %i",
-                    info->ciWidth, info->ciHeight,
-                    info->ciRate, info->ciScale,
-                    info->ciActiveFrame, info->ciFrameCount);
-
-                codec->config.ci_valid = 1;
-                memcpy(&codec->config.ci, (void*)lParam2, sizeof(VFWEXT_CONFIGURE_INFO_T));
-                return ICERR_OK;
-            }
-            return ICERR_UNSUPPORTED;
-#endif
         default:
         if (uMsg < DRV_USER)
             return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
diff --git a/x264.c b/x264.c
index 67f774945701def41901d2e194760f7e6fb07950..5292eac339568d48ea84a08a72f7156f647b5067 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -980,146 +980,6 @@ static int  Parse( int argc, char **argv,
 /*****************************************************************************
  * Decode:
  *****************************************************************************/
-#if 0
-static int  Decode( x264_param_t  *param, FILE *fh26l, hnd_t hout )
-{
-    fprintf( stderr, "decompressor not working (help is welcome)\n" );
-    return -1;
-    x264_nal_t nal;
-    int i_data;
-    int b_eof;
-
-    //param.cpu = 0;
-    if( ( h = x264_decoder_open( &param ) ) == NULL )
-    {
-        fprintf( stderr, "x264_decoder_open failed\n" );
-        return -1;
-    }
-
-    i_start = x264_mdate();
-    b_eof = 0;
-    i_frame = 0;
-    i_data  = 0;
-    nal.p_payload = malloc( DATA_MAX );
-
-    while( !b_ctrl_c )
-    {
-        uint8_t *p, *p_next, *end;
-        int i_size;
-        /* fill buffer */
-        if( i_data < DATA_MAX && !b_eof )
-        {
-            int i_read = fread( &data[i_data], 1, DATA_MAX - i_data, fh26l );
-            if( i_read <= 0 )
-            {
-                b_eof = 1;
-            }
-            else
-            {
-                i_data += i_read;
-            }
-        }
-
-        if( i_data < 3 )
-        {
-            break;
-        }
-
-        end = &data[i_data];
-
-        /* extract one nal */
-        p = &data[0];
-        while( p < end - 3 )
-        {
-            if( p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 )
-            {
-                break;
-            }
-            p++;
-        }
-
-        if( p >= end - 3 )
-        {
-            fprintf( stderr, "garbage (i_data = %d)\n", i_data );
-            i_data = 0;
-            continue;
-        }
-
-        p_next = p + 3;
-        while( p_next < end - 3 )
-        {
-            if( p_next[0] == 0x00 && p_next[1] == 0x00 && p_next[2] == 0x01 )
-            {
-                break;
-            }
-            p_next++;
-        }
-
-        if( p_next == end - 3 && i_data < DATA_MAX )
-        {
-            p_next = end;
-        }
-
-        /* decode this nal */
-        i_size = p_next - p - 3;
-        if( i_size <= 0 )
-        {
-            if( b_eof )
-            {
-                break;
-            }
-            fprintf( stderr, "nal too large (FIXME) ?\n" );
-            i_data = 0;
-            continue;
-        }
-
-        x264_nal_decode( &nal, p +3, i_size );
-
-        /* decode the content of the nal */
-        x264_decoder_decode( h, &pic, &nal );
-
-        if( pic != NULL )
-        {
-            int i;
-
-            i_frame++;
-
-            for( i = 0; i < pic->i_plane;i++ )
-            {
-                int i_line;
-                int i_div;
-
-                i_div = i==0 ? 1 : 2;
-                for( i_line = 0; i_line < pic->i_height/i_div; i_line++ )
-                {
-                    fwrite( pic->plane[i]+i_line*pic->i_stride[i], 1, pic->i_width/i_div, hout );
-                }
-            }
-        }
-
-        memmove( &data[0], p_next, end - p_next );
-        i_data -= p_next - &data[0];
-    }
-
-    i_end = x264_mdate();
-    free( nal.p_payload );
-    fprintf( stderr, "\n" );
-
-    x264_decoder_close( h );
-
-    fclose( fh26l );
-    if( hout != stdout )
-    {
-        fclose( hout );
-    }
-    if( i_frame > 0 )
-    {
-        double fps = (double)i_frame * (double)1000000 /
-                     (double)( i_end - i_start );
-        fprintf( stderr, "decoded %d frames %ffps\n", i_frame, fps );
-    }
-}
-#endif
 
 static int  Encode_frame( x264_t *h, hnd_t hout, x264_picture_t *pic )
 {
diff --git a/x264.h b/x264.h
index a0158007e0ddd448fc3133a51dd7939a27e34225..a60babc889354d6d14d1e4b151c940ae0b4e7298 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -344,22 +344,6 @@ int     x264_encoder_encode ( x264_t *, x264_nal_t **, int *, x264_picture_t *,
 void    x264_encoder_close  ( x264_t * );
 
 /* XXX: decoder isn't working so no need to export it */
-#if 0
-/****************************************************************************
- * Decoder functions:
- ****************************************************************************
- * XXX: Not yet working so do not try ...
- ****************************************************************************/
-/* x264_decoder_open:
- */
-x264_t *x264_decoder_open   ( x264_param_t * );
-/* x264_decoder_decode:
- */
-int     x264_decoder_decode ( x264_t *, x264_picture_t **, x264_nal_t * );
-/* x264_decoder_close:
- */
-void    x264_decoder_close  ( x264_t * );
-#endif
 
 /****************************************************************************
  * Private stuff for internal usage: