ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

synth_real.c
Go to the documentation of this file.
00001 /*
00002     synth_real.c: The functions for synthesizing real (float) samples, at the end of decoding.
00003 
00004     copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
00005     see COPYING and AUTHORS files in distribution or http://mpg123.org
00006     initially written by Michael Hipp, heavily dissected and rearranged by Thomas Orgis
00007 */
00008 
00009 #include "mpg123lib_intern.h"
00010 #include "sample.h"
00011 #include "debug.h"
00012 
00013 #ifdef REAL_IS_FIXED
00014 #error "Do not build this file with fixed point math!"
00015 #else
00016 /* 
00017     Part 3: All synth functions that produce float output.
00018     What we need is just a special WRITE_SAMPLE. For the generic and i386 functions, that is.
00019     The optimized synths would need to be changed internally to support float output.
00020 */
00021 
00022 #define SAMPLE_T real
00023 #define WRITE_SAMPLE(samples,sum,clip) WRITE_REAL_SAMPLE(samples,sum,clip)
00024 
00025 /* Part 3a: All straight 1to1 decoding functions */
00026 #define BLOCK 0x40 /* One decoding block is 64 samples. */
00027 
00028 #define SYNTH_NAME synth_1to1_real
00029 #include "synth.h"
00030 #undef SYNTH_NAME
00031 
00032 /* Mono-related synths; they wrap over _some_ synth_1to1_real (could be generic, could be i386). */
00033 #define SYNTH_NAME       fr->synths.plain[r_1to1][f_real]
00034 #define MONO_NAME        synth_1to1_real_mono
00035 #define MONO2STEREO_NAME synth_1to1_real_mono2stereo
00036 #include "synth_mono.h"
00037 #undef SYNTH_NAME
00038 #undef MONO_NAME
00039 #undef MONO2STEREO_NAME
00040 
00041 #ifdef OPT_X86
00042 #define NO_AUTOINCREMENT
00043 #define SYNTH_NAME synth_1to1_real_i386
00044 #include "synth.h"
00045 #undef SYNTH_NAME
00046 /* i386 uses the normal mono functions. */
00047 #undef NO_AUTOINCREMENT
00048 #endif
00049 
00050 #undef BLOCK
00051 
00052 /* At least one optimized real decoder... */
00053 #ifdef OPT_X86_64
00054 /* Assembler routines. */
00055 int synth_1to1_real_x86_64_asm(real *window, real *b0, real *samples, int bo1);
00056 int synth_1to1_real_stereo_x86_64_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
00057 void dct64_real_x86_64(real *out0, real *out1, real *samples);
00058 /* Hull for C mpg123 API */
00059 int synth_1to1_real_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
00060 {
00061     real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
00062 
00063     real *b0, **buf;
00064     int bo1;
00065 
00066     if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
00067 
00068     if(!channel)
00069     {
00070         fr->bo--;
00071         fr->bo &= 0xf;
00072         buf = fr->real_buffs[0];
00073     }
00074     else
00075     {
00076         samples++;
00077         buf = fr->real_buffs[1];
00078     }
00079 
00080     if(fr->bo & 0x1)
00081     {
00082         b0 = buf[0];
00083         bo1 = fr->bo;
00084         dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
00085     }
00086     else
00087     {
00088         b0 = buf[1];
00089         bo1 = fr->bo+1;
00090         dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
00091     }
00092 
00093     synth_1to1_real_x86_64_asm(fr->decwin, b0, samples, bo1);
00094 
00095     if(final) fr->buffer.fill += 256;
00096 
00097     return 0;
00098 }
00099 
00100 int synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
00101 {
00102     real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
00103 
00104     real *b0l, *b0r, **bufl, **bufr;
00105     int bo1;
00106 
00107     if(fr->have_eq_settings)
00108     {
00109         do_equalizer(bandPtr_l,0,fr->equalizer);
00110         do_equalizer(bandPtr_r,1,fr->equalizer);
00111     }
00112 
00113     fr->bo--;
00114     fr->bo &= 0xf;
00115     bufl = fr->real_buffs[0];
00116     bufr = fr->real_buffs[1];
00117 
00118     if(fr->bo & 0x1)
00119     {
00120         b0l = bufl[0];
00121         b0r = bufr[0];
00122         bo1 = fr->bo;
00123         dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
00124         dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
00125     }
00126     else
00127     {
00128         b0l = bufl[1];
00129         b0r = bufr[1];
00130         bo1 = fr->bo+1;
00131         dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
00132         dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
00133     }
00134 
00135     synth_1to1_real_stereo_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
00136 
00137     fr->buffer.fill += 256;
00138 
00139     return 0;
00140 }
00141 #endif
00142 
00143 #ifdef OPT_SSE
00144 /* Assembler routines. */
00145 int synth_1to1_real_sse_asm(real *window, real *b0, real *samples, int bo1);
00146 int synth_1to1_real_stereo_sse_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
00147 void dct64_real_sse(real *out0, real *out1, real *samples);
00148 /* Hull for C mpg123 API */
00149 int synth_1to1_real_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
00150 {
00151     real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
00152 
00153     real *b0, **buf;
00154     int bo1;
00155 
00156     if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
00157 
00158     if(!channel)
00159     {
00160         fr->bo--;
00161         fr->bo &= 0xf;
00162         buf = fr->real_buffs[0];
00163     }
00164     else
00165     {
00166         samples++;
00167         buf = fr->real_buffs[1];
00168     }
00169 
00170     if(fr->bo & 0x1)
00171     {
00172         b0 = buf[0];
00173         bo1 = fr->bo;
00174         dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
00175     }
00176     else
00177     {
00178         b0 = buf[1];
00179         bo1 = fr->bo+1;
00180         dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
00181     }
00182 
00183     synth_1to1_real_sse_asm(fr->decwin, b0, samples, bo1);
00184 
00185     if(final) fr->buffer.fill += 256;
00186 
00187     return 0;
00188 }
00189 
00190 int synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
00191 {
00192     real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
00193 
00194     real *b0l, *b0r, **bufl, **bufr;
00195     int bo1;
00196 
00197     if(fr->have_eq_settings)
00198     {
00199         do_equalizer(bandPtr_l,0,fr->equalizer);
00200         do_equalizer(bandPtr_r,1,fr->equalizer);
00201     }
00202 
00203     fr->bo--;
00204     fr->bo &= 0xf;
00205     bufl = fr->real_buffs[0];
00206     bufr = fr->real_buffs[1];
00207 
00208     if(fr->bo & 0x1)
00209     {
00210         b0l = bufl[0];
00211         b0r = bufr[0];
00212         bo1 = fr->bo;
00213         dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
00214         dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
00215     }
00216     else
00217     {
00218         b0l = bufl[1];
00219         b0r = bufr[1];
00220         bo1 = fr->bo+1;
00221         dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
00222         dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
00223     }
00224 
00225     synth_1to1_real_stereo_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
00226 
00227     fr->buffer.fill += 256;
00228 
00229     return 0;
00230 }
00231 #endif
00232 
00233 #ifndef NO_DOWNSAMPLE
00234 
00235 /*
00236     Part 3b: 2to1 synth. Only generic and i386.
00237 */
00238 #define BLOCK 0x20 /* One decoding block is 32 samples. */
00239 
00240 #define SYNTH_NAME synth_2to1_real
00241 #include "synth.h"
00242 #undef SYNTH_NAME
00243 
00244 /* Mono-related synths; they wrap over _some_ synth_2to1_real (could be generic, could be i386). */
00245 #define SYNTH_NAME       fr->synths.plain[r_2to1][f_real]
00246 #define MONO_NAME        synth_2to1_real_mono
00247 #define MONO2STEREO_NAME synth_2to1_real_mono2stereo
00248 #include "synth_mono.h"
00249 #undef SYNTH_NAME
00250 #undef MONO_NAME
00251 #undef MONO2STEREO_NAME
00252 
00253 #ifdef OPT_X86
00254 #define NO_AUTOINCREMENT
00255 #define SYNTH_NAME synth_2to1_real_i386
00256 #include "synth.h"
00257 #undef SYNTH_NAME
00258 /* i386 uses the normal mono functions. */
00259 #undef NO_AUTOINCREMENT
00260 #endif
00261 
00262 #undef BLOCK
00263 
00264 /*
00265     Part 3c: 4to1 synth. Only generic and i386.
00266 */
00267 #define BLOCK 0x10 /* One decoding block is 16 samples. */
00268 
00269 #define SYNTH_NAME synth_4to1_real
00270 #include "synth.h"
00271 #undef SYNTH_NAME
00272 
00273 /* Mono-related synths; they wrap over _some_ synth_4to1_real (could be generic, could be i386). */
00274 #define SYNTH_NAME       fr->synths.plain[r_4to1][f_real]
00275 #define MONO_NAME        synth_4to1_real_mono
00276 #define MONO2STEREO_NAME synth_4to1_real_mono2stereo
00277 #include "synth_mono.h"
00278 #undef SYNTH_NAME
00279 #undef MONO_NAME
00280 #undef MONO2STEREO_NAME
00281 
00282 #ifdef OPT_X86
00283 #define NO_AUTOINCREMENT
00284 #define SYNTH_NAME synth_4to1_real_i386
00285 #include "synth.h"
00286 #undef SYNTH_NAME
00287 /* i386 uses the normal mono functions. */
00288 #undef NO_AUTOINCREMENT
00289 #endif
00290 
00291 #undef BLOCK
00292 
00293 #endif /* NO_DOWNSAMPLE */
00294 
00295 #ifndef NO_NTOM
00296 /*
00297     Part 3d: ntom synth.
00298     Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
00299 */
00300 
00301 /* These are all in one header, there's no flexibility to gain. */
00302 #define SYNTH_NAME       synth_ntom_real
00303 #define MONO_NAME        synth_ntom_real_mono
00304 #define MONO2STEREO_NAME synth_ntom_real_mono2stereo
00305 #include "synth_ntom.h"
00306 #undef SYNTH_NAME
00307 #undef MONO_NAME
00308 #undef MONO2STEREO_NAME
00309 
00310 #endif
00311 
00312 #undef SAMPLE_T
00313 #undef WRITE_SAMPLE
00314 
00315 #endif /* non-fixed type */

Generated on Sun May 27 2012 04:34:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.