diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index f94e13aef0..377968fcd2 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -207,56 +207,48 @@ static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, const i } } -void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { +static void av_always_inline h264_filter_mb_fast_internal( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, + unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { MpegEncContext * const s = &h->s; - int mb_xy; - int mb_type, left_type, top_type; - int qp, qp0, qp1, qpc, qpc0, qpc1; int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444; - int qp_bd_offset, a, b; - mb_xy = h->mb_xy; + int mb_xy = h->mb_xy; + int left_type= h->left_type[LTOP]; + int top_type= h->top_type; - if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { - ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); - return; - } - assert(!FRAME_MBAFF); - left_type= h->left_type[LTOP]; - top_type= h->top_type; + int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); + int a = h->slice_alpha_c0_offset - qp_bd_offset; + int b = h->slice_beta_offset - qp_bd_offset; - mb_type = s->current_picture.f.mb_type[mb_xy]; - qp = s->current_picture.f.qscale_table[mb_xy]; - qp0 = s->current_picture.f.qscale_table[mb_xy - 1]; - qp1 = s->current_picture.f.qscale_table[h->top_mb_xy]; - qpc = get_chroma_qp( h, 0, qp ); - qpc0 = get_chroma_qp( h, 0, qp0 ); - qpc1 = get_chroma_qp( h, 0, qp1 ); + int mb_type = s->current_picture.f.mb_type[mb_xy]; + int qp = s->current_picture.f.qscale_table[mb_xy]; + int qp0 = s->current_picture.f.qscale_table[mb_xy - 1]; + int qp1 = s->current_picture.f.qscale_table[h->top_mb_xy]; + int qpc = get_chroma_qp( h, 0, qp ); + int qpc0 = get_chroma_qp( h, 0, qp0 ); + int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; - qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); - a = h->slice_alpha_c0_offset - qp_bd_offset; - b = h->slice_beta_offset - qp_bd_offset; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(left_type) - filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, a, b, h, 1); + filter_mb_edgev( &img_y[4*0<h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { + ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); + return; + } + +#if CONFIG_SMALL + h264_filter_mb_fast_internal(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, h->pixel_shift); +#else + if(h->pixel_shift){ + h264_filter_mb_fast_internal(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 1); + }else{ + h264_filter_mb_fast_internal(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 0); + } +#endif +} + static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ int v; diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c index 1042552948..35ec267b42 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_mmx.c @@ -354,10 +354,11 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth) { int mm_flags = av_get_cpu_flags(); - if (bit_depth == 8) { if (mm_flags & AV_CPU_FLAG_MMX2) { c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; } + + if (bit_depth == 8) { #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { c->h264_idct_dc_add =