[SCM] libav/experimental: Avoid wasting 4 cpu cycles per MB in redundantly calculating qp_thresh.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:57:45 UTC 2013


The following commit has been merged in the experimental branch:
commit 2e36c931f0e8d9fe812badd4dee90fdd352c05be
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Sat Jan 16 11:55:35 2010 +0000

    Avoid wasting 4 cpu cycles per MB in redundantly calculating qp_thresh.
    
    Originally committed as revision 21243 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6056497..3cec418 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2110,6 +2110,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
                 return 1; // deblocking switched inside frame
         }
     }
+    h->qp_thresh= 15 - h->slice_alpha_c0_offset - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
 
 #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.h b/libavcodec/h264.h
index eb5cecc..6d18af4 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -273,6 +273,8 @@ typedef struct H264Context{
 
     int chroma_qp[2]; //QPc
 
+    int qp_thresh;      ///< QP threshold to skip loopfilter
+
     int prev_mb_skipped;
     int next_mb_skipped;
 
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 08c9723..7d462e1 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -654,7 +654,7 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
     //for sufficiently low qp, filtering wouldn't do anything
     //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
     if(!FRAME_MBAFF){
-        int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
+        int qp_thresh = h->qp_thresh;
         int qp = s->current_picture.qscale_table[mb_xy];
         if(qp <= qp_thresh
            && (mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list