diff options
Diffstat (limited to 'src/libfaad/output.c')
-rw-r--r-- | src/libfaad/output.c | 71 |
1 files changed, 11 insertions, 60 deletions
diff --git a/src/libfaad/output.c b/src/libfaad/output.c index 33ebed39c..a96ebd983 100644 --- a/src/libfaad/output.c +++ b/src/libfaad/output.c @@ -1,28 +1,31 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** +** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com +** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. -** +** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software +** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** +** The "appropriate copyright message" mentioned in section 2c of the GPLv2 +** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" +** ** Commercial non-GPL licensing of this software is possible. -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** -** $Id: output.c,v 1.9 2006/06/30 21:36:27 dgp85 Exp $ +** $Id: output.c,v 1.46 2007/11/01 12:33:32 menno Exp $ **/ #include "common.h" @@ -463,7 +466,7 @@ static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample } } -static void* output_to_PCM_orig(NeAACDecHandle hDecoder, +void* output_to_PCM(NeAACDecHandle hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { @@ -554,56 +557,4 @@ static void* output_to_PCM_orig(NeAACDecHandle hDecoder, return sample_buffer; } -void *output_to_PCM(NeAACDecHandle hDecoder, - real_t **input, void *sample_buffer, uint8_t channels, - uint16_t frame_len, uint8_t format) -{ - int ch, i; - int16_t *short_sample_buffer; - real_t *ch0, *ch1, *ch2, *ch3, *ch4; - - if (format != FAAD_FMT_16BIT) - return output_to_PCM_orig(hDecoder, input, sample_buffer, channels, frame_len, format); - - short_sample_buffer = (int16_t *)sample_buffer; - ch0 = input[hDecoder->internal_channel[0]]; - ch1 = input[hDecoder->internal_channel[1]]; - ch2 = input[hDecoder->internal_channel[2]]; - ch3 = input[hDecoder->internal_channel[3]]; - ch4 = input[hDecoder->internal_channel[4]]; - - if (hDecoder->downMatrix) - { - for (i = 0; i < frame_len; ++i) - { - int32_t tmp = (ch1[i] + ((ch0[i] + ch3[i]) >> 1) + ((ch0[i] + ch3[i]) >> 2) + (1 << (REAL_BITS))) >> (REAL_BITS + 1); - if ((tmp + 0x8000) & ~0xffff) - tmp = ~(tmp >> 31) - 0x8000; - short_sample_buffer[0] = tmp; - tmp = (ch2[i] + ((ch0[i] + ch4[i]) >> 1) + ((ch0[i] + ch4[i]) >> 2) + (1 << (REAL_BITS))) >> (REAL_BITS + 1); - if ((tmp + 0x8000) & ~0xffff) - tmp = ~(tmp >> 31) - 0x8000; - short_sample_buffer[1] = tmp; - short_sample_buffer += channels; - } - return sample_buffer; - } - - /* Copy output to a standard PCM buffer */ - for (i = 0; i < frame_len; ++i) - { - for (ch = 0; ch < channels; ++ch) - { - int32_t tmp = input[hDecoder->internal_channel[ch]][i]; - tmp += (1 << (REAL_BITS - 1)); - tmp >>= REAL_BITS; - if ((tmp + 0x8000) & ~0xffff) - tmp = ~(tmp >> 31) - 0x8000; - *(short_sample_buffer++) = tmp; - } - } - - return sample_buffer; -} - #endif |