ReactOS  0.4.15-dev-509-g96a357b
layer2.c File Reference
#include "mpg123lib_intern.h"
#include "l2tables.h"
#include "getbits.h"
Include dependency graph for layer2.c:

Go to the source code of this file.

Functions

void init_layer12 (void)
 
void init_layer12_stuff (mpg123_handle *fr, real *(*init_table)(mpg123_handle *fr, real *table, int m))
 
realinit_layer12_table (mpg123_handle *fr, real *table, int m)
 
static int II_step_one (unsigned int *bit_alloc, int *scale, mpg123_handle *fr)
 
static void II_step_two (unsigned int *bit_alloc, real fraction[2][4][SBLIMIT], int *scale, mpg123_handle *fr, int x1)
 
static void II_select_table (mpg123_handle *fr)
 
int do_layer2 (mpg123_handle *fr)
 

Variables

static int grp_3tab [32 *3] = { 0, }
 
static int grp_5tab [128 *3] = { 0, }
 
static int grp_9tab [1024 *3] = { 0, }
 
static const double mulmul [27]
 

Function Documentation

◆ do_layer2()

int do_layer2 ( mpg123_handle fr)

Definition at line 369 of file layer2.c.

370 {
371  int clip=0;
372  int i,j;
373  int stereo = fr->stereo;
374  /* pick_table clears unused subbands */
375  /* replacement for real fraction[2][4][SBLIMIT], needs alignment. */
376  real (*fraction)[4][SBLIMIT] = fr->layer2.fraction;
377  unsigned int bit_alloc[64];
378  int scale[192];
379  int single = fr->single;
380 
381  II_select_table(fr);
382  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : fr->II_sblimit;
383 
384  if(fr->jsbound > fr->II_sblimit)
385  {
386  fprintf(stderr, "Truncating stereo boundary to sideband limit.\n");
387  fr->jsbound=fr->II_sblimit;
388  }
389 
390  /* TODO: What happens with mono mixing, actually? */
391  if(stereo == 1 || single == SINGLE_MIX) /* also, mix not really handled */
393 
394  if(II_step_one(bit_alloc, scale, fr))
395  {
396  if(NOQUIET)
397  error("first step of layer I decoding failed");
398  return clip;
399  }
400 
401  for(i=0;i<SCALE_BLOCK;i++)
402  {
403  II_step_two(bit_alloc,fraction,scale,fr,i>>2);
404  if(fr->bits_avail < 0)
405  {
406  if(NOQUIET)
407  error("missing bits in layer II step two");
408  return clip;
409  }
410  for(j=0;j<3;j++)
411  {
412  if(single != SINGLE_STEREO)
413  clip += (fr->synth_mono)(fraction[single][j], fr);
414  else
415  clip += (fr->synth_stereo)(fraction[0][j], fraction[1][j], fr);
416  }
417  }
418 
419  return clip;
420 }
#define error(str)
Definition: mkdosfs.c:1605
#define SCALE_BLOCK
#define SINGLE_STEREO
Definition: frame.h:188
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define SBLIMIT
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
float single
Definition: msinkaut.idl:29
static void II_step_two(unsigned int *bit_alloc, real fraction[2][4][SBLIMIT], int *scale, mpg123_handle *fr, int x1)
Definition: layer2.c:230
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 SINGLE_LEFT
Definition: frame.h:189
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
func_synth_mono synth_mono
Definition: frame.h:182
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 GLint GLint j
Definition: glfuncs.h:250
#define MPG_MD_JOINT_STEREO
static void II_select_table(mpg123_handle *fr)
Definition: layer2.c:336
#define NOQUIET
static int II_step_one(unsigned int *bit_alloc, int *scale, mpg123_handle *fr)
Definition: layer2.c:117
func_synth_stereo synth_stereo
Definition: frame.h:181
struct mpg123_handle_struct::@3380 layer2
FILE * stderr
#define SINGLE_MIX
Definition: frame.h:191

◆ II_select_table()

static void II_select_table ( mpg123_handle fr)
static

Definition at line 336 of file layer2.c.

