html5-img
1 / 17

G.711 簡介

G.711 簡介. Speaker : Chungyi Wang Adviser : Quincy Wu Date : 20070305. outline. PCM G.711 的取樣基本原理 A-law Mu-law A-law V.S Mu-law Reference. PCM. PCM (Pulse code modulation) 波形編碼,把類比的音訊信號轉換為數位信號 G.711 有兩個編碼方式,分別是 A-law Mu-law

adsila
Download Presentation

G.711 簡介

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. G.711 簡介 Speaker : Chungyi Wang Adviser : Quincy Wu Date : 20070305

  2. outline • PCM • G.711 的取樣基本原理 • A-law • Mu-law • A-law V.S Mu-law • Reference

  3. PCM • PCM (Pulse code modulation) • 波形編碼,把類比的音訊信號轉換為數位信號 • G.711有兩個編碼方式,分別是 • A-law • Mu-law • G.711的編碼方式會將14bits(所以會用16bits儲存)的樣本訊息轉換成8bits的樣本以期傳送資料壓縮 from:http://en.wikipedia.org/wiki/Pulse_code_modulation

  4. G.711 的取樣基本原理 • 低位數的差異 • 取較具影響的位數 • 前N位較具影響,好比說N = 5 (強度1位,樣本4位) • 由16bits轉成8bits • 傳送時將重要的位數encode成8bits (保留重要位數) • 接收端將此decode成PCM的16bits (有些許失真)

  5. A-law(1/4) • 規則 • 取影響最大的5位 • s 代表的是sign,於樣本為正數時填1 • 逢偶數位取補數 • s x’ x x’w x’ y z’

  6. A-law(2/4) • 範例 -- 3210 (0000110010001010)2 => 10011100 • 取s,s = 1 • 取強度位置 • 0 0001 10010001010 • Xs = 100 • 取高位樣本 • 0 0001 10010001010 • wxyz = 1001 • 結合以上數字 • sxxxwxyz • 11001001 • 逢偶位數取補數 • 1 1001001 • 1 0011100

  7. A-law(3/4) • 範例 -- 321(0000000101000001)2 => 11000001 • 取s,s = 1 • 取強度位置 • 0 0000001 01000001 • Xs = 001 • 取高位樣本 • 0 0000001 01000001 • wxyz = 0100 • 結合以上數字 • sxxxwxyz • 10010100 • 逢偶位數取補數 • 1 0010100 • 1 1000001

  8. A-law(4/4) • 範例程式 • 使用mediastreamer2的g711common.h • unsigned char s16_to_alaw(int pcm_val) • 將16bit的原始樣本 encode 成為8bit的a-law碼 • int alaw_to_s16(unsigned char a_val) • 將8bit的a-law碼 decode 成為16bit的原始樣本 • unsigned char s16_to_ulaw(int pcm_val) • int ulaw_to_s16(unsigned char a_val)

  9. Mu-law(1/6) • 規則 • 1.取得範圍值,得到8-bit基本值b(ex 0x80) • 2.取得間隔數值size(ex 256)

  10. Mu-law(2/6) • 規則 • 3.取得區間基本值rb(ex 2015) • 4.算出與區間基本值rb的距離d • d = rb - sample • 5.依據間距大小size,算出平移量 • s = d / size • 6.與8-bit基本值相加 • output = b + s

  11. Mu-law(3/6) • 範例 – 2345 => 0x9D • 1.取得範圍值 • range => 4063~2015 • 1-1.得到8-bit基本值 • b = 0x90 • 2.取得間隔數值 • size = 128 • 3.取得區間基本值 • rb = 4063 • 4.算出與區間基本值rb的距離d • d = rb – sample = 4063 – 2345 = 1718

  12. Mu-law(4/6) • 5.依據間距大小size,算出平移量 • s = d / size = 1718 / 128 = 13.42… => 13 • 6.與8-bit基本值相加 • output = b + s = 0x90 + 13 = 9D

  13. Mu-law(5/6) • Decode • 建立對應的陣列 • 大小為255 • 先前的2345 => 0x9D, • 執行結果得到>>ulaw 9d becomes 2271

  14. Mu-law(6/6) • 範例程式 • 秀出Mu-law全部的Decode結果

  15. A-law V.S Mu-law (1/2)

  16. A-law V.S Mu-law (2/2) • 如果將A-law的間距加大一倍到8192,那麼與Mu-law的量化執行結果會相近 (link 3) • 在A-law於較小的數值有較大的動態範圍值(dynamic range) ,也就是靜音時會比較採樣雜訊,而不是僅取靜音 (link 3) • 於33-127的數值兩者的執行效果相近,但是Mu-law如果在數值32之前的區間加入粒狀理論(granularity),Mu-law會較少使用all-zero來取代雜音的訊息量化 (link 4)

  17. Reference • http://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-G.711-198811-I!!PDF-E&type=items • ITU-T G.711 pdf • http://en.wikipedia.org/wiki/G.711 • Wikipedia : G.711 & A-law • http://en.wikipedia.org/wiki/Mu-law • Wikipedia : Mu-law • http://72.14.235.104/search?q=cache:CIgTx4nuxeQJ:telecom.tbi.net/pcm1.html+mu-law+Comparison+with+A-law&hl=zh-TW&ct=clnk&cd=5&gl=tw • A-law & Mu-law 較詳盡的介紹

More Related