cs4405
play

CS4405 JPEG Transform Coding JPEG Compression Workflow RGB - PowerPoint PPT Presentation

CS4405 JPEG Transform Coding JPEG Compression Workflow RGB Optional Chroma Subsample YCbCr Chroma Sub-sampling 4:2:0 Reduces input data by 50% R G B Y U V Chroma Sub-sampling


  1. CS4405 JPEG Transform Coding JPEG ¡Compression ¡Workflow RGB Optional Chroma Subsample YCbCr Chroma ¡Sub-­‑sampling ‣ 4:2:0 • Reduces ¡input ¡data ¡by ¡50% R G B Y U V

  2. Chroma ¡Sub-­‑sampling luminance ¡ RGB ¡Components YCbCr ¡Components More ¡resolution ¡in ¡Y ¡than ¡in ¡Cb ¡or ¡Cr

  3. YCb ¡Cr ¡After ¡JPEG ¡(Q=30%) JPEG ¡Y JPEG ¡Cb JPEG ¡Cr Simple ¡Example ¡Transform ‣ In ¡image ¡compression ¡the ¡data ¡is ¡usually ¡a ¡two-­‑ dimensional ¡array ¡of ¡pixels • Typically ¡a ¡4x4 ¡8x8 ¡or ¡16x16 ¡block ¡of ¡pixels Inverse ¡Transform Transform A B A ¡= ¡X0 X0 ¡= ¡A B ¡= ¡X1 ¡+ ¡X0 X1 ¡= ¡B ¡-­‑ ¡A C D C ¡= ¡X2 ¡+ ¡X0 X2 ¡= ¡C ¡-­‑ ¡A D ¡= ¡X3 ¡+ ¡X0 X3 ¡= ¡D ¡-­‑ ¡A Example ¡Transform ‣ If ¡the ¡pixels ¡were ¡8 ¡bits ¡each ¡then ¡the ¡block ¡would ¡use ¡32 ¡bits • Using ¡the ¡transform ¡we ¡could ¡assign ¡4 ¡bits ¡each ¡for ¡the ¡difference ¡values ¡and ¡8 ¡ bits ¡for ¡the ¡base ¡pixel • This ¡would ¡reduce ¡the ¡data ¡to ¡8 ¡+ ¡(3x4) ¡or ¡20 ¡bits ¡for ¡the ¡2x2 ¡block • Compressing ¡from ¡8bpp ¡to ¡5bpp ‣ The ¡goal ¡is ¡to ¡develop ¡good ¡transforms ¡with ¡calculations ¡ that ¡are ¡easy ¡to ¡implement ¡in ¡hardware ¡or ¡software ‣ Typically ¡transforms ¡use ¡8x8 ¡blocks • Best ¡fit ¡most ¡processor ¡architectures

  4. Transform ¡Coding ‣ Spatial ¡(natural) ¡image ¡data ¡is ¡difficult ¡to ¡compress • Neighbouring ¡pixels ¡are ¡highly ¡interrelated • Difficult ¡to ¡decide ¡what ¡data ¡to ¡discard ¡that ¡will ¡not ¡affect ¡image ¡ quality ‣ Convert ¡spatial ¡data ¡into ¡a ¡different ¡representation ‣ Two ¡common ¡transforms • DCT ¡– ¡Discrete ¡Cosine ¡Transform ¡(JPEG) • DWT ¡– ¡Discrete ¡Wavelet ¡Transform ¡(JPEG ¡2000) An ¡Image ¡as ¡a ¡Wave ‣ The ¡colour ¡amplitude ¡information ¡can ¡be ¡thought ¡of ¡as ¡a ¡wave ¡ ‣ Decompose ¡the ¡wave ¡into ¡its ¡component ¡frequencies ‣ For ¡the ¡8x8 ¡matrix ¡of ¡colour ¡data ¡calculate ¡an ¡8x8 ¡matrix ¡of ¡ coefficients ¡for ¡the ¡frequency ¡components ‣ The ¡same ¡idea ¡applies ¡for ¡an ¡image ¡described ¡using ¡the ¡YCbCr ¡ colour ¡space • Y ¡can ¡be ¡treated ¡as ¡a ¡2D ¡wave ¡of ¡luminance ¡values • Cb ¡and ¡Cr ¡each ¡as ¡a ¡2D ¡wave ¡of ¡chroma ¡values ‣ DCT ¡is ¡applied ¡three ¡times ¡(for ¡Y, ¡Cb ¡and ¡Cr) 1D ¡Discrete ¡Cosine ¡Transform ‣ The ¡signal ¡is ¡the ¡weighted ¡sum ¡of ¡cosine ¡functions ¡ of ¡different ¡frequencies

  5. 1D ¡Example 1D ¡DCT ¡Example All ¡DCT ¡coefficients 15 15 First ¡10 ¡DCT ¡coefficients 10 First ¡6 ¡DCT ¡coefficients 5 10 y 0 -5 5 -10 -15 y 0 0 10 20 30 40 50 Index -5 100 -10 0 z -15 -100 -200 0 10 20 30 40 50 0 10 20 30 40 50 Index Index Block-­‑based ¡DCT ‣ The ¡de-­‑correlation ¡and ¡compaction ¡performance ¡of ¡ the ¡DCT ¡increases ¡with ¡block ¡size ¡however ¡the ¡ transform ¡is ¡not ¡usually ¡applied ¡to ¡the ¡whole ¡image • The ¡computational ¡complexity ¡increases ¡(exponentially) ¡with ¡size ¡ ‣ The ¡choice ¡of ¡block ¡size ¡is ¡important • If ¡the ¡block ¡size ¡becomes ¡too ¡large ¡more ¡edges ¡become ¡part ¡of ¡the ¡ transform ¡block ¡causing ¡blocking ¡artefacts ¡ • ¡Small ¡block ¡sizes ¡result ¡in ¡poor ¡compression

  6. Block-­‑based ¡DCT ‣ 8x8 ¡blocks ¡are ¡used ¡in ¡JPEG • 8x8 ¡blocks ¡are ¡typically ¡small ¡enough ¡that ¡blocking ¡artefacts ¡can ¡be ¡ avoided ¡without ¡having ¡to ¡encode ¡a ¡lot ¡of ¡high-­‑frequency ¡ information ‣ Optimal ¡case ¡is ¡to ¡use ¡variable ¡block ¡sizes ¡that ¡vary ¡ according ¡to ¡image ¡features • Requires ¡image ¡segmentation Block ¡Size Block ¡Size

  7. Block ¡Size Block ¡Size 4 5 6 7 2-D FDCT 1-U and 2-U discreie cosine transfoim ire 7 J ’ 2D ¡DCT ‣ The ¡DCT ¡can ¡be ¡extended ¡into ¡two ¡dimensions ‣ In ¡an ¡8x8 ¡block ¡each ¡of ¡the ¡64 ¡pixel ¡values ¡ contributes ¡to ¡the ¡calculation • 64 ¡x ¡64 ¡= ¡4096 ¡multiply-­‑add ¡operations f2,] are the 64 sarnplcs (iJj of the Inp~tt sample block, FL,> are the 64 DCT ~ ~ e ~ (x,,y) ~ c ~ e ~ ~ ~ s are constants: and C(x), C(y) g,,) The R ~ ~ e I I ~ ~ ~ of sarn~~es and coefficletilh (Fx,y) i s illustrated in Figure 7.1.

  8. 2D ¡Discrete ¡Cosine ¡Transform ‣ The ¡64 ¡(8x8) ¡DCT ¡basis ¡functions ¡ ‣ Add ¡multiples ¡of ¡these ¡to ¡fit ¡the ¡ block ¡of ¡pixel ¡values ¡in ¡the ¡ original ¡picture ‣ If ¡implemented ¡directly ¡an ¡8×8 ¡ DCT ¡requires ¡ • 64 ¡x ¡64 ¡multiply ¡operations ¡ • 49 ¡x ¡64 ¡additions Calculating ¡the ¡2D ¡DCT ‣ The ¡2D ¡DCT ¡is ¡separable ¡into ¡two ¡1D ¡DCTs • 1D ¡horizontal ¡DCT ¡followed ¡by ¡a ¡1D ¡vertical ¡DCT • 2 ¡x ¡8 ¡x ¡64 ¡(1024) ¡multiply-­‑add ¡operations ‣ The ¡direct ¡application ¡of ¡these ¡formulas ¡would ¡ require ¡O(N 2 ) ¡operations ¡ Calculating ¡the ¡2D ¡DCT ‣ Factoring ¡the ¡computation ¡(taking ¡advantage ¡of ¡the ¡ symmetry ¡of ¡the ¡cosine ¡function) ¡it ¡is ¡possible ¡to ¡ compute ¡with ¡O(N ¡log ¡N) ¡complexity ‣ The ¡total ¡computation ¡load ¡for ¡an ¡8×8 ¡DCT ¡can ¡be ¡ reduced ¡to • 28 ¡add/subtract ¡operations • 22 ¡multiply ¡operations

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend