diff options
Diffstat (limited to 'libavcodec/ra288.c')
-rw-r--r-- | libavcodec/ra288.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 319bdd4..8bafc01 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -2,20 +2,20 @@ * RealAudio 2.0 (28.8K) * Copyright (c) 2003 the ffmpeg project * - * 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 */ @@ -68,6 +68,11 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx) avctx->channel_layout = AV_CH_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + if (avctx->block_align <= 0) { + av_log_ask_for_sample(avctx, "unsupported block align\n"); + return AVERROR_PATCHWELCOME; + } + avpriv_float_dsp_init(&ractx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); avcodec_get_frame_defaults(&ractx->frame); @@ -108,14 +113,14 @@ static void decode(RA288Context *ractx, float gain, int cb_coef) for (i=0; i < 5; i++) buffer[i] = codetable[cb_coef][i] * sumsum; - sum = avpriv_scalarproduct_float_c(buffer, buffer, 5) * ((1 << 24) / 5.); + sum = avpriv_scalarproduct_float_c(buffer, buffer, 5); - sum = FFMAX(sum, 1); + sum = FFMAX(sum, 5. / (1<<24)); /* shift and store */ memmove(gain_block, gain_block + 1, 9 * sizeof(*gain_block)); - gain_block[9] = 10 * log10(sum) - 32; + gain_block[9] = 10 * log10(sum) + (10*log10(((1<<24)/5.)) - 32); ff_celp_lp_synthesis_filterf(block, ractx->sp_lpc, buffer, 5, 36); } @@ -143,6 +148,8 @@ static void do_hybrid_window(RA288Context *ractx, MAX_BACKWARD_FILTER_LEN + MAX_BACKWARD_FILTER_NONREC, 16)]); + av_assert2(order>=0); + ractx->fdsp.vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16)); convolve(buffer1, work + order , n , order); |