From patchwork Sun Dec 16 13:19:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 11436 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 1F7BC44CCDC for ; Sun, 16 Dec 2018 15:19:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A13B68AA2B; Sun, 16 Dec 2018 15:19:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8154368A8E7 for ; Sun, 16 Dec 2018 15:19:46 +0200 (EET) X-QQ-mid: bizesmtp21t1544966361tukvprlu Received: from localhost (unknown [47.90.47.25]) by esmtp6.qq.com (ESMTP) with id ; Sun, 16 Dec 2018 21:19:21 +0800 (CST) X-QQ-SSF: 01100000004000F0FNF1B00A0000000 X-QQ-FEAT: ZXYkEieV2/R3bScFFnnr81I+nK4wsNVFZgBtwIt3b6HYif5lWwLZqA0lwupa+ Dayk5r95AlJdL/8J7tk4erIZTMdJ2cm11sj3ov9cuoBrf6Co6DSbt2D84PIEn+PoSKoJ9xX egIVvaXNeQaYw4PYjX5q7TBAGDOlPt6V50VuAY3KrnMeDh9h8xh4tFS8dl1VukQYFTfAlXO tVFLrLWw8gk+H/iTN0XCNAllDCXkaH0yzKTQW7IFodLQOn/Ap1x0VE1ijg4mFXOoK2woQ7+ BSzB7mODqLVN0EWev5Zza41QMSJROLFLE4UhzeFZtLBW5I X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Sun, 16 Dec 2018 21:19:17 +0800 Message-Id: <20181216131918.1562-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/fft_template: improve performance of the ff_fft_init in fft_template 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: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" move the two if condition out of the loop, that can less n-1 times than condition in loop. Signed-off-by: Steven Liu --- libavcodec/fft_template.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c index 762c014bc8..2d97534505 100644 --- a/libavcodec/fft_template.c +++ b/libavcodec/fft_template.c @@ -261,17 +261,26 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (s->fft_permutation == FF_FFT_PERM_AVX) { fft_perm_avx(s); } else { + if (s->revtab) { for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); k = -split_radix_permutation(i, n, s->inverse) & (n-1); - if (s->revtab) s->revtab[k] = j; - if (s->revtab32) - s->revtab32[k] = j; } + } + if (s->revtab32) { + for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) + j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); + k = -split_radix_permutation(i, n, s->inverse) & (n-1); + s->revtab32[k] = j; + } + } } return 0;