From a93bbf39ba3feaaeeff72d04f810da7d8aa817b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 1 May 2024 12:06:38 +0200 Subject: [PATCH] Remove sinewin.cpp/h --- Common/Common.vcxproj | 2 - Common/Common.vcxproj.filters | 6 --- UWP/CommonUWP/CommonUWP.vcxproj | 2 - UWP/CommonUWP/CommonUWP.vcxproj.filters | 6 --- android/jni/Android.mk | 3 +- ext/at3_standalone/CMakeLists.txt | 1 - ext/at3_standalone/atrac3plusdsp.cpp | 15 +++++-- ext/at3_standalone/sinewin.cpp | 60 ------------------------- ext/at3_standalone/sinewin.h | 48 -------------------- libretro/Makefile.common | 3 +- 10 files changed, 14 insertions(+), 132 deletions(-) delete mode 100644 ext/at3_standalone/sinewin.cpp delete mode 100644 ext/at3_standalone/sinewin.h diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 73c7f834ab..cb78a6ceb6 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -396,7 +396,6 @@ - @@ -605,7 +604,6 @@ - NotUsing diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 2fa42ddc7c..e9ea060b0c 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -557,9 +557,6 @@ ext\at3_standalone - - ext\at3_standalone - @@ -1032,9 +1029,6 @@ ext\at3_standalone - - ext\at3_standalone - ext\at3_standalone diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index 5d6e99ea6a..b7bf692fbf 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -251,7 +251,6 @@ - @@ -402,7 +401,6 @@ - diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index 1795ce8645..183f8f48f0 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -492,9 +492,6 @@ ext\at3_standalone - - ext\at3_standalone - @@ -943,9 +940,6 @@ ext\at3_standalone - - ext\at3_standalone - diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 838a037439..ac949a57ef 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -121,8 +121,7 @@ AT3_STANDALONE_FILES := \ ${SRC}/ext/at3_standalone/get_bits.cpp \ ${SRC}/ext/at3_standalone/compat.cpp \ ${SRC}/ext/at3_standalone/fft.cpp \ - ${SRC}/ext/at3_standalone/mem.cpp \ - ${SRC}/ext/at3_standalone/sinewin.cpp + ${SRC}/ext/at3_standalone/mem.cpp RCHEEVOS_FILES := \ ${SRC}/ext/rcheevos/src/rapi/rc_api_common.c \ diff --git a/ext/at3_standalone/CMakeLists.txt b/ext/at3_standalone/CMakeLists.txt index e3b282c5ce..80a237b3de 100644 --- a/ext/at3_standalone/CMakeLists.txt +++ b/ext/at3_standalone/CMakeLists.txt @@ -15,7 +15,6 @@ set(ALL_SOURCE_FILES ${SRC_DIR}/compat.cpp ${SRC_DIR}/fft.cpp ${SRC_DIR}/mem.cpp - ${SRC_DIR}/sinewin.cpp ) add_library(at3_standalone STATIC ${ALL_SOURCE_FILES}) diff --git a/ext/at3_standalone/atrac3plusdsp.cpp b/ext/at3_standalone/atrac3plusdsp.cpp index d7bbd0b792..1cf345ced6 100644 --- a/ext/at3_standalone/atrac3plusdsp.cpp +++ b/ext/at3_standalone/atrac3plusdsp.cpp @@ -46,7 +46,6 @@ #include #include "float_dsp.h" -#include "sinewin.h" #include "fft.h" #include "atrac3plus.h" @@ -91,12 +90,22 @@ const float av_atrac3p_mant_tab[8] = { 0.035619736 }; +DECLARE_ALIGNED(32, float, av_sine_64)[64]; +DECLARE_ALIGNED(32, float, av_sine_128)[128]; + +// Generate a sine window. +static void ff_sine_window_init(float *window, int n) { + int i; + for (i = 0; i < n; i++) + window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); +} + #define ATRAC3P_MDCT_SIZE (ATRAC3P_SUBBAND_SAMPLES * 2) void ff_atrac3p_init_imdct(FFTContext *mdct_ctx) { - ff_init_ff_sine_windows(7); - ff_init_ff_sine_windows(6); + ff_sine_window_init(av_sine_64, 64); + ff_sine_window_init(av_sine_128, 128); /* Initialize the MDCT transform. */ ff_mdct_init(mdct_ctx, 8, 1, -1.0); diff --git a/ext/at3_standalone/sinewin.cpp b/ext/at3_standalone/sinewin.cpp deleted file mode 100644 index 8f75b8b79c..0000000000 --- a/ext/at3_standalone/sinewin.cpp +++ /dev/null @@ -1,60 +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 _USE_MATH_DEFINES -#include - -#include -#include "aac_defines.h" -#include "compat.h" - -#include "mem.h" -#include "aac_defines.h" - -#include "sinewin.h" - -SINETABLE(32); -SINETABLE(64); -SINETABLE(128); -SINETABLE(256); -SINETABLE(512); -SINETABLE(1024); -SINETABLE(2048); -SINETABLE(4096); -SINETABLE(8192); - -// Thie array is only accessed in init. However, not so for the -// sine tables it points to. -static float *av_sine_windows[] = { - NULL, NULL, NULL, NULL, NULL, // unused - av_sine_32, av_sine_64, av_sine_128, - av_sine_256, av_sine_512, av_sine_1024, - av_sine_2048, av_sine_4096, av_sine_8192 -}; - -// Generate a sine window. -void ff_sine_window_init(float *window, int n) { - int i; - for (i = 0; i < n; i++) - window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); -} - -void ff_init_ff_sine_windows(int index) { - assert(index >= 0 && index < FF_ARRAY_ELEMS(av_sine_windows)); - ff_sine_window_init(av_sine_windows[index], 1 << index); -} diff --git a/ext/at3_standalone/sinewin.h b/ext/at3_standalone/sinewin.h deleted file mode 100644 index da512bbd1f..0000000000 --- a/ext/at3_standalone/sinewin.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2008 Robert Swain - * - * 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 - */ - -#pragma once - -#include "compat.h" - -#define SINETABLE(size) \ - DECLARE_ALIGNED(32, float, av_sine_##size)[size] - - /** - * Generate a sine window. - * @param window pointer to half window - * @param n size of half window - */ -void ff_sine_window_init(float *window, int n); - -/** - * initialize the specified entry of ff_sine_windows - */ -void ff_init_ff_sine_windows(int index); - -extern SINETABLE(32); -extern SINETABLE(64); -extern SINETABLE(128); -extern SINETABLE(256); -extern SINETABLE(512); -extern SINETABLE(1024); -extern SINETABLE(2048); -extern SINETABLE(4096); -extern SINETABLE(8192); diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 75b51cdef5..e91b78e722 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -271,8 +271,7 @@ SOURCES_CXX += \ ${EXTDIR}/at3_standalone/get_bits.cpp \ ${EXTDIR}/at3_standalone/compat.cpp \ ${EXTDIR}/at3_standalone/fft.cpp \ - ${EXTDIR}/at3_standalone/mem.cpp \ - ${EXTDIR}/at3_standalone/sinewin.cpp + ${EXTDIR}/at3_standalone/mem.cpp ifeq ($(PLATFORM_EXT), android) COREFLAGS += -DHAVE_DLFCN_H