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

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

?? a-u-law.txt

?? 查表法實(shí)現(xiàn)a-law算法
?? TXT
字號(hào):
Mu-Law and A-Law Compression Tutorial  
 


Overview: What are A-Law and Mu-Law compression? In the simplest terms, they are standard forms of audio compression for 16 bit sounds. Like most audio compression techniques, they are lossy, which means that when you expand them back from their compressed state, they will not be exactly the same as when you compressed them. The compression is always 2:1, meaning that audio compressed with either of these algorithms will always be exactly half of their original size. 
Mu-Law and A-Law compression are both logarithmic forms of data compression, and are extremely similar, as you will see in a minute. One definition of Mu-Law is 

          "...a form of logarithmic data compression 
          for audio data. Due to the fact that we hear logarithmically, 
          sound recorded at higher levels does not require the same 
          resolution as low-level sound. This allows us to disregard 
          the least significant bits in high-level data. This turns 
          out to resemble a logarithmic transformation. The resulting 
          compression forces a 16-bit number to be represented as an 8-bit 
          number." (www-s.ti.com/sc/psheets/spra267/spra267.pdf) 

And from the comp.dsp newsgroup FAQ we also get this definition: 

          Mu-law (also "u-law") encoding is a form of logarithmic 
          quantization or companding. It's based on the observation that 
          many signals are statistically more likely to be near a low 
          signal level than a high signal level. Therefore, it makes 
          more sense to have more quantization points near a low level 
          than a high level. In a typical mu-law system, linear samples 
          of 14 to 16 bits are companded to 8 bits. Most telephone 
          quality codecs (including the Sparcstation's audio codec) use 
          mu-law encoded samples. 

In simpler terms, this means that sound is represented as a wave, and humans can only hear audio in the middle of the wave. We can remove data from the upper and lower frequencies of a sound, and humans will not be able to hear a significant difference. Both Mu-Law and A-Law take advantage of this, and are able to compress 16-bit audio in an manner acceptable to human ears. A-Law and Mu-Law compression appear to have been developed at around the same time, and basically only differ by the particular logarithmic function used to determine the translation. When we get to the work of implementing the algorithms, you will see that the differences are nominal. The main difference is that Mu-Law attempts to keep the top five bits of precision, and uses a logarithmic function to determine the bottom three bits, while A-Law compression keeps the top four bits and uses the logarithmic function to figure out the bottom four. Both of these algorithms are used as telecommunication standards, A-Law being used mainly in Europe, and Mu-Law being used in the United States. 

DISCLAIMER: 
Please understand that I am glossing over several of the details, but recognize that the entire purpose of this document is to make two extremely useful algorithms much more accessable to "average" programmers, like myself. 


Mu-Law Compression: 
As you read this explanation, remember that the purpose of the algorithm is to compress a 16-bit source sample down to an 8-bit sample. The crux of Mu-Law functionality is deciding which of the samples need to keep the most of their precision. Even the "most-important" sample will still lose precision. It simply becomes a matter of determining how much each sample loses, and minimizing the loss on samples deemed "more important". 
To generate a compressed Mu-Law sample from an uncompressed sample, the following algorithm is applied to the 16-bit source sample. 
(Please refer to the code listing for Mu-Law compression.) 

First, the algorithm first stores off the sign. It then adds in a bias value which (due to wrapping) will cause high valued samples to lose precision. The top five most significant bits are pulled out of the sample (which has been previously biased). Then, the bottom three bits of the compressed byte are generated using a small look-up table, based on the biased value of the source sample. The 8-bit compressed sample is then finally created by logically OR'ing together the 5 most important bits, the 3 lower bits, and the sign when applicable. The bits are the logically NOT'ed, which I assume is for transmission reasons (although you might not transmit your sample.) 


MuLaw Compresion Code: 

const int cBias = 0x84; 
const int cClip = 32635; 

static char MuLawCompressTable[256] = 
{ 
     0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, 
     4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 
     5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 
     5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 
     6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 
}; 

unsigned char LinearToMuLawSample(short sample) 
{ 
     int sign = (sample >> 8) & 0x80; 
     if (sign) 
          sample = (short)-sample; 
     if (sample > cClip) 
          sample = cClip; 
     sample = (short)(sample + cBias); 
     int exponent = (int)MuLawCompressTable[(sample>>7) & 0xFF]; 
     int mantissa = (sample >> (exponent+3)) & 0x0F; 
     int compressedByte = ~ (sign | (exponent << 4) | mantissa); 

     return (unsigned char)compressedByte; 
} 




A-Law Compression: 

As mentioned earlier, A-Law compression is extremely similar to Mu-Law compression. As you will see, they differ primarily in the way that they keep precision. The following is a short synopsis of the encoding algorithm, and the code example follows the written explanation. First, the sign is stored off. Then the code branches. If the absolute value of the source sample is less than 256, the 16-bit sample is simply shifted down 4 bits and converted to an 8-bit value, thus losing the top 4 bits in the process. However, if it is more than 256, a logarithmic algorithm is applied to the sample to determine the precision to keep. In that case, the sample is shifted down to access the seven most significant bits of the sample. Those seven bits are then used to determine the precision of the bottom 4 bits. Finally, the top seven bits are shifted back up four bits to make room for the bottom 4 bits. The two are then logically OR'd together to create the eight bit compressed sample. The sign is then applied, and the entire compressed sample is logically XOR'd, again, I assume for transmission reasons. 


A-Law Compression Code: 

static char ALawCompressTable[128] = 
{ 
     1,1,2,2,3,3,3,3, 
     4,4,4,4,4,4,4,4, 
     5,5,5,5,5,5,5,5, 
     5,5,5,5,5,5,5,5, 
     6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6, 
     6,6,6,6,6,6,6,6, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7, 
     7,7,7,7,7,7,7,7 
}; 

unsigned char LinearToALawSample(short sample) 
{ 
     int sign; 
     int exponent; 
     int mantissa; 
     unsigned char compressedByte; 

     sign = ((~sample) >> 8) & 0x80; 
     if (!sign) 
          sample = (short)-sample; 
     if (sample > cClip) 
          sample = cClip; 
     if (sample >= 256) 
     { 
          exponent = (int)ALawCompressTable[(sample >> 8) & 0x7F]; 
          mantissa = (sample >> (exponent + 3) ) & 0x0F; 
          compressedByte = ((exponent << 4) | mantissa); 
     } 
     else 
     { 
          compressedByte = (unsigned char)(sample >> 4); 
     } 
     compressedByte ^= (sign ^ 0x55); 
     return compressedByte; 
} 



Decompression: 
Now, the most obvious way to decompress a compressed Mu-Law or A-Law sample would be to reverse the algorithm. But a more efficient method exists. Consider for a moment the fact that A-Law and Mu-Law both take a 16-bit value and crunch it down to an 8-bit value. The reverse of that is to take an 8-bit value and turn it into a sixteen bit value. In the graphics world, it is extremely common to represent 32 and 24 bit values with an eight bit index into a palette table. So, why not take a page from the world of graphics and use palettes for the Mu-Law and A-Law compression look up? Sounds good to me. In fact, these palettes will be smaller than their 24 and 32 bit cousins because we only need to represent 16 bit values, not 24 and 32. In a nutshell, we will create static lookup tables to do the reverse conversion from A-Law and Mu-Law. The two differing tables are presented below. To convert from your compressed sample back to the raw 16-bit sample, just use your compressed sample as the index into the table, and the corresponding value in the table is your decompressed 16-bit sample. Obviously, the downside is that this method requires the memory overhead for the tables, but each table is only 512 bytes. In this day and age, that's downright cheap for the absolute fastest decompression! 


Decompression Code: 

static short MuLawDecompressTable[256] = 
{ 
     -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, 
     -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, 
     -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412, 
     -11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316, 
      -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, 
      -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, 
      -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, 
      -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, 
      -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, 
      -1372, -1308, -1244, -1180, -1116, -1052,  -988,  -924, 
       -876,  -844,  -812,  -780,  -748,  -716,  -684,  -652, 
       -620,  -588,  -556,  -524,  -492,  -460,  -428,  -396, 
       -372,  -356,  -340,  -324,  -308,  -292,  -276,  -260, 
       -244,  -228,  -212,  -196,  -180,  -164,  -148,  -132, 
       -120,  -112,  -104,   -96,   -88,   -80,   -72,   -64, 
        -56,   -48,   -40,   -32,   -24,   -16,    -8,     0, 
      32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, 
      23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, 
      15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, 
      11900, 11388, 10876, 10364,  9852,  9340,  8828,  8316, 
       7932,  7676,  7420,  7164,  6908,  6652,  6396,  6140, 
       5884,  5628,  5372,  5116,  4860,  4604,  4348,  4092, 
       3900,  3772,  3644,  3516,  3388,  3260,  3132,  3004, 
       2876,  2748,  2620,  2492,  2364,  2236,  2108,  1980, 
       1884,  1820,  1756,  1692,  1628,  1564,  1500,  1436, 
       1372,  1308,  1244,  1180,  1116,  1052,   988,   924, 
        876,   844,   812,   780,   748,   716,   684,   652, 
        620,   588,   556,   524,   492,   460,   428,   396, 
        372,   356,   340,   324,   308,   292,   276,   260, 
        244,   228,   212,   196,   180,   164,   148,   132, 
        120,   112,   104,    96,    88,    80,    72,    64, 
         56,    48,    40,    32,    24,    16,     8,     0 
}; 




static short ALawDecompressTable[256] = 
{ 
     -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, 
     -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, 
     -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, 
     -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, 
     -22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944, 
     -30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136, 
     -11008,-10496,-12032,-11520,-8960, -8448, -9984, -9472, 
     -15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568, 
     -344,  -328,  -376,  -360,  -280,  -264,  -312,  -296, 
     -472,  -456,  -504,  -488,  -408,  -392,  -440,  -424, 
     -88,   -72,   -120,  -104,  -24,   -8,    -56,   -40, 
     -216,  -200,  -248,  -232,  -152,  -136,  -184,  -168, 
     -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, 
     -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, 
     -688,  -656,  -752,  -720,  -560,  -528,  -624,  -592, 
     -944,  -912,  -1008, -976,  -816,  -784,  -880,  -848, 
      5504,  5248,  6016,  5760,  4480,  4224,  4992,  4736, 
      7552,  7296,  8064,  7808,  6528,  6272,  7040,  6784, 
      2752,  2624,  3008,  2880,  2240,  2112,  2496,  2368, 
      3776,  3648,  4032,  3904,  3264,  3136,  3520,  3392, 
      22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, 
      30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, 
      11008, 10496, 12032, 11520, 8960,  8448,  9984,  9472, 
      15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, 
      344,   328,   376,   360,   280,   264,   312,   296, 
      472,   456,   504,   488,   408,   392,   440,   424, 
      88,    72,   120,   104,    24,     8,    56,    40, 
      216,   200,   248,   232,   152,   136,   184,   168, 
      1376,  1312,  1504,  1440,  1120,  1056,  1248,  1184, 
      1888,  1824,  2016,  1952,  1632,  1568,  1760,  1696, 
      688,   656,   752,   720,   560,   528,   624,   592, 
      944,   912,  1008,   976,   816,   784,   880,   848 
}; 
 
 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产91九色蝌蚪| 久久综合久久综合久久综合| 久久超碰97中文字幕| 亚洲天堂中文字幕| 欧美一区二区三区四区五区| 白白色 亚洲乱淫| 久久精品99国产国产精| 一区二区欧美在线观看| 国产亚洲欧美一级| 欧美一区二区三区在线看| 色噜噜狠狠一区二区三区果冻| 免费久久99精品国产| 亚洲欧美日韩成人高清在线一区| 久久在线观看免费| 在线播放一区二区三区| 91毛片在线观看| 国产成人鲁色资源国产91色综 | 日产国产欧美视频一区精品| 国产精品久久毛片av大全日韩| 精品毛片乱码1区2区3区| 制服丝袜亚洲色图| 欧美日韩综合在线免费观看| 91小视频免费观看| www.av精品| 成人高清在线视频| 丁香天五香天堂综合| 国产一区二区三区久久悠悠色av| 奇米一区二区三区av| 亚洲123区在线观看| 一区二区三区四区在线播放 | 国产乱码精品一品二品| 日韩精品乱码免费| 五月天婷婷综合| 亚洲国产一区视频| 亚洲一区二区3| 夜夜嗨av一区二区三区四季av| 国产精品美女久久久久久久久| 国产亚洲精久久久久久| 久久综合色天天久久综合图片| 欧美xxxxx牲另类人与| 日韩美女在线视频| 精品奇米国产一区二区三区| 欧美mv日韩mv国产网站| 精品日韩欧美在线| 久久麻豆一区二区| 国产欧美视频一区二区| 国产精品丝袜91| 中文字幕一区av| 亚洲视频小说图片| 亚洲国产日韩av| 亚洲成人免费看| 青青草国产精品97视觉盛宴| 久久99热国产| 国产激情一区二区三区桃花岛亚洲| 国产福利一区二区三区视频| 成人美女视频在线看| 99精品欧美一区二区三区综合在线| 99久久精品免费| 久久综合久久久久88| 99久久精品免费看| 色88888久久久久久影院野外 | 在线观看av不卡| 欧美日韩国产高清一区二区三区 | 国产精品无码永久免费888| 自拍偷自拍亚洲精品播放| 一区二区三区四区精品在线视频| 亚洲黄色免费电影| 婷婷中文字幕一区三区| 国产真实乱对白精彩久久| av亚洲精华国产精华精华| 欧美视频你懂的| 精品国产成人系列| 中文字幕欧美一区| 日本午夜一区二区| 成人激情小说网站| 欧美日本不卡视频| 国产日韩亚洲欧美综合| 亚洲一区视频在线| 色视频欧美一区二区三区| 欧美丝袜自拍制服另类| 久久午夜电影网| 一区二区三区中文字幕在线观看| 免费成人美女在线观看.| 成人av在线一区二区| 欧美一区二区三区思思人| 亚洲国产精品99久久久久久久久| 亚洲成人午夜电影| 成人一区二区三区视频在线观看| 欧美亚洲禁片免费| 国产人妖乱国产精品人妖| 亚洲va欧美va天堂v国产综合| 国产福利精品导航| 欧美男同性恋视频网站| 国产精品久久久久久户外露出 | 日本午夜一区二区| av在线一区二区三区| 欧美一级在线免费| 一区二区三区波多野结衣在线观看| 精品一区二区三区久久| 欧美性色黄大片| 国产欧美精品一区二区三区四区| 日韩专区欧美专区| 色悠久久久久综合欧美99| 久久久久久久电影| 蜜桃av噜噜一区| 欧美日韩在线三区| 日韩一区欧美一区| 高清av一区二区| 日韩三级av在线播放| 亚洲第一搞黄网站| av激情成人网| 国产喷白浆一区二区三区| 蜜桃视频在线观看一区二区| 精品婷婷伊人一区三区三| 亚洲欧美综合网| 粉嫩av亚洲一区二区图片| 欧美α欧美αv大片| 午夜视频一区二区| 欧洲激情一区二区| 亚洲天堂精品在线观看| 成人丝袜高跟foot| 欧美国产一区在线| 国产精品综合在线视频| 精品99一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 7777精品伊人久久久大香线蕉经典版下载 | 在线亚洲精品福利网址导航| 国产精品污www在线观看| 风流少妇一区二区| 久久久夜色精品亚洲| 国产一区高清在线| 2024国产精品| 国产在线视视频有精品| 欧美不卡在线视频| 极品少妇xxxx偷拍精品少妇| 欧美一级久久久| 青青青爽久久午夜综合久久午夜| 5858s免费视频成人| 欧美a级理论片| 日韩三级视频在线观看| 久久成人免费网站| 久久综合九色综合97_久久久| 久久99精品国产.久久久久| 久久夜色精品国产欧美乱极品| 久久精品国产精品亚洲综合| 欧美大片免费久久精品三p| 韩国av一区二区三区在线观看| 久久综合色之久久综合| 成人免费av在线| 亚洲欧美日韩国产另类专区| 欧美在线观看视频一区二区| 水野朝阳av一区二区三区| 日韩精品中文字幕一区二区三区| 国产一区二区三区蝌蚪| 国产精品女同互慰在线看| 色婷婷综合久久久久中文一区二区| 亚洲一区二区精品久久av| 中文字幕亚洲一区二区av在线| 91热门视频在线观看| 亚洲成人动漫一区| 日韩欧美国产系列| 成人精品视频网站| 亚洲午夜久久久久久久久久久| 91精品国产综合久久久蜜臀图片| 激情欧美一区二区三区在线观看| 国产午夜精品一区二区| 色综合网站在线| 午夜亚洲国产au精品一区二区| 精品国产在天天线2019| 9l国产精品久久久久麻豆| 亚洲图片一区二区| 亚洲精品一区二区精华| 91亚洲大成网污www| 日韩av一区二区三区| 亚洲国产精品成人综合色在线婷婷 | 久久国产欧美日韩精品| 欧美国产一区二区| 欧美无砖专区一中文字| 国产一区999| 亚洲成人激情综合网| 久久久久97国产精华液好用吗| 色综合久久久久综合体| 精品制服美女久久| 一区二区欧美精品| 精品对白一区国产伦| 在线欧美日韩精品| 国产精品小仙女| 亚洲va天堂va国产va久| 国产精品视频观看| 91精品国产aⅴ一区二区| 99久久99久久久精品齐齐| 美女mm1313爽爽久久久蜜臀| 亚洲欧美日韩在线| 国产亚洲短视频| 7777精品伊人久久久大香线蕉| 99视频精品免费视频| 精品无码三级在线观看视频| 亚洲国产另类av| **欧美大码日韩| 久久精品人人做人人综合|