Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensynth_8bit.h
Go to the documentation of this file.
00001 /* 00002 synth_8bit.h: Wrappers over optimized synth_xtoy for converting signed short to 8bit. 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, code generalized to the wrapper by Thomas Orgis 00007 00008 Only variable is the BLOCK size to choose 1to1, 2to1 or 4to1. 00009 Oh, and the names: BASE_SYNTH_NAME, SYNTH_NAME, MONO_NAME, MONO2STEREO_NAME 00010 (p.ex. opt_synth_1to1(fr), synth_1to1_8bit, synth_1to1_8bit_mono, ...). 00011 */ 00012 00013 int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final) 00014 { 00015 short samples_tmp[BLOCK]; 00016 short *tmp1 = samples_tmp + channel; 00017 int i,ret; 00018 00019 unsigned char *samples = fr->buffer.data; 00020 int pnt = fr->buffer.fill; 00021 fr->buffer.data = (unsigned char*) samples_tmp; 00022 fr->buffer.fill = 0; 00023 ret = BASE_SYNTH_NAME(bandPtr, channel, fr , 0); 00024 fr->buffer.data = samples; 00025 00026 samples += channel + pnt; 00027 for(i=0;i<(BLOCK/2);i++) 00028 { 00029 *samples = fr->conv16to8[*tmp1>>AUSHIFT]; 00030 samples += 2; 00031 tmp1 += 2; 00032 } 00033 fr->buffer.fill = pnt + (final ? BLOCK : 0 ); 00034 00035 return ret; 00036 } 00037 00038 int MONO_NAME(real *bandPtr, mpg123_handle *fr) 00039 { 00040 short samples_tmp[BLOCK]; 00041 short *tmp1 = samples_tmp; 00042 int i,ret; 00043 00044 unsigned char *samples = fr->buffer.data; 00045 int pnt = fr->buffer.fill; 00046 fr->buffer.data = (unsigned char*) samples_tmp; 00047 fr->buffer.fill = 0; 00048 ret = BASE_SYNTH_NAME(bandPtr, 0, fr, 0); 00049 fr->buffer.data = samples; 00050 00051 samples += pnt; 00052 for(i=0;i<(BLOCK/2);i++) 00053 { 00054 *samples++ = fr->conv16to8[*tmp1>>AUSHIFT]; 00055 tmp1+=2; 00056 } 00057 fr->buffer.fill = pnt + BLOCK/2; 00058 00059 return ret; 00060 } 00061 00062 int MONO2STEREO_NAME(real *bandPtr, mpg123_handle *fr) 00063 { 00064 short samples_tmp[BLOCK]; 00065 short *tmp1 = samples_tmp; 00066 int i,ret; 00067 00068 unsigned char *samples = fr->buffer.data; 00069 int pnt = fr->buffer.fill; 00070 fr->buffer.data = (unsigned char*) samples_tmp; 00071 fr->buffer.fill = 0; 00072 ret = BASE_SYNTH_NAME(bandPtr, 0, fr, 0); 00073 fr->buffer.data = samples; 00074 00075 samples += pnt; 00076 for(i=0;i<(BLOCK/2);i++) 00077 { 00078 *samples++ = fr->conv16to8[*tmp1>>AUSHIFT]; 00079 *samples++ = fr->conv16to8[*tmp1>>AUSHIFT]; 00080 tmp1 += 2; 00081 } 00082 fr->buffer.fill = pnt + BLOCK; 00083 00084 return ret; 00085 } 00086 Generated on Sun May 27 2012 04:33:12 for ReactOS by
1.7.6.1
|