From b5bbc84fe2ae07d98764361d93d40ee2781467ab Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Mon, 11 Jul 2011 14:46:37 -0700 Subject: H.264: add filter_mb_fast support for >8-bit decoding Much faster high bit depth deblocking. --- libavcodec/h264_loopfilter.c | 106 +++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 48 deletions(-) (limited to 'libavcodec/h264_loopfilter.c') 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; - - 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 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; + + 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; -- cgit v1.2.3