亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? mp3dec.c

?? arm7制作的MP3(軟解碼部分)
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/* MPEG AUDIO LAYER 3 DECODER */
/* Bjorn Wesen 1997           */

/*#define USE_DATA */

#undef ROCKFORD

#ifndef DSP
#define DECVERBOSE
#endif

#include "mp3dec.h"

#ifdef DSPSIMUL
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#else
#ifdef DSP
#include "c3x_start.h"
#include "c3x_control.h"
#endif
#endif

#ifdef INT_MATH

mpfloat
operator+(mpfloat a, mpfloat b) {
    return mpfloat(a._val + b._val);
}

mpfloat
operator-(mpfloat a, mpfloat b) {
    return mpfloat(a._val - b._val);
}

mpfloat
operator-(mpfloat a) {
    return mpfloat(-a._val);
}

mpfloat
operator*(mpfloat a, mpfloat b) {
    return mpfloat(a._val * b._val);
}

mpfloat operator/(mpfloat a, mpfloat b) {
    return mpfloat(a._val / b._val);
}

#endif


static float Frame_sampfreqs[4] = { 44.1, 48, 32, 0 };
static int Frame_bitrates[15] = { 0, 32, 40, 48, 56, 64, 80, 96, 
				  112, 128, 160, 192, 224, 256, 320 };

/* scalefac_compress indexes into this table to find the sizes of the 
   scalefactor bitfields */

static int Frame_slen[2][16] = { { 0, 0, 0, 0, 3, 1, 1, 1,
				   2, 2, 2, 3, 3, 3, 4, 4 },
				 { 0, 1, 2, 3, 0, 1, 2, 3,
				   1, 2, 3, 1, 2, 3, 2, 3 } };

/* for each samplerate there is a special division of the 576 frequency
   lines into bands */

struct Frame_band Frame_bands[3] = {
    
    { { 0,4,8,12,16,20,24,30,36,44,52,
	62,74,90,110,134,162,196,238,288,342,418,576 },
      { 0,4,8,12,16,22,30,40,52,66,84,106,136,192 }},

    { { 0,4,8,12,16,20,24,30,36,42,50,
	60,72,88,106,128,156,190,230,276,330,384,576 },
      { 0,4,8,12,16,22,28,38,50,64,80,100,126,192 }},

    { { 0,4,8,12,16,20,24,30,36,44,54,
	66,82,102,126,156,194,240,296,364,448,550,576 },
      { 0,4,8,12,16,22,30,42,58,78,104,138,180,192 }}
};


static Bitstream Frame_bitbuf;   /* used for keeping the main data */


#ifdef DECVERBOSE

void dump_floats(mpfloat *f, int num)
{
    int i;
    printf("\n");
    for(i = 0; i < num; i++) {
	if(i && !(i % 5))
	    printf("\n");
	printf("%10f ", f[i]);
    }
    printf("\n");
}


void dump_ints(int *f, int num)
{
    int i;
    printf("\n");
    for(i = 0; i < num; i++) {
	if(i && !(i % 5))
	    printf("\n");
	printf("%8d ", f[i]);
    }
    printf("\n");
}
#endif

int frameNum = 0;
#ifdef UNIX
int
main(int argc, char **argv)
{
    FILE *fp; 
    int i = 0;
    char nameb[256];
    PCMSample samples[576*4];
    int numframes = 1024;
    Bitstream my_bs;
    Frame my_frame;

    my_bs.buffer32 = (unsigned long *)malloc(0x2000 * 4);
    
    if(argc < 2)
	exit(0);
    
    if(argc == 3)
	numframes = atoi(argv[2]);

    Frame_init();
    HuffmanTable_init();
    Granule_init();
    sprintf(nameb, "%s.mp3", argv[1]);
    Bitstream_open(&my_bs, nameb);
    sprintf(nameb, "%s.raw", argv[1]);
    fp = fopen(nameb, "wb");
    printf("Decoding...\n");
    do {
	fprintf(stderr, "\r[%6d]", i++);
	fflush(stderr);
	frameNum++;
	Frame_load(&my_frame, &my_bs, samples);
	fwrite(samples, 2, 576*4, fp);
/*    Frame_dump(&my_frame); */
    } while(!Bitstream32_fillbuffer(&my_bs) && i < numframes);
    printf("\n");
    Bitstream_close(&my_bs);
    fclose(fp);
    
    exit(0);
}

