layer3.c File Reference

#include <config.h>
#include <stdlib.h>
#include "common.h"
#include "huffman.h"
#include "lame.h"
#include "machine.h"
#include "encoder.h"
#include "lame-analysis.h"
#include "decode_i386.h"

Include dependency graph for layer3.c:

Go to the source code of this file.

Classes

struct  bandInfoStruct

Defines

#define MACRO0(v)
#define MACRO1(v)
#define MACRO2(v)
#define DCT12_PART1
#define DCT12_PART2

Functions

static unsigned int get1bit (PMPSTR mp)
void init_layer3 (int down_sample_sblimit)
static void III_get_side_info_1 (PMPSTR mp, struct III_sideinfo *si, int stereo, int ms_stereo, long sfreq, int single)
static void III_get_side_info_2 (PMPSTR mp, struct III_sideinfo *si, int stereo, int ms_stereo, long sfreq, int single)
static int III_get_scale_factors_1 (PMPSTR mp, int *scf, struct gr_info_s *gr_infos)
static int III_get_scale_factors_2 (PMPSTR mp, int *scf, struct gr_info_s *gr_infos, int i_stereo)
static int III_dequantize_sample (PMPSTR mp, real xr[SBLIMIT][SSLIMIT], int *scf, struct gr_info_s *gr_infos, int sfreq, int part2bits)
static void III_i_stereo (real xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, struct gr_info_s *gr_infos, int sfreq, int ms_stereo, int lsf)
static void III_antialias (real xr[SBLIMIT][SSLIMIT], struct gr_info_s *gr_infos)
static void dct36 (real *inbuf, real *o1, real *o2, real *wintab, real *tsbuf)
static void dct12 (real *in, real *rawout1, real *rawout2, real *wi, real *ts)
static void III_hybrid (PMPSTR mp, real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT], int ch, struct gr_info_s *gr_infos)
int do_layer3_sideinfo (PMPSTR mp)
int do_layer3 (PMPSTR mp, unsigned char *pcm_sample, int *pcm_point, int(*synth_1to1_mono_ptr)(PMPSTR, real *, unsigned char *, int *), int(*synth_1to1_ptr)(PMPSTR, real *, int, unsigned char *, int *))

Variables

static real ispow [8207]
static real aa_ca [8]
static real aa_cs [8]
static real COS1 [12][6]
static real win [4][36]
static real win1 [4][36]
static real gainpow2 [256+118+4]
static real COS9 [9]
static real COS6_1
static real COS6_2
static real tfcos36 [9]
static real tfcos12 [3]
static int longLimit [9][23]
static int shortLimit [9][14]
bandInfoStruct bandInfo [9]
static int mapbuf0 [9][152]
static int mapbuf1 [9][156]
static int mapbuf2 [9][44]
static int * map [9][3]
static int * mapend [9][3]
static unsigned int n_slen2 [512]
static unsigned int i_slen2 [256]
static real tan1_1 [16]
static real tan2_1 [16]
static real tan1_2 [16]
static real tan2_2 [16]
static real pow1_1 [2][16]
static real pow2_1 [2][16]
static real pow1_2 [2][16]
static real pow2_2 [2][16]
static const int pretab1 [22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0}
static const int pretab2 [22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
III_sideinfo sideinfo


Define Documentation

#define DCT12_PART1

Value:

in5 = in[5*3];  \
     in5 += (in4 = in[4*3]); \
     in4 += (in3 = in[3*3]); \
     in3 += (in2 = in[2*3]); \
     in2 += (in1 = in[1*3]); \
     in1 += (in0 = in[0*3]); \
                             \
     in5 += in3; in3 += in1; \
                             \
     in2 *= COS6_1; \
     in3 *= COS6_1; \

Referenced by dct12().

#define DCT12_PART2

Value:

in0 += in4 * COS6_2; \
                          \
     in4 = in0 + in2;     \
     in0 -= in2;          \
                          \
     in1 += in5 * COS6_2; \
                          \
     in5 = (in1 + in3) * tfcos12[0]; \
     in1 = (in1 - in3) * tfcos12[2]; \
                         \
     in3 = in4 + in5;    \
     in4 -= in5;         \
                         \
     in2 = in0 + in1;    \
     in0 -= in1;

Referenced by dct12().

#define MACRO0 (  ) 

Value:

{ \
    real tmp; \
    out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \
    out2[8-(v)] = tmp * w[26-(v)];  } \
    sum0 -= sum1; \
    ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \
    ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)];

