]> git.sesse.net Git - x264/blobdiff - common/deblock.c
Use a 16-bit buffer in hpel_filter regardless of bit depth
[x264] / common / deblock.c
index 784710e05b290f55cfd18285efbe42dfc2e23737..97311176ab19130e345fbe1bfc104394728f7611 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * deblock.c: h264 encoder library
+ * deblock.c: deblocking
  *****************************************************************************
- * Copyright (C) 2003-2008 x264 project
+ * Copyright (C) 2003-2010 x264 project
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Loren Merritt <lorenm@u.washington.edu>
  * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
  *****************************************************************************/
 
 #include "common.h"
 
 /* Deblocking filter */
-static const uint8_t i_alpha_table[52+12*2] =
+static const uint8_t i_alpha_table[52+12*3] =
 {
+     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,  4,  4,  5,  6,
@@ -36,8 +40,9 @@ static const uint8_t i_alpha_table[52+12*2] =
    255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,
 };
-static const uint8_t i_beta_table[52+12*2] =
+static const uint8_t i_beta_table[52+12*3] =
 {
+     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,  2,  2,  2,  3,
@@ -47,12 +52,14 @@ static const uint8_t i_beta_table[52+12*2] =
     18, 18,
     18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
 };
-static const int8_t i_tc0_table[52+12*2][4] =
+static const int8_t i_tc0_table[52+12*3][4] =
 {
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 },
     {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 },
     {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 },
@@ -63,9 +70,9 @@ static const int8_t i_tc0_table[52+12*2][4] =
     {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
     {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
 };
-#define alpha_table(x) i_alpha_table[(x)+12]
-#define beta_table(x)  i_beta_table[(x)+12]
-#define tc0_table(x)   i_tc0_table[(x)+12]
+#define alpha_table(x) i_alpha_table[(x)+24]
+#define beta_table(x)  i_beta_table[(x)+24]
+#define tc0_table(x)   i_tc0_table[(x)+24]
 
 /* From ffmpeg */
 static inline void deblock_luma_c( pixel *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0 )
@@ -130,7 +137,8 @@ static inline void deblock_chroma_c( pixel *pix, int xstride, int ystride, int a
             pix += 2*ystride;
             continue;
         }
-        for( int d = 0; d < 2; d++ )
+        for( int d = 0; d < 2; d++, pix += ystride-2 )
+        for( int e = 0; e < 2; e++, pix++ )
         {
             int p1 = pix[-2*xstride];
             int p0 = pix[-1*xstride];
@@ -143,17 +151,16 @@ static inline void deblock_chroma_c( pixel *pix, int xstride, int ystride, int a
                 pix[-1*xstride] = x264_clip_pixel( p0 + delta );    /* p0' */
                 pix[ 0*xstride] = x264_clip_pixel( q0 - delta );    /* q0' */
             }
-            pix += ystride;
         }
     }
 }
 static void deblock_v_chroma_c( pixel *pix, int stride, int alpha, int beta, int8_t *tc0 )
 {
-    deblock_chroma_c( pix, stride, 1, alpha, beta, tc0 );
+    deblock_chroma_c( pix, stride, 2, alpha, beta, tc0 );
 }
 static void deblock_h_chroma_c( pixel *pix, int stride, int alpha, int beta, int8_t *tc0 )
 {
-    deblock_chroma_c( pix, 1, stride, alpha, beta, tc0 );
+    deblock_chroma_c( pix, 2, stride, alpha, beta, tc0 );
 }
 
 static inline void deblock_luma_intra_c( pixel *pix, int xstride, int ystride, int alpha, int beta )
@@ -208,9 +215,10 @@ static void deblock_h_luma_intra_c( pixel *pix, int stride, int alpha, int beta
     deblock_luma_intra_c( pix, 1, stride, alpha, beta );
 }
 
-static inline void deblock_chroma_intra_c( pixel *pix, int xstride, int ystride, int alpha, int beta )
+static inline void deblock_chroma_intra_c( pixel *pix, int xstride, int ystride, int alpha, int beta, int dir )
 {
-    for( int d = 0; d < 8; d++ )
+    for( int d = 0; d < (dir?16:8); d++, pix += ystride-2 )
+    for( int e = 0; e < (dir?1:2); e++, pix++ )
     {
         int p1 = pix[-2*xstride];
         int p0 = pix[-1*xstride];
@@ -222,16 +230,15 @@ static inline void deblock_chroma_intra_c( pixel *pix, int xstride, int ystride,
             pix[-1*xstride] = (2*p1 + p0 + q1 + 2) >> 2;   /* p0' */
             pix[ 0*xstride] = (2*q1 + q0 + p1 + 2) >> 2;   /* q0' */
         }
-        pix += ystride;
     }
 }
 static void deblock_v_chroma_intra_c( pixel *pix, int stride, int alpha, int beta )
 {
-    deblock_chroma_intra_c( pix, stride, 1, alpha, beta );
+    deblock_chroma_intra_c( pix, stride, 2, alpha, beta, 1 );
 }
 static void deblock_h_chroma_intra_c( pixel *pix, int stride, int alpha, int beta )
 {
-    deblock_chroma_intra_c( pix, 1, stride, alpha, beta );
+    deblock_chroma_intra_c( pix, 2, stride, alpha, beta, 0 );
 }
 
 static void deblock_strength_c( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
@@ -263,37 +270,36 @@ static void deblock_strength_c( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264
     }
 }
 
