quantsine.c

来自「CHP 3 - Real-Time Digital Signal Process」· C语言 代码 · 共 42 行

C
42
字号
// 
//  Project: Experiment 3.6.1 Quantization Sinewave - Chapter 3 
//  File name: quantSine.c   
//
//  Description: This is the experiment test program for quatization sinewave
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//


#define	BUF_SIZE	40
const short	sineTable[BUF_SIZE]= {
 0x0000,0x01E0,0x03C0,0x05A0,0x0740,0x08C0,0x0A00,0x0B20,
 0x0BE0,0x0C40,0x0C60,0x0C40,0x0BE0,0x0B20,0x0A00,0x08C0,
 0x0740,0x05A0,0x03C0,0x01E0,0x0000,0xFE20,0xFC40,0xFA60,
 0xF8C0,0xF740,0xF600,0xF4E0,0xF420,0xF3C0,0xF3A0,0xF3C0,
 0xF420,0xF4E0,0xF600,0xF740,0xF8C0,0xFA60,0xFC40,0x0000};

short out16[BUF_SIZE];     // 16 bits output sample buffer  
short out12[BUF_SIZE];     // 12 bits output sample buffer  
short out8[BUF_SIZE];      // 8 bits output sample buffer   
short out6[BUF_SIZE];      // 6 bits output sample buffer   

void main()
{
  short i;

  for (i = 0; i < BUF_SIZE; i++)
  {
    out16[i] = sineTable[i];          // 16-bit data     
    out12[i] = sineTable[i]&0xfff0;   // Mask off 4-bit  
    out8[i] = sineTable[i]&0xff00;    // Mask off 8-bit  
    out6[i] = sineTable[i]&0xfc00;    // Mask off 10-bit 
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?