[FFmpeg-cvslog] libvorbis: use float input instead of s16

Justin Ruggles git at videolan.org
Thu Mar 1 03:20:23 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Feb 28 19:55:10 2012 -0500| [c5063e0348db97626aecc17c42fd41718fd62f13] | committer: Justin Ruggles

libvorbis: use float input instead of s16

libvorbis takes float input, so we can just deinterleave/reorder the input
as-is instead of also converting.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5063e0348db97626aecc17c42fd41718fd62f13
---

 libavcodec/libvorbis.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index d783942..2ca7796 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -236,7 +236,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
 {
     OggVorbisContext *s = avctx->priv_data;
     ogg_packet op;
-    signed short *audio = data;
+    float *audio = data;
     int pkt_size;
 
     /* send samples to libvorbis */
@@ -251,7 +251,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
             int co = (channels > 8) ? c :
                      ff_vorbis_encoding_channel_layout_offsets[channels - 1][c];
             for (i = 0; i < samples; i++)
-                buffer[c][i] = audio[i * channels + co] / 32768.f;
+                buffer[c][i] = audio[i * channels + co];
         }
         vorbis_analysis_wrote(&s->vd, samples);
     } else {
@@ -315,7 +315,7 @@ AVCodec ff_libvorbis_encoder = {
     .encode         = oggvorbis_encode_frame,
     .close          = oggvorbis_encode_close,
     .capabilities   = CODEC_CAP_DELAY,
-    .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
+    .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
                                                       AV_SAMPLE_FMT_NONE },
     .long_name      = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
     .priv_class     = &class,



More information about the ffmpeg-cvslog mailing list