diff options
Diffstat (limited to 'libavcodec/ac3.c')
-rw-r--r-- | libavcodec/ac3.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 99e5b50..b54315d 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -2,20 +2,20 @@ * Common code between the AC-3 encoder and decoder * Copyright (c) 2000 Fabrice Bellard * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, int band_start, band_end, begin, end1; int lowcomp, fastleak, slowleak; + if (end <= 0) + return AVERROR_INVALIDDATA; + /* excitation function */ band_start = ff_ac3_bin_to_band_tab[start]; band_end = ff_ac3_bin_to_band_tab[end-1] + 1; @@ -200,9 +203,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band) return -1; if (dba_values[seg] >= 4) { - delta = (dba_values[seg] - 3) << 7; + delta = (dba_values[seg] - 3) * 128; } else { - delta = (dba_values[seg] - 4) << 7; + delta = (dba_values[seg] - 4) * 128; } for (i = 0; i < dba_lengths[seg]; i++) { mask[band++] += delta; |