libmpg123 1.15.4

git-svn-id: svn://kolibrios.org@3960 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge)
2013-10-02 16:44:03 +00:00
parent 44d189b67c
commit 2217a37e5b
68 changed files with 11403 additions and 1285 deletions

View File

@@ -41,20 +41,21 @@ echo "
#define dn_SSE "SSE"
#define dn_x86_64 "x86-64"
#define dn_ARM "ARM"
#define dn_NEON "NEON"
static const char* decname[] =
{
"auto"
, dn_generic, dn_generic_dither, dn_i386, dn_i486, dn_i586, dn_i586_dither, dn_MMX, dn_3DNow, dn_3DNowExt, dn_AltiVec, dn_SSE, dn_x86_64, dn_ARM
, dn_generic, dn_generic_dither, dn_i386, dn_i486, dn_i586, dn_i586_dither, dn_MMX, dn_3DNow, dn_3DNowExt, dn_AltiVec, dn_SSE, dn_x86_64, dn_ARM, dn_NEON
, "nodec"
};
#if (defined OPT_X86) && (defined OPT_MULTI)
#include "getcpuflags.h"
struct cpuflags cpu_flags;
static struct cpuflags cpu_flags;
#else
/* Faking stuff for non-multi builds. The same code for synth function choice is used.
Just no runtime dependency of result... */
char cpu_flags;
#define cpu_flags nothing
#define cpu_i586(s) 1
#define cpu_fpu(s) 1
#define cpu_mmx(s) 1
@@ -91,7 +92,17 @@ char cpu_flags;
# define OUT_SYNTHS(synth_16, synth_8, synth_real, synth_32) { IF8(synth_8) IFREAL(synth_real) IF32(synth_32) }
#endif
const struct synth_s synth_base =
/* The call of left and right plain synth, wrapped.
This may be replaced by a direct stereo optimized synth. */
static int synth_stereo_wrap(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int clip;
clip = (fr->synth)(bandPtr_l, 0, fr, 0);
clip += (fr->synth)(bandPtr_r, 1, fr, 1);
return clip;
}
static const struct synth_s synth_base =
{
{ /* plain */
OUT_SYNTHS(synth_1to1, synth_1to1_8bit, synth_1to1_real, synth_1to1_s32)
@@ -114,13 +125,13 @@ const struct synth_s synth_base =
# endif
},
{ /* mono2stereo */
OUT_SYNTHS(synth_1to1_mono2stereo, synth_1to1_8bit_mono2stereo, synth_1to1_real_mono2stereo, synth_1to1_s32_mono2stereo)
OUT_SYNTHS(synth_1to1_m2s, synth_1to1_8bit_m2s, synth_1to1_real_m2s, synth_1to1_s32_m2s)
# ifndef NO_DOWNSAMPLE
,OUT_SYNTHS(synth_2to1_mono2stereo, synth_2to1_8bit_mono2stereo, synth_2to1_real_mono2stereo, synth_2to1_s32_mono2stereo)
,OUT_SYNTHS(synth_4to1_mono2stereo, synth_4to1_8bit_mono2stereo, synth_4to1_real_mono2stereo, synth_4to1_s32_mono2stereo)
,OUT_SYNTHS(synth_2to1_m2s, synth_2to1_8bit_m2s, synth_2to1_real_m2s, synth_2to1_s32_m2s)
,OUT_SYNTHS(synth_4to1_m2s, synth_4to1_8bit_m2s, synth_4to1_real_m2s, synth_4to1_s32_m2s)
# endif
# ifndef NO_NTOM
,OUT_SYNTHS(synth_ntom_mono2stereo, synth_ntom_8bit_mono2stereo, synth_ntom_real_mono2stereo, synth_ntom_s32_mono2stereo)
,OUT_SYNTHS(synth_ntom_m2s, synth_ntom_8bit_m2s, synth_ntom_real_m2s, synth_ntom_s32_m2s)
# endif
},
{ /* mono*/
@@ -155,7 +166,7 @@ enum optdec defdec(void){ return defopt; }
enum optcla decclass(const enum optdec type)
{
return (type == mmx || type == sse || type == dreidnowext || type == x86_64 ) ? mmxsse : normal;
return (type == mmx || type == sse || type == dreidnowext || type == x86_64 || type == neon) ? mmxsse : normal;
}
@@ -215,6 +226,9 @@ static int find_dectype(mpg123_handle *fr)
#ifdef OPT_ARM
else if(basic_synth == synth_1to1_arm) type = arm;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_neon) type = neon;
#endif
#ifdef OPT_GENERIC_DITHER
else if(basic_synth == synth_1to1_dither) type = generic_dither;
#endif
@@ -239,6 +253,9 @@ static int find_dectype(mpg123_handle *fr)
#ifdef OPT_ALTIVEC
else if(basic_synth == synth_1to1_real_altivec) type = altivec;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_real_neon) type = neon;
#endif
#endif /* real */
@@ -252,6 +269,9 @@ static int find_dectype(mpg123_handle *fr)
#ifdef OPT_ALTIVEC
else if(basic_synth == synth_1to1_s32_altivec) type = altivec;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_s32_neon) type = neon;
#endif
#endif /* 32bit */
#ifdef OPT_X86
@@ -308,7 +328,8 @@ int set_synth_functions(mpg123_handle *fr)
basic_format = f_real;
#endif
#ifndef NO_32BIT
else if(fr->af.encoding & MPG123_ENC_32)
/* 24 bit integer means decoding to 32 bit first. */
else if(fr->af.encoding & MPG123_ENC_32 || fr->af.encoding & MPG123_ENC_24)
basic_format = f_32;
#endif
@@ -387,6 +408,7 @@ int set_synth_functions(mpg123_handle *fr)
# ifdef ACCURATE_ROUNDING
&& fr->cpu_opts.type != sse
&& fr->cpu_opts.type != x86_64
&& fr->cpu_opts.type != neon
# endif
)
{
@@ -445,9 +467,11 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
/* covers any i386+ cpu; they actually differ only in the synth_1to1 function, mostly... */
#ifdef OPT_X86
#ifdef OPT_MULTI
#ifndef NO_LAYER3
#if (defined OPT_3DNOW || defined OPT_3DNOWEXT)
fr->cpu_opts.dct36 = dct36;
fr->cpu_opts.the_dct36 = dct36;
#endif
#endif
#endif
@@ -487,9 +511,12 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
chosen = "3DNowExt";
fr->cpu_opts.type = dreidnowext;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.dct36 = dct36_3dnowext;
/* The DCT36 is _bad_, at least compared to gcc 4.4-built C code. */
/* fr->cpu_opts.the_dct36 = dct36_3dnowext; */
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnowext;
# endif
@@ -502,9 +529,12 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
chosen = "3DNow";
fr->cpu_opts.type = dreidnow;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.dct36 = dct36_3dnow;
/* The DCT36 is _bad_, at least compared to gcc 4.4-built C code. */
/* fr->cpu_opts.the_dct36 = dct36_3dnow; */
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnow;
# endif
@@ -585,7 +615,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_mono2stereo;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
}
# endif
# endif
@@ -658,6 +688,27 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
}
# endif
# ifdef OPT_NEON
if(!done && (auto_choose || want_dec == neon))
{
chosen = "NEON";
fr->cpu_opts.type = neon;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_neon;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_neon;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_neon;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_neon;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_neon;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_neon;
# endif
done = 1;
}
# endif
# ifdef OPT_ARM
if(!done && (auto_choose || want_dec == arm))
{
@@ -690,7 +741,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_mono2stereo;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
}
# endif
# endif
@@ -770,6 +821,9 @@ static const char *mpg123_supported_decoder_list[] =
#ifdef OPT_ARM
NULL,
#endif
#ifdef OPT_NEON
NULL,
#endif
#ifdef OPT_GENERIC_FLOAT
NULL,
#endif
@@ -818,6 +872,9 @@ static const char *mpg123_decoder_list[] =
#ifdef OPT_ARM
dn_ARM,
#endif
#ifdef OPT_NEON
dn_NEON,
#endif
#ifdef OPT_GENERIC
dn_generic,
#endif
@@ -877,6 +934,9 @@ void check_decoders(void )
#ifdef OPT_ARM
*(d++) = decname[arm];
#endif
#ifdef OPT_NEON
*(d++) = decname[neon];
#endif
#ifdef OPT_GENERIC
*(d++) = decname[generic];
#endif
@@ -893,8 +953,8 @@ const char* attribute_align_arg mpg123_current_decoder(mpg123_handle *mh)
return decname[mh->cpu_opts.type];
}
const char attribute_align_arg **mpg123_decoders(){ return mpg123_decoder_list; }
const char attribute_align_arg **mpg123_supported_decoders()
const char attribute_align_arg **mpg123_decoders(void){ return mpg123_decoder_list; }
const char attribute_align_arg **mpg123_supported_decoders(void)
{
#ifdef OPT_MULTI
return mpg123_supported_decoder_list;