comparison mpegvideo_enc.c @ 5273:101f20612a94 libavcodec

Split ff_set_mpeg4_time() and move the non mpeg4 specific part into mpegvideo_enc.c.
author aurel
date Tue, 10 Jul 2007 14:37:33 +0000
parents 604a09d6cf2e
children 7b3fcb7c61ce
comparison
equal deleted inserted replaced
5272:b51c25603164 5273:101f20612a94
2669 //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality); 2669 //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);
2670 update_qscale(s); 2670 update_qscale(s);
2671 return 0; 2671 return 0;
2672 } 2672 }
2673 2673
2674 /* must be called before writing the header */
2675 static void set_frame_distances(MpegEncContext * s){
2676 assert(s->current_picture_ptr->pts != AV_NOPTS_VALUE);
2677 s->time= s->current_picture_ptr->pts*s->avctx->time_base.num;
2678
2679 if(s->pict_type==B_TYPE){
2680 s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
2681 assert(s->pb_time > 0 && s->pb_time < s->pp_time);
2682 }else{
2683 s->pp_time= s->time - s->last_non_b_time;
2684 s->last_non_b_time= s->time;
2685 assert(s->picture_number==0 || s->pp_time > 0);
2686 }
2687 }
2688
2674 static int encode_picture(MpegEncContext *s, int picture_number) 2689 static int encode_picture(MpegEncContext *s, int picture_number)
2675 { 2690 {
2676 int i; 2691 int i;
2677 int bits; 2692 int bits;
2678 2693
2683 s->me.mc_mb_var_sum_temp = 0; 2698 s->me.mc_mb_var_sum_temp = 0;
2684 2699
2685 /* we need to initialize some time vars before we can encode b-frames */ 2700 /* we need to initialize some time vars before we can encode b-frames */
2686 // RAL: Condition added for MPEG1VIDEO 2701 // RAL: Condition added for MPEG1VIDEO
2687 if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4)) 2702 if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4))
2688 ff_set_mpeg4_time(s, s->picture_number); //FIXME rename and use has_b_frames or similar 2703 set_frame_distances(s);
2704 if(ENABLE_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4)
2705 ff_set_mpeg4_time(s);
2689 2706
2690 s->me.scene_change_score=0; 2707 s->me.scene_change_score=0;
2691 2708
2692 // s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME ratedistoration 2709 // s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME ratedistoration
2693 2710