comparison h264_refs.c @ 12093:05f91a88f986 libavcodec

Factorize ff_generate_sliding_window_mmcos() out.
author michael
date Mon, 05 Jul 2010 12:42:19 +0000
parents 7dd2a45249a9
children f7bedc1ce1bc
comparison
equal deleted inserted replaced
12092:de9e45d04063 12093:05f91a88f986
468 for(i = 0; i < 16; i++){ 468 for(i = 0; i < 16; i++){
469 Picture *pic= h->long_ref[i]; 469 Picture *pic= h->long_ref[i];
470 if (pic) { 470 if (pic) {
471 av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]); 471 av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]);
472 } 472 }
473 }
474 }
475 }
476
477 void ff_generate_sliding_window_mmcos(H264Context *h) {
478 MpegEncContext * const s = &h->s;
479 assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
480
481 if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
482 !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {
483 h->mmco[0].opcode= MMCO_SHORT2UNUSED;
484 h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
485 h->mmco_index= 1;
486 if (FIELD_PICTURE) {
487 h->mmco[0].short_pic_num *= 2;
488 h->mmco[1].opcode= MMCO_SHORT2UNUSED;
489 h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
490 h->mmco_index= 2;
473 } 491 }
474 } 492 }
475 } 493 }
476 494
477 int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ 495 int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
671 if(opcode == MMCO_END) 689 if(opcode == MMCO_END)
672 break; 690 break;
673 } 691 }
674 h->mmco_index= i; 692 h->mmco_index= i;
675 }else{ 693 }else{
676 assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); 694 ff_generate_sliding_window_mmcos(h);
677
678 if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
679 !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {
680 h->mmco[0].opcode= MMCO_SHORT2UNUSED;
681 h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
682 h->mmco_index= 1;
683 if (FIELD_PICTURE) {
684 h->mmco[0].short_pic_num *= 2;
685 h->mmco[1].opcode= MMCO_SHORT2UNUSED;
686 h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
687 h->mmco_index= 2;
688 }
689 }
690 } 695 }
691 } 696 }
692 697
693 return 0; 698 return 0;
694 } 699 }