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_s32.c
Go to the documentation of this file.
00001 /*
00002     synth_s32.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 4: All synth functions that produce signed 32 bit output.
00018     What we need is just a special WRITE_SAMPLE.
00019 */
00020 
00021 #define SAMPLE_T int32_t
00022 #define WRITE_SAMPLE(samples,sum,clip) WRITE_S32_SAMPLE(samples,sum,clip)
00023 
00024 /* Part 4a: All straight 1to1 decoding functions */
00025 #define BLOCK 0x40 /* One decoding block is 64 samples. */
00026 
00027 #define SYNTH_NAME synth_1to1_s32
00028 #include "synth.h"
00029 #undef SYNTH_NAME
00030 
00031 /* Mono-related synths; they wrap over _some_ synth_1to1_s32 (could be generic, could be i386). */
00032 #define SYNTH_NAME       fr->synths.plain[r_1to1][f_32]
00033 #define MONO_NAME        synth_1to1_s32_mono
00034 #define MONO2STEREO_NAME synth_1to1_s32_mono2stereo
00035 #include "synth_mono.h"
00036 #undef SYNTH_NAME
00037 #undef MONO_NAME
00038 #undef MONO2STEREO_NAME
00039 
00040 #ifdef OPT_X86
00041 #define NO_AUTOINCREMENT
00042 #define SYNTH_NAME synth_1to1_s32_i386
00043 #include "synth.h"
00044 #undef SYNTH_NAME
00045 /* i386 uses the normal mono functions. */
00046 #undef NO_AUTOINCREMENT
00047 #endif
00048 
00049 #ifdef OPT_X86_64
00050 /* Assembler routines. */
00051 int synth_1to1_s32_x86_64_asm(real *window, real *b0, int32_t *samples, int bo1);
00052 int synth_1to1_s32_stereo_x86_64_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
00053 void dct64_real_x86_64(real *out0, real *out1, real *samples);
00054 /* Hull for C mpg123 API */
00055 int synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
00056 {
00057     int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
00058 
00059     real *b0, **buf;
00060     int bo1;
00061     int clip;
00062 
00063     if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
00064 
00065     if(!channel)
00066     {
00067         fr->bo--;
00068         fr->bo &= 0xf;
00069         buf = fr->real_buffs[0];
00070     }
00071     else
00072     {
00073         samples++;
00074         buf = fr->real_buffs[1];
00075     }
00076 
00077     if(fr->bo & 0x1)
00078     {
00079         b0 = buf[0];
00080         bo1 = fr->bo;
00081         dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
00082     }
00083     else
00084     {
00085         b0 = buf[1];
00086         bo1 = fr->bo+1;
00087         dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
00088     }
00089 
00090     clip = synth_1to1_s32_x86_64_asm(fr->decwin, b0, samples, bo1);
00091 
00092     if(final) fr->buffer.fill += 256;
00093 
00094     return clip;
00095 }
00096 
00097 
00098 int synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
00099 {
00100     int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
00101 
00102     real *b0l, *b0r, **bufl, **bufr;
00103     int bo1;
00104     int clip;
00105 
00106     if(fr->have_eq_settings)
00107     {
00108         do_equalizer(bandPtr_l,0,fr->equalizer);
00109         do_equalizer(bandPtr_r,1,fr->equalizer);
00110     }
00111 
00112     fr->bo--;
00113     fr->bo &= 0xf;
00114     bufl = fr->real_buffs[0];
00115     bufr = fr->real_buffs[1];
00116 
00117     if(fr->bo & 0x1)
00118     {
00119         b0l = bufl[0];
00120         b0r = bufr[0];
00121         bo1 = fr->bo;
00122         dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
00123         dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
00124     }
00125     else
00126     {
00127         b0l = bufl[1];
00128         b0r = bufr[1];
00129         bo1 = fr->bo+1;
00130         dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
00131         dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
00132     }
00133 
00134     clip = synth_1to1_s32_stereo_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
00135 
00136     fr->buffer.fill += 256;
00137 
00138     return clip;
00139 }
00140 #endif
00141 
00142 #ifdef OPT_SSE
00143 /* Assembler routines. */
00144 int synth_1to1_s32_sse_asm(real *window, real *b0, int32_t *samples, int bo1);
00145 int synth_1to1_s32_stereo_sse_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
00146 void dct64_real_sse(real *out0, real *out1, real *samples);
00147 /* Hull for C mpg123 API */
00148 int synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
00149 {
00150     int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
00151 
00152     real *b0, **buf;
00153     int bo1;
00154     int clip;
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     clip = synth_1to1_s32_sse_asm(fr->decwin, b0, samples, bo1);
00184 
00185     if(final) fr->buffer.fill += 256;
00186 
00187     return clip;
00188 }
00189 
00190 
00191 int synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
00192 {
00193     int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
00194 
00195     real *b0l, *b0r, **bufl, **bufr;
00196     int bo1;
00197     int clip;
00198 
00199     if(fr->have_eq_settings)
00200     {
00201         do_equalizer(bandPtr_l,0,fr->equalizer);
00202         do_equalizer(bandPtr_r,1,fr->equalizer);
00203     }
00204 
00205     fr->bo--;
00206     fr->bo &= 0xf;
00207     bufl = fr->real_buffs[0];
00208     bufr = fr->real_buffs[1];
00209 
00210     if(fr->bo & 0x1)
00211     {
00212         b0l = bufl[0];
00213         b0r = bufr[0];
00214         bo1 = fr->bo;
00215         dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
00216         dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
00217     }
00218     else
00219     {
00220         b0l = bufl[1];
00221         b0r = bufr[1];
00222         bo1 = fr->bo+1;
00223         dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
00224         dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
00225     }
00226 
00227     clip = synth_1to1_s32_stereo_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
00228 
00229     fr->buffer.fill += 256;
00230 
00231     return clip;
00232 }
00233 #endif
00234 
00235 #undef BLOCK
00236 
00237 #ifndef NO_DOWNSAMPLE
00238 
00239 /*
00240     Part 4b: 2to1 synth. Only generic and i386.
00241 */
00242 #define BLOCK 0x20 /* One decoding block is 32 samples. */
00243 
00244 #define SYNTH_NAME synth_2to1_s32
00245 #include "synth.h"
00246 #undef SYNTH_NAME
00247 
00248 /* Mono-related synths; they wrap over _some_ synth_2to1_s32 (could be generic, could be i386). */
00249 #define SYNTH_NAME       fr->synths.plain[r_2to1][f_32]
00250 #define MONO_NAME        synth_2to1_s32_mono
00251 #define MONO2STEREO_NAME synth_2to1_s32_mono2stereo
00252 #include "synth_mono.h"
00253 #undef SYNTH_NAME
00254 #undef MONO_NAME
00255 #undef MONO2STEREO_NAME
00256 
00257 #ifdef OPT_X86
00258 #define NO_AUTOINCREMENT
00259 #define SYNTH_NAME synth_2to1_s32_i386
00260 #include "synth.h"
00261 #undef SYNTH_NAME
00262 /* i386 uses the normal mono functions. */
00263 #undef NO_AUTOINCREMENT
00264 #endif
00265 
00266 #undef BLOCK
00267 
00268 /*
00269     Part 4c: 4to1 synth. Only generic and i386.
00270 */
00271 #define BLOCK 0x10 /* One decoding block is 16 samples. */
00272 
00273 #define SYNTH_NAME synth_4to1_s32
00274 #include "synth.h"
00275 #undef SYNTH_NAME
00276 
00277 /* Mono-related synths; they wrap over _some_ synth_4to1_s32 (could be generic, could be i386). */
00278 #define SYNTH_NAME       fr->synths.plain[r_4to1][f_32]
00279 #define MONO_NAME        synth_4to1_s32_mono
00280 #define MONO2STEREO_NAME synth_4to1_s32_mono2stereo
00281 #include "synth_mono.h"
00282 #undef SYNTH_NAME
00283 #undef MONO_NAME
00284 #undef MONO2STEREO_NAME
00285 
00286 #ifdef OPT_X86
00287 #define NO_AUTOINCREMENT
00288 #define SYNTH_NAME synth_4to1_s32_i386
00289 #include "synth.h"
00290 #undef SYNTH_NAME
00291 /* i386 uses the normal mono functions. */
00292 #undef NO_AUTOINCREMENT
00293 #endif
00294 
00295 #undef BLOCK
00296 
00297 #endif /* NO_DOWNSAMPLE */
00298 
00299 #ifndef NO_NTOM
00300 /*
00301     Part 4d: ntom synth.
00302     Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
00303 */
00304 
00305 /* These are all in one header, there's no flexibility to gain. */
00306 #define SYNTH_NAME       synth_ntom_s32
00307 #define MONO_NAME        synth_ntom_s32_mono
00308 #define MONO2STEREO_NAME synth_ntom_s32_mono2stereo
00309 #include "synth_ntom.h"
00310 #undef SYNTH_NAME
00311 #undef MONO_NAME
00312 #undef MONO2STEREO_NAME
00313 
00314 #endif
00315 
00316 #undef SAMPLE_T
00317 #undef WRITE_SAMPLE
00318 
00319 #endif /* non-fixed type */

Generated on Thu May 24 2012 04:34:40 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.