summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-02-08 07:04:32 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-02-08 07:04:32 +0000
commitc0234aa44ceed5dbb2d5e5994d1c0c238a9fd490 (patch)
treeee46b330e2b81b1d857951016865cd81be109730 /libavcodec/h264.c
parent4accd1fd1854486403108fa9a4288ff4da0ff82b (diff)
slightly faster loopfilter
Originally committed as revision 4958 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index e80a3992c2..cd21c26037 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -6547,6 +6547,18 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
* frame numbers, not indices. */
static const int ref2frm[18] = {-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ //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(!h->mb_aff_frame){
+ int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX(0, h->pps.chroma_qp_index_offset);
+ 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)
+ && (mb_y == 0 || ((qp + s->current_picture.qscale_table[h->top_mb_xy] + 1)>>1) <= qp_thresh)){
+ return;
+ }
+ }
+
if (h->mb_aff_frame
// left mb is in picture
&& h->slice_table[mb_xy-1] != 255
@@ -6617,8 +6629,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
const int mbm_type = s->current_picture.mb_type[mbm_xy];
int start = h->slice_table[mbm_xy] == 255 ? 1 : 0;
- const int edges = ((mb_type & mbm_type) & (MB_TYPE_16x16|MB_TYPE_SKIP))
- == (MB_TYPE_16x16|MB_TYPE_SKIP) ? 1 : 4;
+ const int edges = (mb_type & (MB_TYPE_16x16|MB_TYPE_SKIP))
+ == (MB_TYPE_16x16|MB_TYPE_SKIP) ? 1 : 4;
// how often to recheck mv-based bS when iterating between edges
const int mask_edge = (mb_type & (MB_TYPE_16x16 | (MB_TYPE_16x8 << dir))) ? 3 :
(mb_type & (MB_TYPE_8x16 >> dir)) ? 1 : 0;