From patchwork Sat Apr 18 00:59:25 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: 19034 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 7070C44AE21 for ; Sat, 18 Apr 2020 03:59:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3C8A068BE73; Sat, 18 Apr 2020 03:59:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E9CA68B9FE for ; Sat, 18 Apr 2020 03:59:32 +0300 (EEST) Date: Sat, 18 Apr 2020 00:59:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail; t=1587171571; bh=adt3exjXRK4ECOC/MC4l52ItC9a5Q9/nZPaxaiDoJgM=; h=Date:To:From:Cc:Reply-To:Subject:From; b=HsCv2Fv/vJptdZTvOfjZJRPYfLRO1CrwYZctDdiPCimG8/5s/ZEe27OyPJYyHGo4p DXFwjrpJ6zlwaXX3Z/QSX33Fu18xTtq97tyEpwRjRn2eUEir5Wfw3O+KymMWKva1ED metQD3bYNlvwTKXXOoaARajJlKUsORaUXViVcc6Y= To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200418005911.22975-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.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 mail.protonmail.ch Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for() 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" Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html Signed-off-by: Zane van Iperen --- libavcodec/adpcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index ee18875579..7d35884056 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1271,14 +1271,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } break; case AV_CODEC_ID_ADPCM_IMA_APC: - while (bytestream2_get_bytes_left(&gb) > 0) { + for (n = nb_samples >> (1 - st); n > 0; n--) { int v = bytestream2_get_byteu(&gb); *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; case AV_CODEC_ID_ADPCM_IMA_SSI: - while (bytestream2_get_bytes_left(&gb) > 0) { + for (n = nb_samples >> (1 - st); n > 0; n--) { int v = bytestream2_get_byteu(&gb); *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0], v >> 4 ); *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F); @@ -1305,7 +1305,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } break; case AV_CODEC_ID_ADPCM_IMA_OKI: - while (bytestream2_get_bytes_left(&gb) > 0) { + for (n = nb_samples >> (1 - st); n > 0; n--) { int v = bytestream2_get_byteu(&gb); *samples++ = adpcm_ima_oki_expand_nibble(&c->status[0], v >> 4 ); *samples++ = adpcm_ima_oki_expand_nibble(&c->status[st], v & 0x0F); From patchwork Sat Apr 18 00:59:33 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: 19035 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 4054744AE21 for ; Sat, 18 Apr 2020 03:59:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 250C968BEE6; Sat, 18 Apr 2020 03:59:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A9D468B82B for ; Sat, 18 Apr 2020 03:59:40 +0300 (EEST) Date: Sat, 18 Apr 2020 00:59:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail; t=1587171579; bh=qszxspKfwXzVW3lmGRzssVc3lABvyeIhsu+cWDAZDMg=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=KEGQPdnuGig81vwMRMEstudl0qj1Ov9/QPXQkiV3drfdXbayjaowQlTVLprO+9iJc kFhcVNpiKB49KO7g2PLF5cHIwVic0HsOyIKRrqMZOq1q2zi9ru2kaoTGxNO3ZpRRGX S+Rl30U13kcxYtVyJ5FZ8w10dXoTCGj1J2aFu9Uo= To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200418005911.22975-2-zane@zanevaniperen.com> In-Reply-To: <20200418005911.22975-1-zane@zanevaniperen.com> References: <20200418005911.22975-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.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 mail.protonmail.ch Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/adpcm: update get_nb_samples() doc 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 7d35884056..9ea6a268eb 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -668,7 +668,7 @@ static inline int16_t adpcm_argo_expand_nibble(ADPCMChannelStatus *cs, int nibbl } /** - * Get the number of samples that will be decoded from the packet. + * Get the number of samples (per channel) that will be decoded from the packet. * In one case, this is actually the maximum number of samples possible to * decode with the given buf_size. *