comparison h264.c @ 2629:202cd69d8d2e libavcodec

fix ref comparison in B-frame deblocker ('unused' and 'unavailable' were treated as different)
author lorenm
date Sun, 24 Apr 2005 21:06:22 +0000
parents 511e3afc43e1
children 72e6ffa1f3a5
comparison
equal deleted inserted replaced
2628:511e3afc43e1 2629:202cd69d8d2e
6077 static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { 6077 static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {
6078 MpegEncContext * const s = &h->s; 6078 MpegEncContext * const s = &h->s;
6079 const int mb_xy= mb_x + mb_y*s->mb_stride; 6079 const int mb_xy= mb_x + mb_y*s->mb_stride;
6080 int first_vertical_edge_done = 0; 6080 int first_vertical_edge_done = 0;
6081 int dir; 6081 int dir;
6082 /* FIXME: A given frame may occupy more than one position in
6083 * the reference list. So ref2frm should be populated with
6084 * frame numbers, not indices. */
6085 static const int ref2frm[18] = {-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
6082 6086
6083 if (h->mb_aff_frame 6087 if (h->mb_aff_frame
6084 // left mb is in picture 6088 // left mb is in picture
6085 && h->slice_table[mb_xy-1] != 255 6089 && h->slice_table[mb_xy-1] != 255
6086 // and current and left pair do not have the same interlaced type 6090 // and current and left pair do not have the same interlaced type
6108 bS[i] = 4; 6112 bS[i] = 4;
6109 } else if( h->non_zero_count_cache[b_idx] != 0 || 6113 } else if( h->non_zero_count_cache[b_idx] != 0 ||
6110 h->non_zero_count_cache[bn_idx] != 0 ) { 6114 h->non_zero_count_cache[bn_idx] != 0 ) {
6111 bS[i] = 2; 6115 bS[i] = 2;
6112 } else { 6116 } else {
6113 /* FIXME: A given frame may occupy more than one position in
6114 * the reference list. So we should compare the frame numbers,
6115 * not the indices in the ref list. */
6116 int l; 6117 int l;
6117 bS[i] = 0; 6118 bS[i] = 0;
6118 for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) { 6119 for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) {
6119 if( h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] || 6120 if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] ||
6120 ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || 6121 ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
6121 ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= 4 ) { 6122 ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= 4 ) {
6122 bS[i] = 1; 6123 bS[i] = 1;
6123 break; 6124 break;
6124 } 6125 }
6247 h->non_zero_count_cache[bn_idx] != 0 ) { 6248 h->non_zero_count_cache[bn_idx] != 0 ) {
6248 bS[i] = 2; 6249 bS[i] = 2;
6249 } 6250 }
6250 else 6251 else
6251 { 6252 {
6252 /* FIXME: A given frame may occupy more than one position in
6253 * the reference list. So we should compare the frame numbers,
6254 * not the indices in the ref list. */
6255 int l; 6253 int l;
6256 bS[i] = 0; 6254 bS[i] = 0;
6257 for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) { 6255 for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) {
6258 if( h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] || 6256 if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] ||
6259 ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || 6257 ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 ||
6260 ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= 4 ) { 6258 ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= 4 ) {
6261 bS[i] = 1; 6259 bS[i] = 1;
6262 break; 6260 break;
6263 } 6261 }