From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 67038457D2 for ; Sun, 23 Apr 2023 22:32:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7BA6368BF70; Mon, 24 Apr 2023 01:32:47 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 78F5268BA82 for ; Mon, 24 Apr 2023 01:32:39 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 8F6101BF205 for ; Sun, 23 Apr 2023 22:32:38 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 24 Apr 2023 00:32:32 +0200 Message-Id: <20230423223236.375-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230423223236.375-1-michael@niedermayer.cc> References: <20230423223236.375-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/apedec: Move pointer instead of copying each element in delay in long_filter_high_3800() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ~1000 -> 930 cycles Signed-off-by: Michael Niedermayer --- libavcodec/apedec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index c08d13d6c2..40cd78a991 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -944,7 +944,7 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len { int i, j; int32_t dotprod, sign; - int32_t coeffs[256], delay[256]; + int32_t coeffs[256], delay[256+256], *delayp = delay; if (order >= length) return; @@ -956,13 +956,16 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len dotprod = 0; sign = APESIGN(buffer[i]); for (j = 0; j < order; j++) { - dotprod += delay[j] * (unsigned)coeffs[j]; - coeffs[j] += ((delay[j] >> 31) | 1) * sign; + dotprod += delayp[j] * (unsigned)coeffs[j]; + coeffs[j] += ((delayp[j] >> 31) | 1) * sign; } buffer[i] -= (unsigned)(dotprod >> shift); - for (j = 0; j < order - 1; j++) - delay[j] = delay[j + 1]; - delay[order - 1] = buffer[i]; + delayp ++; + delayp[order - 1] = buffer[i]; + if (delayp - delay == 256) { + memcpy(delay, delayp, sizeof(*delay)*256); + delayp = delay; + } } } -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".