jpeg notes jpeg

Upload: jenny-soon

Post on 04-Jun-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Jpeg notes jpeg...

    1/12

    The JPEG Standard

    Jiun-De Huang

    E-mail: [email protected]

    Graduate Institute o !ommuni"ation Engineering#ational $aiwan %ni&ersit'( $ai)ei( $aiwan( *+!

    Abstract

    J,EG Joint ,otogra)i" E/)erts Grou) is an international "om)ression

    standard or "ontinuous-tone still image( ot gra's"ale and "olor. $is standard is

    designed to su))ort a wide &ariet' o a))li"ations or "ontinuous-tone images.

    e"ause o te distin"t re3uirement or ea" o te a))li"ations( te J,EG standard

    a&e two asi" "om)ression metods. $e D!$-ased matod is s)e"iied or loss'

    "om)ression( and te )redi"ti&e matod is s)e"iied or lossless "om)ression.

    sim)le loss' te"ni3ue "alled aseline( wi" is a D!$-ased metods( as een

    widel' used toda' and is sui"ient or a large numer o a))li"ations. In tis )a)er(we will sim)l' introdu"e te J,EG standard and o"uses on te aseline metod.

    1 Introduction

    $e J,EG standard is a "ollaoration among te International

    $ele"ommuni"ation %nion I$%( International +rganiation or 6tandardiation

    I6+( and International Ele"trote"ni"al !ommission IE!. Its oi"ial name is

    7I6+8IE! 1091-1 Digital "om)ression and "oding o "ontinuous-tone still image7(

    and 7I$%-$ *e"ommendation $.17. J,EG a&e te ollowing modes o o)erations :

    a Lossless mode:$e image is en"oded to guarantee e/a"t re"o&er' o e&er' )i/el

    o original image e&en toug te "om)ression ratio is lower tan te loss'

    modes.

    Sequential mode:It "om)resses te image in a single let-to-rigt( to)-to-ottom

    s"an.

    " Progressive mode:It "om)resses te image in multi)le s"ans. en transmission

    time is long( te image will dis)la' rom indistin"t to "lear a))earan"e.

    d Hierarchical mode:!om)ress te image at multi)le resolutions so tat te lower

    resolution o te image "an e a""essed irst witout de"om)ressing te wole

    resolution o te image.

    $e last tree D!$-ased modes ( "( and d are loss' "om)ression e"ause

    )re"ision limitation to "om)ute D!$ and te 3uantiation )ro"ess introdu"e distortion

    in te re"onstru"ted image. $e lossless mode uses )redi"ti&e metod and does not

    a&e 3uantiation )ro"ess. $e ierar"i"al mode "an use D!$-ased "oding or

    )ridi"ti&e "oding o)tionall'. $e most widel' used mode in )ra"ti"e is is "alled te

    aseline J,EG s'stem( wi" is ased on se3uential mode( D!$-ased "oding and

    Human "oding or entro)' en"oding. ;ig. 1 is te lo"< diagram o aseline s'stem.

    $e J,EG standard deines onl' te s'nta/ o te "om)ressed itstream. It does

    not s)e"i' an' ting aout ile ormat. noter standard "alled J;I; J,EG ;ile

    Inter"ange ;ormat( "reated ' IJG Inde)endend J,EG Grou)( ma

  • 8/13/2019 Jpeg notes jpeg...

    2/12

    !olor S"ace !onversion and #o$nsam"ling

    In order to a"ie&e good "om)ression )erorman"e( "orrelation etween te "olor

    "om)onents is irst redu"ed ' "on&erting te RGB"olor s)a"e into a de"orrelated

    "olor s)a"e. In aseline J,EG( a RGBimage is irst transormed into a luminan"e-

    "rominan"" "olor s)a"e su" as YCbCr. $e ad&antage o "on&erting te image into

    luminan"e-"rominan"e "olor s)a"e is tat te luminan"e and "rominan"e

    "om)onents are &er' mu" de"orrelated etween ea" oter. =oreo&er( te

    "rominan"e "annels "ontain mu" redundant inormation and "an easil' e

    susam)led witout sa"rii"ing an' &isual 3ualit' or te re"onstru"ted image. $e

    transormation rom RGB to YCbCr( is ased on te ollowing matemati"al

    e/)ression:

    0.299000 0.5>000 0.114000 0

    0.1?>? 0.12?4 0.500002 12

    0.500000 0.41? 0.0112 12

    b

    r

    Y R

    C G

    C B

    = +

    $e &alue YA 0.299RB 0.5>GB 0.114Bis "alled te luminan"e. It is te &alue

    used ' mono"rome monitors to re)resent an RGB "olour. ,'siologi"all'( it

    re)resents te intensit' o anRGB"olor )er"ei&ed ' te e'e. $e ormula is li

  • 8/13/2019 Jpeg notes jpeg...

    3/12

  • 8/13/2019 Jpeg notes jpeg...

    4/12

    In&erse D!$ :> >

    0 0

    1 2 1 2 1 ( ( "os "os

    4 1? 1?

    or 0(...(> and 0(...(>

    u v

    x u y vf x y C u C v F u v

    x y

    = =

    + + =

    = =

    $eFu(v is "alled te D!$ "oei"ient( and te D!$ asis is :

    (

    2 1 2 1 ( "os "os

    4 1? 1?x y

    C u C v x u y vu v

    + + =

    $en we "an rewrite te in&erse D!$ to :> >

    (

    0 0

    ( ( ( or 0(...(> and 0(...(>x y

    u v

    f x y F u v u v x y= =

    = = =

    ;ig. $e D!$ asis ( ( x y u v

    48 39 40 68 60 38 50 12

    1

    14

    9 82 79

    10

    1

    11

    3

    10

    6 27 62

    58 63 77 69 12

    4

    10

    7 74

    12

    5

    80 97 74 54 59 71 91 66

    18 34 33 46 64 61 32 37

    14

    9

    10

    8 80

    10

    6

    11

    6 61 73 92

    21

    1

    23

    3

    15

    9 88

    10

    7

    15

    8

    16

    1

    10

    9

    699.2

    5

    43.1

    8

    55.2

    5

    72.1

    1

    24.0

    0

    -

    25.5

    1

    11.2

    1

    -

    4.14

    -

    129.7

    8

    -

    71.5

    0

    -

    70.2

    6

    -

    73.3

    5

    59.4

    3

    -

    24.0

    2

    22.6

    1

    -

    2.05

    85.7130.3

    2

    61.7

    8

    44.8

    7

    14.8

    4

    17.3

    5

    15.5

    1

    -

    13.1

    9

    -

    40.81

    10.1

    7

    -

    17.5

    3

    -

    55.8

    1

    30.5

    0

    -

    2.28

    -

    21.0

    0

    -

    1.26

    - -af x(y : &alues o luminan"e Fu(v : D!$ "oei"ients

    ;ig. 4 n e/am)le o D!$ "oei"ients or a lo"

  • 8/13/2019 Jpeg notes jpeg...

    5/12

    % ,uanti-ation

    $e transormed lo"< now "onsists o ?4 D!$ "oei"ients. $e irst"oei"ient F0(0 is te D! "om)onent and te oter ? "oei"ients are !

    "om)onent. $e D! "om)onentF0(0 is essentiall' te sum o te ?4 )i/els in te

    in)ut )i/el lo"< multi)lied ' te s"aling a"tor 184C0C0A18 as sown ine3uation orFu(v.

    $e ne/t ste) in te "om)ression )ro"ess is to 3uantie te transormed

    "oei"ients. Ea" o te ?4 D!$ "oei"ients are uniorml' 3uantied. $e ?4

    3uantiation ste)-sie )arameters or uniorm 3uantiation o te ?4 D!$ "oei"ients

    orm an 3uantiation matri/. Ea" element in te 3uantiation matri/ is an integeretween 1 and 255. Ea" D!$ "oei"ient Fu(v is di&ided ' te "orres)onding

    3uantier ste)-sie )arameter Qu(v in te 3uantiation matri/ and rounded to te

    nearest integer as :

    - ( 0- ( 0- ( 0

    qF u vF u v RoundQ u v

    =

    $e J,EG standard does not deine an' i/ed 3uantiation matri/. It is te

    )rerogati&e o te user to sele"t a 3uantiation matri/. $ere are two 3uantiation

    matri"es )ro&ided in nne/ o te J,EG standard or reeren"e( ut not

    re3uirement. $ese two 3uantiation matri"es are sown elow :

    1? 11 10 1? 24 40 51 ?1

    12 12 14 19 2? 5 ?0 55

    14 1 1? 24 40 5> ?9 5?14 1> 22 29 51 > 0 ?2

    1 22 > 5? ? 109 10 >>

    24 5 55 ?4 1 104 11 92

    49 ?4 > > 10 121 120 101

    >2 92 95 9 112 100 10 99

    1> 1 24 4> 99 99 99 99

    1 21 2? ?? 99 99 99 99

    24 2? 5? 99 99 99 99 994> ?? 99 99 99 99 99 99

    99 99 99 99 99 99 99 99

    99 99 99 99 99 99 99 99

    99 99 99 99 99 99 99 99

    99 99 99 99 99 99 99 99

    a Fuminan"e 3uantiation matri/ !rominan"e 3uantiation matri/

    ;ig. 5 Cuantiation matri/

    699.2

    5

    43.1

    8

    55.2

    5

    72.1

    1

    24.0

    0

    -25.5

    1

    11.2

    1

    -

    4.14

    -

    129.7

    8

    -

    71.5

    0

    -

    70.2

    6

    -

    73.3

    5

    59.4

    3

    -

    24.0

    2

    22.6

    1

    -

    2.05

    85.7130.3

    2

    61.7

    8

    44.8

    7

    14.8

    4

    17.3

    5

    15.5

    1

    -

    13.1

    9

    -

    40.81

    10.1

    7

    -

    17.5

    3

    -

    55.8

    1

    30.5

    0

    -

    2.28

    -

    21.0

    0

    -

    1.26

    44 4 ? 5 1 -1 0 0-11 -? -5 -4 2 0 0 0

    ? 2 4 2 0 0 0 0

    - 1 -1 -2 1 0 0 0

    -9 -2 0 0 0 0 0 0

    4 0 1 -1 -1 0 0 0

    -1 -1 0 0 1 0 0 0

    0 -1 0 0 0 0 0 0

    aFu(v : D!$ "oei"ients Fqu(v : ter 3uantiation

    ;ig. ? n e/am)le o 3uantiation or a D!$ "oei"ients

    5

  • 8/13/2019 Jpeg notes jpeg...

    6/12

  • 8/13/2019 Jpeg notes jpeg...

    7/12

    E+ End o lo" 0(45 4(2 1(-0 0(-1? 2(1 0(0

    e gi&e anoter e/am)le. ;or te 3uantied &e"tor as ollows :

    5>( eigteen eroes( ( 0( 0( 0( 0( 2( tirt'-tree eroes( 95( E+

    $e J,EG Human "oding ma 15(0 2( 4(2 15(0 15(0 1(95 0(0

    15(0 is a s)e"ial "oded &alue wi" indi"ates tat tere are 1? "onse"uti&e eroes.

    + #i&&erence !oding o& #! !oe&&icients

    e"ause te D! "oei"ients "ontains a lot o energ'( it usuall' as mu" larger

    &alue tan ! "oei"ients( and we "an noti"e tat tere is a &er' "lose "onne"tion

    etween te D! "oei"ients o ada"ent lo"

  • 8/13/2019 Jpeg notes jpeg...

    8/12

    Hu&&man !oding

    Instead o storing te a"tual &alue ( te J,EG standard s)e"iies tat we store te

    minimum sie in its in wi" we "an (-?(-5(-4(4(5(?(> 000(001(010(011(100(101(110(111

    4 -15(...(-((...(15 0000(...(0111(1000(...(1111

    5 -1(...(-1?(1?(...1 00000(...(01111(10000(...(11111

    ? -?(...(-2(2(...? 000000(...(011111(100000(...(111111

    > -12>(...(-?4(?4(...(12> 0000000(...(0111111(1000000(...(1111111

    -255(..(-12(12(..(255 ...

    9 -511(..(-25?(25?(..(511 ...10 -102(..(-512(512(..(102 ...

    11 -204>(..(-1024(1024(..(204> ...

    ;ig. 9 $ale o te "ategor' and it-"oded &alues

    In "onse3uen"e or te )re&ious e/am)le o ! "oei"ients:

    0(5> 0(45 4(2 1(-0 0(- 2(1 0(0

    e en"ode onl' te rigt &alue o tese )airs as "ategor' and its or te &alue( e/"e)t

    te )airs tat are s)e"ial mar

  • 8/13/2019 Jpeg notes jpeg...

    9/12

    ...

    15810 1? 1111111111111110

    ;ig. 10 Human tale o luminan"e ! "oei"ients

    $e inal ste) is en"oding tis 'te using Human "oding. ;or e/am)le( i te

    Human "ode o 'te 0(? is 111000( and te Human "ode o 'te 4(5 is

    1111111110011001( and so on. $e inal stream o its written in te J,EG ile on

    dis< or te )re&ious e/am)le o ? "oei"ients is :

    1111000 1111001 ( 111000 101101 ( 1111111110011000 10111 (

    11111110110 00001 ( 1011 0111 ( 11100 1 ( 1010

    "ategor' "ode lengt "ode word

    0 2 00

    1 0102 011

    100

    4 101

    5 110

    ? 4 1110

    > 5 11110

    ? 111110

    9 > 1111110

    10 11111110

    ;ig. 11 Human tale o luminan"e D! "oei"ients

    #ow we "osider te en"oding o te dieren"e o D! "oei"ients. $e

    dieren"e will e re)resented ' "ategor' and its its or te &alue( and it will e

    Human en"oded onl' te "ategor' &alue. ;or e/am)le( i dieren"e is e3ual to -511(

    ten it will e re)resented as 9(000000000. I te Human "ode o 9 is 1111110( te

    stream o its written in te J,EG ile on dis< or te dieren"e is :

    1111110 000000000

    ;inall'( we "omine tis e/am)le o D! and to te )re&ious e/am)le o !s( or tis

    &e"tor wit ?4 "oei"ients( te inal stream o its written in te J,EG ile will e :

    1111110 000000000 ( 1111000 1111001 ( 111000 101101 (

    1111111110011000 10111 ( 11111110110 00001 ( 1011 0111 ( 11100 1 ( 1010

    2 !onclusions

    e a&e introdu"ed te asi" "om)ression metods o J,EG standard. ltoug

    tis standard as e"ome te most )o)ular image ormat( it still as some )ro)erties

    to im)ro&ement. ;or e/am)le( te new J,EG 2000 standard use wa&elet-ased

    "om)ression metod( and it "an o)erate at iger "om)ression ratio witoutgenerating te "ara"teristi" lo"

  • 8/13/2019 Jpeg notes jpeg...

    10/12

    J,EG standard.

    10

  • 8/13/2019 Jpeg notes jpeg...

    11/12

    0e&erences

    K1L 2004

    K2L $. "ar'a( . . *a'( 7Image ,ro"essing: ,rin"i)les and ))li"ations7( Jon

    ile' M 6ons( 2005( )).51-?.KL *. !. Gonole( *. E. oods( 6. F. Eddins( 7Digital Image ,ro"essing %sing

    =atla7( ,renti"e Hall( 2004.

    K4L G. . alla"e( $e J,EG 6till ,i"ture !om)ression 6tandard( !ommuni"ations

    o te !=( ol. 4( Issue 4( )).0-44.

    K5L !. !uturi"u( note aout te J,EG de"oding algoritm(

    a&ailale in tt):88www.o)ennet.ru8do"s8ormats8)eg.t/t( 1999.

    K?L I$%-$ *e"ommendation $.1( Digital "om)ression and "oding o "ontinuous-

    tone still images - *e3uirements and guidelines(

    a&ailale in tt):88www.itu.int8re"8$-*E!-$8eK>L $e Inde)endent J,EG Grou)( ! sour"e "ode o J,EG En"oder resear" ?(

    199.

    Simulation 0esults

    I1: +riginal image wit widt Wand eigtH

    C: En"oded )eg stream romI1

    I2: De"oded image rom C

    !om)ression ratio A sieoC 8 sieoI1

    *oot mean s3uare error A [ ]2

    1 2

    1 1

    ( ( 8 H W

    y x

    I x y I x y H W= =

    Cuantiation : 1 ( Downsam)ling : 444 Cuantiation : 1 ( Downsam)ling : 420

    !om)ression ratio : 0.04524

    *oot mean s3uare error : ?.

    !om)ression ratio : 0.059011

    *oot mean s3uare error : .0

    Cuantiation : 4 ( Downsam)ling : 444 Cuantiation : 4 ( Downsam)ling : 420

    !om)ression ratio : 0.0?14

    *oot mean s3uare error : 11.5?

    !om)ression ratio : 0.02>>

    *oot mean s3uare error : 12.4?

    ;rom te tale ao&e and te igure ne/t )age( we "an see tat te t')e 420 o

    downsam)ling "an de"rease te "om)ression ratio wit little &ision error( and te

    3uantiation le&el 4 "an also de"rease te "om)ression ratio ut generating te "lear

    "ara"teristi" lo"

  • 8/13/2019 Jpeg notes jpeg...

    12/12

    +riginal image : lena.m)

    !om)ression image :

    Cuantiation : 1 ( Downsam)ling : 444 Cuantiation : 1 ( Downsam)ling : 420

    Cuantiation : 4 ( Downsam)ling : 444 Cuantiation : 4 ( Downsam)ling : 420

    12