#endif

#ifdef DSP
 
#include "testmp.h"
//static unsigned char inbuffer[20000];

main()
{
    int i, jayjay;
#ifdef DSP_LOFI
    PCMSample samples[288*40];
#else
    PCMSample samples[576*4];
#endif
    int numframes = 40;
    Bitstream my_bs;
    Frame my_frame;
    static unsigned char bit_reservoir[BITSTREAM_BUFSIZE + 4];
    static unsigned char buffel[BITSTREAM_BUFSIZE + 4];

#ifdef DSPSIMUL
    FILE *output;
#else
#ifndef ROCKFORD
    init_da();
#endif
#endif

#ifdef ROCKFORD
    for(jayjay = 0; jayjay < 10;) {
#endif
    i = 0;
    Frame_init();
    Frame_bitbuf.buffer = bit_reservoir;

    HuffmanTable_init();
    Granule_init();

    Bitstream_open(&my_bs, 0);
    my_bs.buffer = buffel;
    Bitstream_fillbuffer(&my_bs);
#ifdef DSPSIMUL
    output = fopen("outfil.raw", "wb");
#endif
    do {
	frameNum++;
	Frame_load(&my_frame, &my_bs, samples + 288*i);
#ifdef DSPSIMUL
	fprintf(stderr, ".");
	fflush(stderr);
	fwrite(samples, 1, 576*4, output);
#else
	/*play_buffer((void *)(samples + 288*i));*/
#endif
	i++;
	Bitstream_fillbuffer(&my_bs);
    } while(i < numframes);
#ifdef ROCKFORD
    }
#else
    play_buffer((void *)samples);
#endif
#ifdef DSPSIMUL
    fprintf(stderr, "\n");
    fclose(output);
    exit(0);
#endif
    while(1);

}
#endif

static int Frame_bitbuf_framestart = 0;

void
Frame_init()
{
    Bitstream_open(&Frame_bitbuf, 0);
}


