From patchwork Sat Jan 9 19:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 24872 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 7651544B6A7 for ; Sat, 9 Jan 2021 21:21:51 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5CB7568A86F; Sat, 9 Jan 2021 21:21:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 681956881A0 for ; Sat, 9 Jan 2021 21:21:45 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 14D671060309 for ; Sat, 9 Jan 2021 19:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1610220105; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=8jmFrW8yzMK5w0x7qadHeT2zktZkCFmDIj1uCytFbBI=; b=bRWkVWeMA85U5SUkSclbOvMphqARqD6i1GGgRX4JLhDNoFL8VIXENQFOpNFzb5Xw PTb7CS3wwaY2UaFHeGQh9haxXGRYRTfHZIEJgRobLXeiCRnuEc0S7LnuUM7VswcUwWM 5qQJMZZ5QX4JZk1KjHtsb8yjaoSQNFJuufJvFIAOaykfXeBhgiM1MFTZLyH48M+99dE TySQ2Jp1d2z+TAE718tOA0hAhKh+ozOl3XGZ/pJJO1yyroQOrP/OP/VzrXMljyG+KxV EIun0LvHYW2Ag/1LfaAIYV0FZi+T+wk5Yu0z6DLsTA/JjNlEzKz7bdPeKf7VjWjhS3L 5GwR2MfK9g== Date: Sat, 9 Jan 2021 20:21:45 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] mdct_fixed: remove 16-bit MDCT code 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" No longer needed or used by anything. Patch attached. Read patch 1/6 to see the size savings. Subject: [PATCH 5/6] mdct_fixed: remove 16-bit MDCT code No longer needed or used by anything. --- libavcodec/Makefile | 2 +- libavcodec/arm/Makefile | 3 +- libavcodec/arm/fft_fixed_init_arm.c | 10 -- libavcodec/arm/mdct_fixed_neon.S | 193 ---------------------------- libavcodec/fft-internal.h | 2 - libavcodec/fft.h | 1 - libavcodec/fft_template.c | 2 - libavcodec/mdct_fixed.c | 65 ---------- 8 files changed, 2 insertions(+), 276 deletions(-) delete mode 100644 libavcodec/arm/mdct_fixed_neon.S delete mode 100644 libavcodec/mdct_fixed.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0546e6f6c5..bf4256dc87 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -115,7 +115,7 @@ OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LZF) += lzf.o -OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o mdct_fixed_32.o +OBJS-$(CONFIG_MDCT) += mdct_float.o mdct_fixed_32.o OBJS-$(CONFIG_ME_CMP) += me_cmp.o OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index c6be814153..23e8abbf2e 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -123,8 +123,7 @@ NEON-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_neon.o \ NEON-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_neon.o \ arm/idctdsp_neon.o \ arm/simple_idct_neon.o -NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ - arm/mdct_fixed_neon.o +NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o NEON-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_neon.o NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o diff --git a/libavcodec/arm/fft_fixed_init_arm.c b/libavcodec/arm/fft_fixed_init_arm.c index 11226d65ff..30ce48d352 100644 --- a/libavcodec/arm/fft_fixed_init_arm.c +++ b/libavcodec/arm/fft_fixed_init_arm.c @@ -26,8 +26,6 @@ #include "libavcodec/fft.h" void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z); -void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i); -void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i); av_cold void ff_fft_fixed_init_arm(FFTContext *s) { @@ -38,13 +36,5 @@ av_cold void ff_fft_fixed_init_arm(FFTContext *s) #if CONFIG_FFT s->fft_calc = ff_fft_fixed_calc_neon; #endif - -#if CONFIG_MDCT - if (!s->inverse && s->nbits >= 3) { - s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; - s->mdct_calc = ff_mdct_fixed_calc_neon; - s->mdct_calcw = ff_mdct_fixed_calcw_neon; - } -#endif } } diff --git a/libavcodec/arm/mdct_fixed_neon.S b/libavcodec/arm/mdct_fixed_neon.S deleted file mode 100644 index 365c5e7faf..0000000000 --- a/libavcodec/arm/mdct_fixed_neon.S +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2011 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/arm/asm.S" - -.macro prerot dst, rt - lsr r3, r6, #2 @ n4 - add \rt, r4, r6, lsr #1 @ revtab + n4 - add r9, r3, r3, lsl #1 @ n3 - add r8, r7, r6 @ tcos + n4 - add r3, r2, r6, lsr #1 @ in + n4 - add r9, r2, r9, lsl #1 @ in + n3 - sub r8, r8, #16 - sub r10, r3, #16 - sub r11, r9, #16 - mov r12, #-16 -1: - vld2.16 {d0,d1}, [r9, :128]! - vld2.16 {d2,d3}, [r11,:128], r12 - vld2.16 {d4,d5}, [r3, :128]! - vld2.16 {d6,d7}, [r10,:128], r12 - vld2.16 {d16,d17},[r7, :128]! @ cos, sin - vld2.16 {d18,d19},[r8, :128], r12 - vrev64.16 q1, q1 - vrev64.16 q3, q3 - vrev64.16 q9, q9 - vneg.s16 d0, d0 - vneg.s16 d2, d2 - vneg.s16 d16, d16 - vneg.s16 d18, d18 - vhsub.s16 d0, d0, d3 @ re - vhsub.s16 d4, d7, d4 @ im - vhsub.s16 d6, d6, d5 - vhsub.s16 d2, d2, d1 - vmull.s16 q10, d0, d16 - vmlsl.s16 q10, d4, d17 - vmull.s16 q11, d0, d17 - vmlal.s16 q11, d4, d16 - vmull.s16 q12, d6, d18 - vmlsl.s16 q12, d2, d19 - vmull.s16 q13, d6, d19 - vmlal.s16 q13, d2, d18 - vshrn.s32 d0, q10, #15 - vshrn.s32 d1, q11, #15 - vshrn.s32 d2, q12, #15 - vshrn.s32 d3, q13, #15 - vzip.16 d0, d1 - vzip.16 d2, d3 - ldrh lr, [r4], #2 - ldrh r2, [\rt, #-2]! - add lr, \dst, lr, lsl #2 - add r2, \dst, r2, lsl #2 - vst1.32 {d0[0]}, [lr,:32] - vst1.32 {d2[0]}, [r2,:32] - ldrh lr, [r4], #2 - ldrh r2, [\rt, #-2]! - add lr, \dst, lr, lsl #2 - add r2, \dst, r2, lsl #2 - vst1.32 {d0[1]}, [lr,:32] - vst1.32 {d2[1]}, [r2,:32] - ldrh lr, [r4], #2 - ldrh r2, [\rt, #-2]! - add lr, \dst, lr, lsl #2 - add r2, \dst, r2, lsl #2 - vst1.32 {d1[0]}, [lr,:32] - vst1.32 {d3[0]}, [r2,:32] - ldrh lr, [r4], #2 - ldrh r2, [\rt, #-2]! - add lr, \dst, lr, lsl #2 - add r2, \dst, r2, lsl #2 - vst1.32 {d1[1]}, [lr,:32] - vst1.32 {d3[1]}, [r2,:32] - subs r6, r6, #32 - bgt 1b -.endm - -function ff_mdct_fixed_calc_neon, export=1 - push {r1,r4-r11,lr} - - ldr r4, [r0, #8] @ revtab - ldr r6, [r0, #16] @ mdct_size; n - ldr r7, [r0, #24] @ tcos - - prerot r1, r5 - - mov r4, r0 - bl X(ff_fft_fixed_calc_neon) - - pop {r5} - mov r12, #-16 - ldr r6, [r4, #16] @ mdct_size; n - ldr r7, [r4, #24] @ tcos - add r5, r5, r6, lsr #1 - add r7, r7, r6, lsr #1 - sub r1, r5, #16 - sub r2, r7, #16 -1: - vld2.16 {d4,d5}, [r7,:128]! - vld2.16 {d6,d7}, [r2,:128], r12 - vld2.16 {d0,d1}, [r5,:128] - vld2.16 {d2,d3}, [r1,:128] - vrev64.16 q3, q3 - vrev64.16 q1, q1 - vneg.s16 q3, q3 - vneg.s16 q2, q2 - vmull.s16 q11, d2, d6 - vmlal.s16 q11, d3, d7 - vmull.s16 q8, d0, d5 - vmlsl.s16 q8, d1, d4 - vmull.s16 q9, d0, d4 - vmlal.s16 q9, d1, d5 - vmull.s16 q10, d2, d7 - vmlsl.s16 q10, d3, d6 - vshrn.s32 d0, q11, #15 - vshrn.s32 d1, q8, #15 - vshrn.s32 d2, q9, #15 - vshrn.s32 d3, q10, #15 - vrev64.16 q0, q0 - vst2.16 {d2,d3}, [r5,:128]! - vst2.16 {d0,d1}, [r1,:128], r12 - subs r6, r6, #32 - bgt 1b - - pop {r4-r11,pc} -endfunc - -function ff_mdct_fixed_calcw_neon, export=1 - push {r1,r4-r11,lr} - - ldrd r4, r5, [r0, #8] @ revtab, tmp_buf - ldr r6, [r0, #16] @ mdct_size; n - ldr r7, [r0, #24] @ tcos - - prerot r5, r1 - - mov r4, r0 - mov r1, r5 - bl X(ff_fft_fixed_calc_neon) - - pop {r7} - mov r12, #-16 - ldr r6, [r4, #16] @ mdct_size; n - ldr r9, [r4, #24] @ tcos - add r5, r5, r6, lsr #1 - add r7, r7, r6 - add r9, r9, r6, lsr #1 - sub r3, r5, #16 - sub r1, r7, #16 - sub r2, r9, #16 -1: - vld2.16 {d4,d5}, [r9,:128]! - vld2.16 {d6,d7}, [r2,:128], r12 - vld2.16 {d0,d1}, [r5,:128]! - vld2.16 {d2,d3}, [r3,:128], r12 - vrev64.16 q3, q3 - vrev64.16 q1, q1 - vneg.s16 q3, q3 - vneg.s16 q2, q2 - vmull.s16 q8, d2, d6 - vmlal.s16 q8, d3, d7 - vmull.s16 q9, d0, d5 - vmlsl.s16 q9, d1, d4 - vmull.s16 q10, d0, d4 - vmlal.s16 q10, d1, d5 - vmull.s16 q11, d2, d7 - vmlsl.s16 q11, d3, d6 - vrev64.32 q8, q8 - vrev64.32 q9, q9 - vst2.32 {q10,q11},[r7,:128]! - vst2.32 {d16,d18},[r1,:128], r12 - vst2.32 {d17,d19},[r1,:128], r12 - subs r6, r6, #32 - bgt 1b - - pop {r4-r11,pc} -endfunc diff --git a/libavcodec/fft-internal.h b/libavcodec/fft-internal.h index 0a8f7d05cf..5566ad9b81 100644 --- a/libavcodec/fft-internal.h +++ b/libavcodec/fft-internal.h @@ -57,8 +57,6 @@ #include "fft.h" #include "mathops.h" -void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input); - #define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767) #define sqrthalf ((int16_t)((1<<15)*M_SQRT1_2)) diff --git a/libavcodec/fft.h b/libavcodec/fft.h index 5f67b61f06..ee823dd9ae 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -108,7 +108,6 @@ struct FFTContext { void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - void (*mdct_calcw)(struct FFTContext *s, FFTDouble *output, const FFTSample *input); enum fft_permutation_type fft_permutation; enum mdct_permutation_type mdct_permutation; uint32_t *revtab32; diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c index e807f4b255..4ffb9b1d9d 100644 --- a/libavcodec/fft_template.c +++ b/libavcodec/fft_template.c @@ -236,10 +236,8 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (ARCH_ARM) ff_fft_init_arm(s); if (ARCH_PPC) ff_fft_init_ppc(s); if (ARCH_X86) ff_fft_init_x86(s); - if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; if (HAVE_MIPSFPU) ff_fft_init_mips(s); #else - if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c; if (ARCH_ARM) ff_fft_fixed_init_arm(s); #endif for(j=4; j<=nbits; j++) { diff --git a/libavcodec/mdct_fixed.c b/libavcodec/mdct_fixed.c deleted file mode 100644 index aabf0c88f8..0000000000 --- a/libavcodec/mdct_fixed.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define FFT_FLOAT 0 -#define FFT_FIXED_32 0 -#include "mdct_template.c" - -/* same as ff_mdct_calcw_c with double-width unscaled output */ -void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input) -{ - int i, j, n, n8, n4, n2, n3; - FFTDouble re, im; - const uint16_t *revtab = s->revtab; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - FFTComplex *x = s->tmp_buf; - FFTDComplex *o = (FFTDComplex *)out; - - n = 1 << s->mdct_bits; - n2 = n >> 1; - n4 = n >> 2; - n8 = n >> 3; - n3 = 3 * n4; - - /* pre rotation */ - for(i=0;ifft_calc(s, x); - - /* post rotation */ - for(i=0;i