summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-02-16 21:42:01 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-02-16 21:42:01 +0000
commit3425501d3b09650c6b295ba225e02e97c002372c (patch)
tree31ebfa5c82edf6a8a4c29b9c8771e4fd67f4433e /libavcodec/h264.c
parent187696fa72ec47c7151cd3cc708e224fe2eccb55 (diff)
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 Originally committed as revision 7999 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f2630b5e21..145c6b010f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -614,7 +614,7 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
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 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
#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 @@ static inline void write_back_motion(H264Context *h, int mb_type){
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 @@ static void hl_decode_mb(H264Context *h){
}
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 @@ static int decode_ref_pic_list_reordering(H264Context *h){
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 @@ static int decode_ref_pic_list_reordering(H264Context *h){
}
}
}
-
- 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 int decode_ref_pic_list_reordering(H264Context *h){
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 @@ decode_intra_mb:
}
}
- 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 @@ decode_intra_mb:
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 @@ decode_intra_mb:
}
}
- 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 @@ decode_intra_mb:
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 @@ decode_intra_mb:
}
}
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 @@ decode_intra_mb:
}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 @@ decode_intra_mb:
}
}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 @@ decode_intra_mb:
}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);