diff options
author | Jason Garrett-Glaser <jason@x264.com> | 2011-06-26 06:40:05 +0400 |
---|---|---|
committer | Jason Garrett-Glaser <jason@x264.com> | 2011-06-27 01:35:36 +0400 |
commit | 84153d188347b3dee684fab40bf28ddd3eba64cf (patch) | |
tree | ca18bc0f8044dc00277a8013359a6e22ac77debb | |
parent | 3fbc9bbb884da6a1fb331b1cb03945008ee36312 (diff) |
H.264: make filter_mb_fast support 4:4:4
-rw-r--r-- | libavcodec/h264_loopfilter.c | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index 86ecb2737f..bdfbce79f0 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -218,10 +218,11 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, int mb_type, left_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); + int chroma444 = CHROMA444; mb_xy = h->mb_xy; - if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff || CHROMA444) { + if(!h->top_type || !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; } @@ -264,16 +265,46 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h); } if(chroma){ - if(left_type){ - filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h); - filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h); + if(chroma444){ + if(left_type){ + filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h); + filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h); + } + if( IS_8x8DCT(mb_type) ) { + filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); + filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); + filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); + } else { + filter_mb_edgev( &img_cb[4*1], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cr[4*1], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h); + filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); + filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); + filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, h); + filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, h); + } + }else{ + if(left_type){ + filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h); + filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h); + } + filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h); + filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h); + filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); + filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h); + filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); + filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h); } - filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h); - filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h); - filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); - filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h); - filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); - filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h); } return; } else { @@ -301,9 +332,14 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, #define FILTER(hv,dir,edge)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\ - if(chroma && !(edge&1)) {\ - filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ - filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ + if(chroma){\ + if(chroma444){\ + filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ + filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ + } else if(!(edge&1)) {\ + filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ + filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ + }\ }\ } if(left_type) |