diff options
author | Jeff Downs <heydowns@borg.com> | 2007-10-06 15:49:13 +0000 |
---|---|---|
committer | Andreas Ă–man <andreas@lonelycoder.com> | 2007-10-06 15:49:13 +0000 |
commit | 12a09bfa3952e6a7b53cd352920dd0d03cbc6f3e (patch) | |
tree | 1e8f82da1c0ba628527d01ac1a3855eba4a90f3f | |
parent | 8a11a96987f5088050c2172a98af2d8fe75513d4 (diff) | |
download | ffmpeg-12a09bfa3952e6a7b53cd352920dd0d03cbc6f3e.tar.gz |
Augment mmcodecoding process to work properly with fields. Part of PAFF implementation.
patch by Jeff Downs, heydowns a borg d com
original thread:
Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264
Date: 18/09/07 20:30
Originally committed as revision 10675 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 4b8253ce22..a1ac4aca29 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3565,7 +3565,7 @@ static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ h->mmco[i].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ - h->mmco[i].short_pic_num= (h->frame_num - get_ue_golomb(gb) - 1) & ((1<<h->sps.log2_max_frame_num)-1); //FIXME fields + 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_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){ av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); return -1; @@ -3573,7 +3573,7 @@ static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ unsigned int long_arg= get_ue_golomb(gb); - if(/*h->mmco[i].long_arg >= h->long_ref_count || h->long_ref[ h->mmco[i].long_arg ] == NULL*/ long_arg >= 16){ + if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } @@ -3591,10 +3591,17 @@ static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ }else{ assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); - if(h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count){ //FIXME fields + if(h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && + !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; + if (FIELD_PICTURE) { + h->mmco[0].short_pic_num *= 2; + h->mmco[1].opcode= MMCO_SHORT2UNUSED; + h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; + h->mmco_index= 2; + } }else h->mmco_index= 0; } |