EE4209/EE5809 Digital Audio : Huffman coding
1. table (symbol, probability/count, code, subtotal_bits)
2. steps:
construct the tree from the bottom
Each time combine the two symbols with the smallest probability or count.
put the small_manifold on the left_hand_size
left =0; right =1
average num of bits per symbols = total num of bits/ num of symbols to be encoded
汪兆銘: 汪主席和平建國言論集、 和平反共建國文獻 (汪偽政府宣傳部 1940)
http://share.ovi.com/media/mdmailbo-50.333/mdmailbo-50.10109
use firefox to download. use 7zip to unzip . use djvu to read.
Mittwoch, 7. Dezember 2011
EE4209/EE5809 Digital Audio : Arithmetic coding
EE4209/EE5809 Digital Audio : Arithmetic coding
1. table(symbol, probability, probability_line_0_1)
2. table(symbol, low, high, range, shift)
3. start : low=0.0, high=1.0, range=1.0
4. algorithm :
5. entropy :
H(s) = -sum( i=1 to n) | (pi)*log2(pi)
1. table(symbol, probability, probability_line_0_1)
2. table(symbol, low, high, range, shift)
3. start : low=0.0, high=1.0, range=1.0
4. algorithm :
low =0;
high =1;
while ( sein_symbol) {
range = high -low;
high = low + range * symbol_high;
low = low + range * symbol_low;
}
print(low);
5. entropy :
H(s) = -sum( i=1 to n) | (pi)*log2(pi)
陳雲:堅持自治,就是捍衛兩制 (陽光時務第八期)
陳雲:堅持自治,就是捍衛兩制 ( 陽光時務第八期)
http://www.youtube.com/watch?v=9BJbuOm77UA
【 陳雲視頻專訪:堅持自治,就是捍衛兩制 】
陳雲指出,香港需要改變以往「 先要幫中國民主化以保障香港一國兩制 」的思維模式,要自保唯一出路,是堅持自治、捍衛兩制、與內地保持邊緣化,才可營造香港、內地的雙贏局面,否則只有死路一條。
但自治並非是搞港獨,香港不應亦不能獨立。
日本關東地區的蔬菜似乎極速巨大化 Dec 2011
http://taiwan2ch.pixnet.net/blog/post/39634959-%E6%97%A5%E6%9C%AC%E9%97%9C%E6%9D%B1%E5%9C%B0%E5%8D%80%E7%9A%84%E8%94%AC%E8%8F%9C%E4%BC%BC%E4%B9%8E%E6%A5%B5%E9%80%9F%E5%B7%A8%E5%A4%A7%E5%8C%96#axzz1fqPcbpHa
http://www.youtube.com/watch?v=9BJbuOm77UA
【 陳雲視頻專訪:堅持自治,就是捍衛兩制 】
陳雲指出,香港需要改變以往「 先要幫中國民主化以保障香港一國兩制 」的思維模式,要自保唯一出路,是堅持自治、捍衛兩制、與內地保持邊緣化,才可營造香港、內地的雙贏局面,否則只有死路一條。
但自治並非是搞港獨,香港不應亦不能獨立。
日本關東地區的蔬菜似乎極速巨大化 Dec 2011
http://taiwan2ch.pixnet.net/blog/post/39634959-%E6%97%A5%E6%9C%AC%E9%97%9C%E6%9D%B1%E5%9C%B0%E5%8D%80%E7%9A%84%E8%94%AC%E8%8F%9C%E4%BC%BC%E4%B9%8E%E6%A5%B5%E9%80%9F%E5%B7%A8%E5%A4%A7%E5%8C%96#axzz1fqPcbpHa
Labels:
EE4206/EE5806,
EE4209/EE5809,
MS5220
Dienstag, 6. Dezember 2011
EE4209/EE5809 Digital Audio -- entropy : log2 a ....計算機, Calculator
EE4209/EE5809 Digital Audio -- entropy : log2 a ....計算機, Calculator
log2 a ....計算機, calculator
[轉引] 網路數學 log2 a ....計算機.. 大多數的計算機只有 log10
網路數學
log (X/Y) = log X - log Y
log XY = log X + log Y
log 4 = log ( 2的"2" 次方) = 2x log2
log 8 = log ( 2的"3" 次方) = 3x log2
log 50 = log (5x10) = log 5 + 1 = log (10/2) + 1 = (1-0.3010) +1
或是 log50 = log (100/2) = log 100 - log 2
= 1.6990
log 2=0.3010
log 3=0.4771
log 7=0.8451
..............背這三個就夠了 其他都用算的才不用背那麼多
----------------------------------------
說 example 最簡單:
例如:
log2 a = (log10 a)/(log10 2)
example a = 317
log2 317 = (log10 317)/(log10 2) = 2.50106/0.30103 = 8.3083
了嗎?
忘了說..
我的算法需要用計算機.. 大多數的計算機只有 log10 的..
如果你要算其他的 base 像 log2, log3, log4..etc 就要用這個算法
http://tw.myblog.yahoo.com/qi3800/article?mid=2292&prev=2293&next=-1
http://forum.pcdvd.com.tw/showthread.php?t=404616
log2 a ....計算機, calculator
[轉引] 網路數學 log2 a ....計算機.. 大多數的計算機只有 log10
網路數學
log (X/Y) = log X - log Y
log XY = log X + log Y
log 4 = log ( 2的"2" 次方) = 2x log2
log 8 = log ( 2的"3" 次方) = 3x log2
log 50 = log (5x10) = log 5 + 1 = log (10/2) + 1 = (1-0.3010) +1
或是 log50 = log (100/2) = log 100 - log 2
= 1.6990
log 2=0.3010
log 3=0.4771
log 7=0.8451
..............背這三個就夠了 其他都用算的才不用背那麼多
----------------------------------------
說 example 最簡單:
例如:
log2 a = (log10 a)/(log10 2)
example a = 317
log2 317 = (log10 317)/(log10 2) = 2.50106/0.30103 = 8.3083
了嗎?
忘了說..
我的算法需要用計算機.. 大多數的計算機只有 log10 的..
如果你要算其他的 base 像 log2, log3, log4..etc 就要用這個算法
http://tw.myblog.yahoo.com/qi3800/article?mid=2292&prev=2293&next=-1
http://forum.pcdvd.com.tw/showthread.php?t=404616
Montag, 5. Dezember 2011
EE4209/EE5809 Digital Audio : Rice Code 1.4
//rice_code4.c
// This is a complete C program for Rice coding-- Kojeve, Hyppolite, Lauer on Self-consciousness as Desire
// This is a complete C program for Rice coding-- Kojeve, Hyppolite, Lauer on Self-consciousness as Desire
#define N 128
#define MAX_CODE_SIZE 32
#include
#include
typedef struct rice_code_info
{
short int abs_residual; //
int m; // the m parameter used in this sample;
int sign; // 1 or -1;
int index; // original location in the sample
unsigned char rice_codedata[MAX_CODE_SIZE];
int code_size;
} RICE_CODE_INFO;
RICE_CODE_INFO r_info[N];
int m_param = 32;
int source_data[6] = {25, 34,42, 47,66,76};
//char* r_code[6];
void rice_encode(RICE_CODE_INFO r_info[], int sourc_data[], int m)
{
// qcode and rcode
int quotient ; // quotient
int remainder, remain_part;
int i=0,j, k, log2M, v=1, and_1=0, s=0;
int p =0; // print out the rice code
log2M = (int)floor(log2(m));
printf("log2M is :%d\n ", log2M);
printf(" the MSB is the sign bit\n");
for (i=0; i<6; i++)
{
r_info[i].abs_residual = source_data[i];
r_info[i].sign=1;
quotient = r_info[i].abs_residual/m; // find quotient
remainder = r_info[i].abs_residual%m; // find remainder
if (r_info[i].sign == -1) {
r_info[i].rice_codedata[0]='1'; // negative sign
}
else {
r_info[i].rice_codedata[0]='0'; // positive sign
}
if (quotient ==0 )
{
// printf("quotient is 0\n");
r_info[i].rice_codedata[1]='0';
printf(" data= %d, quotient = %d, remainder = %d\n", source_data[i], quotient, remainder);
}
else {
printf(" data = %d ,quotient = %d , remainder = %d\n", source_data[i], quotient, remainder);
for (j =0; j<=quotient; j++) {
r_info[i].rice_codedata[j+1] = '1'; // quotient in unary code
}
} // else
r_info[i].rice_codedata[quotient+1]='0'; // to delimit the end of qcode
// q+r : r in truncated binary encoding : from q+1 to (q+1 +M )
// only M size is needed. The remaining bits are discarded.
remain_part = remainder;
for (k=log2M-1, s=0; k >=0 , s<=log2M-1; k--, s++) {
//shift the remainder
remain_part = remainder >> k ;
//printf(" after shift, r is : %d , k is %d ", remain_part, k);
if (v & remain_part )
r_info[i].rice_codedata[1+quotient+1+s] ='1';
else
r_info[i].rice_codedata[ 1 + quotient+1+s] ='0';
}
r_info[i].code_size = ( 1+quotient +1 + log2M );
// size of rice code : (sign bit + quotient + delimit_bit_0 + remainder)
//print out the rice code
for (p=0; p<r_info[i].code_size; p++) {
printf("%c", r_info[i].rice_codedata[p]);
// printf(" code_size = %d\n", r_info[i].code_size);
}
printf("\n");
printf("v is %d\n", v);
printf("v <<4 is %d ", v<<4);
printf("v >>4 is %d\n", v>>4);
printf(" 7>>1 is %d ",7>>1 );
}
}
void rice_decode( RICE_CODE_INFO r_info[], int m)
{
int quotient=0, remainder=0 ,log2M, remain_const=0;
int number=0, i=0, j=0, k=0, r=0,s=0;
printf(" rice-decode()\n");
log2M = (int)floor(log2(m));
for (i=0; i<6; i++) {
for(j =0;j<r_info[i].code_size; j++) {
printf("%c", r_info[i].rice_codedata[j]);
}
printf("\n");
printf("find the quotient ...\n");
for (k=1; k<(r_info[i].code_size-(log2M) );k++) {
if (r_info[i].rice_codedata[k] =='1') {
quotient++;
}
} // for - to find the quotient
printf("the quotient is : %d ;", quotient);
// find the remainder : start from : sign bit+ quotient + delimit bit
for (r= (1+quotient +1), s=log2M-1 ; r<(r_info[i].code_size), s>=0; r++,s-- ) {
if (r_info[i].rice_codedata[r] == '1') {
// printf("%d " , r_info[i].rice_codedata[r]);
// need to convert the char constant to integer
remain_const = r_info[i].rice_codedata[r] -48;
remainder += ( remain_const ) * (pow(2, s));
}
}
//log2M--;
number = remainder + quotient*m;
printf(",remainder is %d\n", remainder);
quotient =0; //reset the q forthe next loop
remainder =0; // reset the remainder for the next loop
log2M = (int)floor(log2(m));
printf(" the number is ..:%d\n", number);
}
}
int main( int argc, char* argv[] )
{
printf("Rice code\n");
rice_encode( r_info, source_data, m_param);
printf(" 25/32 = %d\n", 25/32);
printf(" 66/32 = %d\n", 66/32);
//--------------
printf("----------------\n");
printf(" decoding rice code . . .\n");
rice_decode( r_info, m_param);
return 0;
}
陳雲 : 共產黨在香港的殖民行為
陳雲 : 共產黨在香港的殖民行為
共產黨最可愛的地方,就是自身已經捲入跨國金融資本主義,成了美國的跨國提款機 和中國工奴代管人的時候,依然保育住歷史,不合時宜地做着英國的維多利亞朝或中國的清朝的事。
都已經收回香港,從英國手上接管香港的主權了,都說好了一國兩制的了,要區隔大陸與香港,大陸的法律不在香港實施( 除 《 基本法 》 附件三列出的之外 ),大陸的黨委系統不在香港支配港府,港澳的黨工系統也不在香港浮面。
這會影響一國兩制,也影響國際聲譽,影響美國對香港的態度,因為香港的國際締約地位,源自殖民地時期的自治身分。美國國會於一九九二年通過 《 香港政策法 》,該法例設立了法律框架,使美國可繼續和擴大數十年來與香港市民及 其官員建立的廣泛、多層面關係,藉此承認及支持香港的自治權。
該法例的前提,是允許美國僅在總統可證實香港擁有充分自治權的時候,才給予香港區別對待。
一旦中共侵蝕香港的自治權,美國將不予香港優惠對待,而其他國家必會跟隨,削弱香港的國際締約地位而動搖香港的金融中心地位。香港的金融中心地位,幫助中共套匯、融資和人民幣國際化,這可是中共的救命草啊。
source :
陳雲:共黨的佔領 潛伏的複製
http://commentshk.blogspot.com/2011/11/blog-post_3629.html
---
Teddy Cheung :
只要讀者再看 《 香港城邦論 》 後,自然就不會對大陸有任何感情,教育下一代,時時刻刻防範敵人進一步侵略香港,保衛香港最重要!
Wan Chin :
一個理由就夠:中國共產黨專政。
Wan Chin :
他們連死都不怕,就不敢反共。沒希望的一群人。
Wan Chin :
中共連民建聯都信不過,要派退休幹部親自出馬參選區議會,加上種票案情嚴重,違反《 中英聯合聲明 》,顯示中共毫不尊重國際條約和一國兩制,香港人勢必反抗,國際社會也看在眼裡,伺機而動。
see also:
沈旭暉 : 美港關係之謎(二)﹕《美國香港政策法》
http://www.facebook.com/notes/沈旭暉/美港關係之謎二美國香港政策法/274172075950283
共產黨最可愛的地方,就是自身已經捲入跨國金融資本主義,成了美國的跨國提款機 和中國工奴代管人的時候,依然保育住歷史,不合時宜地做着英國的維多利亞朝或中國的清朝的事。
都已經收回香港,從英國手上接管香港的主權了,都說好了一國兩制的了,要區隔大陸與香港,大陸的法律不在香港實施( 除 《 基本法 》 附件三列出的之外 ),大陸的黨委系統不在香港支配港府,港澳的黨工系統也不在香港浮面。
這會影響一國兩制,也影響國際聲譽,影響美國對香港的態度,因為香港的國際締約地位,源自殖民地時期的自治身分。美國國會於一九九二年通過 《 香港政策法 》,該法例設立了法律框架,使美國可繼續和擴大數十年來與香港市民及 其官員建立的廣泛、多層面關係,藉此承認及支持香港的自治權。
該法例的前提,是允許美國僅在總統可證實香港擁有充分自治權的時候,才給予香港區別對待。
一旦中共侵蝕香港的自治權,美國將不予香港優惠對待,而其他國家必會跟隨,削弱香港的國際締約地位而動搖香港的金融中心地位。香港的金融中心地位,幫助中共套匯、融資和人民幣國際化,這可是中共的救命草啊。
source :
陳雲:共黨的佔領 潛伏的複製
http://commentshk.blogspot.com/2011/11/blog-post_3629.html
---
Teddy Cheung :
只要讀者再看 《 香港城邦論 》 後,自然就不會對大陸有任何感情,教育下一代,時時刻刻防範敵人進一步侵略香港,保衛香港最重要!
Wan Chin :
一個理由就夠:中國共產黨專政。
Wan Chin :
他們連死都不怕,就不敢反共。沒希望的一群人。
Wan Chin :
中共連民建聯都信不過,要派退休幹部親自出馬參選區議會,加上種票案情嚴重,違反《 中英聯合聲明 》,顯示中共毫不尊重國際條約和一國兩制,香港人勢必反抗,國際社會也看在眼裡,伺機而動。
see also:
沈旭暉 : 美港關係之謎(二)﹕《美國香港政策法》
http://www.facebook.com/notes/沈旭暉/美港關係之謎二美國香港政策法/274172075950283
Sonntag, 4. Dezember 2011
EE4206/EE5806 Digital Image Processing: tut#6 Q1. answer -- Local histogram processing
EE4206/EE5806 Digital Image Processing: tut#6 Q1. answer -- Local histogram processing
The idea is to devise transformation functions based on the intensity distribution in a neighborhood of every pixel in the image.
steps:
1. The procedure is to define a neighborhood and MOVE its CENTRE from pixel to pixel.
2. At EACH location, the histogram of the points in the neighborhood is computed and either a histogram equalization or histogram specification transformation function is obtained.
3. This function is used to MAP the intensity of the pixel CENTERED in the neighborhood.
4. The center of the neighborhood region is then MOVED to an ADJACENT pixel location and the procedure is repeated.
5. * Because ONLY ONE row or column of the neighborhood changes during a pixel-to-pixel translation of the neighborhood, updating the histogram obtained in the previous location with the NEW data introduced at EACH motion step is possible.
6. This approach has obvious advantages over repeatedly computing the histogram of ALL pixels in the neighborhood region each time the region is moved one pixel location.
The idea is to devise transformation functions based on the intensity distribution in a neighborhood of every pixel in the image.
steps:
1. The procedure is to define a neighborhood and MOVE its CENTRE from pixel to pixel.
2. At EACH location, the histogram of the points in the neighborhood is computed and either a histogram equalization or histogram specification transformation function is obtained.
3. This function is used to MAP the intensity of the pixel CENTERED in the neighborhood.
4. The center of the neighborhood region is then MOVED to an ADJACENT pixel location and the procedure is repeated.
5. * Because ONLY ONE row or column of the neighborhood changes during a pixel-to-pixel translation of the neighborhood, updating the histogram obtained in the previous location with the NEW data introduced at EACH motion step is possible.
6. This approach has obvious advantages over repeatedly computing the histogram of ALL pixels in the neighborhood region each time the region is moved one pixel location.
Abonnieren
Posts (Atom)