summaryrefslogtreecommitdiff
path: root/libavcodec/vorbisenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-07 11:23:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-07 11:28:38 +0200
commit79d30321a29dc648d5a475ce5086b2760d5d8c12 (patch)
treec712b09b56a0937ca08a1c89365addd8e4e33d4b /libavcodec/vorbisenc.c
parent537ef8bebf8a35aab448db6ec876e275a10f0f15 (diff)
parent31b2262dca9cc77709d20c45610ec8030e7f9257 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: wmaenc: use float planar sample format (e)ac3enc: use planar sample format aacenc: use planar sample format adpcmenc: use planar sample format for adpcm_ima_wav and adpcm_ima_qt adpcmenc: move 'ch' variable to higher scope adpcmenc: fix 3 instances of variable shadowing adpcm_ima_wav: simplify encoding libvorbis: use planar sample format libmp3lame: use planar sample formats vorbisenc: use float planar sample format ffm: do not write or read the audio sample format parseutils: fix parsing of invalid alpha values doc/RELEASE_NOTES: update for the 9 release. smoothstreamingenc: Add a more verbose error message smoothstreamingenc: Ignore the return value from mkdir smoothstreamingenc: Try writing a manifest when opening the muxer smoothstreamingenc: Move the output_chunk_list and write_manifest functions up smoothstreamingenc: Properly return errors from ism_flush to the caller smoothstreamingenc: Check the output UrlContext before accessing it Conflicts: doc/RELEASE_NOTES libavcodec/aacenc.c libavcodec/ac3enc_template.c libavcodec/wmaenc.c tests/ref/lavf/ffm Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vorbisenc.c')
-rw-r--r--libavcodec/vorbisenc.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index b88791f274..74d6331ee3 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -963,10 +963,10 @@ static int residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
return 0;
}
-static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *audio,
- int samples)
+static int apply_window_and_mdct(vorbis_enc_context *venc,
+ float **audio, int samples)
{
- int i, j, channel;
+ int i, channel;
const float * win = venc->win[0];
int window_len = 1 << (venc->log2_blocksize[0] - 1);
float n = (float)(1 << venc->log2_blocksize[0]) / 4.;
@@ -988,9 +988,8 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
float * offset = venc->samples + channel*window_len*2 + window_len;
- j = channel;
- for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = audio[j] / 32768. / n * win[window_len - i - 1];
+ for (i = 0; i < samples; i++)
+ offset[i] = audio[channel][i] / n * win[window_len - i - 1];
}
} else {
for (channel = 0; channel < venc->channels; channel++)
@@ -1005,9 +1004,8 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
float *offset = venc->saved + channel * window_len;
- j = channel;
- for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = audio[j] / 32768. / n * win[i];
+ for (i = 0; i < samples; i++)
+ offset[i] = audio[channel][i] / n * win[i];
}
venc->have_saved = 1;
} else {
@@ -1020,7 +1018,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
vorbis_enc_context *venc = avccontext->priv_data;
- const int16_t *audio = frame ? (const int16_t *)frame->data[0] : NULL;
+ float **audio = frame ? (float **)frame->extended_data : NULL;
int samples = frame ? frame->nb_samples : 0;
vorbis_enc_mode *mode;
vorbis_enc_mapping *mapping;
@@ -1213,7 +1211,7 @@ AVCodec ff_vorbis_encoder = {
.encode2 = vorbis_encode_frame,
.close = vorbis_encode_close,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
- .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
};