From 0263ece7f8a69fc34034860a9bc959d61314dc65 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Wed, 2 Nov 2005 19:43:52 +0000 Subject: [PATCH] Use direct non-interleaved full precision output data instead of converting to 16 bit interleaved data. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7734 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/aac.c | 13 ++++++++----- apps/codecs/libfaad/decoder.c | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c index 9b07fb8d64..5bb9241d3b 100644 --- a/apps/codecs/aac.c +++ b/apps/codecs/aac.c @@ -66,8 +66,8 @@ enum codec_status codec_start(struct codec_api* api) ci->configure(CODEC_DSP_ENABLE, (bool *)true); ci->configure(DSP_DITHER, (bool *)false); - ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); - ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16)); + ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED); + ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(29)); next_track: @@ -100,7 +100,7 @@ enum codec_status codec_start(struct codec_api* api) } NeAACDecConfigurationPtr conf = NeAACDecGetCurrentConfiguration(hDecoder); - conf->outputFormat = 1; // 16-bit integers + conf->outputFormat = FAAD_FMT_24BIT; /* irrelevant, we don't convert */ NeAACDecSetConfiguration(hDecoder, conf); unsigned long s=0; @@ -147,7 +147,8 @@ enum codec_status codec_start(struct codec_api* api) /* Decode one block - returned samples will be host-endian */ rb->yield(); decodedbuffer = NeAACDecDecode(hDecoder, &frameInfo, buffer, n); - + /* ignore decodedbuffer return value, we access samples in the + decoder struct directly */ if (frameInfo.error > 0) { LOGF("FAAD: decoding error \"%s\"\n", NeAACDecGetErrorMessage(frameInfo.error)); return CODEC_ERROR; @@ -161,7 +162,9 @@ enum codec_status codec_start(struct codec_api* api) /* Output the audio */ rb->yield(); - while (!rb->pcmbuf_insert((char*)decodedbuffer, frameInfo.samples << 1)) + while (!rb->pcmbuf_insert_split(hDecoder->time_out[0], + hDecoder->time_out[1], + frameInfo.samples*2)) rb->yield(); /* Update the elapsed-time indicator */ diff --git a/apps/codecs/libfaad/decoder.c b/apps/codecs/libfaad/decoder.c index 10d97952bd..145247784f 100644 --- a/apps/codecs/libfaad/decoder.c +++ b/apps/codecs/libfaad/decoder.c @@ -982,9 +982,10 @@ static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, } #endif + /* we don't need sample conversion in rockbox. sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, output_channels, frame_len, hDecoder->config.outputFormat); - + */ hDecoder->postSeekResetFlag = 0;