From patchwork Thu Dec 24 23:24:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 24645 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 15ED74481A5 for ; Fri, 25 Dec 2020 02:48:46 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE92A68ACE3; Fri, 25 Dec 2020 02:48:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31C79687F26 for ; Fri, 25 Dec 2020 02:48:40 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1ksZyy-0008WV-0E for ffmpeg-devel@ffmpeg.org; Fri, 25 Dec 2020 00:25:20 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id sZy0klbdUO4rAsZy0kXzRS; Fri, 25 Dec 2020 00:24:20 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=RNDN4Lq+ c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=5XoJ9KCY64U2T4N_1lYA:9 a=_yFJ9sh8x_SYITJ4:21 a=AxtMKYIDSrmeZUp6:21 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 25 Dec 2020 00:24:17 +0100 Message-Id: <20201224232419.10369-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201224232419.10369-1-michael@niedermayer.cc> References: <20201224232419.10369-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfDlM7Gbi2ZsKEKxdwzglEQb7oiaNFsQ07alqW7YWgSDQCWcsNs5/EW7QaVczyNeuM8KM3rzIw40hne/Q9iUh5vQpI2eBm0WgtyYnA8iLf9cwAbHtIYRw 4ymIlc2J79kQXLhRj0uRDSTUMvPz1TmRAty0SPNWWt/H9kbE1zlhpJoj Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/siren: remove constant region_size 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavcodec/siren.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/siren.c b/libavcodec/siren.c index b1b4944562..0713ef25e7 100644 --- a/libavcodec/siren.c +++ b/libavcodec/siren.c @@ -352,6 +352,7 @@ static const float noise_category6[20] = { }; #define FRAME_SIZE 320 +#define REGION_SIZE 20 typedef struct SirenContext { GetBitContext gb; @@ -361,7 +362,6 @@ typedef struct SirenContext { int number_of_regions; int scale_factor; int sample_rate_bits; - int region_size; unsigned dw1, dw2, dw3, dw4; @@ -402,7 +402,6 @@ static av_cold int siren_init(AVCodecContext *avctx) s->esf_adjustment = 7; s->number_of_regions = 14; s->scale_factor = 22; - s->region_size = 20; s->dw1 = s->dw2 = s->dw3 = s->dw4 = 1; for (i = 0; i < 64; i++) { @@ -574,7 +573,7 @@ static int decode_vector(SirenContext *s, int number_of_regions, for (region = 0; region < number_of_regions; region++) { category = power_categories[region]; - coefs_ptr = coefs + (region * s->region_size); + coefs_ptr = coefs + (region * REGION_SIZE); if (category >= 0 && category < 7) { decoder_tree = decoder_tables[category]; @@ -623,11 +622,11 @@ static int decode_vector(SirenContext *s, int number_of_regions, } } - coefs_ptr = coefs + (region * s->region_size); + coefs_ptr = coefs + (region * REGION_SIZE); if (category == 5) { i = 0; - for (j = 0; j < s->region_size; j++) { + for (j = 0; j < REGION_SIZE; j++) { if (*coefs_ptr != 0) i++; coefs_ptr++; @@ -636,7 +635,7 @@ static int decode_vector(SirenContext *s, int number_of_regions, noise = decoder_standard_deviation[region] * noise_category5[i]; } else if (category == 6) { i = 0; - for (j = 0; j < s->region_size; j++) { + for (j = 0; j < REGION_SIZE; j++) { if (*coefs_ptr++ != 0) i++; } @@ -648,7 +647,7 @@ static int decode_vector(SirenContext *s, int number_of_regions, noise = 0; } - coefs_ptr = coefs + (region * s->region_size); + coefs_ptr = coefs + (region * REGION_SIZE); if (category == 5 || category == 6 || category == 7) { dw1 = get_dw(s);