Mercurial > libavcodec.hg
comparison mpegvideo.c @ 1907:7ff22288289e libavcodec
huge vbv buffer size + CBR fix
author | michael |
---|---|
date | Fri, 26 Mar 2004 12:30:04 +0000 |
parents | 129236143f2e |
children | f2d134308a70 |
comparison
equal
deleted
inserted
replaced
1906:caee9c21b0b1 | 1907:7ff22288289e |
---|---|
883 return -1; | 883 return -1; |
884 } | 884 } |
885 | 885 |
886 if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ | 886 if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ |
887 av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isnt recommanded!\n"); | 887 av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isnt recommanded!\n"); |
888 } | 888 } |
889 | |
890 if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate | |
891 && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) | |
892 && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ | |
889 | 893 |
894 av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); | |
895 } | |
896 | |
890 if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 | 897 if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 |
891 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ | 898 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ |
892 av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); | 899 av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); |
893 return -1; | 900 return -1; |
894 } | 901 } |
2113 flush_put_bits(&s->pb); | 2120 flush_put_bits(&s->pb); |
2114 s->frame_bits = put_bits_count(&s->pb); | 2121 s->frame_bits = put_bits_count(&s->pb); |
2115 } | 2122 } |
2116 | 2123 |
2117 /* update mpeg1/2 vbv_delay for CBR */ | 2124 /* update mpeg1/2 vbv_delay for CBR */ |
2118 if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1){ | 2125 if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1 |
2126 && 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){ | |
2119 int vbv_delay; | 2127 int vbv_delay; |
2120 | 2128 |
2121 assert(s->repeat_first_field==0); | 2129 assert(s->repeat_first_field==0); |
2122 | 2130 |
2123 vbv_delay= lrintf(90000 * s->rc_context.buffer_index / s->avctx->rc_max_rate); | 2131 vbv_delay= lrintf(90000 * s->rc_context.buffer_index / s->avctx->rc_max_rate); |