void
Frame_load(Frame *f, Bitstream *bs, PCMSample *samps)
{
  int ch, scfsi_band, gr, i, previous_end, alignbits,
      trash, part2_start;

  f->samples = samps;

  /* seek the sync word */
  if(!Bitstream_seek_sync(bs)) {
#ifndef DSP
    printf("Couldn't find sync.\n");
#endif
    return;
  }

  /* check that the ID is 1, describing ISO/IEC 11172-3 audio */
  if(!Bitstream32_get1(bs)) {
#ifndef DSP
    printf("Incorrect frame ID = 0!\n");
#endif
    return;
  }

  /* check that its a layer 3 frame */
  if(Bitstream32_get(bs, 2) != LAYER3) {
#ifndef DSP
      printf("Not a layer-3 frame!\n");
#endif
      return;
  }

  /* read the header */

  f->CRC_enable = !Bitstream32_get1(bs);  /* meaning of this bit is inverted */
  f->bitrate_index = Bitstream32_get(bs, 4);
  f->sampling_frequency = Bitstream32_get(bs, 2); 
  f->padding_bit = Bitstream32_get1(bs);
  (void)Bitstream32_get1(bs);  /* skip the private bit, we dont use it */
  f->mode = Bitstream32_get(bs, 2);
  f->channels = (f->mode == MODE_SINGLE_CHANNEL) ? 1 : 2;
  f->mode_extension = Bitstream32_get(bs, 2);
  f->copyright = Bitstream32_get1(bs);
  f->originality = Bitstream32_get1(bs);
  f->emphasis = Bitstream32_get(bs, 2);

  /* if this frame has a CRC, read it */
  
  if(f->CRC_enable)
    f->CRC = Bitstream32_get(bs, 16);

  /* now read the Layer-3 audio_data part of the frame */

  /* the following data constitutes the side information stream -
       - main_data_begin pointer
       - side info for both granules (scfsi)
       - side info granule 1
       - side info granule 2
  */

  /* read the starting offset of the main data */
  
  f->main_data_begin = Bitstream32_get(bs, 9);

  /* read private parts */
  
  if(f->channels == 1)
    (void)Bitstream32_get(bs, 5);   /* 5 private bits for single_channel */
  else
    (void)Bitstream32_get(bs, 3);   /* 3 private bits for other modes */

  /* read scalefactor selection information, 4 bits per channel */
  
  for(ch = 0; ch < f->channels; ch++)
    for(scfsi_band = 0; scfsi_band < 4; scfsi_band++)
      f->scfsi[ch][scfsi_band] = Bitstream32_get1(bs);
  
  /* read the side info for the channels for each granule */
  
  for(gr = 0; gr < 2; gr++)  
    for(ch = 0; ch < f->channels; ch++)
	Granule_decode_info(&f->gr[gr][ch], bs);
    
  /* calculate the size of this header in bytes */

  f->header_size = 4 + 2 * f->CRC_enable + (f->channels == 1 ? 17 : 32);

  /* calculate the size of the main_data block of this frame */

  /* the distance between two consequitive syncwords is determined from
     the formula: N = 144 * bitrate / sampling_frequency + padding */

  /* then we find the size of the main data by taking that number and
     subtracting the size of the header and padding */

  f->main_data_size = (int)(((144 * Frame_bitrates[f->bitrate_index]) /
    Frame_sampfreqs[f->sampling_frequency])) + f->padding_bit - f->header_size;

  /* extract all main data of this frame and insert it into the bitbuffer */
  /* ## TODO check if main data is bytealigned, if so, we can copy it much
     faster */
  
  for(i = f->main_data_size; i > 0; i--)
    Bitstream_putbyte(&Frame_bitbuf, Bitstream32_get(bs, 8));

/*   
  printf("Inserted %d bytes of main data into buffer.\n", f->main_data_size);
  */

  /* get the end (in bytes) of the last used main data */
  
  previous_end = Bitstream_tell(&Frame_bitbuf) / 8;  
/*
  printf("previous_end %d\n", previous_end);
  */
 
  /* align the bit buffer to a byte boundary */
  
  if((alignbits = Bitstream_tell(&Frame_bitbuf) % 8)) {
    Bitstream_get(&Frame_bitbuf, 8 - alignbits);
    previous_end++;
  }

  /* see if there is a gap between the end of the last framedata and
     the start of the new framedata, and if so, discard it. If trash 
     is negative, it means there was an error and there isn't enough
     data to decode this frame */
 
  trash = Frame_bitbuf_framestart - previous_end - f->main_data_begin;

  if(previous_end > BITSTREAM_BUFSIZE) {
    Frame_bitbuf_framestart -= BITSTREAM_BUFSIZE;
    Bitstream_rewindbytes(&Frame_bitbuf, BITSTREAM_BUFSIZE);
  }

  if(trash < 0) {
#ifndef DSP
    printf("Too little data to decode frame.\n");
#endif
    return;
  } else if(trash > 0) {
#ifndef DSP
    printf("%d bytes of trash\n", trash);
#endif
    Bitstream_get(&Frame_bitbuf, 8 * trash);
  }

  /* duplicate the end to reduce the need for modulo calcs in huffman */
  
  Frame_bitbuf.buffer[BITSTREAM_BUFSIZE] = Frame_bitbuf.buffer[0];
  Frame_bitbuf.buffer[BITSTREAM_BUFSIZE + 1] = Frame_bitbuf.buffer[1];
  Frame_bitbuf.buffer[BITSTREAM_BUFSIZE + 2] = Frame_bitbuf.buffer[2];
  Frame_bitbuf.buffer[BITSTREAM_BUFSIZE + 3] = Frame_bitbuf.buffer[3];

  /* remember the start of the next frame */

  Frame_bitbuf_framestart += f->main_data_size;

  /* the Frame_bitbuf stream is now positioned at the start of the
     main_data for this frame, and we know there is enough data to
     decode it, so start reading the granules now. */

  /* the following data constitute the main data stream -
       - scalefactors and Huffman code data granule 1
       - scalefactors and Huffman code data granule 2
       - ancillary data
  */

  /* Bands, scalefactors etc:
       The spectrum of 576 frequency lines, is divided into bands 
       differently depending on sampling frequency and block type.
       Each band has its own scalefactor, which is read below.
       Each band also has its own huffman coded energies, read further
       below.
  */

  /* read the main data stream for both granules */

  for(gr = 0; gr < 2; gr++) {
      
      /* read the main data stream for all channels in the granule */

      Granule_floatfreqs xr[2];     /* 2*576 = 1152 */
      Granule_floatfreqs lr[2];     /* 2*576 = 1152 */

      for(ch = 0; ch < f->channels; ch++) {
	  Granule_intfreqs is;  /* for storing the de-huffmanized energies */

	  part2_start = Bitstream_tell(&Frame_bitbuf);
	  
	  /* decode the scalefactors */

	  Granule_decode_scalefactors(&f->gr[gr][ch], &Frame_bitbuf,
				      ch, gr, f);
	  
	  /* now comes the Huffman coded bits */
	  PROFSTART;

	  Granule_decode_huffman(&f->gr[gr][ch], &Frame_bitbuf, 
				 part2_start, is, f);
	  PROFSTOP;
/*
	  if(frameNum == 85)
	      dump_ints(is, 576);
	      */      
	  Granule_requantize(&f->gr[gr][ch], is, xr[ch], f);

      } /* end of channel loop */

      /* we have the decoded and requantized spectrum for both channels,
	 so we can apply stereo processing */
      /* xr -> lr */

      Granule_process_stereo(&f->gr[gr][0], &f->gr[gr][1], xr, lr, f);
      
      /* now we can, for each channel, synthesize the PCM output */

      for(ch = 0; ch < f->channels; ch++) {
	  
	  /* first we have to reorder short block data */
	  /* lr -> xr */
	  Granule_reorder(&f->gr[gr][ch], lr[ch], xr[ch], f);
/*
	  if(frameNum == 10) {
	      printf("Granule %d\n", gr);
	      dump_floats(lr2[ch], 576);
	  }
	  */
	  /* now we do the alias reduction */
	  /* xr -> xr */
	  Granule_antialias(&f->gr[gr][ch], xr[ch]);
	      
	  /* apply the IMDCT transform */
	  /* xr -> xr */
	  Granule_imdct(&f->gr[gr][ch], ch, xr[ch]);
	  /* frequency inversion to compensate for the polyphase filterbank */
	  /* xr -> xr */
	  
	  Granule_freqinverse(&f->gr[gr][ch], xr[ch]);

	  /* finally generate the PCM samples from the filterbank */
/*
	  if(frameNum == 10) {
	      int z;
	      for(z = 0; z < 576; z++) {
		  if(z && !(z % 5))
		      printf("\n");
		  printf("%6d ", f->samples[gr][z][0]);
	      }
	  }
	  */
      }

#ifdef WIN32
#define FABS(x) (x > 0.0 ? x : -x)
	  /* the windows player has a nice spectrum analyser.. */
	  {
	      int z, y;
	      for(z = 0; z < 32; z++) {
		  f->spectrum[z] = 0.0f;
		  for(y = 0; y < 18; y++)
		      f->spectrum[z] +=
			  FABS(xr[0][z*18+y]) +
			  FABS(xr[1][z*18+y]);
	      }
	  }
#endif

      /* for stereo, use an optimized subband synthesis routine that
	 processes both channels at once */
      /* xr -> samples */

#ifdef DSP_LOFI
      /* do lo-fidelity processing, mono in 11khz *shiver* */
      Granule_subband_synthesis(&f->gr[gr][0], 0, xr[0],
				&f->samples[gr*144]);
#else

      if(f->channels == 2)
	  Granule_subband_synthesis2(&f->gr[gr][ch], xr[0],
				     xr[1],
				     &f->samples[gr*576*2]);
      else
	  Granule_subband_synthesis(&f->gr[gr][0], 0, xr[0],
				    &f->samples[gr*576*2]);
#endif  

  } /* end of granule loop */

}

#ifdef MAKE_DATA

void
make_data_file(const char *fname, const char *datname, mpfloat *nbrs, int len)
{
    int i;
    FILE *f = fopen(fname, "w");
    fprintf(f, "static mpfloat %s[%d] = {\n", datname, len);
    for(i = 0; i < len; i++) {
	if(i && !(i % 4))
	    fprintf(f, "\n");
	fprintf(f, "%.12g, ", nbrs[i]);
    }
    fprintf(f, "\n};\n\n");

    fclose(f);
}

void
make_data_file_2d(const char *fname,
		  const char *datname, mpfloat *nbrs, int len1, int len2)
{
    int i, j;
    FILE *f = fopen(fname, "w");
    fprintf(f, "static mpfloat %s[%d][%d] = {\n", datname, len1, len2);
    for(j = 0; j < len1; j++) {
	fprintf(f, "{\n");
	for(i = 0; i < len2; i++) {

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久国产一区二区三区四区小说 | 亚洲一区视频在线| 亚洲午夜一区二区三区| 免费成人av在线| 国产91精品一区二区| 91色.com| 日韩欧美激情四射| 国产精品看片你懂得| 同产精品九九九| 国产成人在线看| 欧洲亚洲精品在线| 久久久久久一级片| 亚洲国产欧美一区二区三区丁香婷| 美女网站一区二区| 不卡av电影在线播放| 欧美日本一道本| 国产精品视频在线看| 日韩精品亚洲一区| 成人美女视频在线看| 67194成人在线观看| 国产精品黄色在线观看| 麻豆成人91精品二区三区| 91麻豆免费在线观看| 欧美mv日韩mv国产网站app| 亚洲欧美一区二区三区久本道91 | 精品国精品自拍自在线| 亚洲人精品午夜| 国产在线麻豆精品观看| 欧美色精品在线视频| 国产精品欧美综合在线| 麻豆freexxxx性91精品| 在线观看国产精品网站| 欧美国产精品劲爆| 另类调教123区| 精品1区2区3区| 亚洲欧洲国产专区| 激情都市一区二区| 69av一区二区三区| 亚洲一区二区三区视频在线 | 国产日韩欧美一区二区三区乱码| 亚洲gay无套男同| 99热国产精品| 国产视频不卡一区| 精品一区二区三区久久久| 欧美无砖砖区免费| 中文字幕日本不卡| 高清久久久久久| 久久这里只有精品视频网| 肉色丝袜一区二区| 欧美性猛交xxxx乱大交退制版| 国产精品无遮挡| 国产+成+人+亚洲欧洲自线| 日韩欧美美女一区二区三区| 午夜国产精品一区| 欧美性xxxxx极品少妇| 亚洲欧美视频在线观看| av高清久久久| 中文字幕一区二区三区在线播放| 国产精品88888| 久久精品一区二区三区不卡牛牛 | 久久久精品欧美丰满| 精品中文字幕一区二区小辣椒 | 国产在线精品一区二区| 欧美成人福利视频| 蜜芽一区二区三区| 欧美一区二区二区| 日本系列欧美系列| 日韩欧美国产1| 久久99精品视频| wwww国产精品欧美| 国产一区二区三区av电影 | 99久久久久免费精品国产 | 色偷偷88欧美精品久久久| 欧美国产精品久久| 成人av在线网站| 中文字幕字幕中文在线中不卡视频| 成人av在线网站| 亚洲精品自拍动漫在线| 日本道在线观看一区二区| 亚洲一区免费视频| 欧美精品一二三| 久久不见久久见免费视频7 | 国产成人一区在线| 国产欧美日韩一区二区三区在线观看| 丁香一区二区三区| 日韩美女久久久| 欧美视频一区二区| 日本一区中文字幕| 精品久久久久久久久久久久久久久 | 国产大片一区二区| 欧美高清一级片在线观看| bt欧美亚洲午夜电影天堂| 亚洲丝袜另类动漫二区| 欧美视频一区在线观看| 日韩av中文字幕一区二区三区| 精品少妇一区二区三区在线播放| 国产美女一区二区三区| 国产精品福利一区二区| 欧美亚洲动漫精品| 久久国产欧美日韩精品| 日本一区二区三区国色天香 | 一区在线观看视频| 欧美性猛片aaaaaaa做受| 免费一级片91| 亚洲国产成人一区二区三区| 97成人超碰视| 午夜精品久久久久影视| xfplay精品久久| 一本一道综合狠狠老| 午夜精彩视频在线观看不卡| 久久―日本道色综合久久| 97se亚洲国产综合自在线观| 亚洲va欧美va天堂v国产综合| 337p日本欧洲亚洲大胆精品| 96av麻豆蜜桃一区二区| 日韩激情一二三区| 欧美国产丝袜视频| 欧美日高清视频| 福利一区在线观看| 亚洲午夜久久久久久久久电影院| 欧美岛国在线观看| 色婷婷国产精品综合在线观看| 琪琪久久久久日韩精品| 国产精品视频你懂的| 欧美久久一二三四区| 国产精品1区2区| 午夜久久久久久久久| 中文字幕欧美激情一区| 欧美另类高清zo欧美| 成人综合在线视频| 日本三级亚洲精品| 亚洲免费观看在线视频| 久久综合久久综合亚洲| 欧美影院午夜播放| 成人三级伦理片| 蜜桃av一区二区| 一区二区三区不卡在线观看| 国产亚洲精品中文字幕| 欧美一区二区精美| 色婷婷av一区二区三区之一色屋| 国产精品一二一区| 偷拍一区二区三区四区| 亚洲欧美一区二区三区极速播放 | 成人免费黄色在线| 美女爽到高潮91| 亚洲国产美女搞黄色| 中文字幕一区三区| 国产亚洲成年网址在线观看| 91精品婷婷国产综合久久竹菊| 91成人免费网站| 99视频一区二区| 成人午夜精品在线| 激情亚洲综合在线| 欧美aa在线视频| 亚洲成在人线免费| 亚洲激情在线激情| 中文字幕在线不卡| 日本一二三不卡| 久久久噜噜噜久久人人看| 欧美成人性战久久| 91精品国产综合久久久蜜臀图片| 欧美探花视频资源| 欧洲亚洲国产日韩| 色天天综合久久久久综合片| 成人av网址在线| 国产·精品毛片| 国产福利一区在线| 国产成人免费在线视频| 国产精品乡下勾搭老头1| 激情文学综合丁香| 国内不卡的二区三区中文字幕| 免费亚洲电影在线| 免费欧美高清视频| 奇米一区二区三区| 蜜臀久久99精品久久久久久9| 日本三级韩国三级欧美三级| 日本视频一区二区| 免费在线观看精品| 久久er精品视频| 毛片av中文字幕一区二区| 免费日本视频一区| 久久99精品国产.久久久久久| 久久99精品国产.久久久久久 | 中文无字幕一区二区三区| 久久综合九色综合欧美98| 26uuu久久综合| 欧美国产97人人爽人人喊| 国产精品毛片高清在线完整版| 国产精品久久久久久久午夜片| 一色屋精品亚洲香蕉网站| 亚洲免费资源在线播放| 亚洲综合久久久| 日韩成人av影视| 国产一区视频网站| 成人av网站在线观看免费| 色菇凉天天综合网| 欧美日韩国产系列| 日韩精品一区二区三区四区| 国产亚洲精品7777| 日韩美女精品在线|