[FFmpeg-cvslog] H.264: improve qp_thresh check

Jason Garrett-Glaser git at videolan.org
Sun Jul 10 04:33:42 CEST 2011


ffmpeg | branch: master | Jason Garrett-Glaser <jason at x264.com> | Wed Jul  6 14:08:30 2011 -0700| [6a2176aac05e1edbcdf8fb9c26d572d092a00c3c] | committer: Jason Garrett-Glaser

H.264: improve qp_thresh check

Eliminate redundant check in filter_mb_fast, consider bit depth in calculating qp_thresh.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a2176aac05e1edbcdf8fb9c26d572d092a00c3c
---

 libavcodec/h264.c            |    4 +++-
 libavcodec/h264_loopfilter.c |    6 +-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f79f4d1..33c9527 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2931,7 +2931,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
             }
         }
     }
-    h->qp_thresh= 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
+    h->qp_thresh = 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset)
+                 - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1])
+                 + 6 * (h->sps.bit_depth_luma - 8);
 
 #if 0 //FMO
     if( h->pps.num_slice_groups > 1  && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index c716347..5de9f78 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -216,7 +216,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
     MpegEncContext * const s = &h->s;
     int mb_xy;
     int mb_type, left_type, top_type;
-    int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh;
+    int qp, qp0, qp1, qpc, qpc0, qpc1;
     int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
     int chroma444 = CHROMA444;
 
@@ -241,10 +241,6 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
     qp1 = (qp + qp1 + 1) >> 1;
     qpc0 = (qpc + qpc0 + 1) >> 1;
     qpc1 = (qpc + qpc1 + 1) >> 1;
-    qp_thresh = 15+52 - h->slice_alpha_c0_offset;
-    if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
-       qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
-        return;
 
     if( IS_INTRA(mb_type) ) {
         static const int16_t bS4[4] = {4,4,4,4};



More information about the ffmpeg-cvslog mailing list