-static inline void deblock_edge( x264_t *h, pixel *pix1, pixel *pix2, int i_stride, uint8_t bS[4], int i_qp, int b_chroma, x264_deblock_inter_t pf_inter )
+static inline void deblock_edge( x264_t *h, pixel *pix, int i_stride, uint8_t bS[4], int i_qp, int b_chroma, x264_deblock_inter_t pf_inter )
 {
-    int index_a = i_qp + h->sh.i_alpha_c0_offset;
-    int alpha = alpha_table(index_a);
-    int beta  = beta_table(i_qp + h->sh.i_beta_offset);
+    int index_a = i_qp-QP_BD_OFFSET + h->sh.i_alpha_c0_offset;
+    int index_b = i_qp-QP_BD_OFFSET + h->sh.i_beta_offset;
+    int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
+    int beta  = beta_table(index_b) << (BIT_DEPTH-8);
     int8_t tc[4];
 
     if( !M32(bS) || !alpha || !beta )
         return;
 
-    tc[0] = tc0_table(index_a)[bS[0]] + b_chroma;
-    tc[1] = tc0_table(index_a)[bS[1]] + b_chroma;
-    tc[2] = tc0_table(index_a)[bS[2]] + b_chroma;
-    tc[3] = tc0_table(index_a)[bS[3]] + b_chroma;
+    tc[0] = (tc0_table(index_a)[bS[0]] << (BIT_DEPTH-8)) + b_chroma;
+    tc[1] = (tc0_table(index_a)[bS[1]] << (BIT_DEPTH-8)) + b_chroma;
+    tc[2] = (tc0_table(index_a)[bS[2]] << (BIT_DEPTH-8)) + b_chroma;
+    tc[3] = (tc0_table(index_a)[bS[3]] << (BIT_DEPTH-8)) + b_chroma;
 
-    pf_inter( pix1, i_stride, alpha, beta, tc );
-    if( b_chroma )
-        pf_inter( pix2, i_stride, alpha, beta, tc );
+    pf_inter( pix, i_stride, alpha, beta, tc );
 }
 
-static inline void deblock_edge_intra( x264_t *h, pixel *pix1, pixel *pix2, int i_stride, uint8_t bS[4], int i_qp, int b_chroma, x264_deblock_intra_t pf_intra )
+static inline void deblock_edge_intra( x264_t *h, pixel *pix, int i_stride, uint8_t bS[4], int i_qp, int b_chroma, x264_deblock_intra_t pf_intra )
 {
-    int alpha = alpha_table(i_qp + h->sh.i_alpha_c0_offset);
-    int beta  = beta_table(i_qp + h->sh.i_beta_offset);
+    int index_a = i_qp-QP_BD_OFFSET + h->sh.i_alpha_c0_offset;
+    int index_b = i_qp-QP_BD_OFFSET + h->sh.i_beta_offset;
+    int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
+    int beta  = beta_table(index_b) << (BIT_DEPTH-8);
 
     if( !alpha || !beta )
         return;
 
-    pf_intra( pix1, i_stride, alpha, beta );
-    if( b_chroma )
-        pf_intra( pix2, i_stride, alpha, beta );
+    pf_intra( pix, i_stride, alpha, beta );
 }
 
 void x264_frame_deblock_row( x264_t *h, int mb_y )
@@ -305,7 +311,7 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
     int strideuv  = h->fdec->i_stride[1];
     int stride2uv = strideuv << b_interlaced;
 
-    for( int mb_x = 0; mb_x < h->sps->i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
+    for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
     {
         x264_prefetch_fenc( h, h->fdec, mb_x, mb_y );
         x264_macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
@@ -313,16 +319,14 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
         int mb_xy = h->mb.i_mb_xy;
         int transform_8x8 = h->mb.mb_transform_size[h->mb.i_mb_xy];
         int intra_cur = IS_INTRA( h->mb.type[mb_xy] );
-        uint8_t (*bs)[4][4] = h->deblock_strength[mb_y&b_interlaced][mb_x];
+        uint8_t (*bs)[4][4] = h->deblock_strength[mb_y&1][mb_x];
 
         pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey  + 16*mb_x;
-        pixel *pixu = h->fdec->plane[1] +  8*mb_y*strideuv +  8*mb_x;
-        pixel *pixv = h->fdec->plane[2] +  8*mb_y*strideuv +  8*mb_x;
+        pixel *pixuv = h->fdec->plane[1] + 8*mb_y*strideuv + 16*mb_x;
         if( mb_y & b_interlaced )
         {
             pixy -= 15*stridey;
-            pixu -=  7*strideuv;
-            pixv -=  7*strideuv;
+            pixuv -= 7*strideuv;
         }
 
         int qp = h->mb.qp[mb_xy];
@@ -332,11 +336,11 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
         #define FILTER( intra, dir, edge, qp, chroma_qp )\
         do\
         {\
-            deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1), NULL,\
+            deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1),\
                                  stride2y, bs[dir][edge], qp, 0,\
                                  h->loopf.deblock_luma##intra[dir] );\
             if( !(edge & 1) )\
-                deblock_edge##intra( h, pixu + 2*edge*(dir?stride2uv:1), pixv + 2*edge*(dir?stride2uv:1),\
+                deblock_edge##intra( h, pixuv + 2*edge*(dir?stride2uv:2),\
                                      stride2uv, bs[dir][edge], chroma_qp, 1,\
                                      h->loopf.deblock_chroma##intra[dir] );\
         } while(0)
@@ -382,19 +386,64 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
                                  FILTER( , 1, 2, qp, qpc );
             if( !transform_8x8 ) FILTER( , 1, 3, qp, qpc );
         }
+
+        #undef FILTER
     }
 }
 
-#ifdef HAVE_MMX
-void x264_deblock_v_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
+/* For deblock-aware RD.
+ * TODO:
+ *  deblock macroblock edges
+ *  support analysis partitions smaller than 16x16
+ *  deblock chroma
+ *  handle duplicate refs correctly
+ *  handle cavlc+8x8dct correctly
+ */
+void x264_macroblock_deblock( x264_t *h )
+{
+    int qp_thresh = 15 - X264_MIN( h->sh.i_alpha_c0_offset, h->sh.i_beta_offset ) - X264_MAX( 0, h->param.analyse.i_chroma_qp_offset );
+    int qp = h->mb.i_qp;
+    if( qp <= qp_thresh || h->mb.i_type == P_SKIP )
+        return;
 
+    uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&1][h->mb.i_mb_x];
+    if( IS_INTRA( h->mb.i_type ) )
+        memset( bs, 3, 2*4*4*sizeof(uint8_t) );
+    else
+        h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv,
+                                   bs, 4 >> h->sh.b_mbaff, h->sh.i_type == SLICE_TYPE_B );
+
+    int transform_8x8 = h->mb.b_transform_8x8;
+    pixel *fdec = h->mb.pic.p_fdec[0];
+
+    #define FILTER( dir, edge )\
+    do\
+    {\
+        deblock_edge( h, fdec + 4*edge*(dir?FDEC_STRIDE:1),\
+                      FDEC_STRIDE, bs[dir][edge], qp, 0,\
+                      h->loopf.deblock_luma[dir] );\
+    } while(0)
+
+    if( !transform_8x8 ) FILTER( 0, 1 );
+                         FILTER( 0, 2 );
+    if( !transform_8x8 ) FILTER( 0, 3 );
+
+    if( !transform_8x8 ) FILTER( 1, 1 );
+                         FILTER( 1, 2 );
+    if( !transform_8x8 ) FILTER( 1, 3 );
+
+    #undef FILTER
+}
+
+#if HAVE_MMX
 void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
+void x264_deblock_v_chroma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
+void x264_deblock_h_chroma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_v_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta );
 void x264_deblock_h_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta );
+void x264_deblock_v_chroma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta );
+void x264_deblock_h_chroma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta );
 void x264_deblock_strength_mmxext( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
                                    int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][4][4],
                                    int mvy_limit, int bframe );
@@ -404,12 +453,17 @@ void x264_deblock_strength_sse2  ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X
 void x264_deblock_strength_ssse3 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
                                    int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][4][4],
                                    int mvy_limit, int bframe );
-#ifdef ARCH_X86
+#if ARCH_X86
 void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
+void x264_deblock_v_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
+void x264_deblock_h_chroma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_h_luma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
 void x264_deblock_v8_luma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
