From patchwork Fri Sep 18 12:04:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 22469 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2D5DC44A11F for ; Fri, 18 Sep 2020 15:04:59 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1BF3768B8CF; Fri, 18 Sep 2020 15:04:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D3FF068B877 for ; Fri, 18 Sep 2020 15:04:51 +0300 (EEST) Date: Fri, 18 Sep 2020 12:04:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail2; t=1600430691; bh=xoZvNiElvyFmIvij5rBqbV4nhsJGRhxFyJy/uU320+0=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=jbtP6xW5cUuSIcMsf+bIRwDXdmjF8bBQ1SE0ATavob7ZzSu43FZkgZHkW3sqZcL7J fMC10SRhkWPa068iohiXCC8uPEp+o00PLKYbAjhl1XQ+bpwNDJWvVtLyguD1+Okbj4 eUdneJqo90mdARKbhbDGpQG7pezEcFIPJsNXepQtYCGfEb64BFKdSJGE3HT9JEC44J IL+/8hRrxN6OSjCN83+elWq+yssBYIpDMth/4bmc9qnELQ4ZAFlGjNx+Qe+UDpbvNi UCc6edvK5ZIHIzyXV2BBgiG8cX4QHsBxvetOu6KSqpjd/qYaKXZHy+YZxvk2wCW79F 1hD2h/ISUeLkg== To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200918120416.7319-3-zane@zanevaniperen.com> In-Reply-To: <20200918120416.7319-1-zane@zanevaniperen.com> References: <20200918120416.7319-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Subject: [FFmpeg-devel] [PATCH v2 2/7] avcodec/adpcm_{psx, argo}: add missing indent X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Zane van Iperen --- libavcodec/adpcm.c | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 14be1f4f88..4755308824 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1966,42 +1966,42 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, case AV_CODEC_ID_ADPCM_PSX: for (int block = 0; block < avpkt->size / FFMAX(avctx->block_align, 16 * avctx->channels); block++) { int nb_samples_per_block = 28 * FFMAX(avctx->block_align, 16 * avctx->channels) / (16 * avctx->channels); - for (channel = 0; channel < avctx->channels; channel++) { - samples = samples_p[channel] + block * nb_samples_per_block; - - /* Read in every sample for this channel. */ - for (i = 0; i < nb_samples_per_block / 28; i++) { - int filter, shift, flag, byte; - - filter = bytestream2_get_byteu(&gb); - shift = filter & 0xf; - filter = filter >> 4; - if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) - return AVERROR_INVALIDDATA; - flag = bytestream2_get_byteu(&gb); - - /* Decode 28 samples. */ - for (n = 0; n < 28; n++) { - int sample = 0, scale; - - if (flag < 0x07) { - if (n & 1) { - scale = sign_extend(byte >> 4, 4); - } else { - byte = bytestream2_get_byteu(&gb); - scale = sign_extend(byte, 4); + for (channel = 0; channel < avctx->channels; channel++) { + samples = samples_p[channel] + block * nb_samples_per_block; + + /* Read in every sample for this channel. */ + for (i = 0; i < nb_samples_per_block / 28; i++) { + int filter, shift, flag, byte; + + filter = bytestream2_get_byteu(&gb); + shift = filter & 0xf; + filter = filter >> 4; + if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) + return AVERROR_INVALIDDATA; + flag = bytestream2_get_byteu(&gb); + + /* Decode 28 samples. */ + for (n = 0; n < 28; n++) { + int sample = 0, scale; + + if (flag < 0x07) { + if (n & 1) { + scale = sign_extend(byte >> 4, 4); + } else { + byte = bytestream2_get_byteu(&gb); + scale = sign_extend(byte, 4); + } + + scale = scale * (1 << 12); + sample = (int)((scale >> shift) + (c->status[channel].sample1 * xa_adpcm_table[filter][0] + c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64); } - - scale = scale * (1 << 12); - sample = (int)((scale >> shift) + (c->status[channel].sample1 * xa_adpcm_table[filter][0] + c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64); + *samples++ = av_clip_int16(sample); + c->status[channel].sample2 = c->status[channel].sample1; + c->status[channel].sample1 = sample; } - *samples++ = av_clip_int16(sample); - c->status[channel].sample2 = c->status[channel].sample1; - c->status[channel].sample1 = sample; } } } - } break; case AV_CODEC_ID_ADPCM_ARGO: /* @@ -2022,23 +2022,23 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, * They should be 0 initially. */ for (int block = 0; block < avpkt->size / avctx->block_align; block++) { - for (channel = 0; channel < avctx->channels; channel++) { - int control, shift; + for (channel = 0; channel < avctx->channels; channel++) { + int control, shift; - samples = samples_p[channel] + block * 32; - cs = c->status + channel; + samples = samples_p[channel] + block * 32; + cs = c->status + channel; - /* Get the control byte and decode the samples, 2 at a time. */ - control = bytestream2_get_byteu(&gb); - shift = (control >> 4) + 2; + /* Get the control byte and decode the samples, 2 at a time. */ + control = bytestream2_get_byteu(&gb); + shift = (control >> 4) + 2; - for (n = 0; n < 16; n++) { - int sample = bytestream2_get_byteu(&gb); - *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 4, shift, control & 0x04); - *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 0, shift, control & 0x04); + for (n = 0; n < 16; n++) { + int sample = bytestream2_get_byteu(&gb); + *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 4, shift, control & 0x04); + *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 0, shift, control & 0x04); + } } } - } break; case AV_CODEC_ID_ADPCM_ZORK: if (!c->has_status) {