ReactOS  0.4.14-dev-384-g5b37caa
synth_8bit.h
Go to the documentation of this file.
1 /*
2  synth_8bit.h: Wrappers over optimized synth_xtoy for converting signed short to 8bit.
3 
4  copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
5  see COPYING and AUTHORS files in distribution or http://mpg123.org
6  initially written by Michael Hipp, code generalized to the wrapper by Thomas Orgis
7 
8  Only variable is the BLOCK size to choose 1to1, 2to1 or 4to1.
9  Oh, and the names: BASE_SYNTH_NAME, SYNTH_NAME, MONO_NAME, MONO2STEREO_NAME
10  (p.ex. opt_synth_1to1(fr), synth_1to1_8bit, synth_1to1_8bit_mono, ...).
11 */
12 
13 int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final)
14 {
15  short samples_tmp[BLOCK];
16  short *tmp1 = samples_tmp + channel;
17  int i,ret;
18 
19  unsigned char *samples = fr->buffer.data;
20  int pnt = fr->buffer.fill;
21  fr->buffer.data = (unsigned char*) samples_tmp;
22  fr->buffer.fill = 0;
23  ret = BASE_SYNTH_NAME(bandPtr, channel, fr , 0);
24  fr->buffer.data = samples;
25 
26  samples += channel + pnt;
27  for(i=0;i<(BLOCK/2);i++)
28  {
29  *samples = fr->conv16to8[*tmp1>>AUSHIFT];
30  samples += 2;
31  tmp1 += 2;
32  }
33  fr->buffer.fill = pnt + (final ? BLOCK : 0 );
34 
35  return ret;
36 }
37 
38 int MONO_NAME(real *bandPtr, mpg123_handle *fr)
39 {
40  short samples_tmp[BLOCK];
41  short *tmp1 = samples_tmp;
42  int i,ret;
43 
44  unsigned char *samples = fr->buffer.data;
45  int pnt = fr->buffer.fill;
46  fr->buffer.data = (unsigned char*) samples_tmp;
47  fr->buffer.fill = 0;
48  ret = BASE_SYNTH_NAME(bandPtr, 0, fr, 0);
49  fr->buffer.data = samples;
50 
51  samples += pnt;
52  for(i=0;i<(BLOCK/2);i++)
53  {
54  *samples++ = fr->conv16to8[*tmp1>>AUSHIFT];
55  tmp1+=2;
56  }
57  fr->buffer.fill = pnt + BLOCK/2;
58 
59  return ret;
60 }
61 
63 {
64  short samples_tmp[BLOCK];
65  short *tmp1 = samples_tmp;
66  int i,ret;
67 
68  unsigned char *samples = fr->buffer.data;
69  int pnt = fr->buffer.fill;
70  fr->buffer.data = (unsigned char*) samples_tmp;
71  fr->buffer.fill = 0;
72  ret = BASE_SYNTH_NAME(bandPtr, 0, fr, 0);
73  fr->buffer.data = samples;
74 
75  samples += pnt;
76  for(i=0;i<(BLOCK/2);i++)
77  {
78  *samples++ = fr->conv16to8[*tmp1>>AUSHIFT];
79  *samples++ = fr->conv16to8[*tmp1>>AUSHIFT];
80  tmp1 += 2;
81  }
82  fr->buffer.fill = pnt + BLOCK;
83 
84  return ret;
85 }
86 
GLsizei samples
Definition: glext.h:7006
int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final)
Definition: synth_8bit.h:13
int MONO_NAME(real *bandPtr, mpg123_handle *fr)
Definition: synth_8bit.h:38
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
struct outbuffer buffer
Definition: frame.h:265
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BLOCK
Definition: synth.c:1138
unsigned char * conv16to8
Definition: frame.h:134
#define BASE_SYNTH_NAME
Definition: synth_8bit.c:50
#define AUSHIFT
int ret
int MONO2STEREO_NAME(real *bandPtr, mpg123_handle *fr)
Definition: synth_8bit.h:62