Mercurial > libavcodec.hg
changeset 12093:05f91a88f986 libavcodec
Factorize ff_generate_sliding_window_mmcos() out.
author | michael |
---|---|
date | Mon, 05 Jul 2010 12:42:19 +0000 |
parents | de9e45d04063 |
children | f7bedc1ce1bc |
files | h264.h h264_refs.c |
diffstat | 2 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.h Mon Jul 05 08:16:43 2010 +0000 +++ b/h264.h Mon Jul 05 12:42:19 2010 +0000 @@ -666,6 +666,8 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb); +void ff_generate_sliding_window_mmcos(H264Context *h); + /** * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
--- a/h264_refs.c Mon Jul 05 08:16:43 2010 +0000 +++ b/h264_refs.c Mon Jul 05 12:42:19 2010 +0000 @@ -474,6 +474,24 @@ } } +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 @@ } 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); } }