?? g711dec.c
字號:
#include <stdio.h>#define BIAS 132 /* バイアスの猛 */void disp_c(unsigned char value);void disp_s(short value);short g711decode(unsigned char ulaw_sample);int main(int argv, char **argc){ int i; unsigned char mu[8]={ /* デコ〖ド漣 | デコ〖ド稿 */ 0, /* 0 000 0000 | 1000001010000100 */ 17, /* 0 001 0001 | 1100001110000100 */ 34, /* 0 010 0010 | 1110001100000100 */ 51, /* 0 011 0011 | 1111001001000100 */ 68, /* 0 100 0100 | 1111100110100100 */ 89, /* 0 101 1001 | 1111110110110100 */ 108, /* 0 110 1100 | 1111111101001100 */ 123 /* 0 111 1011 | 1111111111100000 */ }; /* テスト */ for (i = 0; i < 8; i++ ){ disp_c(mu[i]); g711decode( mu[i] ); printf("\n"); } return 0;}/* デコ〖ド簇眶 */short g711decode(unsigned char ulaw_sample){ short audio_sample; int t; ulaw_sample = ~ulaw_sample; t = ((ulaw_sample & 0x0f) << 3) + BIAS; t <<= (ulaw_sample & 0x70) >> 4; audio_sample = ((ulaw_sample & 0x80) ? (BIAS - t) : (t - BIAS)); return audio_sample;}/* shortの2渴眶山績簇眶 */void disp_s(short value){ int i; printf("\t"); for( i = 0x8000; i > 0; i >>= 1 ){ if(value & i ){ printf("1"); }else{ printf("0"); } }}/* unsigned char の2渴眶山績簇眶 */void disp_c(unsigned char value){ int i; printf("\t"); for( i = 0x80; i > 0; i >>= 1 ){ if(value & i ){ printf("1"); }else{ printf("0"); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -