/*****************************************************************************
- * 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"
-/* cavlc + 8x8 transform stores nnz per 16 coeffs for the purpose of
- * entropy coding, but per 64 coeffs for the purpose of deblocking */
-static void munge_cavlc_nnz_row( x264_t *h, int mb_y, uint8_t (*buf)[16] )
-{
- uint32_t (*src)[6] = (uint32_t(*)[6])h->mb.non_zero_count + mb_y * h->sps->i_mb_width;
- int8_t *transform = h->mb.mb_transform_size + mb_y * h->sps->i_mb_width;
- for( int x = 0; x<h->sps->i_mb_width; x++ )
- {
- memcpy( buf+x, src+x, 16 );
- if( transform[x] )
- {
- int nnz = src[x][0] | src[x][1];
- src[x][0] = src[x][1] = ((uint16_t)nnz ? 0x0101 : 0) + (nnz>>16 ? 0x01010000 : 0);
- nnz = src[x][2] | src[x][3];
- src[x][2] = src[x][3] = ((uint16_t)nnz ? 0x0101 : 0) + (nnz>>16 ? 0x01010000 : 0);
- }
- }
-}
-
-static void restore_cavlc_nnz_row( x264_t *h, int mb_y, uint8_t (*buf)[16] )
-{
- uint8_t (*dst)[24] = h->mb.non_zero_count + mb_y * h->sps->i_mb_width;
- for( int x = 0; x < h->sps->i_mb_width; x++ )
- memcpy( dst+x, buf+x, 16 );
-}
-
-static void munge_cavlc_nnz( x264_t *h, int mb_y, uint8_t (*buf)[16], void (*func)(x264_t*, int, uint8_t (*)[16]) )
-{
- func( h, mb_y, buf );
- if( mb_y > 0 )
- func( h, mb_y-1, buf + h->sps->i_mb_width );
- if( h->sh.b_mbaff )
- {
- func( h, mb_y+1, buf + h->sps->i_mb_width * 2 );
- if( mb_y > 0 )
- func( h, mb_y-2, buf + h->sps->i_mb_width * 3 );
- }
-}
-
-
/* 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,
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,
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 },
{-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( uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0 )
+static inline void deblock_luma_c( pixel *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0 )
{
for( int i = 0; i < 4; i++ )
{
}
delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
- pix[-1*xstride] = x264_clip_uint8( p0 + delta ); /* p0' */
- pix[ 0*xstride] = x264_clip_uint8( q0 - delta ); /* q0' */
+ pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */
+ pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */
}
pix += ystride;
}
}
}
-static void deblock_v_luma_c( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
+static void deblock_v_luma_c( pixel *pix, int stride, int alpha, int beta, int8_t *tc0 )
{
deblock_luma_c( pix, stride, 1, alpha, beta, tc0 );
}
-static void deblock_h_luma_c( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
+static void deblock_h_luma_c( pixel *pix, int stride, int alpha, int beta, int8_t *tc0 )
{
deblock_luma_c( pix, 1, stride, alpha, beta, tc0 );
}
-static inline void deblock_chroma_c( uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0 )
+static inline void deblock_chroma_c( pixel *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0 )
{
for( int i = 0; i < 4; i++ )
{
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];
if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
{
int delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
- pix[-1*xstride] = x264_clip_uint8( p0 + delta ); /* p0' */
- pix[ 0*xstride] = x264_clip_uint8( q0 - delta ); /* q0' */
+ 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( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
+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( uint8_t *pix, int stride, int alpha, int beta, int8_t *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( uint8_t *pix, int xstride, int ystride, int alpha, int beta )
+static inline void deblock_luma_intra_c( pixel *pix, int xstride, int ystride, int alpha, int beta )
{
for( int d = 0; d < 16; d++ )
{
pix += ystride;
}
}
-static void deblock_v_luma_intra_c( uint8_t *pix, int stride, int alpha, int beta )
+static void deblock_v_luma_intra_c( pixel *pix, int stride, int alpha, int beta )
{
deblock_luma_intra_c( pix, stride, 1, alpha, beta );
}
-static void deblock_h_luma_intra_c( uint8_t *pix, int stride, int alpha, int beta )
+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( uint8_t *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];
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( uint8_t *pix, int stride, int alpha, int beta )
+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( uint8_t *pix, int stride, int alpha, int beta )
+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],
}
}
-static inline void deblock_edge( x264_t *h, uint8_t *pix1, uint8_t *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, uint8_t *pix1, uint8_t *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 )
{
int b_interlaced = h->sh.b_mbaff;
- 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_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 stridey = h->fdec->i_stride[0];
int stride2y = stridey << b_interlaced;
int strideuv = h->fdec->i_stride[1];
int stride2uv = strideuv << b_interlaced;
- uint8_t (*nnz_backup)[16] = h->scratch_buffer;
- if( !h->pps->b_cabac && h->pps->b_transform_8x8_mode )
- munge_cavlc_nnz( h, mb_y, nnz_backup, munge_cavlc_nnz_row );
-
- 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 );
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];
- uint8_t *pixy = h->fdec->plane[0] + 16*mb_y*stridey + 16*mb_x;
- uint8_t *pixu = h->fdec->plane[1] + 8*mb_y*strideuv + 8*mb_x;
- uint8_t *pixv = h->fdec->plane[2] + 8*mb_y*strideuv + 8*mb_x;
- if( b_interlaced && (mb_y&1) )
+ pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey + 16*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];
#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)
int qp_top = (qp + qpt + 1) >> 1;
int qpc_top = (h->chroma_qp_table[qp] + h->chroma_qp_table[qpt] + 1) >> 1;
int intra_top = IS_INTRA( h->mb.type[h->mb.i_mb_top_xy] );
- if( !b_interlaced && (intra_cur || intra_top) )
+ if( ~b_interlaced & (intra_cur | intra_top) )
FILTER( _intra, 1, 0, qp_top, qpc_top );
else
{
if( intra_top )
- memset( bs[1][0], 3, sizeof(bs[1][0]) );
+ M32( bs[1][0] ) = 0x03030303;
FILTER( , 1, 0, qp_top, qpc_top );
}
}
FILTER( , 1, 2, qp, qpc );
if( !transform_8x8 ) FILTER( , 1, 3, qp, qpc );
}
- }
- if( !h->pps->b_cabac && h->pps->b_transform_8x8_mode )
- munge_cavlc_nnz( h, mb_y, nnz_backup, restore_cavlc_nnz_row );
+ #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 );
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 );
#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 * );
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;
}
#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
}