337 {
338  const int translate[3][2][16] =
339  {
340  {
341  { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 },
342  { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 }
343  },
344  {
345  { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 },
346  { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 }
347  },
348  {
349  { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 },
350  { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 }
351  }
352  };
353 
354  int table,sblim;
355  const struct al_table *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
356  const int sblims[5] = { 27 , 30 , 8, 12 , 30 };
357 
358  if(fr->sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */
359  table = 4;
360  else
362 
363  sblim = sblims[table];
364  fr->alloc = tables[table];
365  fr->II_sblimit = sblim;
366 }
static const struct al_table alloc_1[]
Definition: l2tables.h:56
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
const struct al_table * alloc
Definition: frame.h:178
static const struct al_table alloc_4[]
Definition: l2tables.h:127
int sampling_frequency
Definition: frame.h:205
Definition: frame.h:32
static void translate(POINT *pt, UINT count, const XFORM *xform)
Definition: metafile.c:2586
static const struct al_table alloc_0[]
Definition: l2tables.h:16
static const struct al_table alloc_3[]
Definition: l2tables.h:111
static const struct al_table alloc_2[]
Definition: l2tables.h:99
struct nls_table * tables
Definition: nls_base.c:22

Referenced by do_layer2().

◆ II_step_one()

static int II_step_one ( unsigned int bit_alloc,
int scale,
mpg123_handle fr 
)
static

Definition at line 117 of file layer2.c.

118 {
119  int stereo = fr->stereo-1;
120  int sblimit = fr->II_sblimit;
121  int jsbound = fr->jsbound;
122  int sblimit2 = fr->II_sblimit<<stereo;
123  const struct al_table *alloc1 = fr->alloc;
124  int i;
125  unsigned int scfsi_buf[64];
126  unsigned int *scfsi,*bita;
127  int sc,step;
128  /* Count the bits needed for getbits_fast(). */
129  unsigned int needbits = 0;
130  unsigned int scale_bits[4] = { 18, 12, 6, 12 };
131 
132  bita = bit_alloc;
133  if(stereo)
134  {
135  for(i=jsbound;i;i--,alloc1+=(1<<step))
136  {
137  step=alloc1->bits;
138  bita[0] = (char) getbits(fr, step);
139  bita[1] = (char) getbits(fr, step);
140  needbits += ((bita[0]?1:0)+(bita[1]?1:0))*2;
141  bita+=2;
142  }
143  for(i=sblimit-jsbound;i;i--,alloc1+=(1<<step))
144  {
145  step=alloc1->bits;
146  bita[0] = (char) getbits(fr, step);
147  bita[1] = bita[0];
148  needbits += (bita[0]?1:0)*2*2;
149  bita+=2;
150  }
151  bita = bit_alloc;
152  scfsi=scfsi_buf;
153 
154  if(fr->bits_avail < needbits)
155  {
156  if(NOQUIET)
157  error2("need %u bits, have %li", needbits, fr->bits_avail);
158  return -1;
159  }
160  for(i=sblimit2;i;i--)
161  if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2);
162  }
163  else /* mono */
164  {
165  for(i=sblimit;i;i--,alloc1+=(1<<step))
166  {
167  step=alloc1->bits;
168  *bita = (char) getbits(fr, step);
169  if(*bita)
170  needbits += 2;
171  ++bita;
172  }
173  bita = bit_alloc;
174  scfsi=scfsi_buf;
175  if(fr->bits_avail < needbits)
176  {
177  if(NOQUIET)
178  error2("need %u bits, have %li", needbits, fr->bits_avail);
179  return -1;
180  }
181  for(i=sblimit;i;i--)
182  if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2);
183  }
184 
185  needbits = 0;
186  bita = bit_alloc;
187  scfsi=scfsi_buf;
188  for(i=sblimit2;i;--i)
189  if(*bita++)
190  needbits += scale_bits[*scfsi++];
191  if(fr->bits_avail < needbits)
192  {
193  if(NOQUIET)
194  error2("need %u bits, have %li", needbits, fr->bits_avail);
195  return -1;
196  }
197 
198  bita = bit_alloc;
199  scfsi=scfsi_buf;
200  for(i=sblimit2;i;--i)
201  if(*bita++)
202  switch(*scfsi++)
203  {
204  case 0:
205  *scale++ = getbits_fast(fr, 6);
206  *scale++ = getbits_fast(fr, 6);
207  *scale++ = getbits_fast(fr, 6);
208  break;
209  case 1 :
210  *scale++ = sc = getbits_fast(fr, 6);
211  *scale++ = sc;
212  *scale++ = getbits_fast(fr, 6);
213  break;
214  case 2:
215  *scale++ = sc = getbits_fast(fr, 6);
216  *scale++ = sc;
217  *scale++ = sc;
218  break;
219  default: /* case 3 */
220  *scale++ = getbits_fast(fr, 6);
221  *scale++ = sc = getbits_fast(fr, 6);
222  *scale++ = sc;
223  break;
224  }
225 
226  return 0;
227 }
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
const struct al_table * alloc
Definition: frame.h:178
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
unsigned char
Definition: typeof.h:29
Definition: frame.h:32
#define error2(s, a, b)
Definition: debug.h:126
static unsigned int getbits(mpg123_handle *fr, int number_of_bits)
Definition: getbits.h:32
#define NOQUIET
#define getbits_fast(fr, nob)
Definition: getbits.h:89

