Subversion Repositories Kolibri OS

Rev

Rev 1905 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1905 Rev 3960
Line 39... Line 39...
39
#define dn_3DNowExt "3DNowExt"
39
#define dn_3DNowExt "3DNowExt"
40
#define dn_AltiVec "AltiVec"
40
#define dn_AltiVec "AltiVec"
41
#define dn_SSE "SSE"
41
#define dn_SSE "SSE"
42
#define dn_x86_64 "x86-64"
42
#define dn_x86_64 "x86-64"
43
#define dn_ARM "ARM"
43
#define dn_ARM "ARM"
-
 
44
#define dn_NEON "NEON"
44
static const char* decname[] =
45
static const char* decname[] =
45
{
46
{
46
	"auto"
47
	"auto"
47
	, 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
48
	, 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
48
	, "nodec"
49
	, "nodec"
49
};
50
};
Line 50... Line 51...
50
 
51
 
51
#if (defined OPT_X86) && (defined OPT_MULTI)
52
#if (defined OPT_X86) && (defined OPT_MULTI)
52
#include "getcpuflags.h"
53
#include "getcpuflags.h"
53
struct cpuflags cpu_flags;
54
static struct cpuflags cpu_flags;
54
#else
55
#else
55
/* Faking stuff for non-multi builds. The same code for synth function choice is used.
56
/* Faking stuff for non-multi builds. The same code for synth function choice is used.
56
   Just no runtime dependency of result... */
57
   Just no runtime dependency of result... */
57
char cpu_flags;
58
#define cpu_flags nothing
58
#define cpu_i586(s)     1
59
#define cpu_i586(s)     1
59
#define cpu_fpu(s)      1
60
#define cpu_fpu(s)      1
60
#define cpu_mmx(s)      1
61
#define cpu_mmx(s)      1
61
#define cpu_3dnow(s)    1
62
#define cpu_3dnow(s)    1
Line 89... Line 90...
89
#	define OUT_SYNTHS(synth_16, synth_8, synth_real, synth_32) { synth_16, IF8(synth_8) IFREAL(synth_real) IF32(synth_32) }
90
#	define OUT_SYNTHS(synth_16, synth_8, synth_real, synth_32) { synth_16, IF8(synth_8) IFREAL(synth_real) IF32(synth_32) }
90
#else
91
#else
91
#	define OUT_SYNTHS(synth_16, synth_8, synth_real, synth_32) { IF8(synth_8) IFREAL(synth_real) IF32(synth_32) }
92
#	define OUT_SYNTHS(synth_16, synth_8, synth_real, synth_32) { IF8(synth_8) IFREAL(synth_real) IF32(synth_32) }
92
#endif
93
#endif
Line -... Line 94...
-
 
94
 
-
 
95
/* The call of left and right plain synth, wrapped.
-
 
96
   This may be replaced by a direct stereo optimized synth. */
-
 
