11
11
#include "mpg123lib_intern.h" /* includes optimize.h */
14
/* Must match the enum dectype! */
17
It SUCKS having to define these names that way, but compile-time intialization of string arrays is a bitch.
18
GCC doesn't see constant stuff when it's wiggling in front of it!
19
Anyhow: Have a script for that:
20
names="generic generic_dither i386 i486 i586 i586_dither MMX 3DNow 3DNowExt AltiVec SSE"
21
for i in $names; do echo "##define dn_$i \"$i\""; done
22
echo -n "static const char* decname[] =
26
for i in $names; do echo -n ", dn_$i"; done
31
#define dn_generic "generic"
32
#define dn_generic_dither "generic_dither"
33
#define dn_i386 "i386"
34
#define dn_i486 "i486"
35
#define dn_i586 "i586"
36
#define dn_i586_dither "i586_dither"
38
#define dn_3DNow "3DNow"
39
#define dn_3DNowExt "3DNowExt"
40
#define dn_AltiVec "AltiVec"
42
static const char* decname[] =
45
, dn_generic, dn_generic_dither, dn_i386, dn_i486, dn_i586, dn_i586_dither, dn_MMX, dn_3DNow, dn_3DNowExt, dn_AltiVec, dn_SSE
49
#if (defined OPT_X86) && (defined OPT_MULTI)
14
50
#include "getcpuflags.h"
15
51
struct cpuflags cpu_flags;
54
enum optdec defdec(void){ return defopt; }
56
enum optcla decclass(const enum optdec type)
58
return (type == mmx || type == sse || type == dreidnowext) ? mmxsse : normal;
61
/* Determine what kind of decoder is actually active
62
This depends on runtime choices which may cause fallback to i386 or generic code. */
63
static int find_dectype(mpg123_handle *fr)
65
enum optdec type = nodec;
66
/* Direct and indirect usage, 1to1 stereo decoding.
67
Concentrating on the plain stereo synth should be fine, mono stuff is derived. */
68
func_synth basic_synth = fr->synth;
71
if(basic_synth == synth_1to1_8bit_wrap)
72
basic_synth = opt_synth_1to1(fr); /* That is what's really below the surface. */
76
if(FALSE) ; /* Just to initialize the else if ladder. */
79
else if(basic_synth == synth_1to1_3dnowext) type = dreidnowext;
82
else if(basic_synth == synth_1to1_sse) type = sse;
85
else if(basic_synth == synth_1to1_3dnow) type = dreidnow;
88
else if(basic_synth == synth_1to1_mmx) type = mmx;
90
#ifdef OPT_I586_DITHER
91
else if(basic_synth == synth_1to1_i586_dither) type = ifuenf_dither;
94
else if(basic_synth == synth_1to1_i586) type = ifuenf;
99
( FALSE /* just as a first value for the || chain */
101
|| basic_synth == synth_1to1_i386
104
|| basic_synth == synth_1to1_8bit_i386
106
#ifndef NO_DOWNSAMPLE
108
|| basic_synth == synth_2to1_i386
109
|| basic_synth == synth_4to1_i386
112
|| basic_synth == synth_2to1_8bit_i386
113
|| basic_synth == synth_4to1_8bit_i386
116
#ifndef REAL_IS_FIXED
118
|| basic_synth == synth_1to1_real_i386
121
|| basic_synth == synth_1to1_s32_i386
123
#ifndef NO_DOWNSAMPLE
125
|| basic_synth == synth_2to1_real_i386
126
|| basic_synth == synth_4to1_real_i386
129
|| basic_synth == synth_2to1_s32_i386
130
|| basic_synth == synth_4to1_s32_i386
139
|| basic_synth == synth_1to1
140
#ifndef NO_DOWNSAMPLE
141
|| basic_synth == synth_2to1
142
|| basic_synth == synth_4to1
145
|| basic_synth == synth_ntom
149
|| basic_synth == synth_1to1_8bit
150
#ifndef NO_DOWNSAMPLE
151
|| basic_synth == synth_2to1_8bit
152
|| basic_synth == synth_4to1_8bit
155
|| basic_synth == synth_ntom_8bit
159
|| basic_synth == synth_1to1_real
160
#ifndef NO_DOWNSAMPLE
161
|| basic_synth == synth_2to1_real
162
|| basic_synth == synth_4to1_real
165
|| basic_synth == synth_ntom_real
169
|| basic_synth == synth_1to1_s32
170
#ifndef NO_DOWNSAMPLE
171
|| basic_synth == synth_2to1_s32
172
|| basic_synth == synth_4to1_s32
175
|| basic_synth == synth_ntom_s32
180
#ifdef OPT_GENERIC_DITHER
181
else if(basic_synth == synth_1to1_dither) type = generic_dither;
183
#ifdef OPT_DITHER /* either i586 or generic! */
184
#ifndef NO_DOWNSAMPLE
187
basic_synth == synth_2to1_dither
188
|| basic_synth == synth_4to1_dither
189
) type = generic_dither;
193
else if(basic_synth == synth_1to1_altivec) type = altivec;
197
/* i486 is special ... the specific code is in use for 16bit 1to1 stereo
198
otherwise we have i386 active... but still, the distinction doesn't matter*/
204
fr->cpu_opts.type = type;
205
fr->cpu_opts.class = decclass(type);
207
debug3("determined active decoder type %i (%s) of class %i", type, decname[type], fr->cpu_opts.class);
212
if(NOQUIET) error("Unable to determine active decoder type -- this is SERIOUS b0rkage!");
214
fr->err = MPG123_BAD_DECODER_SETUP;
219
/* set synth functions for current frame, optimizations handled by opt_* macros */
220
int set_synth_functions(mpg123_handle *fr)
222
int ds = fr->down_sample;
223
int basic_format = OUT_16; /* Default is always 16bit. */
224
/* The tables to select the synth functions from...
225
First we have stereo synths for different outputs and resampling modes,
226
then functions for mono2stereo and mono, again for different outputs and resampling modes. */
227
func_synth funcs[OUT_FORMATS][4];
228
func_synth_mono funcs_mono[OUT_FORMATS][4];
229
func_synth_mono funcs_mono2stereo[OUT_FORMATS][4];
231
/* What a pyramid... but that's the host of synth function interfaces we cater.
232
TODO: In future, the synth slots in the frame struct should have the same array structure.
233
Actually... they shall _be_ _this_ struct. Will reduce quite some code. */
235
funcs[OUT_16][0] = (func_synth) opt_synth_1to1(fr);
236
#ifndef NO_DOWNSAMPLE
237
funcs[OUT_16][1] = (func_synth) opt_synth_2to1(fr);
238
funcs[OUT_16][2] = (func_synth) opt_synth_4to1(fr);
241
funcs[OUT_16][3] = (func_synth) opt_synth_ntom(fr);
245
funcs[OUT_8][0] = (func_synth) opt_synth_1to1_8bit(fr);
246
#ifndef NO_DOWNSAMPLE
247
funcs[OUT_8][1] = (func_synth) opt_synth_2to1_8bit(fr);
248
funcs[OUT_8][2] = (func_synth) opt_synth_4to1_8bit(fr);
251
funcs[OUT_8][3] = (func_synth) opt_synth_ntom_8bit(fr);
255
funcs[OUT_REAL][0] = (func_synth) opt_synth_1to1_real(fr);
256
#ifndef NO_DOWNSAMPLE
257
funcs[OUT_REAL][1] = (func_synth) opt_synth_2to1_real(fr);
258
funcs[OUT_REAL][2] = (func_synth) opt_synth_4to1_real(fr);
261
funcs[OUT_REAL][3] = (func_synth) opt_synth_ntom_real(fr);
265
funcs[OUT_S32][0] = (func_synth) opt_synth_1to1_s32(fr);
266
#ifndef NO_DOWNSAMPLE
267
funcs[OUT_S32][1] = (func_synth) opt_synth_2to1_s32(fr);
268
funcs[OUT_S32][2] = (func_synth) opt_synth_4to1_s32(fr);
271
funcs[OUT_S32][3] = (func_synth) opt_synth_ntom_s32(fr);
276
funcs_mono[OUT_16][0] = (func_synth_mono) opt_synth_1to1_mono(fr);
277
#ifndef NO_DOWNSAMPLE
278
funcs_mono[OUT_16][1] = (func_synth_mono) opt_synth_2to1_mono(fr);
279
funcs_mono[OUT_16][2] = (func_synth_mono) opt_synth_4to1_mono(fr);
282
funcs_mono[OUT_16][3] = (func_synth_mono) opt_synth_ntom_mono(fr);
286
funcs_mono[OUT_8][0] = (func_synth_mono) opt_synth_1to1_8bit_mono(fr);
287
#ifndef NO_DOWNSAMPLE
288
funcs_mono[OUT_8][1] = (func_synth_mono) opt_synth_2to1_8bit_mono(fr);
289
funcs_mono[OUT_8][2] = (func_synth_mono) opt_synth_4to1_8bit_mono(fr);
292
funcs_mono[OUT_8][3] = (func_synth_mono) opt_synth_ntom_8bit_mono(fr);
296
funcs_mono[OUT_REAL][0] = (func_synth_mono) opt_synth_1to1_real_mono(fr);
297
#ifndef NO_DOWNSAMPLE
298
funcs_mono[OUT_REAL][1] = (func_synth_mono) opt_synth_2to1_real_mono(fr);
299
funcs_mono[OUT_REAL][2] = (func_synth_mono) opt_synth_4to1_real_mono(fr);
302
funcs_mono[OUT_REAL][3] = (func_synth_mono) opt_synth_ntom_real_mono(fr);
306
funcs_mono[OUT_S32][0] = (func_synth_mono) opt_synth_1to1_s32_mono(fr);
307
#ifndef NO_DOWNSAMPLE
308
funcs_mono[OUT_S32][1] = (func_synth_mono) opt_synth_2to1_s32_mono(fr);
309
funcs_mono[OUT_S32][2] = (func_synth_mono) opt_synth_4to1_s32_mono(fr);
312
funcs_mono[OUT_S32][3] = (func_synth_mono) opt_synth_ntom_s32_mono(fr);
317
funcs_mono2stereo[OUT_16][0] = (func_synth_mono) opt_synth_1to1_mono2stereo(fr);
318
#ifndef NO_DOWNSAMPLE
319
funcs_mono2stereo[OUT_16][1] = (func_synth_mono) opt_synth_2to1_mono2stereo(fr);
320
funcs_mono2stereo[OUT_16][2] = (func_synth_mono) opt_synth_4to1_mono2stereo(fr);
323
funcs_mono2stereo[OUT_16][3] = (func_synth_mono) opt_synth_ntom_mono2stereo(fr);
327
funcs_mono2stereo[OUT_8][0] = (func_synth_mono) opt_synth_1to1_8bit_mono2stereo(fr);
328
#ifndef NO_DOWNSAMPLE
329
funcs_mono2stereo[OUT_8][1] = (func_synth_mono) opt_synth_2to1_8bit_mono2stereo(fr);
330
funcs_mono2stereo[OUT_8][2] = (func_synth_mono) opt_synth_4to1_8bit_mono2stereo(fr);
333
funcs_mono2stereo[OUT_8][3] = (func_synth_mono) opt_synth_ntom_8bit_mono2stereo(fr);
337
funcs_mono2stereo[OUT_REAL][0] = (func_synth_mono) opt_synth_1to1_real_mono2stereo(fr);
338
#ifndef NO_DOWNSAMPLE
339
funcs_mono2stereo[OUT_REAL][1] = (func_synth_mono) opt_synth_2to1_real_mono2stereo(fr);
340
funcs_mono2stereo[OUT_REAL][2] = (func_synth_mono) opt_synth_4to1_real_mono2stereo(fr);
343
funcs_mono2stereo[OUT_REAL][3] = (func_synth_mono) opt_synth_ntom_real_mono2stereo(fr);
347
funcs_mono2stereo[OUT_S32][0] = (func_synth_mono) opt_synth_1to1_s32_mono2stereo(fr);
348
#ifndef NO_DOWNSAMPLE
349
funcs_mono2stereo[OUT_S32][1] = (func_synth_mono) opt_synth_2to1_s32_mono2stereo(fr);
350
funcs_mono2stereo[OUT_S32][2] = (func_synth_mono) opt_synth_4to1_s32_mono2stereo(fr);
353
funcs_mono2stereo[OUT_S32][3] = (func_synth_mono) opt_synth_ntom_s32_mono2stereo(fr);
357
/* Select the basic output format, different from 16bit: 8bit, real. */
358
if(fr->af.encoding & MPG123_ENC_8)
359
basic_format = OUT_8;
360
else if(fr->af.encoding & MPG123_ENC_FLOAT)
361
basic_format = OUT_REAL;
362
else if(fr->af.encoding & MPG123_ENC_32)
363
basic_format = OUT_S32;
365
if /* Make sure the chosen format is compiled into this lib. */
368
|| basic_format == OUT_8
371
|| basic_format == OUT_16
374
|| basic_format == OUT_S32
377
|| basic_format == OUT_REAL
381
if(NOQUIET) error("set_synth_functions: This output format is disabled in this build!");
386
/* Finally selecting the synth functions for stereo / mono. */
387
fr->synth = funcs[basic_format][ds];
388
fr->synth_mono = fr->af.channels==2
389
? funcs_mono2stereo[basic_format][ds] /* Mono MPEG file decoded to stereo. */
390
: funcs_mono[basic_format][ds]; /* Mono MPEG file decoded to mono. */
392
if(find_dectype(fr) != MPG123_OK) /* Actually determine the currently active decoder breed. */
394
fr->err = MPG123_BAD_DECODER_SETUP;
398
if(frame_buffers(fr) != 0)
400
fr->err = MPG123_NO_BUFFERS;
401
if(NOQUIET) error("Failed to set up decoder buffers!");
407
if(basic_format == OUT_8)
409
if(make_conv16to8_table(fr) != 0)
411
if(NOQUIET) error("Failed to set up conv16to8 table!");
412
/* it's a bit more work to get proper error propagation up */
419
/* Special treatment for MMX, SSE and 3DNowExt stuff. */
420
if(fr->cpu_opts.class == mmxsse)
423
init_layer3_stuff(fr, init_layer3_gainpow2_mmx);
426
init_layer12_stuff(fr, init_layer12_table_mmx);
428
fr->make_decode_tables = make_decode_tables_mmx;
434
init_layer3_stuff(fr, init_layer3_gainpow2);
437
init_layer12_stuff(fr, init_layer12_table);
439
fr->make_decode_tables = make_decode_tables;
442
/* We allocated the table buffers just now, so (re)create the tables. */
443
fr->make_decode_tables(fr);
448
int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
450
const char* chosen = ""; /* the chosen decoder opt as string */
451
enum optdec want_dec = nodec;
454
want_dec = dectype(cpu);
455
auto_choose = want_dec == autodec ? 1 : 0;
458
if(!auto_choose && want_dec != defopt)
460
if(NOQUIET) error2("you wanted decoder type %i, I only have %i", want_dec, defopt);
466
const char **sd = mpg123_decoders(); /* this contains _one_ decoder */
473
First the set of synth functions is nulled, so that we know what to fill in at the end.
475
## This is an inline bourne shell script for execution in nedit to generate the lines below.
476
## The ## is a quote for just #
477
for t in "" _8bit _s32 _real
479
test "$t" = _real && echo "##ifndef NO_REAL"
480
test "$t" = "" && echo "##ifndef NO_16BIT"
481
test "$t" = "_8bit" && echo "##ifndef NO_8BIT"
482
test "$t" = "_s32" && echo "##ifndef NO_32BIT"
484
for i in 1to1 2to1 4to1 ntom;
486
if test "$i" = ntom; then
487
echo "##ifndef NO_NTOM"
489
if test "$i" = 2to1; then
490
echo "##ifndef NO_DOWNSAMPLE"
492
for f in "" _mono _mono2stereo;
494
echo " fr->cpu_opts.synth_${i}${t}${f} = NULL;"
496
if test "$i" = ntom; then
499
if test "$i" = 4to1; then
508
fr->cpu_opts.synth_1to1 = NULL;
509
fr->cpu_opts.synth_1to1_mono = NULL;
510
fr->cpu_opts.synth_1to1_mono2stereo = NULL;
511
#ifndef NO_DOWNSAMPLE
512
fr->cpu_opts.synth_2to1 = NULL;
513
fr->cpu_opts.synth_2to1_mono = NULL;
514
fr->cpu_opts.synth_2to1_mono2stereo = NULL;
515
fr->cpu_opts.synth_4to1 = NULL;
516
fr->cpu_opts.synth_4to1_mono = NULL;
517
fr->cpu_opts.synth_4to1_mono2stereo = NULL;
520
fr->cpu_opts.synth_ntom = NULL;
521
fr->cpu_opts.synth_ntom_mono = NULL;
522
fr->cpu_opts.synth_ntom_mono2stereo = NULL;
526
fr->cpu_opts.synth_1to1_8bit = NULL;
527
fr->cpu_opts.synth_1to1_8bit_mono = NULL;
528
fr->cpu_opts.synth_1to1_8bit_mono2stereo = NULL;
529
#ifndef NO_DOWNSAMPLE
530
fr->cpu_opts.synth_2to1_8bit = NULL;
531
fr->cpu_opts.synth_2to1_8bit_mono = NULL;
532
fr->cpu_opts.synth_2to1_8bit_mono2stereo = NULL;
533
fr->cpu_opts.synth_4to1_8bit = NULL;
534
fr->cpu_opts.synth_4to1_8bit_mono = NULL;
535
fr->cpu_opts.synth_4to1_8bit_mono2stereo = NULL;
538
fr->cpu_opts.synth_ntom_8bit = NULL;
539
fr->cpu_opts.synth_ntom_8bit_mono = NULL;
540
fr->cpu_opts.synth_ntom_8bit_mono2stereo = NULL;
544
fr->cpu_opts.synth_1to1_s32 = NULL;
545
fr->cpu_opts.synth_1to1_s32_mono = NULL;
546
fr->cpu_opts.synth_1to1_s32_mono2stereo = NULL;
547
#ifndef NO_DOWNSAMPLE
548
fr->cpu_opts.synth_2to1_s32 = NULL;
549
fr->cpu_opts.synth_2to1_s32_mono = NULL;
550
fr->cpu_opts.synth_2to1_s32_mono2stereo = NULL;
551
fr->cpu_opts.synth_4to1_s32 = NULL;
552
fr->cpu_opts.synth_4to1_s32_mono = NULL;
553
fr->cpu_opts.synth_4to1_s32_mono2stereo = NULL;
556
fr->cpu_opts.synth_ntom_s32 = NULL;
557
fr->cpu_opts.synth_ntom_s32_mono = NULL;
558
fr->cpu_opts.synth_ntom_s32_mono2stereo = NULL;
562
fr->cpu_opts.synth_1to1_real = NULL;
563
fr->cpu_opts.synth_1to1_real_mono = NULL;
564
fr->cpu_opts.synth_1to1_real_mono2stereo = NULL;
565
#ifndef NO_DOWNSAMPLE
566
fr->cpu_opts.synth_2to1_real = NULL;
567
fr->cpu_opts.synth_2to1_real_mono = NULL;
568
fr->cpu_opts.synth_2to1_real_mono2stereo = NULL;
569
fr->cpu_opts.synth_4to1_real = NULL;
570
fr->cpu_opts.synth_4to1_real_mono = NULL;
571
fr->cpu_opts.synth_4to1_real_mono2stereo = NULL;
574
fr->cpu_opts.synth_ntom_real = NULL;
575
fr->cpu_opts.synth_ntom_real_mono = NULL;
576
fr->cpu_opts.synth_ntom_real_mono2stereo = NULL;
580
fr->cpu_opts.type = nodec;
581
/* covers any i386+ cpu; they actually differ only in the synth_1to1 function... */
585
#if (defined OPT_3DNOW || defined OPT_3DNOWEXT)
586
fr->cpu_opts.dct36 = dct36;
590
if(cpu_i586(cpu_flags))
592
debug2("standard flags: 0x%08x\textended flags: 0x%08x", cpu_flags.std, cpu_flags.ext);
594
if( !done && (auto_choose || want_dec == dreidnowext )
595
&& cpu_3dnow(cpu_flags)
596
&& cpu_3dnowext(cpu_flags)
597
&& cpu_mmx(cpu_flags) )
600
fr->cpu_opts.type = dreidnowext;
602
fr->cpu_opts.dct36 = dct36_3dnowext;
605
fr->cpu_opts.synth_1to1 = synth_1to1_3dnowext;
611
if( !done && (auto_choose || want_dec == sse)
612
&& cpu_sse(cpu_flags) && cpu_mmx(cpu_flags) )
615
fr->cpu_opts.type = sse;
617
fr->cpu_opts.synth_1to1 = synth_1to1_sse;
624
fr->cpu_opts.dct36 = dct36;
626
if( !done && (auto_choose || want_dec == dreidnow)
627
&& cpu_3dnow(cpu_flags) && cpu_mmx(cpu_flags) )
630
fr->cpu_opts.type = dreidnow;
632
fr->cpu_opts.dct36 = dct36_3dnow;
635
fr->cpu_opts.synth_1to1 = synth_1to1_3dnow;
641
if( !done && (auto_choose || want_dec == mmx)
642
&& cpu_mmx(cpu_flags) )
645
fr->cpu_opts.type = mmx;
647
fr->cpu_opts.synth_1to1 = synth_1to1_mmx;
653
if(!done && (auto_choose || want_dec == ifuenf))
655
chosen = "i586/pentium";
656
fr->cpu_opts.type = ifuenf;
658
fr->cpu_opts.synth_1to1 = synth_1to1_i586;
663
#ifdef OPT_I586_DITHER
664
if(!done && (auto_choose || want_dec == ifuenf_dither))
666
chosen = "dithered i586/pentium";
667
fr->cpu_opts.type = ifuenf_dither;
669
fr->cpu_opts.synth_1to1 = synth_1to1_i586_dither;
670
# ifndef NO_DOWNSAMPLE
671
fr->cpu_opts.synth_2to1 = synth_2to1_dither;
672
fr->cpu_opts.synth_4to1 = synth_4to1_dither;
680
/* That won't cooperate in multi opt mode - forcing i486 in layer3.c
681
But still... here it is... maybe for real use in future. */
682
if(!done && (auto_choose || want_dec == ivier))
685
fr->cpu_opts.type = ivier;
690
if(!done && (auto_choose || want_dec == idrei))
693
fr->cpu_opts.type = idrei;
699
{ /* We have chosen some x86 decoder... */
700
/* First, we see if there is indeed some special (non-i386) synth_1to1 and use the 8bit wrappers over it.
701
If not, we use the direct i386 8bit synth and the normal mono functions. */
703
#ifndef NO_16BIT /* possibility to use a 16->8 wrapper... */
704
if(fr->cpu_opts.synth_1to1 != NULL)
706
fr->cpu_opts.synth_1to1_8bit = synth_1to1_8bit_wrap;
707
fr->cpu_opts.synth_1to1_8bit_mono = synth_1to1_8bit_wrap_mono;
708
fr->cpu_opts.synth_1to1_8bit_mono2stereo = synth_1to1_8bit_wrap_mono2stereo;
712
fr->cpu_opts.synth_1to1 = synth_1to1_i386;
713
#endif /* straight 8bit */
714
fr->cpu_opts.synth_1to1_8bit = synth_1to1_8bit_i386;
720
if(fr->cpu_opts.synth_1to1 == NULL)
721
fr->cpu_opts.synth_1to1 = synth_1to1_i386;
724
Now fill in the non-mono synths that are still missing from the i386 variants.
727
## This is an inline bourne shell script for execution in nedit to generate the lines below.
728
## The ## is a quote for just #
729
for t in "" _8bit _s32 _real
731
test "$t" = _real && echo "## ifndef NO_REAL"
732
test "$t" = "" && echo "## ifndef NO_16BIT"
733
test "$t" = "_8bit" && echo "## ifndef NO_8BIT"
734
test "$t" = "_s32" && echo "## ifndef NO_32BIT"
736
for i in 1to1 2to1 4to1
738
if test "$i" = 2to1; then
739
echo "## ifndef NO_DOWNSAMPLE"
741
echo " if(fr->cpu_opts.synth_${i}${t} == NULL) fr->cpu_opts.synth_${i}${t} = synth_${i}${t}_i386;"
742
if test "$i" = 4to1; then
751
if(fr->cpu_opts.synth_1to1 == NULL) fr->cpu_opts.synth_1to1 = synth_1to1_i386;
752
# ifndef NO_DOWNSAMPLE
753
if(fr->cpu_opts.synth_2to1 == NULL) fr->cpu_opts.synth_2to1 = synth_2to1_i386;
754
if(fr->cpu_opts.synth_4to1 == NULL) fr->cpu_opts.synth_4to1 = synth_4to1_i386;
758
if(fr->cpu_opts.synth_1to1_8bit == NULL) fr->cpu_opts.synth_1to1_8bit = synth_1to1_8bit_i386;
759
# ifndef NO_DOWNSAMPLE
760
if(fr->cpu_opts.synth_2to1_8bit == NULL) fr->cpu_opts.synth_2to1_8bit = synth_2to1_8bit_i386;
761
if(fr->cpu_opts.synth_4to1_8bit == NULL) fr->cpu_opts.synth_4to1_8bit = synth_4to1_8bit_i386;
765
if(fr->cpu_opts.synth_1to1_s32 == NULL) fr->cpu_opts.synth_1to1_s32 = synth_1to1_s32_i386;
766
# ifndef NO_DOWNSAMPLE
767
if(fr->cpu_opts.synth_2to1_s32 == NULL) fr->cpu_opts.synth_2to1_s32 = synth_2to1_s32_i386;
768
if(fr->cpu_opts.synth_4to1_s32 == NULL) fr->cpu_opts.synth_4to1_s32 = synth_4to1_s32_i386;
772
if(fr->cpu_opts.synth_1to1_real == NULL) fr->cpu_opts.synth_1to1_real = synth_1to1_real_i386;
773
# ifndef NO_DOWNSAMPLE
774
if(fr->cpu_opts.synth_2to1_real == NULL) fr->cpu_opts.synth_2to1_real = synth_2to1_real_i386;
775
if(fr->cpu_opts.synth_4to1_real == NULL) fr->cpu_opts.synth_4to1_real = synth_4to1_real_i386;
782
#ifdef OPT_GENERIC_DITHER
783
if(!done && (auto_choose || want_dec == generic_dither))
785
chosen = "dithered generic";
786
fr->cpu_opts.type = generic_dither;
788
fr->cpu_opts.synth_1to1 = synth_1to1_dither;
789
# ifndef NO_DOWNSAMPLE
790
fr->cpu_opts.synth_2to1 = synth_2to1_dither;
791
fr->cpu_opts.synth_4to1 = synth_4to1_dither;
794
/* Wrapping 8bit functions don't make sense for dithering. */
800
if(!done && (auto_choose || want_dec == altivec))
803
fr->cpu_opts.type = altivec;
805
fr->cpu_opts.synth_1to1 = synth_1to1_altivec;
806
fr->cpu_opts.synth_1to1_8bit = synth_1to1_8bit_wrap;
807
fr->cpu_opts.synth_1to1_8bit_mono = synth_1to1_8bit_wrap_mono;
808
fr->cpu_opts.synth_1to1_8bit_mono2stereo = synth_1to1_8bit_wrap_mono2stereo;
815
if(!done && (auto_choose || want_dec == generic))
818
fr->cpu_opts.type = generic;
823
fr->cpu_opts.class = decclass(fr->cpu_opts.type);
826
Filling in the last bits.
827
No need to care about 8bit wrappers here, that's all set.
828
Just set everything still missing to a generic function.
830
## This is an inline bourne shell script for execution in nedit to generate the lines below.
831
## The ## is a quote for just #
832
for t in "" _8bit _s32 _real
834
test "$t" = _real && echo "## ifndef NO_REAL"
835
test "$t" = "" && echo "## ifndef NO_16BIT"
836
test "$t" = "_8bit" && echo "## ifndef NO_8BIT"
837
test "$t" = "_s32" && echo "## ifndef NO_32BIT"
839
for i in 1to1 2to1 4to1 ntom
841
if test "$i" = ntom; then
842
echo "## ifndef NO_NTOM"
844
if test "$i" = 2to1; then
845
echo "## ifndef NO_DOWNSAMPLE"
847
for m in "" _mono _mono2stereo
849
echo " if(fr->cpu_opts.synth_${i}${t}${m} == NULL) fr->cpu_opts.synth_${i}${t}${m} = synth_${i}${t}${m};"
851
if test "$i" = ntom; then
854
if test "$i" = 4to1; then
863
if(fr->cpu_opts.synth_1to1 == NULL) fr->cpu_opts.synth_1to1 = synth_1to1;
864
if(fr->cpu_opts.synth_1to1_mono == NULL) fr->cpu_opts.synth_1to1_mono = synth_1to1_mono;
865
if(fr->cpu_opts.synth_1to1_mono2stereo == NULL) fr->cpu_opts.synth_1to1_mono2stereo = synth_1to1_mono2stereo;
866
# ifndef NO_DOWNSAMPLE
867
if(fr->cpu_opts.synth_2to1 == NULL) fr->cpu_opts.synth_2to1 = synth_2to1;
868
if(fr->cpu_opts.synth_2to1_mono == NULL) fr->cpu_opts.synth_2to1_mono = synth_2to1_mono;
869
if(fr->cpu_opts.synth_2to1_mono2stereo == NULL) fr->cpu_opts.synth_2to1_mono2stereo = synth_2to1_mono2stereo;
870
if(fr->cpu_opts.synth_4to1 == NULL) fr->cpu_opts.synth_4to1 = synth_4to1;
871
if(fr->cpu_opts.synth_4to1_mono == NULL) fr->cpu_opts.synth_4to1_mono = synth_4to1_mono;
872
if(fr->cpu_opts.synth_4to1_mono2stereo == NULL) fr->cpu_opts.synth_4to1_mono2stereo = synth_4to1_mono2stereo;
875
if(fr->cpu_opts.synth_ntom == NULL) fr->cpu_opts.synth_ntom = synth_ntom;
876
if(fr->cpu_opts.synth_ntom_mono == NULL) fr->cpu_opts.synth_ntom_mono = synth_ntom_mono;
877
if(fr->cpu_opts.synth_ntom_mono2stereo == NULL) fr->cpu_opts.synth_ntom_mono2stereo = synth_ntom_mono2stereo;
881
if(fr->cpu_opts.synth_1to1_8bit == NULL) fr->cpu_opts.synth_1to1_8bit = synth_1to1_8bit;
882
if(fr->cpu_opts.synth_1to1_8bit_mono == NULL) fr->cpu_opts.synth_1to1_8bit_mono = synth_1to1_8bit_mono;
883
if(fr->cpu_opts.synth_1to1_8bit_mono2stereo == NULL) fr->cpu_opts.synth_1to1_8bit_mono2stereo = synth_1to1_8bit_mono2stereo;
884
# ifndef NO_DOWNSAMPLE
885
if(fr->cpu_opts.synth_2to1_8bit == NULL) fr->cpu_opts.synth_2to1_8bit = synth_2to1_8bit;
886
if(fr->cpu_opts.synth_2to1_8bit_mono == NULL) fr->cpu_opts.synth_2to1_8bit_mono = synth_2to1_8bit_mono;
887
if(fr->cpu_opts.synth_2to1_8bit_mono2stereo == NULL) fr->cpu_opts.synth_2to1_8bit_mono2stereo = synth_2to1_8bit_mono2stereo;
888
if(fr->cpu_opts.synth_4to1_8bit == NULL) fr->cpu_opts.synth_4to1_8bit = synth_4to1_8bit;
889
if(fr->cpu_opts.synth_4to1_8bit_mono == NULL) fr->cpu_opts.synth_4to1_8bit_mono = synth_4to1_8bit_mono;
890
if(fr->cpu_opts.synth_4to1_8bit_mono2stereo == NULL) fr->cpu_opts.synth_4to1_8bit_mono2stereo = synth_4to1_8bit_mono2stereo;
893
if(fr->cpu_opts.synth_ntom_8bit == NULL) fr->cpu_opts.synth_ntom_8bit = synth_ntom_8bit;
894
if(fr->cpu_opts.synth_ntom_8bit_mono == NULL) fr->cpu_opts.synth_ntom_8bit_mono = synth_ntom_8bit_mono;
895
if(fr->cpu_opts.synth_ntom_8bit_mono2stereo == NULL) fr->cpu_opts.synth_ntom_8bit_mono2stereo = synth_ntom_8bit_mono2stereo;
899
if(fr->cpu_opts.synth_1to1_s32 == NULL) fr->cpu_opts.synth_1to1_s32 = synth_1to1_s32;
900
if(fr->cpu_opts.synth_1to1_s32_mono == NULL) fr->cpu_opts.synth_1to1_s32_mono = synth_1to1_s32_mono;
901
if(fr->cpu_opts.synth_1to1_s32_mono2stereo == NULL) fr->cpu_opts.synth_1to1_s32_mono2stereo = synth_1to1_s32_mono2stereo;
902
# ifndef NO_DOWNSAMPLE
903
if(fr->cpu_opts.synth_2to1_s32 == NULL) fr->cpu_opts.synth_2to1_s32 = synth_2to1_s32;
904
if(fr->cpu_opts.synth_2to1_s32_mono == NULL) fr->cpu_opts.synth_2to1_s32_mono = synth_2to1_s32_mono;
905
if(fr->cpu_opts.synth_2to1_s32_mono2stereo == NULL) fr->cpu_opts.synth_2to1_s32_mono2stereo = synth_2to1_s32_mono2stereo;
906
if(fr->cpu_opts.synth_4to1_s32 == NULL) fr->cpu_opts.synth_4to1_s32 = synth_4to1_s32;
907
if(fr->cpu_opts.synth_4to1_s32_mono == NULL) fr->cpu_opts.synth_4to1_s32_mono = synth_4to1_s32_mono;
908
if(fr->cpu_opts.synth_4to1_s32_mono2stereo == NULL) fr->cpu_opts.synth_4to1_s32_mono2stereo = synth_4to1_s32_mono2stereo;
911
if(fr->cpu_opts.synth_ntom_s32 == NULL) fr->cpu_opts.synth_ntom_s32 = synth_ntom_s32;
912
if(fr->cpu_opts.synth_ntom_s32_mono == NULL) fr->cpu_opts.synth_ntom_s32_mono = synth_ntom_s32_mono;
913
if(fr->cpu_opts.synth_ntom_s32_mono2stereo == NULL) fr->cpu_opts.synth_ntom_s32_mono2stereo = synth_ntom_s32_mono2stereo;
917
if(fr->cpu_opts.synth_1to1_real == NULL) fr->cpu_opts.synth_1to1_real = synth_1to1_real;
918
if(fr->cpu_opts.synth_1to1_real_mono == NULL) fr->cpu_opts.synth_1to1_real_mono = synth_1to1_real_mono;
919
if(fr->cpu_opts.synth_1to1_real_mono2stereo == NULL) fr->cpu_opts.synth_1to1_real_mono2stereo = synth_1to1_real_mono2stereo;
920
# ifndef NO_DOWNSAMPLE
921
if(fr->cpu_opts.synth_2to1_real == NULL) fr->cpu_opts.synth_2to1_real = synth_2to1_real;
922
if(fr->cpu_opts.synth_2to1_real_mono == NULL) fr->cpu_opts.synth_2to1_real_mono = synth_2to1_real_mono;
923
if(fr->cpu_opts.synth_2to1_real_mono2stereo == NULL) fr->cpu_opts.synth_2to1_real_mono2stereo = synth_2to1_real_mono2stereo;
924
if(fr->cpu_opts.synth_4to1_real == NULL) fr->cpu_opts.synth_4to1_real = synth_4to1_real;
925
if(fr->cpu_opts.synth_4to1_real_mono == NULL) fr->cpu_opts.synth_4to1_real_mono = synth_4to1_real_mono;
926
if(fr->cpu_opts.synth_4to1_real_mono2stereo == NULL) fr->cpu_opts.synth_4to1_real_mono2stereo = synth_4to1_real_mono2stereo;
929
if(fr->cpu_opts.synth_ntom_real == NULL) fr->cpu_opts.synth_ntom_real = synth_ntom_real;
930
if(fr->cpu_opts.synth_ntom_real_mono == NULL) fr->cpu_opts.synth_ntom_real_mono = synth_ntom_real_mono;
931
if(fr->cpu_opts.synth_ntom_real_mono2stereo == NULL) fr->cpu_opts.synth_ntom_real_mono2stereo = synth_ntom_real_mono2stereo;
935
#endif /* OPT_MULTI */
938
if(VERBOSE) fprintf(stderr, "Decoder: %s\n", chosen);
943
if(NOQUIET) error("Could not set optimization!");
948
enum optdec dectype(const char* decoder)
951
if( (decoder == NULL)
952
|| (decoder[0] == 0) )
955
for(dt=autodec; dt<nodec; ++dt)
956
if(!strcasecmp(decoder, decname[dt])) return dt;
958
return nodec; /* If we found nothing... */
17
963
/* same number of entries as full list, but empty at beginning */
18
static char *mpg123_supported_decoder_list[] =
964
static const char *mpg123_supported_decoder_list[] =
20
966
#ifdef OPT_3DNOWEXT