comparison h264.c @ 3101:32903d6b5ef1 libavcodec

slightly faster loopfilter
author lorenm
date Wed, 08 Feb 2006 07:04:32 +0000
parents 072dbc669253
children 2d35fb3cb940
comparison
equal deleted inserted replaced
3100:3c40c240a267 3101:32903d6b5ef1
6545 /* FIXME: A given frame may occupy more than one position in 6545 /* FIXME: A given frame may occupy more than one position in
6546 * the reference list. So ref2frm should be populated with 6546 * the reference list. So ref2frm should be populated with
6547 * frame numbers, not indices. */ 6547 * frame numbers, not indices. */
6548 static const int ref2frm[18] = {-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; 6548 static const int ref2frm[18] = {-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
6549 6549
6550 //for sufficiently low qp, filtering wouldn't do anything
6551 //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
6552 if(!h->mb_aff_frame){
6553 int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX(0, h->pps.chroma_qp_index_offset);
6554 int qp = s->current_picture.qscale_table[mb_xy];
6555 if(qp <= qp_thresh
6556 && (mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)
6557 && (mb_y == 0 || ((qp + s->current_picture.qscale_table[h->top_mb_xy] + 1)>>1) <= qp_thresh)){
6558 return;
6559 }
6560 }
6561
6550 if (h->mb_aff_frame 6562 if (h->mb_aff_frame
6551 // left mb is in picture 6563 // left mb is in picture
6552 && h->slice_table[mb_xy-1] != 255 6564 && h->slice_table[mb_xy-1] != 255
6553 // and current and left pair do not have the same interlaced type 6565 // and current and left pair do not have the same interlaced type
6554 && (IS_INTERLACED(s->current_picture.mb_type[mb_xy]) != IS_INTERLACED(s->current_picture.mb_type[mb_xy-1])) 6566 && (IS_INTERLACED(s->current_picture.mb_type[mb_xy]) != IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]))
6615 const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy; 6627 const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy;
6616 const int mb_type = s->current_picture.mb_type[mb_xy]; 6628 const int mb_type = s->current_picture.mb_type[mb_xy];
6617 const int mbm_type = s->current_picture.mb_type[mbm_xy]; 6629 const int mbm_type = s->current_picture.mb_type[mbm_xy];
6618 int start = h->slice_table[mbm_xy] == 255 ? 1 : 0; 6630 int start = h->slice_table[mbm_xy] == 255 ? 1 : 0;
6619 6631
6620 const int edges = ((mb_type & mbm_type) & (MB_TYPE_16x16|MB_TYPE_SKIP)) 6632 const int edges = (mb_type & (MB_TYPE_16x16|MB_TYPE_SKIP))
6621 == (MB_TYPE_16x16|MB_TYPE_SKIP) ? 1 : 4; 6633 == (MB_TYPE_16x16|MB_TYPE_SKIP) ? 1 : 4;
6622 // how often to recheck mv-based bS when iterating between edges 6634 // how often to recheck mv-based bS when iterating between edges
6623 const int mask_edge = (mb_type & (MB_TYPE_16x16 | (MB_TYPE_16x8 << dir))) ? 3 : 6635 const int mask_edge = (mb_type & (MB_TYPE_16x16 | (MB_TYPE_16x8 << dir))) ? 3 :
6624 (mb_type & (MB_TYPE_8x16 >> dir)) ? 1 : 0; 6636 (mb_type & (MB_TYPE_8x16 >> dir)) ? 1 : 0;
6625 // how often to recheck mv-based bS when iterating along each edge 6637 // how often to recheck mv-based bS when iterating along each edge
6626 const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)); 6638 const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));