Referenced by do_layer2().

◆ II_step_two()

static void II_step_two ( unsigned int bit_alloc,
real  fraction[2][4][SBLIMIT],
int scale,
mpg123_handle fr,
int  x1 
)
static

Definition at line 230 of file layer2.c.

231 {
232  int i,j,k,ba;
233  int stereo = fr->stereo;
234  int sblimit = fr->II_sblimit;
235  int jsbound = fr->jsbound;
236  const struct al_table *alloc2,*alloc1 = fr->alloc;
237  unsigned int *bita=bit_alloc;
238  int d1,step;
239 
240  for(i=0;i<jsbound;i++,alloc1+=(1<<step))
241  {
242  step = alloc1->bits;
243  for(j=0;j<stereo;j++)
244  {
245  if( (ba=*bita++) )
246  {
247  k=(alloc2 = alloc1+ba)->bits;
248  if( (d1=alloc2->d) < 0)
249  {
250  real cm=fr->muls[k][scale[x1]];
251  fraction[j][0][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm);
252  fraction[j][1][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm);
253  fraction[j][2][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm);
254  }
255  else
256  {
257  const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab };
258  unsigned int idx,*tab,m=scale[x1];
259  idx = (unsigned int) getbits(fr, k);
260  tab = (unsigned int *) (table[d1] + idx + idx + idx);
261  fraction[j][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]);
262  fraction[j][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]);
263  fraction[j][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m]);
264  }
265  scale+=3;
266  }
267  else
268  fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = DOUBLE_TO_REAL(0.0);
269  if(fr->bits_avail < 0)
270  return; /* Caller checks that again. */
271  }
272  }
273 
274  for(i=jsbound;i<sblimit;i++,alloc1+=(1<<step))
275  {
276  step = alloc1->bits;
277  bita++; /* channel 1 and channel 2 bitalloc are the same */
278  if( (ba=*bita++) )
279  {
280  k=(alloc2 = alloc1+ba)->bits;
281  if( (d1=alloc2->d) < 0)
282  {
283  real cm;
284  cm=fr->muls[k][scale[x1+3]];
285  fraction[0][0][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1);
286  fraction[0][1][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1);
287  fraction[0][2][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1);
288  fraction[1][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm);
289  fraction[1][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm);
290  fraction[1][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm);
291  cm=fr->muls[k][scale[x1]];
292  fraction[0][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm);
293  fraction[0][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm);
294  fraction[0][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm);
295  }
296  else
297  {
298  const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab };
299  unsigned int idx,*tab,m1,m2;
300  m1 = scale[x1]; m2 = scale[x1+3];
301  idx = (unsigned int) getbits(fr, k);
302  tab = (unsigned int *) (table[d1] + idx + idx + idx);
303  fraction[0][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]);
304  fraction[0][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]);
305  fraction[0][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m2]);
306  }
307  scale+=6;
308  if(fr->bits_avail < 0)
309  return; /* Caller checks that again. */
310  }
311  else
312  {
313  fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
314  fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = DOUBLE_TO_REAL(0.0);
315  }
316 /*
317  Historic comment...
318  should we use individual scalefac for channel 2 or
319  is the current way the right one , where we just copy channel 1 to
320  channel 2 ??
321  The current 'strange' thing is, that we throw away the scalefac
322  values for the second channel ...!!
323  -> changed .. now we use the scalefac values of channel one !!
324 */
325  }
326 
327  if(sblimit > (fr->down_sample_sblimit) )
328  sblimit = fr->down_sample_sblimit;
329 
330  for(i=sblimit;i<SBLIMIT;i++)
331  for (j=0;j<stereo;j++)
332  fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = DOUBLE_TO_REAL(0.0);
333 }
#define DOUBLE_TO_REAL(x)
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define SBLIMIT
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
static int grp_3tab[32 *3]
Definition: layer2.c:21
const struct al_table * alloc
Definition: frame.h:178
#define REAL_SCALE_LAYER12(x)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
const GLfloat * m
Definition: glext.h:10848
int down_sample_sblimit
Definition: frame.h:194
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
unsigned int idx
Definition: utils.c:41
Definition: frame.h:32
static int grp_5tab[128 *3]
Definition: layer2.c:22
real muls[27][64]
Definition: frame.h:145
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 GLint GLint j
Definition: glfuncs.h:250
static int grp_9tab[1024 *3]
Definition: layer2.c:23
static unsigned int getbits(mpg123_handle *fr, int number_of_bits)
Definition: getbits.h:32
short d
Definition: frame.h:35
#define REAL_MUL_SCALE_LAYER12(x, y)
#define DOUBLE_TO_REAL_15(x)
int k
Definition: mpi.c:3369
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by do_layer2().