Referenced by dct36().

#define MACRO1 (  ) 

Value:

{ \
        real sum0,sum1; \
    sum0 = tmp1a + tmp2a; \
        sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \
        MACRO0(v); }

Referenced by dct36().

#define MACRO2 (  ) 

Value:

{ \
    real sum0,sum1; \
    sum0 = tmp2a - tmp1a; \
    sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \
        MACRO0(v); }

Referenced by dct36().


Function Documentation

static void dct12 ( real *  in,
real *  rawout1,
real *  rawout2,
real *  wi,
real *  ts 
) [static]

Definition at line 1347 of file layer3.c.

References DCT12_PART1, DCT12_PART2, real, SBLIMIT, and tfcos12.

Referenced by III_hybrid().

static void dct36 ( real *  inbuf,
real *  o1,
real *  o2,
real *  wintab,
real *  tsbuf 
) [static]

Definition at line 1240 of file layer3.c.

References COS9, MACRO0, MACRO1, MACRO2, real, and tfcos36.

Referenced by III_hybrid().

int do_layer3 ( PMPSTR  mp,
unsigned char *  pcm_sample,
int *  pcm_point,
int(*)(PMPSTR, real *, unsigned char *, int *)  synth_1to1_mono_ptr,
int(*)(PMPSTR, real *, int, unsigned char *, int *)  synth_1to1_ptr 
)

Definition at line 1583 of file layer3.c.

References plotting_data::big_values, plotting_data::bitrate, frame::bitrate_index, III_sideinfo::ch, plotting_data::crc, plotting_data::emph, frame::emphasis, frame::error_protection, mpstr_tag::fr, freqs, III_sideinfo::gr, plotting_data::i_stereo, III_antialias(), III_dequantize_sample(), III_get_scale_factors_1(), III_get_scale_factors_2(), III_hybrid(), III_i_stereo(), plotting_data::js, frame::lay, frame::lsf, III_sideinfo::main_data_begin, plotting_data::mainbits, plotting_data::maindata, gr_info_s::maxb, plotting_data::mixed, frame::mode, frame::mode_ext, MP3_ERR, mpg123_pinfo, plotting_data::mpg123blocktype, plotting_data::mpg123xr, MPG_MD_JOINT_STEREO, plotting_data::ms_stereo, plotting_data::padding, frame::padding, plotting_data::preflag, real, plotting_data::sampfreq, frame::sampling_frequency, SBLIMIT, plotting_data::scalefac_scale, plotting_data::scfsi, set_pointer(), plotting_data::sfb, plotting_data::sfb_s, plotting_data::sfbits, sideinfo, frame::single, SSLIMIT, frame::stereo, plotting_data::stereo, plotting_data::sub_gain, and tabsel_123.

Referenced by decode_header(), and decodeMP3_clipchoice().

Here is the call graph for this function:

int do_layer3_sideinfo ( PMPSTR  mp  ) 

Definition at line 1541 of file layer3.c.

References III_sideinfo::ch, mpstr_tag::fr, III_sideinfo::gr, III_get_side_info_1(), III_get_side_info_2(), frame::lsf, III_sideinfo::main_data_begin, frame::mode, frame::mode_ext, MPG_MD_JOINT_STEREO, frame::sampling_frequency, sideinfo, frame::single, and frame::stereo.

Referenced by decodeMP3_clipchoice().

Here is the call graph for this function:

static unsigned int get1bit ( PMPSTR  mp  )  [static]

Definition at line 110 of file layer3.c.

References mpstr_tag::bitindex, and mpstr_tag::wordpointer.

Referenced by III_get_side_info_1(), and III_get_side_info_2().

static void III_antialias ( real  xr[SBLIMIT][SSLIMIT],
struct gr_info_s gr_infos 
) [static]

Definition at line 1193 of file layer3.c.

References aa_ca, aa_cs, gr_info_s::block_type, ca, cs, gr_info_s::maxb, gr_info_s::mixed_block_flag, and real.

