foobar2000 SDK  2015-08-03
Typedefs | Functions | Variables
mp3_utils.cpp File Reference

Go to the source code of this file.

Typedefs

typedef t_uint16 uint16
 

Functions

static t_uint32 CRC_update (unsigned value, t_uint32 crc)
 
static unsigned extract_header_bits (const t_uint8 p_header[4], unsigned p_base, unsigned p_bits)
 
static t_uint16 grabFrameCRC (const t_uint8 *frameData, t_size sideInfoLen)
 

Variables

static const uint16 bitrate_table_l1v1 [16] = { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448, 0}
 
static const uint16 bitrate_table_l1v2 [16] = { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256, 0}
 
static const uint16 bitrate_table_l23v2 [16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160, 0}
 
static const uint16 bitrate_table_l2v1 [16] = { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384, 0}
 
static const uint16 bitrate_table_l3v1 [16] = { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320, 0}
 
static const uint16 sample_rate_table [] = {11025,12000,8000}
 

Typedef Documentation

typedef t_uint16 uint16

Definition at line 32 of file mp3_utils.cpp.

Function Documentation

static t_uint32 CRC_update ( unsigned  value,
t_uint32  crc 
)
static

Definition at line 199 of file mp3_utils.cpp.

200 {
201  enum { CRC16_POLYNOMIAL = 0x8005 };
202  unsigned i;
203  value <<= 8;
204  for (i = 0; i < 8; i++) {
205  value <<= 1;
206  crc <<= 1;
207  if (((crc ^ value) & 0x10000)) crc ^= CRC16_POLYNOMIAL;
208  }
209  return crc;
210 }
static unsigned extract_header_bits ( const t_uint8  p_header[4],
unsigned  p_base,
unsigned  p_bits 
)
static

Definition at line 5 of file mp3_utils.cpp.

6 {
7  assert(p_base+p_bits<=32);
8  return (unsigned) extract_bits(p_header,p_base,p_bits);
9 }
static t_size extract_bits(const t_uint8 *p_buffer, t_size p_base, t_size p_count)
static t_uint16 grabFrameCRC ( const t_uint8 frameData,
t_size  sideInfoLen 
)
static

Definition at line 221 of file mp3_utils.cpp.

221  {
222  t_uint32 crc = 0xffff;
223  crc = CRC_update(frameData[2], crc);
224  crc = CRC_update(frameData[3], crc);
225  for (t_size i = 6; i < sideInfoLen; i++) {
226  crc = CRC_update(frameData[i], crc);
227  }
228 
229  return (t_uint32) (crc & 0xFFFF);
230 }
static t_uint32 CRC_update(unsigned value, t_uint32 crc)
Definition: mp3_utils.cpp:199
size_t t_size
Definition: int_types.h:48
uint32_t t_uint32
Definition: int_types.h:5

Variable Documentation

const uint16 bitrate_table_l1v1[16] = { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448, 0}
static

Definition at line 34 of file mp3_utils.cpp.

const uint16 bitrate_table_l1v2[16] = { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256, 0}
static

Definition at line 37 of file mp3_utils.cpp.

const uint16 bitrate_table_l23v2[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160, 0}
static

Definition at line 38 of file mp3_utils.cpp.

const uint16 bitrate_table_l2v1[16] = { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384, 0}
static

Definition at line 35 of file mp3_utils.cpp.

const uint16 bitrate_table_l3v1[16] = { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320, 0}
static

Definition at line 36 of file mp3_utils.cpp.

const uint16 sample_rate_table[] = {11025,12000,8000}
static

Definition at line 39 of file mp3_utils.cpp.