On Thu, 20 Sep 2007, Martin Zlomek wrote:
The attached patch fixes picNumX in "Adaptive memory control decoded reference picture marking process".
--- h264.c.orig 2007-09-20 23:30:38.000000000 +0200 +++ h264.c 2007-09-20 23:31:42.000000000 +0200 @@ -3644,7 +3644,7 @@
h->mmco[i].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ - h->mmco[i].short_pic_num= h->curr_pic_num - get_ue_golomb(gb) - 1; + h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1); /* if(h->mmco[i].short_frame_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_frame_num ] == NULL){ av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); return -1;
Why? I'm having trouble mapping this to anything in the spec. Compliant streams should contain data that produces a valid short_pic_num here. Non-compliant streams might produce a garbage pic num that is beyond maximum pic num, but that'll just cause the MMCO execution to skip this operation because it can't find a picture with that picture number. -Jeff