Referenced by do_layer3().

static int III_dequantize_sample ( PMPSTR  mp,
real  xr[SBLIMIT][SSLIMIT],
int *  scf,
struct gr_info_s gr_infos,
int  sfreq,
int  part2bits 
) [static]

Definition at line 666 of file layer3.c.

References gr_info_s::big_values, gr_info_s::block_type, map, mapend, gr_info_s::mixed_block_flag, gr_info_s::part2_3_length, real, gr_info_s::region1start, gr_info_s::region2start, SBLIMIT, and gr_info_s::scalefac_scale.

Referenced by do_layer3().

static int III_get_scale_factors_1 ( PMPSTR  mp,
int *  scf,
struct gr_info_s gr_infos 
) [static]

Definition at line 521 of file layer3.c.

References gr_info_s::block_type, getbits_fast(), gr_info_s::mixed_block_flag, gr_info_s::scalefac_compress, and gr_info_s::scfsi.

Referenced by do_layer3().

Here is the call graph for this function:

static int III_get_scale_factors_2 ( PMPSTR  mp,
int *  scf,
struct gr_info_s gr_infos,
int  i_stereo 
) [static]

Definition at line 607 of file layer3.c.

References gr_info_s::block_type, getbits_fast(), i_slen2, gr_info_s::mixed_block_flag, n_slen2, gr_info_s::preflag, and gr_info_s::scalefac_compress.

Referenced by do_layer3().

Here is the call graph for this function:

static void III_get_side_info_1 ( PMPSTR  mp,
struct III_sideinfo si,
int  stereo,
int  ms_stereo,
long  sfreq,
int  single 
) [static]

Definition at line 324 of file layer3.c.

References bandInfo, III_sideinfo::ch, gainpow2, get1bit(), getbits(), getbits_fast(), III_sideinfo::gr, bandInfoStruct::longIdx, III_sideinfo::main_data_begin, mpg123_pinfo, III_sideinfo::private_bits, plotting_data::qss, gr_info_s::scfsi, and plotting_data::sub_gain.

Referenced by do_layer3_sideinfo().

Here is the call graph for this function:

static void III_get_side_info_2 ( PMPSTR  mp,
struct III_sideinfo si,
int  stereo,
int  ms_stereo,
long  sfreq,
int  single 
) [static]

Definition at line 420 of file layer3.c.

References III_sideinfo::ch, gainpow2, get1bit(), getbits(), getbits_fast(), III_sideinfo::gr, III_sideinfo::main_data_begin, mpg123_pinfo, III_sideinfo::private_bits, plotting_data::qss, and plotting_data::sub_gain.

Referenced by do_layer3_sideinfo().

Here is the call graph for this function:

static void III_hybrid ( PMPSTR  mp,
real  fsIn[SBLIMIT][SSLIMIT],
real  tsOut[SSLIMIT][SBLIMIT],
int  ch,
struct gr_info_s gr_infos 
) [static]

Definition at line 1487 of file layer3.c.

References gr_info_s::block_type, dct12(), dct36(), mpstr_tag::hybrid_blc, mpstr_tag::hybrid_block, gr_info_s::maxb, gr_info_s::mixed_block_flag, real, win, and win1.

Referenced by do_layer3().

Here is the call graph for this function:

static void III_i_stereo ( real  xr_buf[2][SBLIMIT][SSLIMIT],
int *  scalefac,
struct gr_info_s gr_infos,
int  sfreq,
int  ms_stereo,
int  lsf 
) [static]

Definition at line 1049 of file layer3.c.

References bandInfo, gr_info_s::block_type, gr_info_s::maxband, gr_info_s::mixed_block_flag, pow1_1, pow1_2, pow2_1, pow2_2, real, SBLIMIT, gr_info_s::scalefac_compress, bandInfoStruct::shortDiff, bandInfoStruct::shortIdx, tan1_1, tan1_2, tan2_1, and tan2_2.

Referenced by do_layer3().

void init_layer3 ( int  down_sample_sblimit  ) 

Definition at line 128 of file layer3.c.