+void x264_deblock_v_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
+void x264_deblock_h_chroma_intra_mmxext( uint8_t *pix, int stride, int alpha, int beta );
 
+// FIXME this wrapper has a significant cpu cost
 static void x264_deblock_v_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
 {
     x264_deblock_v8_luma_mmxext( pix,   stride, alpha, beta, tc0   );
@@ -423,12 +477,12 @@ static void x264_deblock_v_luma_intra_mmxext( uint8_t *pix, int stride, int alph
 #endif
 #endif
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
 void x264_deblock_v_luma_altivec( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 void x264_deblock_h_luma_altivec( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 );
 #endif // ARCH_PPC
 
-#ifdef HAVE_ARMV6
+#if HAVE_ARMV6
 void x264_deblock_v_luma_neon( uint8_t *, int, int, int, int8_t * );
 void x264_deblock_h_luma_neon( uint8_t *, int, int, int, int8_t * );
 void x264_deblock_v_chroma_neon( uint8_t *, int, int, int, int8_t * );
@@ -447,37 +501,46 @@ void x264_deblock_init( int cpu, x264_deblock_function_t *pf )
     pf->deblock_chroma_intra[0] = deblock_h_chroma_intra_c;
     pf->deblock_strength = deblock_strength_c;
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if( cpu&X264_CPU_MMXEXT )
     {
-        pf->deblock_chroma[1] = x264_deblock_v_chroma_mmxext;
-        pf->deblock_chroma[0] = x264_deblock_h_chroma_mmxext;
-        pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_mmxext;
-        pf->deblock_chroma_intra[0] = x264_deblock_h_chroma_intra_mmxext;
-#ifdef ARCH_X86
+#if !X264_HIGH_BIT_DEPTH
+#if ARCH_X86
         pf->deblock_luma[1] = x264_deblock_v_luma_mmxext;
         pf->deblock_luma[0] = x264_deblock_h_luma_mmxext;
+        pf->deblock_chroma[1] = x264_deblock_v_chroma_mmxext;
+        pf->deblock_chroma[0] = x264_deblock_h_chroma_mmxext;
         pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_mmxext;
         pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_mmxext;
+        pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_mmxext;
+        pf->deblock_chroma_intra[0] = x264_deblock_h_chroma_intra_mmxext;
 #endif
+#endif // !X264_HIGH_BIT_DEPTH
         pf->deblock_strength = x264_deblock_strength_mmxext;
         if( cpu&X264_CPU_SSE2 )
         {
             pf->deblock_strength = x264_deblock_strength_sse2;
+#if !X264_HIGH_BIT_DEPTH
             if( !(cpu&X264_CPU_STACK_MOD4) )
             {
                 pf->deblock_luma[1] = x264_deblock_v_luma_sse2;
                 pf->deblock_luma[0] = x264_deblock_h_luma_sse2;
+                pf->deblock_chroma[1] = x264_deblock_v_chroma_sse2;
+                pf->deblock_chroma[0] = x264_deblock_h_chroma_sse2;
                 pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_sse2;
                 pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_sse2;
+                pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_sse2;
+                pf->deblock_chroma_intra[0] = x264_deblock_h_chroma_intra_sse2;
             }
+#endif // !X264_HIGH_BIT_DEPTH
         }
         if( cpu&X264_CPU_SSSE3 )
             pf->deblock_strength = x264_deblock_strength_ssse3;
     }
 #endif
 
-#ifdef HAVE_ALTIVEC
+#if !X264_HIGH_BIT_DEPTH
+#if HAVE_ALTIVEC
     if( cpu&X264_CPU_ALTIVEC )
     {
         pf->deblock_luma[1] = x264_deblock_v_luma_altivec;
@@ -485,13 +548,14 @@ void x264_deblock_init( int cpu, x264_deblock_function_t *pf )
    }
 #endif // HAVE_ALTIVEC
 
-#ifdef HAVE_ARMV6
+#if HAVE_ARMV6
    if( cpu&X264_CPU_NEON )
    {
         pf->deblock_luma[1] = x264_deblock_v_luma_neon;
         pf->deblock_luma[0] = x264_deblock_h_luma_neon;
-        pf->deblock_chroma[1] = x264_deblock_v_chroma_neon;
-        pf->deblock_chroma[0] = x264_deblock_h_chroma_neon;
+//      pf->deblock_chroma[1] = x264_deblock_v_chroma_neon;
+//      pf->deblock_chroma[0] = x264_deblock_h_chroma_neon;
    }
 #endif
+#endif // !X264_HIGH_BIT_DEPTH
 }