aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJustin Ruggles <jruggle@earthlink.net>2005-08-21 20:27:00 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-08-21 20:27:00 +0000
commitc57c770db3c41ac4caea8379c4053489bffeb032 (patch)
tree3e2de5b1d5093bcde5a6d71b35bdbce1c8bd6f4c /libavcodec
parent32fbf33e61ed13c728e4efcbd8729171391c472f (diff)
downloadffmpeg-c57c770db3c41ac4caea8379c4053489bffeb032.tar.gz
vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
with changes by me int->float as video uses float too remove silent cliping to some per codec range, this should result in an error instead remove change to utils.c as its inconsistant with video Originally committed as revision 4533 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/faac.c6
-rw-r--r--libavcodec/mp3lameaudio.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/faac.c b/libavcodec/faac.c
index a65bdefae5..a49cce968f 100644
--- a/libavcodec/faac.c
+++ b/libavcodec/faac.c
@@ -56,7 +56,11 @@ static int Faac_encode_init(AVCodecContext *avctx)
faac_cfg->mpegVersion = MPEG4;
faac_cfg->useTns = 0;
faac_cfg->allowMidside = 1;
- faac_cfg->bitRate = avctx->bit_rate;
+ faac_cfg->bitRate = avctx->bit_rate / avctx->channels;
+ if(avctx->flags & CODEC_FLAG_QSCALE) {
+ faac_cfg->bitRate = 0;
+ faac_cfg->quantqual = avctx->global_quality / FF_QP2LAMBDA;
+ }
faac_cfg->outputFormat = 0;
faac_cfg->inputFormat = FAAC_INPUT_16BIT;
diff --git a/libavcodec/mp3lameaudio.c b/libavcodec/mp3lameaudio.c
index 3f10a1025c..26764fcc88 100644
--- a/libavcodec/mp3lameaudio.c
+++ b/libavcodec/mp3lameaudio.c
@@ -53,6 +53,11 @@ static int MP3lame_encode_init(AVCodecContext *avctx)
/* lame 3.91 doesn't work in mono */
lame_set_mode(s->gfp, JOINT_STEREO);
lame_set_brate(s->gfp, avctx->bit_rate/1000);
+ if(avctx->flags & CODEC_FLAG_QSCALE) {
+ lame_set_brate(s->gfp, 0);
+ lame_set_VBR(s->gfp, vbr_default);
+ lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
+ }
lame_set_bWriteVbrTag(s->gfp,0);
if (lame_init_params(s->gfp) < 0)
goto err_close;