Mercurial > libavcodec.hg
changeset 4533:dca590e16c43 libavcodec
replace list<2 checks by list<list_count
remove silly ref_count<0 and ref_count==0 checks its impossible for this variable to have such a value
author | michael |
---|---|
date | Fri, 16 Feb 2007 21:42:01 +0000 |
parents | c296efb7575e |
children | a856fe4b80f0 |
files | h264.c |
diffstat | 1 files changed, 18 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Fri Feb 16 21:34:21 2007 +0000 +++ b/h264.c Fri Feb 16 21:42:01 2007 +0000 @@ -614,7 +614,7 @@ int v = *(uint16_t*)&h->non_zero_count[mb_xy][14]; for(i=0; i<16; i++) h->non_zero_count_cache[scan8[i]] = (v>>i)&1; - for(list=0; list<1+(h->slice_type==B_TYPE); list++){ + for(list=0; list<h->list_count; list++){ if(USES_LIST(mb_type,list)){ uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]]; uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]]; @@ -782,7 +782,7 @@ #if 1 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ int list; - for(list=0; list<1+(h->slice_type==B_TYPE); list++){ + for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ /*if(!h->mv_cache_clean[list]){ memset(h->mv_cache [list], 0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all? @@ -1703,7 +1703,7 @@ if(!USES_LIST(mb_type, 0)) fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, h->b8_stride, (uint8_t)LIST_NOT_USED, 1); - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ int y; if(!USES_LIST(mb_type, list)) continue; @@ -3543,7 +3543,7 @@ } if(FRAME_MBAFF) { int list; - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list)) continue; if(IS_16X16(mb_type)){ @@ -3911,7 +3911,7 @@ print_long_term(h); if(h->slice_type==I_TYPE || h->slice_type==SI_TYPE) return 0; //FIXME move before func - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]); if(get_bits1(&s->gb)){ @@ -3989,15 +3989,12 @@ } } } - - if(h->slice_type!=B_TYPE) break; - } - for(list=0; list<2; list++){ + } + for(list=0; list<h->list_count; list++){ for(index= 0; index < h->ref_count[list]; index++){ if(!h->ref_list[list][index].data[0]) h->ref_list[list][index]= s->current_picture; } - if(h->slice_type!=B_TYPE) break; } if(h->slice_type==B_TYPE && !h->direct_spatial_mv_pred) @@ -4008,7 +4005,7 @@ static void fill_mbaff_ref_list(H264Context *h){ int list, i, j; - for(list=0; list<2; list++){ + for(list=0; list<2; list++){ //FIXME try list_count for(i=0; i<h->ref_count[list]; i++){ Picture *frame = &h->ref_list[list][i]; Picture *field = &h->ref_list[list][16+2*i]; @@ -5258,9 +5255,8 @@ } } - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; - if(ref_count == 0) continue; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ @@ -5280,9 +5276,8 @@ if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ const int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; - if(ref_count == 0) continue; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { @@ -6393,8 +6388,7 @@ } } - for( list = 0; list < 2; list++ ) { - if( h->ref_count[list] > 0 ) { + for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ @@ -6408,13 +6402,12 @@ h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } - } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); - for(list=0; list<2; list++){ + for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); @@ -6506,8 +6499,7 @@ } } else if(IS_16X8(mb_type)){ - for(list=0; list<2; list++){ - if(h->ref_count[list]>0){ + for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 8*i ) : 0; @@ -6515,9 +6507,8 @@ }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } - } - } - for(list=0; list<2; list++){ + } + for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); @@ -6535,8 +6526,7 @@ } }else{ assert(IS_8X16(mb_type)); - for(list=0; list<2; list++){ - if(h->ref_count[list]>0){ + for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 4*i ) : 0; @@ -6544,9 +6534,8 @@ }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } - } - } - for(list=0; list<2; list++){ + } + for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy);