aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorLoïc Le Loarer <lll+ffmpeg@m4x.org>2005-02-01 11:26:11 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-02-01 11:26:11 +0000
commit0d315f281c4bbdb59a7395985d9d89a9395928c0 (patch)
treed17d677a6a279c1751a268a337001b71a0bb8f5d /libavcodec/h264.c
parentdc032f33322ea94c9a9cc7b7fc92f1c0a840c277 (diff)
downloadffmpeg-0d315f281c4bbdb59a7395985d9d89a9395928c0.tar.gz
H.264 multiplce instance in reference list patch by (Loic <lll+ffmpeg m4x org )
With this patch, the streams CAWP5_TOSHIBA_E.264 and CVWP5_TOSHIBA_E.264 are completely decoded Originally committed as revision 3917 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index dbedcb48ce..28cb7785f7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3010,25 +3010,28 @@ static int decode_ref_pic_list_reordering(H264Context *h){
else pred+= abs_diff_pic_num;
pred &= h->max_pic_num - 1;
- for(i= h->ref_count[list]-1; i>=index; i--){
- if(h->ref_list[list][i].pic_id == pred && h->ref_list[list][i].long_ref==0)
+ for(i= h->ref_count[list]-1; i>=0; i--){
+ if(h->ref_list[list][i].data[0] != NULL && h->ref_list[list][i].pic_id == pred && h->ref_list[list][i].long_ref==0) // ignore non existing pictures by testing data[0] pointer
break;
}
}else{
pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
- for(i= h->ref_count[list]-1; i>=index; i--){
- if(h->ref_list[list][i].pic_id == pic_id && h->ref_list[list][i].long_ref==1)
+ for(i= h->ref_count[list]-1; i>=0; i--){
+ if(h->ref_list[list][i].pic_id == pic_id && h->ref_list[list][i].long_ref==1) // no need to ignore non existing pictures as non existing pictures have long_ref==0
break;
}
}
- if(i < index){
+ if (i < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
- }else if(i > index){
+ } else if (i != index) /* this test is not necessary, it is only an optimisation to skip double copy of Picture structure in this case */ {
Picture tmp= h->ref_list[list][i];
- for(; i>index; i--){
+ if (i < index) {
+ i = h->ref_count[list];
+ }
+ for(; i > index; i--){
h->ref_list[list][i]= h->ref_list[list][i-1];
}
h->ref_list[list][index]= tmp;