summaryrefslogtreecommitdiff
path: root/src/libfaad/tns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfaad/tns.c')
-rw-r--r--src/libfaad/tns.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libfaad/tns.c b/src/libfaad/tns.c
index bb4db731a..611865204 100644
--- a/src/libfaad/tns.c
+++ b/src/libfaad/tns.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003-2004 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
@@ -19,10 +19,13 @@
** 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: tns.c,v 1.8 2005/10/29 23:57:07 tmmm Exp $
+** $Id: tns.c,v 1.40 2007/11/01 12:33:40 menno Exp $
**/
#include "common.h"
@@ -106,11 +109,11 @@ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
start = min(start, ics->max_sfb);
- start = ics->swb_offset[start];
+ start = min(ics->swb_offset[start], ics->swb_offset_max);
end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
end = min(end, ics->max_sfb);
- end = ics->swb_offset[end];
+ end = min(ics->swb_offset[end], ics->swb_offset_max);
size = end - start;
if (size <= 0)
@@ -160,11 +163,11 @@ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
start = min(start, ics->max_sfb);
- start = ics->swb_offset[start];
+ start = min(ics->swb_offset[start], ics->swb_offset_max);
end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
end = min(end, ics->max_sfb);
- end = ics->swb_offset[end];
+ end = min(ics->swb_offset[end], ics->swb_offset_max);
size = end - start;
if (size <= 0)
@@ -292,7 +295,7 @@ static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l
y = *spectrum;
for (j = 0; j < order; j++)
- y += MUL_C(state[j], lpc[j+1]);
+ y += MUL_C(state[state_index+j], lpc[j+1]);
/* double ringbuffer state */
state_index--;