97
static int synth_stereo_wrap(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
-
 
98
{
-
 
99
	int clip;
-
 
100
	clip  = (fr->synth)(bandPtr_l, 0, fr, 0);
-
 
101
	clip += (fr->synth)(bandPtr_r, 1, fr, 1);
-
 
102
	return clip;
-
 
103
}
93
 
104
 
94
const struct synth_s synth_base =
105
static const struct synth_s synth_base =
95
{
106
{
96
	{ /* plain */
107
	{ /* plain */
97
		 OUT_SYNTHS(synth_1to1, synth_1to1_8bit, synth_1to1_real, synth_1to1_s32)
108
		 OUT_SYNTHS(synth_1to1, synth_1to1_8bit, synth_1to1_real, synth_1to1_s32)
98
#		ifndef NO_DOWNSAMPLE
109
#		ifndef NO_DOWNSAMPLE
Line 112... Line 123...
112
#		ifndef NO_NTOM
123
#		ifndef NO_NTOM
113
		,OUT_SYNTHS(synth_stereo_wrap, synth_stereo_wrap, synth_stereo_wrap, synth_stereo_wrap)
124
		,OUT_SYNTHS(synth_stereo_wrap, synth_stereo_wrap, synth_stereo_wrap, synth_stereo_wrap)
114
#		endif
125
#		endif
115
	},
126
	},
116
	{ /* mono2stereo */
127
	{ /* mono2stereo */
117
		 OUT_SYNTHS(synth_1to1_mono2stereo, synth_1to1_8bit_mono2stereo, synth_1to1_real_mono2stereo, synth_1to1_s32_mono2stereo)
128
		 OUT_SYNTHS(synth_1to1_m2s, synth_1to1_8bit_m2s, synth_1to1_real_m2s, synth_1to1_s32_m2s)
118
#		ifndef NO_DOWNSAMPLE
129
#		ifndef NO_DOWNSAMPLE
119
		,OUT_SYNTHS(synth_2to1_mono2stereo, synth_2to1_8bit_mono2stereo, synth_2to1_real_mono2stereo, synth_2to1_s32_mono2stereo)
130
		,OUT_SYNTHS(synth_2to1_m2s, synth_2to1_8bit_m2s, synth_2to1_real_m2s, synth_2to1_s32_m2s)
120
		,OUT_SYNTHS(synth_4to1_mono2stereo, synth_4to1_8bit_mono2stereo, synth_4to1_real_mono2stereo, synth_4to1_s32_mono2stereo)
131
		,OUT_SYNTHS(synth_4to1_m2s, synth_4to1_8bit_m2s, synth_4to1_real_m2s, synth_4to1_s32_m2s)
121
#		endif
132
#		endif
122
#		ifndef NO_NTOM
133
#		ifndef NO_NTOM
123
		,OUT_SYNTHS(synth_ntom_mono2stereo, synth_ntom_8bit_mono2stereo, synth_ntom_real_mono2stereo, synth_ntom_s32_mono2stereo)
134
		,OUT_SYNTHS(synth_ntom_m2s, synth_ntom_8bit_m2s, synth_ntom_real_m2s, synth_ntom_s32_m2s)
124
#		endif
135
#		endif
125
	},
136
	},
126
	{ /* mono*/
137
	{ /* mono*/
127
		 OUT_SYNTHS(synth_1to1_mono, synth_1to1_8bit_mono, synth_1to1_real_mono, synth_1to1_s32_mono)
138
		 OUT_SYNTHS(synth_1to1_mono, synth_1to1_8bit_mono, synth_1to1_real_mono, synth_1to1_s32_mono)
128
#		ifndef NO_DOWNSAMPLE
139
#		ifndef NO_DOWNSAMPLE
Line 153... Line 164...
153
 
164
 
Line 154... Line 165...
154
enum optdec defdec(void){ return defopt; }
165
enum optdec defdec(void){ return defopt; }
155
 
166
 
156
enum optcla decclass(const enum optdec type)
167
enum optcla decclass(const enum optdec type)
157
{
168
{
Line 158... Line 169...
158
	return (type == mmx || type == sse || type == dreidnowext || type == x86_64 ) ? mmxsse : normal;
169
	return (type == mmx || type == sse || type == dreidnowext || type == x86_64  || type == neon) ? mmxsse : normal;
159
}
170
}
Line 213... Line 224...
213
	else if(basic_synth == synth_1to1_x86_64) type = x86_64;
224
	else if(basic_synth == synth_1to1_x86_64) type = x86_64;
214
#endif
225
#endif
215
#ifdef OPT_ARM
226
#ifdef OPT_ARM
216
	else if(basic_synth == synth_1to1_arm) type = arm;
227
	else if(basic_synth == synth_1to1_arm) type = arm;
217
#endif
228
#endif
-
 
229
#ifdef OPT_NEON
-
 
230
	else if(basic_synth == synth_1to1_neon) type = neon;
-
 
231
#endif
218
#ifdef OPT_GENERIC_DITHER
232
#ifdef OPT_GENERIC_DITHER
219
	else if(basic_synth == synth_1to1_dither) type = generic_dither;
233
	else if(basic_synth == synth_1to1_dither) type = generic_dither;
220
#endif
234
#endif
221
#ifdef OPT_DITHER /* either i586 or generic! */
235
#ifdef OPT_DITHER /* either i586 or generic! */
222
#ifndef NO_DOWNSAMPLE
236
#ifndef NO_DOWNSAMPLE
Line 237... Line 251...
237
	else if(basic_synth == synth_1to1_real_x86_64) type = x86_64;
251
	else if(basic_synth == synth_1to1_real_x86_64) type = x86_64;
238
#endif
252
#endif
239
#ifdef OPT_ALTIVEC
253
#ifdef OPT_ALTIVEC
240
	else if(basic_synth == synth_1to1_real_altivec) type = altivec;
254
	else if(basic_synth == synth_1to1_real_altivec) type = altivec;
241
#endif
255
#endif
-
 
256
#ifdef OPT_NEON
-
 
257
	else if(basic_synth == synth_1to1_real_neon) type = neon;
-
 
258
#endif
Line 242... Line 259...
242
 
259
 
Line 243... Line 260...
243
#endif /* real */
260
#endif /* real */
244
 
261
 
Line 250... Line 267...
250
	else if(basic_synth == synth_1to1_s32_x86_64) type = x86_64;
267
	else if(basic_synth == synth_1to1_s32_x86_64) type = x86_64;
251
#endif
268
#endif
252
#ifdef OPT_ALTIVEC
269
#ifdef OPT_ALTIVEC
253
	else if(basic_synth == synth_1to1_s32_altivec) type = altivec;
270
	else if(basic_synth == synth_1to1_s32_altivec) type = altivec;
254
#endif
271
#endif
-
 
272
#ifdef OPT_NEON
-
 
273
	else if(basic_synth == synth_1to1_s32_neon) type = neon;
-
 
274
#endif
255
#endif /* 32bit */
275
#endif /* 32bit */
Line 256... Line 276...
256
 
276
 
257
#ifdef OPT_X86
277
#ifdef OPT_X86
258
	else if(find_synth(basic_synth, plain_i386))
278
	else if(find_synth(basic_synth, plain_i386))
Line 306... Line 326...
306
#ifndef NO_REAL
326
#ifndef NO_REAL
307
	else if(fr->af.encoding & MPG123_ENC_FLOAT)
327
	else if(fr->af.encoding & MPG123_ENC_FLOAT)
308
	basic_format = f_real;
328
	basic_format = f_real;
309
#endif
329
#endif
310
#ifndef NO_32BIT
330
#ifndef NO_32BIT
-
 
331
	/* 24 bit integer means decoding to 32 bit first. */
311
	else if(fr->af.encoding & MPG123_ENC_32)
332
	else if(fr->af.encoding & MPG123_ENC_32 || fr->af.encoding & MPG123_ENC_24)
312
	basic_format = f_32;
333
	basic_format = f_32;
313
#endif
334
#endif
Line 314... Line 335...
314
 
335
 
315
	/* Make sure the chosen format is compiled into this lib. */
336
	/* Make sure the chosen format is compiled into this lib. */
Line 385... Line 406...
385
	   && basic_format != f_32
406
	   && basic_format != f_32
386
#	endif
407
#	endif
387
#	ifdef ACCURATE_ROUNDING
408
#	ifdef ACCURATE_ROUNDING
388
	   && fr->cpu_opts.type != sse
409
	   && fr->cpu_opts.type != sse
389
	   && fr->cpu_opts.type != x86_64
410
	   && fr->cpu_opts.type != x86_64
-
 
411
	   && fr->cpu_opts.type != neon
390
#	endif
412
#	endif
391
	  )
413
	  )
392
	{
414
	{
393
#ifndef NO_LAYER3
415
#ifndef NO_LAYER3
394
		init_layer3_stuff(fr, init_layer3_gainpow2_mmx);
416
		init_layer3_stuff(fr, init_layer3_gainpow2_mmx);
Line 443... Line 465...
443
 
465
 
444
	fr->cpu_opts.type = nodec;
466
	fr->cpu_opts.type = nodec;
445
	/* covers any i386+ cpu; they actually differ only in the synth_1to1 function, mostly... */
467
	/* covers any i386+ cpu; they actually differ only in the synth_1to1 function, mostly... */
Line -... Line 468...
-
 
468
#ifdef OPT_X86
446
#ifdef OPT_X86
469
 
447
 
470
#ifdef OPT_MULTI
448
#ifndef NO_LAYER3
471
#ifndef NO_LAYER3
-
 
472
#if (defined OPT_3DNOW || defined OPT_3DNOWEXT)
449
#if (defined OPT_3DNOW || defined OPT_3DNOWEXT)
473
	fr->cpu_opts.the_dct36 = dct36;
450
	fr->cpu_opts.dct36 = dct36;
474
#endif
Line 451... Line 475...
451
#endif
475
#endif
452
#endif
476
#endif
Line 485... Line 509...
485
		   && cpu_3dnowext(cpu_flags)
509
		   && cpu_3dnowext(cpu_flags)
486
		   && cpu_mmx(cpu_flags) )
510
		   && cpu_mmx(cpu_flags) )
487
		{
511
		{
488
			chosen = "3DNowExt";
512
			chosen = "3DNowExt";
489
			fr->cpu_opts.type = dreidnowext;
513
			fr->cpu_opts.type = dreidnowext;
-
 
514
#ifdef OPT_MULTI
490
#			ifndef NO_LAYER3
515
#			ifndef NO_LAYER3
-
 
516
/* The DCT36 is _bad_, at least compared to gcc 4.4-built C code. */
491
			fr->cpu_opts.dct36 = dct36_3dnowext;
517
/*			fr->cpu_opts.the_dct36 = dct36_3dnowext; */
-
 
518
#			endif
492
#			endif
519
#endif
493
#			ifndef NO_16BIT
520
#			ifndef NO_16BIT
494
			fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnowext;
521
			fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnowext;
495
#			endif
522
#			endif
496
			done = 1;
523
			done = 1;
Line 500... Line 527...
500
		if(    !done && (auto_choose || want_dec == dreidnow)
527
		if(    !done && (auto_choose || want_dec == dreidnow)
501
		    && cpu_3dnow(cpu_flags) && cpu_mmx(cpu_flags) )
528
		    && cpu_3dnow(cpu_flags) && cpu_mmx(cpu_flags) )
502
		{
529
		{
503
			chosen = "3DNow";
530
			chosen = "3DNow";
504
			fr->cpu_opts.type = dreidnow;
531
			fr->cpu_opts.type = dreidnow;
-
 
532
#ifdef OPT_MULTI
505
#			ifndef NO_LAYER3
533
#			ifndef NO_LAYER3
-
 
534
/* The DCT36 is _bad_, at least compared to gcc 4.4-built C code. */
506
			fr->cpu_opts.dct36 = dct36_3dnow;
535
/*			fr->cpu_opts.the_dct36 = dct36_3dnow; */
-
 
536
#			endif
507
#			endif
537
#endif
508
#			ifndef NO_16BIT
538
#			ifndef NO_16BIT
509
			fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnow;
539
			fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnow;
510
#			endif
540
#			endif
511
			done = 1;
541
			done = 1;
Line 583... Line 613...
583
#		ifndef NO_16BIT /* possibility to use a 16->8 wrapper... */
613
#		ifndef NO_16BIT /* possibility to use a 16->8 wrapper... */
584
		if(fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16])
614
		if(fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16])
585
		{
615
		{
586
			fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
616
			fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
587
			fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
617
			fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
588
			fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_mono2stereo;
618
			fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
589
		}
619
		}
590
#		endif
620
#		endif
591
#		endif
621
#		endif
592
		for(ri=0; ri
622
		for(ri=0; ri
593
		for(fi=0; fi
623
		for(fi=0; fi
Line 656... Line 686...
656
#		endif
686
#		endif
657
		done = 1;
687
		done = 1;
658
	}
688
	}
659
#	endif
689
#	endif
Line -... Line 690...
-
 
690
 
-
 
691
#	ifdef OPT_NEON
-
 
692
	if(!done && (auto_choose || want_dec == neon))
-
 
693
	{
-
 
694
		chosen = "NEON";
-
 
695
		fr->cpu_opts.type = neon;
-
 
696
#		ifndef NO_16BIT
-
 
697
		fr->synths.plain[r_1to1][f_16] = synth_1to1_neon;
-
 
698
		fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_neon;
-
 
699
#		endif
-
 
700
#		ifndef NO_REAL
-
 
701
		fr->synths.plain[r_1to1][f_real] = synth_1to1_real_neon;
-
 
702
		fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_neon;
-
 
703
#		endif
-
 
704
#		ifndef NO_32BIT
-
 
705
		fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_neon;
-
 
706
		fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_neon;
-
 
707
#		endif
-
 
708
		done = 1;
-
 
709
	}
-
 
710
#	endif
660
 
711
 
661
#	ifdef OPT_ARM
712
#	ifdef OPT_ARM
662
	if(!done && (auto_choose || want_dec == arm))
713
	if(!done && (auto_choose || want_dec == arm))
663
	{
714
	{
664
		chosen = "ARM";
715
		chosen = "ARM";
Line 688... Line 739...
688
	     && fr->cpu_opts.type != generic_dither
739
	     && fr->cpu_opts.type != generic_dither
689
	     && fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16] )
740
	     && fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16] )
690
	{
741
	{
691
		fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
742
		fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
692
		fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
743
		fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
693
		fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_mono2stereo;
744
		fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
694
	}
745
	}
695
#	endif
746
#	endif
696
#	endif
747
#	endif
Line 697... Line 748...
697
 
748
 
Line 768... Line 819...
768
	NULL,
819
	NULL,
769
	#endif
820
	#endif
770
	#ifdef OPT_ARM
821
	#ifdef OPT_ARM
771
	NULL,
822
	NULL,
772
	#endif
823
	#endif
-
 
824
	#ifdef OPT_NEON
-
 
825
	NULL,
-
 
826
	#endif
773
	#ifdef OPT_GENERIC_FLOAT
827
	#ifdef OPT_GENERIC_FLOAT
774
	NULL,
828
	NULL,
775
	#endif
829
	#endif
776
#	ifdef OPT_GENERIC
830
#	ifdef OPT_GENERIC
777
	NULL,
831
	NULL,
Line 816... Line 870...
816
	dn_x86_64,
870
	dn_x86_64,
817
	#endif
871
	#endif
818
	#ifdef OPT_ARM
872
	#ifdef OPT_ARM
819
	dn_ARM,
873
	dn_ARM,
820
	#endif
874
	#endif
-
 
875
	#ifdef OPT_NEON
-
 
876
	dn_NEON,
-
 
877
	#endif
821
	#ifdef OPT_GENERIC
878
	#ifdef OPT_GENERIC
822
	dn_generic,
879
	dn_generic,
823
	#endif
880
	#endif
824
	#ifdef OPT_GENERIC_DITHER
881
	#ifdef OPT_GENERIC_DITHER
825
	dn_generic_dither,
882
	dn_generic_dither,
Line 875... Line 932...
875
	*(d++) = decname[x86_64];
932
	*(d++) = decname[x86_64];
876
#endif
933
#endif
877
#ifdef OPT_ARM
934
#ifdef OPT_ARM
878
	*(d++) = decname[arm];
935
	*(d++) = decname[arm];
879
#endif
936
#endif
-
 
937
#ifdef OPT_NEON
-
 
938
	*(d++) = decname[neon];
-
 
939
#endif
880
#ifdef OPT_GENERIC
940
#ifdef OPT_GENERIC
881
	*(d++) = decname[generic];
941
	*(d++) = decname[generic];
882
#endif
942
#endif
883
#ifdef OPT_GENERIC_DITHER
943
#ifdef OPT_GENERIC_DITHER
884
	*(d++) = decname[generic_dither];
944
	*(d++) = decname[generic_dither];
Line 891... Line 951...
891
	if(mh == NULL) return NULL;
951
	if(mh == NULL) return NULL;
Line 892... Line 952...
892
 
952
 
893
	return decname[mh->cpu_opts.type];
953
	return decname[mh->cpu_opts.type];
Line 894... Line 954...
894
}
954
}
895
 
955
 
896
const char attribute_align_arg **mpg123_decoders(){ return mpg123_decoder_list; }
956
const char attribute_align_arg **mpg123_decoders(void){ return mpg123_decoder_list; }
897
const char attribute_align_arg **mpg123_supported_decoders()
957
const char attribute_align_arg **mpg123_supported_decoders(void)
898
{
958
{
899
#ifdef OPT_MULTI
959
#ifdef OPT_MULTI
900
	return mpg123_supported_decoder_list;
960
	return mpg123_supported_decoder_list;