◆ init_layer12()

void init_layer12 ( void  )

Definition at line 39 of file layer2.c.

40 {
41  const int base[3][9] =
42  {
43  { 1 , 0, 2 , } ,
44  { 17, 18, 0 , 19, 20 , } ,
45  { 21, 1, 22, 23, 0, 24, 25, 2, 26 }
46  };
47  int i,j,k,l,len;
48  const int tablen[3] = { 3 , 5 , 9 };
49  int *itable;
50  int *tables[3] = { grp_3tab , grp_5tab , grp_9tab };
51 
52  for(i=0;i<3;i++)
53  {
54  itable = tables[i];
55  len = tablen[i];
56  for(j=0;j<len;j++)
57  for(k=0;k<len;k++)
58  for(l=0;l<len;l++)
59  {
60  *itable++ = base[i][l];
61  *itable++ = base[i][k];
62  *itable++ = base[i][j];
63  }
64  }
65 }
static int grp_3tab[32 *3]
Definition: layer2.c:21
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
static int grp_5tab[128 *3]
Definition: layer2.c:22
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 GLint GLint j
Definition: glfuncs.h:250
r l[0]
Definition: byte_order.h:167
static int grp_9tab[1024 *3]
Definition: layer2.c:23
GLenum GLsizei len
Definition: glext.h:6722
struct nls_table * tables
Definition: nls_base.c:22
int k
Definition: mpi.c:3369

◆ init_layer12_stuff()

void init_layer12_stuff ( mpg123_handle fr,
real *(*)(mpg123_handle *fr, real *table, int m init_table 
)

Definition at line 67 of file layer2.c.

68 {
69  int k;
70  real *table;
71  for(k=0;k<27;k++)
72  {
73  table = init_table(fr, fr->muls[k], k);
74  *table++ = 0.0;
75  }
76 }
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
real muls[27][64]
Definition: frame.h:145
int k
Definition: mpi.c:3369

◆ init_layer12_table()

real* init_layer12_table ( mpg123_handle fr,
real table,
int  m 
)

Definition at line 78 of file layer2.c.

79 {
80 #if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES)
81  int i;
82  for(i=0;i<63;i++)
83  *table++ = layer12_table[m][i];
84 #else
85  int i,j;
86  for(j=3,i=0;i<63;i++,j--)
87  *table++ = DOUBLE_TO_REAL_SCALE_LAYER12(mulmul[m] * pow(2.0,(double) j / 3.0));
88 #endif
89 
90  return table;
91 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
const GLfloat * m
Definition: glext.h:10848
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
float pow(float __x, int __y)
Definition: _cmath.h:458
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 GLint GLint j
Definition: glfuncs.h:250
static const double mulmul[27]
Definition: layer2.c:28
#define DOUBLE_TO_REAL_SCALE_LAYER12(x)
static const real layer12_table[27][64]

Variable Documentation

◆ grp_3tab

int grp_3tab[32 *3] = { 0, }
static

Definition at line 21 of file layer2.c.

Referenced by II_step_two(), and init_layer12().

◆ grp_5tab

int grp_5tab[128 *3] = { 0, }
static

Definition at line 22 of file layer2.c.

Referenced by II_step_two(), and init_layer12().

◆ grp_9tab

int grp_9tab[1024 *3] = { 0, }
static

Definition at line 23 of file layer2.c.

Referenced by II_step_two(), and init_layer12().

◆ mulmul

const double mulmul[27]
static
Initial value:
=
{
0.0 , -2.0/3.0 , 2.0/3.0 ,
2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 ,
2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 ,
2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 ,
-4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 ,
-8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0
}

Definition at line 28 of file layer2.c.

Referenced by init_layer12_table().