Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenoptimize.h
Go to the documentation of this file.
00001 #ifndef MPG123_H_OPTIMIZE 00002 #define MPG123_H_OPTIMIZE 00003 /* 00004 optimize: get a grip on the different optimizations 00005 00006 copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1 00007 see COPYING and AUTHORS files in distribution or http://mpg123.org 00008 initially written by Thomas Orgis, taking from mpg123.[hc] 00009 00010 for building mpg123 with one optimization only, you have to choose exclusively between 00011 OPT_GENERIC (generic C code for everyone) 00012 OPT_GENERIC_DITHER (same with dithering for 1to1) 00013 OPT_I386 (Intel i386) 00014 OPT_I486 (Somewhat special code for i486; does not work together with others.) 00015 OPT_I586 (Intel Pentium) 00016 OPT_I586_DITHER (Intel Pentium with dithering/noise shaping for enhanced quality) 00017 OPT_MMX (Intel Pentium and compatibles with MMX, fast, but not the best accuracy) 00018 OPT_3DNOW (AMD 3DNow!, K6-2/3, Athlon, compatibles...) 00019 OPT_3DNOWEXT (AMD 3DNow! extended, generally Athlon, compatibles...) 00020 OPT_ALTIVEC (Motorola/IBM PPC with AltiVec under MacOSX) 00021 OPT_X86_64 (x86-64 / AMD64 / Intel 64) 00022 00023 or you define OPT_MULTI and give a combination which makes sense (do not include i486, do not mix altivec and x86). 00024 00025 I still have to examine the dynamics of this here together with REAL_IS_FIXED. 00026 Basic point is: Don't use REAL_IS_FIXED with something else than generic or i386. 00027 00028 Also, one should minimize code size by really ensuring that only functions that are really needed are included. 00029 Currently, all generic functions will be always there (to be safe for fallbacks for advanced decoders). 00030 Strictly, at least the synth_1to1 should not be necessary for single-decoder mode. 00031 */ 00032 00033 00034 /* Runtime optimization interface now here: */ 00035 00036 enum optdec 00037 { /* autodec needs to be =0 and the first, nodec needs to be the last -- for loops! */ 00038 autodec=0, generic, generic_dither, idrei, 00039 ivier, ifuenf, ifuenf_dither, mmx, 00040 dreidnow, dreidnowext, altivec, sse, x86_64, arm, 00041 nodec 00042 }; 00043 enum optcla { nocla=0, normal, mmxsse }; 00044 00045 /* - Set up the table of synth functions for current decoder choice. */ 00046 int frame_cpu_opt(mpg123_handle *fr, const char* cpu); 00047 /* - Choose, from the synth table, the synth functions to use for current output format/rate. */ 00048 int set_synth_functions(mpg123_handle *fr); 00049 /* - Parse decoder name and return numerical code. */ 00050 enum optdec dectype(const char* decoder); 00051 /* - Return the default decoder type. */ 00052 enum optdec defdec(void); 00053 /* - Return the class of a decoder type (mmxsse or normal). */ 00054 enum optcla decclass(const enum optdec); 00055 00056 /* Now comes a whole lot of definitions, for multi decoder mode and single decoder mode. 00057 Because of the latter, it may look redundant at times. */ 00058 00059 /* this is included in mpg123.h, which includes config.h */ 00060 #ifdef CCALIGN 00061 #ifdef _MSC_VER 00062 #define ALIGNED(a) __declspec(align(a)) 00063 #else 00064 #define ALIGNED(a) __attribute__((aligned(a))) 00065 #endif 00066 #else 00067 #define ALIGNED(a) 00068 #endif 00069 00070 /* Safety catch for invalid decoder choice. */ 00071 #ifdef REAL_IS_FIXED 00072 #if (defined OPT_I486) || (defined OPT_I586) || (defined OPT_I586_DITHER) \ 00073 || (defined OPT_MMX) || (defined OPT_SSE) || (defined_OPT_ALTIVEC) \ 00074 || (defined OPT_3DNOW) || (defined OPT_3DNOWEXT) || (defined OPT_X86_64) || (defined OPT_GENERIC_DITHER) 00075 #error "Bad decoder choice together with fixed point math!" 00076 #endif 00077 #endif 00078 00079 #if (defined NO_LAYER1 && defined NO_LAYER2) 00080 #define NO_LAYER12 00081 #endif 00082 00083 #ifdef OPT_GENERIC 00084 #ifndef OPT_MULTI 00085 # define defopt generic 00086 #endif 00087 #endif 00088 00089 #ifdef OPT_GENERIC_DITHER 00090 #define OPT_DITHER 00091 #ifndef OPT_MULTI 00092 # define defopt generic_dither 00093 #endif 00094 #endif 00095 00096 /* i486 is special... always alone! */ 00097 #ifdef OPT_I486 00098 #define OPT_X86 00099 #define defopt ivier 00100 #ifdef OPT_MULTI 00101 #error "i486 can only work alone!" 00102 #endif 00103 #define FIR_BUFFER_SIZE 128 00104 #define FIR_SIZE 16 00105 #endif 00106 00107 #ifdef OPT_I386 00108 #define OPT_X86 00109 #ifndef OPT_MULTI 00110 # define defopt idrei 00111 #endif 00112 #endif 00113 00114 #ifdef OPT_I586 00115 #define OPT_X86 00116 #ifndef OPT_MULTI 00117 # define defopt ifuenf 00118 #endif 00119 #endif 00120 00121 #ifdef OPT_I586_DITHER 00122 #define OPT_X86 00123 #define OPT_DITHER 00124 #ifndef OPT_MULTI 00125 # define defopt ifuenf_dither 00126 #endif 00127 #endif 00128 00129 /* We still have some special code around MMX tables. */ 00130 00131 #ifdef OPT_MMX 00132 #define OPT_MMXORSSE 00133 #define OPT_X86 00134 #ifndef OPT_MULTI 00135 # define defopt mmx 00136 #endif 00137 #endif 00138 00139 #ifdef OPT_SSE 00140 #define OPT_MMXORSSE 00141 #define OPT_MPLAYER 00142 #define OPT_X86 00143 #ifndef OPT_MULTI 00144 # define defopt sse 00145 #endif 00146 #endif 00147 00148 #ifdef OPT_3DNOWEXT 00149 #define OPT_MMXORSSE 00150 #define OPT_MPLAYER 00151 #define OPT_X86 00152 #ifndef OPT_MULTI 00153 # define defopt dreidnowext 00154 # define opt_dct36(fr) dct36_3dnowext 00155 #endif 00156 #endif 00157 00158 #ifdef OPT_MPLAYER 00159 extern const int costab_mmxsse[]; 00160 #endif 00161 00162 /* 3dnow used to use synth_1to1_i586 for mono / 8bit conversion - was that intentional? */ 00163 /* I'm trying to skip the pentium code here ... until I see that that is indeed a bad idea */ 00164 #ifdef OPT_3DNOW 00165 #define OPT_X86 00166 #ifndef OPT_MULTI 00167 # define defopt dreidnow 00168 # define opt_dct36(fr) dct36_3dnow 00169 #endif 00170 #endif 00171 00172 #ifdef OPT_ALTIVEC 00173 #ifndef OPT_MULTI 00174 # define defopt altivec 00175 #endif 00176 #endif 00177 00178 #ifdef OPT_X86_64 00179 #define OPT_MMXORSSE 00180 #ifndef OPT_MULTI 00181 # define defopt x86_64 00182 #endif 00183 #endif 00184 00185 #ifdef OPT_ARM 00186 #ifndef OPT_MULTI 00187 # define defopt arm 00188 #endif 00189 #endif 00190 00191 /* used for multi opt mode and the single 3dnow mode to have the old 3dnow test flag still working */ 00192 void check_decoders(void); 00193 00194 /* 00195 Now come two blocks of standard definitions for multi-decoder mode and single-decoder mode. 00196 Most stuff is so automatic that it's indeed generated by some inline shell script. 00197 Remember to use these scripts when possible, instead of direct repetitive hacking. 00198 */ 00199 00200 #ifdef OPT_MULTI 00201 00202 # define defopt nodec 00203 00204 # if (defined OPT_3DNOW || defined OPT_3DNOWEXT) 00205 # define opt_dct36(fr) ((fr)->cpu_opts.the_dct36) 00206 # endif 00207 00208 #endif /* OPT_MULTI else */ 00209 00210 # ifndef opt_dct36 00211 # define opt_dct36(fr) dct36 00212 # endif 00213 00214 #endif /* MPG123_H_OPTIMIZE */ 00215 Generated on Sun May 27 2012 04:33:12 for ReactOS by
1.7.6.1
|