diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-07-05 12:42:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-07-05 12:42:19 +0000 |
commit | 733f5990d0600589782bcfa5c9e22a9391c6c19e (patch) | |
tree | 4a4ab1e8df25794da922826054743d4663d2ef74 /libavcodec/h264_refs.c | |
parent | 6fa197e2778cef3c41c7afe8deae5b664bdd39df (diff) | |
download | ffmpeg-733f5990d0600589782bcfa5c9e22a9391c6c19e.tar.gz |
Factorize ff_generate_sliding_window_mmcos() out.
Originally committed as revision 24056 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264_refs.c')
-rw-r--r-- | libavcodec/h264_refs.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index ed715c6b03..7caa4b0003 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -474,6 +474,24 @@ static void print_long_term(H264Context *h) { } } +void ff_generate_sliding_window_mmcos(H264Context *h) { + MpegEncContext * const s = &h->s; + assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); + + if(h->short_ref_count && 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; + } + } +} + int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ MpegEncContext * const s = &h->s; int i, av_uninit(j); @@ -673,20 +691,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ } h->mmco_index= i; }else{ - assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); - - if(h->short_ref_count && 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; - } - } + ff_generate_sliding_window_mmcos(h); } } |