JPEG implementation and improvement

Slides:



Advertisements
Similar presentations
Transform-domain Wyner-Ziv Codec for Video 教師 : 楊士萱 老師 學生 : 李桐照 同學.
Advertisements

FCU, Department of ECE, IC Design Research Lab. TEL: # 4945 Pre-SIm , Post-Sim.
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
: Arrange the Numbers ★★★☆☆ 題組: Contest Archive with Online Judge 題號: 11481: Arrange the Numbers 解題者:李重儀 解題日期: 2008 年 9 月 13 日 題意: 將數列 {1,2,3, …,N}
: A-Sequence 星級 : ★★☆☆☆ 題組: Online-judge.uva.es PROBLEM SET Volume CIX 題號: Problem D : A-Sequence 解題者:薛祖淵 解題日期: 2006 年 2 月 21 日 題意:一開始先輸入一個.
:Word Morphing ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10508:word morphing 解題者:楊家豪 解題日期: 2006 年 5 月 21 日 題意: 第一行給你兩個正整數, 第一個代表下面會出現幾個字串,
Section 1.2 Describing Distributions with Numbers 用數字描述分配.
Event Sampling 事件取樣法. 關心重點為「事件」本身明確的焦點 行為 清楚掌握主題 - 當「事件」出現時才開 始記錄 記錄程序 等待目標事件的發生 開始記錄 事件結束,停止記錄.
3Com Switch 4500 切VLAN教學.
期末專題 - 吊人頭遊戲 第 35 組 組員 : 電機系 49841XXXX XXX 電機系 49841OOOO OOO.
What is static?. Static? 靜態 ? class Test { static int staticX; int instanceX; public Test(int var1, int var2) { this.staticX = var1; this.instanceX =
指導教授:陳淑媛 學生:李宗叡 李卿輔.  利用下列三種方法 (Edge Detection 、 Local Binary Pattern 、 Structured Local Edge Pattern) 來判斷是否為場景變換,以方便使用者來 找出所要的片段。
: Boxes ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11003: Boxes 解題者:蔡欣燁 解題日期: 2007 年 3 月 19 日.
亂數產生器安全性評估 之統計測試 SEC HW7 姓名:翁玉芬 學號:
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Review of Chapter 3 - 已學過的 rules( 回顧 )- 朝陽科技大學 資訊管理系 李麗華 教授.
Graph V(G 1 )={0, 1, 2, 3, 4, 5, 6, 7, 8, 9} E(G 1 )={(0, 2), (0, 3), (1, 4), (2, 3), (2, 5), (2, 6), (3, 6), (3, 7), (4, 7), (5, 6), (5,
: OPENING DOORS ? 題組: Problem Set Archive with Online Judge 題號: 10606: OPENING DOORS 解題者:侯沛彣 解題日期: 2006 年 6 月 11 日 題意: - 某間學校有 N 個學生,每個學生都有自己的衣物櫃.
: ShellSort ★★☆☆☆ 題組: Problem D 題號: 10152: ShellSort 解題者:林一帆 解題日期: 2006 年 4 月 10 日 題意:烏龜王國的烏龜總是一隻一隻疊在一起。唯一改變烏龜位置 的方法為:一隻烏龜爬出他原來的位置,然後往上爬到最上方。給 你一堆烏龜原來排列的順序,以及我們想要的烏龜的排列順序,你.
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
: Matrix Decompressing ★★★★☆ 題組: Contest Volumes with Online Judge 題號: 11082: Matrix Decompressing 解題者:蔡權昱、劉洙愷 解題日期: 2008 年 4 月 18 日 題意:假設有一矩陣 R*C,
Monte Carlo Simulation Part.2 Metropolis Algorithm Dept. Phys. Tunghai Univ. Numerical Methods C. T. Shih.
2009fallStat_samplec.i.1 Chap10 Sampling distribution (review) 樣本必須是隨機樣本 (random sample) ,才能代表母體 Sample mean 是一隨機變數,隨著每一次抽出來的 樣本值不同,它的值也不同,但會有規律性 為了要知道估計的精確性,必需要知道樣本平均數.
南投縣社區大學 Excel 實務應用入門 講師 : 林泉成
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Wireless Protocol Bluetooth
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
Matlab Assignment Due Assignment 兩個 matlab 程式 : Eigenface : Eigenvector 和 eigenvalue 的應用. Fractal : Affine transform( rotation, translation,
: Tight words ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: : Tight Words 解題者:鐘緯駿、林一帆 解題日期: 2006 年 03 月 14 日 題意: 給定數字 k 與 n (0 ≦ k.
: Happy Number ★ ? 題組: Problem Set Archive with Online Judge 題號: 10591: Happy Number 解題者:陳瀅文 解題日期: 2006 年 6 月 6 日 題意:判斷一個正整數 N 是否為 Happy Number.
各種線上電子資源的特異功能 SwetsWise 的 alert, TOC alert 與 Favorites 2003/4/28 修改.
: Problem A : MiniMice ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11411: Problem A : MiniMice 解題者:李重儀 解題日期: 2008 年 9 月 3 日 題意:簡單的說,題目中每一隻老鼠有一個編號.
: Ahoy, Pirates! ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11402: Ahoy, Pirates! 解題者:李重儀 解題日期: 2008 年 8 月 26 日 題意:有一個海盜島有 N 個海盜,他們的編號 (id)
: Count DePrimes ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11408: Count DePrimes 解題者:李育賢 解題日期: 2008 年 9 月 2 日 題意: 題目會給你二個數字 a,b( 2 ≦ a ≦ 5,000,000,a.
Distributed Video Coding. Outline Distributed video coding Lossless compression Lossy compression Low complexity video encoding Distributed image coding.
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
從此處輸入帳號密碼登入到管理頁面. 點選進到檔案管理 點選「上傳檔案」上傳資料 點選瀏覽選擇電腦裡的檔案 可選擇公開或不公開 為平台上的資料夾 此處為檔案分類,可顯示在展示頁面上,若要參加 MY EG 競賽,做品一律上傳到 “ 98 MY EG Contest ” 點選此處確定上傳檔案.
資料結構實習-一 參數傳遞.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
Management Abstracts Retrieval System; MARS 檢索操作.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/25 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH 2.4~CH 2.6 &
資料結構實習-二.
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
: Expect the Expected ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11427: Expect the Expected 解題者:李重儀 解題日期: 2008 年 9 月 21 日 題意:玩一種遊戲 (a game.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
Chapter 10 m-way 搜尋樹與B-Tree
What is Computer.
1 523: Minimum Transport Cost ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 523: Minimum Transport Cost 解題者:林祺光 解題日期: 2006 年 6 月 12 日 題意:計算兩個城市之間最小的運輸成本,運輸.
Probability Distribution 機率分配 汪群超 12/12. 目的:產生具均等分配的數值 (Data) ,並以 『直方圖』的功能計算出數值在不同範圍內出現 的頻率,及繪製數值的分配圖,以反應出該 機率分配的特性。
Chapter 7 Sampling Distribution
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
: Dream ★★★☆☆ 題組: Contest Archive with Online Judge 題號: 11414: Dream 解題者:李育賢 解題日期: 2008 年 9 月 2 日 題意: 題目會給你一個數字代表測資的數量 ( 最多 100 組 ) , 每組測資第一個數字是此圖形點的個數.
: Problem E Antimatter Ray Clearcutting ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11008: Problem E Antimatter Ray Clearcutting 解題者:林王智瑞.
連續隨機變數 連續變數:時間、分數、重量、……
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/30 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH7.1~CH /12/26.
:Commandos ★★★☆☆ 題組: Contest Archive with Online Judge 題號: 11463: Commandos 解題者:李重儀 解題日期: 2008 年 8 月 11 日 題意: 題目會給你一個敵營區內總共的建築物數,以及建築物 之間可以互通的路有哪些,並給你起點的建築物和終點.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
: SAM I AM ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11419: SAM I AM 解題者:李重儀 解題日期: 2008 年 9 月 11 日 題意: 簡單的說,就是一個長方形的廟裡面有敵人,然 後可以橫的方向開砲或縱向開砲,每次開砲可以.
Briefly introduction to image/ video coding standard and FGS for MPEG-4 卓傳育.
: GCD (I) ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11424: GCD(I) 解題者:李育賢 解題日期: 2008 年 9 月 19 日 題意: 最多 20,000 組測資,題目會給一個數字 N(1
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
幼兒行為觀察與記錄 第八章 事件取樣法.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Chapter 12 Estimation 統計估計. Inferential statistics Parametric statistics 母數統計 ( 母體為常態或 大樣本 ) 假設檢定 hypothesis testing  對有關母體參數的假設,利用樣本資料,決定接受或 不接受該假設的方法.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Running Cat 周弘禮 林靖雅 王柔文.
Introduction to JPEG Alireza Shafaei ( ) Fall 2005.
Presentation transcript:

JPEG implementation and improvement Regular scan, Huffman : 0.72602 Zigzag scan, Huffman: 0.72445 Zigzag scan, Huffman_greedy: 0.72219 Zigzag scan, adaptive Arithmetic coding(AAC): 0.71271 R06942072 林俊宏

Follow JPEG standard published in 1992 Input : Lena color image Size = 512 * 512 Lena512c.bmp Environment : matlab 1972年Lena圖

Coarse block diagram of Compression Source data (Text, Image, Video….) Preprocessing Entropy encoder Compressed data (Bit Stream 0101….) PSNR(Peak Signal to Noise Ratio) SSIM (structural similarity) Reconstruction data (Text, Image, Video….) Bit per pixel (b.p.p) Bit per character (b.p.c.) Compression ratio (CR) Postprocessing Entropy decoder

Evaluation, B.p.p. & PSNR Reduce↓ Keep the same Lena 512*512 Color image Reduce↓ Keep the same

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) 64*64 cell 1*4096 cell 512*512 Stream_Y Chrominance channel (Cb & Cr) 64*64 1*4096 Huffman decoder fun1Dto2D Inverse Quantization Inverse DCT Up sampling Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC frequency domain DCT Ac Run length coding 利用DCT後的特性做紀錄的小技巧 Dc 差分編碼 space domain space domain 4:2:0 Stream_Cb 256*256 Stream_Cr

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

左上數值小的Q table

DCT & Quantization

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

AC, Run length coding 999 = End of block(EOB) Input : 8*8 block →[ZRL]→ output : 1*1cell

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

base code -- table

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

Inside Huffman.m : 4 Table DC (Category 0~11) AC (Run/Size = 0~F/0~A) Luminance (Y channel) 12 elements 16*10+2 (EOB & ZRL) = 162 elements Chrominance (Cb & Cr channel) 依照資料數值大小可以用多少bits表示來分類

How to categorize? Range DC difference Category (from 0 to 11) Size of AC (from 1 to A) EOB || ZRL -1,1 1 -3,-2,2,3 2 -7~-4, 4~7 3 -15~-8, 8~15 4 ….. -1023~-512, 512~1023 10 A

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

Stream structure Include 5 parts : Category DC base code Content DC Run/Size AC base code Content AC ………………repeat End of Block(EOB) Take the first block of luminance channel for example : DC & AC: 16, [0 1 0 1 999] After encoding : 11010000 001 001 1010 DC : Category 5 , need 5 bits to represent content DC

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

Proposed method 1.「之」字形紀錄 The scanning style from Regular-scan to Zigzag-scan. 1 2 3 …… 63 64 65 66 67 127 128 4033 4034 4035 4095 4096 1 2 3 …… 63 64 128 127 126 66 65 4096 4095 4094 4034 4033

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Future work Conclusion

Proposed method 2. apply greedy algorithm on luminance DC. Create own luminance DC table. Why I want to create own table ? To realize the core concept of Huffman : less bits for symbol with high frequency.

Calculate each Category appears frequency. Does not make sense !!! Category 2 should have the shortest Code length in Lena image →but it did not.

greedy algorithm luminance DC

tree{2}{1}{2}{2}{2}{2}{2}{2}{2} = 12 ← stages nine How to implement? tree{1}{1} = 3 ← stages two tree{1}{2} = 4 ← stages two tree{2}{1}{2}{2}{2}{2}{2}{2}{2} = 12 ← stages nine Cell的結構,分1/0 = tree的左邊右邊 Category2, Codelength = 2

How about apply Greedy algorithm on chrominance DC?

Calculate each Category appears frequency. The table is already fit the distribution of datas!!! We cannot get benefit, from greedy algorithm.

Conclusion of Proposed method 2. only apply greedy method on luminance DC (Y channel). Future work : To apply on AC channel maybe can further improve.

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

(Symbol-based) v.s. (Stream-based) An optional alternative to Huffman coding in several video coding standards (ex. H.263, MPEG-4, H.26L)

Example of Arithmetic coding To encode “aaabaa” [Lower,upper] = 0.4096, 0.475136 Use b bits to represent C b = 5, C = 14 ‘aaabaa’→ ‘01110’ 重點提及: 事前機率0.8 , 0.2 Lower和upper調整

adaptive arithmetic coding (A.A.C.) Add two mechanisms to fit the application on JPEG : 1. adapt the frequency table dynamically during the coding process. 2. adapt for long data length 直接套進來是行不通 : 1.不知道每個值發生的機率 2. 無法跑很長long Length [講稿1] the frequency table can truely fit the data distribution property. Beneifit from a larger numerical interval compared to fix frequency table. Consequently, we use less bit and make a good compression. [講稿2] 剛剛的資料很短aaabaa,要適應道很長資料上,電腦的數值沒辦法紀錄這麼細 微 所以我設0.5為threshold,如果越界了就必須輸出0或1來標記,這樣在解碼端才 解的回來,penalty就是Stream length會上升

adaptive arithmetic coding (A.A.C.) Stream structure In A.A.C. After encoding : 10001011……01010 long data length + Range encode Take the first block of luminance channel for example : DC & AC: 16, [0 1 0 1 999] In huffman After encoding : 11010000 001 001 1010

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding Huffman encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

Lena Image Luminance channel (Y) Chrominance channel (Cb & Cr) 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding AAC encoder AAC encoder fun2Dto1D Table L, AC Table L, DC Luminance channel (Y) Stream_Y Chrominance channel (Cb & Cr) Down Sampling 88 DCT Quantization 8*8 Qtable AC Run length coding DC differential coding AAC encoder fun2Dto1D Table C, AC Table C, DC Stream_Cb Stream_Cr

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

Conclusion Implement the lossy compression standard JPEG. modified the model to reduce b.p.p: Regular scan, Huffman : 0.72602 Zigzag scan, Huffman: 0.72445 Zigzag scan, Huffman_greedy: 0.72219 Zigzag scan, adaptive Arithmetic coding(AAC): 0.71271

Outline JPEG overview proposed method 1 - scanning style proposed method 2 – Huffman greedy algorithm proposed method 3 – adaptive arithmetic coding Conclusion Future work

Future work shape adaptive : the block size is not always 8*8. Coarse area : large block ; Fine area : small block edge detection image segmentation

Reference http://djj.ee.ntu.edu.tw/ADSP.htm http://chu246.blogspot.tw/2013/01/huffman-coding-by- matlab.html http://twins.ee.nctu.edu.tw/courses/soclab_04/lab_hw_pdf /proj1_jpeg_introduction.pdf