References aa_ca, aa_cs, bandInfo, COS1, COS6_1, COS6_2, COS9, gainpow2, i, i_slen2, ispow, bandInfoStruct::longIdx, longLimit, map, mapbuf0, mapbuf1, mapbuf2, mapend, n_slen2, pow1_1, pow1_2, pow2_1, pow2_2, bandInfoStruct::shortIdx, shortLimit, tan1_1, tan1_2, tan2_1, tan2_2, tfcos12, tfcos36, win, and win1.

Referenced by InitMP3().


Variable Documentation

real aa_ca[8] [static]

Definition at line 30 of file layer3.c.

Referenced by III_antialias(), and init_layer3().

real aa_cs[8] [static]

Definition at line 30 of file layer3.c.

Referenced by III_antialias(), and init_layer3().

struct bandInfoStruct bandInfo[9]

Definition at line 50 of file layer3.c.

Referenced by III_get_side_info_1(), III_i_stereo(), and init_layer3().

real COS1[12][6] [static]

Definition at line 31 of file layer3.c.

Referenced by init_layer3().

real COS6_1 [static]

Definition at line 36 of file layer3.c.

Referenced by init_layer3().

real COS6_2 [static]

Definition at line 36 of file layer3.c.

Referenced by init_layer3().

real COS9[9] [static]

Definition at line 35 of file layer3.c.

Referenced by dct36(), and init_layer3().

real gainpow2[256+118+4] [static]

Definition at line 34 of file layer3.c.

Referenced by III_get_side_info_1(), III_get_side_info_2(), and init_layer3().

unsigned int i_slen2[256] [static]

Definition at line 105 of file layer3.c.

Referenced by III_get_scale_factors_2(), and init_layer3().

real ispow[8207] [static]

Definition at line 29 of file layer3.c.

Referenced by init_layer3().

int longLimit[9][23] [static]

Definition at line 47 of file layer3.c.

Referenced by init_layer3().

int* map[9][3] [static]

Definition at line 101 of file layer3.c.

Referenced by III_dequantize_sample(), and init_layer3().

int mapbuf0[9][152] [static]

Definition at line 98 of file layer3.c.

Referenced by init_layer3().

int mapbuf1[9][156] [static]

Definition at line 99 of file layer3.c.

Referenced by init_layer3().

int mapbuf2[9][44] [static]

Definition at line 100 of file layer3.c.

Referenced by init_layer3().

int* mapend[9][3] [static]

Definition at line 102 of file layer3.c.

Referenced by III_dequantize_sample(), and init_layer3().

unsigned int n_slen2[512] [static]

Definition at line 104 of file layer3.c.

Referenced by III_get_scale_factors_2(), and init_layer3().

real pow1_1[2][16] [static]

Definition at line 108 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real pow1_2[2][16] [static]

Definition at line 108 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real pow2_1[2][16] [static]

Definition at line 108 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real pow2_2[2][16] [static]

Definition at line 108 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

const int pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0} [static]

Definition at line 660 of file layer3.c.

const int pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} [static]

Definition at line 661 of file layer3.c.

int shortLimit[9][14] [static]

Definition at line 48 of file layer3.c.

Referenced by init_layer3().

struct III_sideinfo sideinfo

Definition at line 1539 of file layer3.c.

Referenced by do_layer3(), and do_layer3_sideinfo().

real tan1_1[16] [static]

Definition at line 107 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real tan1_2[16] [static]

Definition at line 107 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real tan2_1[16] [static]

Definition at line 107 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real tan2_2[16] [static]

Definition at line 107 of file layer3.c.

Referenced by III_i_stereo(), and init_layer3().

real tfcos12[3] [static]

Definition at line 38 of file layer3.c.

Referenced by dct12(), and init_layer3().

real tfcos36[9] [static]

Definition at line 37 of file layer3.c.

Referenced by dct36(), and init_layer3().

real win[4][36] [static]

Definition at line 32 of file layer3.c.

Referenced by III_hybrid(), init_layer3(), mdct_short(), and mdct_sub48().

real win1[4][36] [static]

Definition at line 33 of file layer3.c.

Referenced by III_hybrid(), and init_layer3().


Generated on Sun Dec 2 11:37:42 2007 for LAME by  doxygen 1.5.2