X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faacps.c;h=9b7bdae584b8c5002335906473af023f21189c65;hb=9e22b8aca0fdecee332191fabded428e6a183d25;hp=8f55c7f3c0fd9f2e7263d79f3a91d4cfd8ac2858;hpb=0ba8ba165b84a971dbe9356b57f272dc81410eaf;p=ffmpeg diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c index 8f55c7f3c0f..9b7bdae584b 100644 --- a/libavcodec/aacps.c +++ b/libavcodec/aacps.c @@ -2,20 +2,20 @@ * MPEG-4 Parametric Stereo decoding functions * Copyright (c) 2010 Alex Converse * - * 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 */ @@ -139,7 +139,7 @@ static int ps_read_extension_data(GetBitContext *gb, PSContext *ps, int ps_exten return get_bits_count(gb) - count; } -static void ipdopd_reset(int8_t *opd_hist, int8_t *ipd_hist) +static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist) { int i; for (i = 0; i < PS_MAX_NR_IPDOPD; i++) { @@ -236,6 +236,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps if (!ps->num_env || ps->border_position[ps->num_env] < numQMFSlots - 1) { //Create a fake envelope int source = ps->num_env ? ps->num_env - 1 : ps->num_env_old - 1; + int b; if (source >= 0 && source != ps->num_env) { if (ps->enable_iid) { memcpy(ps->iid_par+ps->num_env, ps->iid_par+source, sizeof(ps->iid_par[0])); @@ -248,6 +249,22 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps memcpy(ps->opd_par+ps->num_env, ps->opd_par+source, sizeof(ps->opd_par[0])); } } + if (ps->enable_iid){ + for (b = 0; b < ps->nr_iid_par; b++) { + if (FFABS(ps->iid_par[ps->num_env][b]) > 7 + 8 * ps->iid_quant) { + av_log(avctx, AV_LOG_ERROR, "iid_par invalid\n"); + goto err; + } + } + } + if (ps->enable_icc){ + for (b = 0; b < ps->nr_iid_par; b++) { + if (ps->icc_par[ps->num_env][b] > 7U) { + av_log(avctx, AV_LOG_ERROR, "icc_par invalid\n"); + goto err; + } + } + } ps->num_env++; ps->border_position[ps->num_env] = numQMFSlots - 1; } @@ -606,7 +623,6 @@ static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC]) par[ 3] = par[ 2]; par[ 2] = par[ 1]; par[ 1] = (par[ 0] + par[ 1]) * 0.5f; - par[ 0] = par[ 0]; } static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34) @@ -811,7 +827,8 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2 h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1]; h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2]; h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3]; - if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) { + + if (!PS_BASELINE && ps->enable_ipdopd && 2*b <= NR_PAR_BANDS[is34]) { //The spec say says to only run this smoother when enable_ipdopd //is set but the reference decoder appears to run it constantly float h11i, h12i, h21i, h22i;