📄 common.c
字号:
/***********************************************
copyright by Haia Tech
www.haia2004.com
************************************************/
#include <string.h>
//#include <stdlib.h>
#include <math.h>
#include "common.h"
//extern FILE *file_p;
extern frame_params fr_ps;
extern unsigned int frameNum;
Bit_stream_struc bs;
unsigned short *mp3_dat;
double s_freq[4] = {44.1, 48, 32, 0};
char *mode_names[4] = { "stereo", "j-stereo", "dual-ch", "single-ch" };
char *layer_names[3] = { "I", "II", "III" };
int bitrate[3][15] = {
{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448},
{0,32,48,56,64,80,96,112,128,160,192,224,256,320,384},
{0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}
};
unsigned short buffer[BUFFER_SIZE];
/* open the device to read the bit stream from it */
void open_bit_stream_r()
{
bs.buf=buffer;
bs.read_ptr=0;
bs.write_ptr=0;
bs.bit_len=16;
bs.totbit=0;
bs.eof = FALSE;
bs.eobs = FALSE;
quest_stream(&bs.write_ptr);
}
/*return the status of the bit stream*/
/* returns 1 if end of bit stream was reached */
/* returns 0 if end of bit stream was not reached */
int mask[8]={0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
int seek_sync(unsigned int sync)
{
unsigned int aligning;
unsigned int val;
aligning = bs.totbit%ALIGNING;
if (aligning)
getbit((int)(ALIGNING-aligning)); //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -