Skip to content

Commit

Permalink
Merge pull request #19099 from hrydgard/remove-more-unused-code
Browse files Browse the repository at this point in the history
Atrac3+ standalone decoder: Remove more unused code
  • Loading branch information
hrydgard committed May 1, 2024
2 parents 59be4b0 + 5536ca4 commit b8f6b53
Show file tree
Hide file tree
Showing 21 changed files with 124 additions and 1,109 deletions.
5 changes: 0 additions & 5 deletions Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@
<ClInclude Include="..\ext\at3_standalone\float_dsp.h" />
<ClInclude Include="..\ext\at3_standalone\get_bits.h" />
<ClInclude Include="..\ext\at3_standalone\intreadwrite.h" />
<ClInclude Include="..\ext\at3_standalone\mathematics.h" />
<ClInclude Include="..\ext\at3_standalone\mem.h" />
<ClInclude Include="..\ext\at3_standalone\sinewin.h" />
<ClInclude Include="..\ext\basis_universal\basisu.h" />
<ClInclude Include="..\ext\basis_universal\basisu_containers.h" />
<ClInclude Include="..\ext\basis_universal\basisu_containers_impl.h" />
Expand Down Expand Up @@ -605,10 +603,7 @@
<ClCompile Include="..\ext\at3_standalone\get_bits.cpp" />
<ClCompile Include="..\ext\at3_standalone\compat.cpp" />
<ClCompile Include="..\ext\at3_standalone\fft.cpp" />
<ClCompile Include="..\ext\at3_standalone\float_dsp.cpp" />
<ClCompile Include="..\ext\at3_standalone\mathematics.cpp" />
<ClCompile Include="..\ext\at3_standalone\mem.cpp" />
<ClCompile Include="..\ext\at3_standalone\sinewin.cpp" />
<ClCompile Include="..\ext\basis_universal\basisu_transcoder.cpp" />
<ClCompile Include="..\ext\libpng17\png.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
Expand Down
15 changes: 0 additions & 15 deletions Common/Common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -551,18 +551,12 @@
<ClInclude Include="..\ext\at3_standalone\intreadwrite.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\ext\at3_standalone\mathematics.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\ext\at3_standalone\at3_decoders.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\ext\at3_standalone\mem.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\ext\at3_standalone\sinewin.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ABI.cpp" />
Expand Down Expand Up @@ -1032,21 +1026,12 @@
<ClCompile Include="..\ext\at3_standalone\atrac3plusdsp.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\float_dsp.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\mem.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\sinewin.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\atrac.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\mathematics.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\ext\at3_standalone\fft.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
Expand Down
8 changes: 1 addition & 7 deletions UWP/CommonUWP/CommonUWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,9 @@
<ClInclude Include="..\..\ext\at3_standalone\atrac3plus_data.h" />
<ClInclude Include="..\..\ext\at3_standalone\compat.h" />
<ClInclude Include="..\..\ext\at3_standalone\fft.h" />
<ClInclude Include="..\..\ext\at3_standalone\float_dsp.h" />
<ClInclude Include="..\..\ext\at3_standalone\get_bits.h" />
<ClInclude Include="..\..\ext\at3_standalone\intreadwrite.h" />
<ClInclude Include="..\..\ext\at3_standalone\mathematics.h" />
<ClInclude Include="..\..\ext\at3_standalone\mem.h" />
<ClInclude Include="..\..\ext\at3_standalone\sinewin.h" />
<ClInclude Include="..\..\ext\basis_universal\basisu.h" />
<ClInclude Include="..\..\ext\basis_universal\basisu_containers.h" />
<ClInclude Include="..\..\ext\basis_universal\basisu_containers_impl.h" />
Expand Down Expand Up @@ -402,11 +399,8 @@
<ClCompile Include="..\..\ext\at3_standalone\atrac3plusdsp.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\compat.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\fft.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\float_dsp.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\get_bits.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\mathematics.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\mem.cpp" />
<ClCompile Include="..\..\ext\at3_standalone\sinewin.cpp" />
<ClCompile Include="..\..\ext\basis_universal\basisu_transcoder.cpp" />
<ClCompile Include="..\..\ext\libpng17\png.c" />
<ClCompile Include="..\..\ext\libpng17\pngerror.c" />
Expand Down Expand Up @@ -456,4 +450,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
20 changes: 1 addition & 19 deletions UWP/CommonUWP/CommonUWP.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -486,21 +486,12 @@
<ClCompile Include="..\..\ext\at3_standalone\fft.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\at3_standalone\float_dsp.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\at3_standalone\get_bits.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\at3_standalone\mathematics.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\at3_standalone\mem.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\at3_standalone\sinewin.cpp">
<Filter>ext\at3_standalone</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
Expand Down Expand Up @@ -940,24 +931,15 @@
<ClInclude Include="..\..\ext\at3_standalone\fft.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\float_dsp.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\get_bits.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\intreadwrite.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\mathematics.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\mem.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\at3_standalone\sinewin.h">
<Filter>ext\at3_standalone</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Common\Math\fast\fast_matrix_neon.S">
Expand Down Expand Up @@ -1006,4 +988,4 @@
<Filter>ext\at3_standalone</Filter>
</Text>
</ItemGroup>
</Project>
</Project>
5 changes: 1 addition & 4 deletions android/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +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/float_dsp.cpp \
${SRC}/ext/at3_standalone/mathematics.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 \
Expand Down
3 changes: 0 additions & 3 deletions ext/at3_standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ set(ALL_SOURCE_FILES
${SRC_DIR}/get_bits.cpp
${SRC_DIR}/compat.cpp
${SRC_DIR}/fft.cpp
${SRC_DIR}/float_dsp.cpp
${SRC_DIR}/mathematics.cpp
${SRC_DIR}/mem.cpp
${SRC_DIR}/sinewin.cpp
)

add_library(at3_standalone STATIC ${ALL_SOURCE_FILES})
39 changes: 38 additions & 1 deletion ext/at3_standalone/atrac3plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <string.h>
#include <stdlib.h>

#include "mathematics.h"
#include "get_bits.h"
#include "atrac3plus.h"
#include "atrac3plus_data.h"
Expand All @@ -41,6 +40,34 @@ static VLC spec_vlc_tabs[112];
static VLC gain_vlc_tabs[11];
static VLC tone_vlc_tabs[7];

static const uint8_t ff_logg2_tab[256] = {
0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
};

// todo: Replace with clz type instructions.
int av_log2(unsigned int v)
{
int n = 0;
if (v & 0xffff0000) {
v >>= 16;
n += 16;
}
if (v & 0xff00) {
v >>= 8;
n += 8;
}
n += ff_logg2_tab[v];

return n;
}

/**
* Generate canonical VLC table from given descriptor.
*
Expand Down Expand Up @@ -788,6 +815,16 @@ static int decode_code_table_indexes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
return 0;
}

/**
* Clear high bits from an unsigned integer starting with specific bit position
* @param a value to clip
* @param p bit position to clip at
* @return clipped value
*/
inline unsigned av_mod_uintp2(unsigned a, unsigned p) {
return a & ((1 << p) - 1);
}

/**
* Decode huffman-coded spectral lines for a given quant unit.
*
Expand Down
16 changes: 13 additions & 3 deletions ext/at3_standalone/atrac3plusdsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@

#endif

#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>

#include "float_dsp.h"
#include "sinewin.h"
#include "fft.h"
#include "atrac3plus.h"

Expand Down Expand Up @@ -90,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);
Expand Down

0 comments on commit b8f6b53

Please sign in to comment.