Commit c5063e03 authored by Justin Ruggles's avatar 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.
parent f15c4281
...@@ -236,7 +236,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets, ...@@ -236,7 +236,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
{ {
OggVorbisContext *s = avctx->priv_data; OggVorbisContext *s = avctx->priv_data;
ogg_packet op; ogg_packet op;
signed short *audio = data; float *audio = data;
int pkt_size; int pkt_size;
/* send samples to libvorbis */ /* send samples to libvorbis */
...@@ -251,7 +251,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets, ...@@ -251,7 +251,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets,
int co = (channels > 8) ? c : int co = (channels > 8) ? c :
ff_vorbis_encoding_channel_layout_offsets[channels - 1][c]; ff_vorbis_encoding_channel_layout_offsets[channels - 1][c];
for (i = 0; i < samples; i++) 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); vorbis_analysis_wrote(&s->vd, samples);
} else { } else {
...@@ -315,7 +315,7 @@ AVCodec ff_libvorbis_encoder = { ...@@ -315,7 +315,7 @@ AVCodec ff_libvorbis_encoder = {
.encode = oggvorbis_encode_frame, .encode = oggvorbis_encode_frame,
.close = oggvorbis_encode_close, .close = oggvorbis_encode_close,
.capabilities = CODEC_CAP_DELAY, .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 }, AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), .long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
.priv_class = &class, .priv_class = &class,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment