X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fqdm2.c;h=a2630fe7fca58453b5fae8a1eeadbad743e51084;hb=6aaf3abd6d7a5690effa7ae298ba54fd62df7525;hp=3645f43e2f20b270dc681cc91605196e81a002be;hpb=d00bff20b2b48796e4bd2d0b83819c159f60a25f;p=ffmpeg diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 3645f43e2f2..a2630fe7fca 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -5,18 +5,20 @@ * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2005 Roberto Togni * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * 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 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library 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 this library; 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 * */ @@ -538,7 +540,7 @@ static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_ run = 1; case_val = 8; } else { - switch (switchtable[coding_method[ch][sb][j]]) { + switch (switchtable[coding_method[ch][sb][j]-8]) { case 0: run = 10; case_val = 10; break; case 1: run = 1; case_val = 16; break; case 2: run = 5; case_val = 24; break; @@ -1470,13 +1472,13 @@ static void qdm2_decode_fft_packets (QDM2Context *q) if (duration >= 0 && duration < 4) qdm2_fft_decode_tones(q, duration, &gb, unknown_flag); } else if (type == 31) { - for (i=0; i < 4; i++) - qdm2_fft_decode_tones(q, i, &gb, unknown_flag); + for (j=0; j < 4; j++) + qdm2_fft_decode_tones(q, j, &gb, unknown_flag); } else if (type == 46) { - for (i=0; i < 6; i++) - q->fft_level_exp[i] = get_bits(&gb, 6); - for (i=0; i < 4; i++) - qdm2_fft_decode_tones(q, i, &gb, unknown_flag); + for (j=0; j < 6; j++) + q->fft_level_exp[j] = get_bits(&gb, 6); + for (j=0; j < 4; j++) + qdm2_fft_decode_tones(q, j, &gb, unknown_flag); } } // Loop on B packets @@ -1834,7 +1836,7 @@ static int qdm2_decode_init(AVCodecContext *avctx) extradata += 8; extradata_size -= 8; - size = BE_32(extradata); + size = AV_RB32(extradata); if(size > extradata_size){ av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", @@ -1844,29 +1846,29 @@ static int qdm2_decode_init(AVCodecContext *avctx) extradata += 4; av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size); - if (BE_32(extradata) != MKBETAG('Q','D','C','A')) { + if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); return -1; } extradata += 8; - avctx->channels = s->nb_channels = s->channels = BE_32(extradata); + avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); extradata += 4; - avctx->sample_rate = BE_32(extradata); + avctx->sample_rate = AV_RB32(extradata); extradata += 4; - avctx->bit_rate = BE_32(extradata); + avctx->bit_rate = AV_RB32(extradata); extradata += 4; - s->group_size = BE_32(extradata); + s->group_size = AV_RB32(extradata); extradata += 4; - s->fft_size = BE_32(extradata); + s->fft_size = AV_RB32(extradata); extradata += 4; - s->checksum_size = BE_32(extradata); + s->checksum_size = AV_RB32(extradata); extradata += 4; s->fft_order = av_log2(s->fft_size) + 1;