Click here to load reader

The LOCO-I Lossless image Compression Algorithm: Principles and Standardization into JPEG-LS

Embed Size (px)

DESCRIPTION

The LOCO-I Lossless image Compression Algorithm: Principles and Standardization into JPEG-LS. Authors: M. J. Weinberger, G. Seroussi, G. Sapiro Source : IEEE Transactions on Image Processing, Vol. 9, No. 8, August 2000, 1309-1324 Speaker: Chia-Chun Wu ( 吳佳駿 ) - PowerPoint PPT Presentation

Citation preview

  • The LOCO-I Lossless imageCompression Algorithm: Principlesand Standardization into JPEG-LS

    Authors: M. J. Weinberger, G. Seroussi, G. SapiroSource : IEEE Transactions on Image Processing, Vol. 9, No. 8, August 2000, 1309-1324Speaker: Chia-Chun Wu ()Date : 2004/10/20

    NCHU

  • Outline1. Introduction2. Example3. Modeler4. Regular mode5. Run mode6. Coded data 7. Result8. Conclusion9. Comments

    NCHU

  • 1. Introduction (1/2)LOCO-I (LOw COmplexity LOssless COmpression for Image) is the standard forlossless and near-lossless compression ofcontinuous-tone images, such as JPEG-LS.

    NCHU

  • 1. Introduction (2/2)Fig.1 JPEG-LSBlock diagram1100 0000

    NCHU

  • 2. ExampleFig.2 4 x 4 Example image data

    Index012345000000010009074742068504320520536864145145145145464100145145145

    RcRbRdRaIx

    NCHU

  • 3. Modeler3.1 Compute local gradients3.2 Local gradient quantization3.3 Quantized gradient merging3.4 Select the mode

    NCHU

  • 3.1 Compute local gradientsIx is the value of current sample in the image.Three gradients g1, g2, g3. g1 = Rd Rb g2 = Rb Rc g3 = Rc Ra

    Example 1 Example 2

    (g1,g2,g3)=( 0,81,-36)(g1,g2,g3)=( 0, 0, 0)

    RcRbRdRaIx

    64145145100145

    145145145145145

    NCHU

  • 3.2 Local gradient quantizationQ1, Q2, Q3 are region numbers of quantized local gradients.

    Example 1 Example 2 (g1,g2,g3) (Q1,Q2,Q3) (g1, g2, g3)=( 0,81,-36) (Q1,Q2,Q3)=( 0, 4, -4) (g1, g2, g3)=( 0, 0, 0) (Q1,Q2,Q3)=( 0, 0, 0)

    gi ( i = 1 to 3 )Qi ( i = 1 to 3 ) {0} 0 {1,2} 1 {3,4,5,6} 2 {7,8,...,20} 3 {21} 4

    NCHU

  • 3.3 Quantized gradient mergingIf the first non-zero element of vector (Q1,Q2,Q3) is negative, then (Q1,Q2,Q3) (-Q1,-Q2,-Q3) and SIGN set to 1, otherwise it set to +1.

    Example 1 Example 2 (Q1, Q2, Q3)=( 0, 4, -4) SIGN = +1 (Q1, Q2, Q3)=( 0, 0, 0) SIGN = +1

    Q1Q2Q300-2-43-100 001-322 2

    Q1Q2Q3SIGN00 2 -14-3 1 -100 0+101-3+122 2+1

    NCHU

  • 3.4 Select the modeIf quantized local gradients are not all zero, choose the regular mode.

    If Q1=Q2=Q3=0, go to the run mode.

    Example 1 Example 2 (Q1, Q2, Q3)=( 0, 4, -4) Reqular mode (Q1, Q2, Q3)=( 0, 0, 0) Run mode

    NCHU

  • 4. Regular model4.1 Compute the fixed prediction4.2 Adaptive correction4.3 Compute the prediction error4.4 Modulo reduction of the error4.5 Error mapping4.6 Compute the Golomb coding parameter k4.7 Golomb Code4.8 Mapped-error encoding4.9 Update the variables

    NCHU

  • 4.1 Compute the fixed predictionRa, Rb, Rc used to predict Ix.Px is predicted value for the sample Ix.

    Example 1

    min(Ra,Rb), if Rc max(Ra,Rb).max(Ra,Rb), if Rc min(Ra,Rb).Ra+RbRc, otherwise.{

    Px =Rc = 64min(100,145)100 Px = max(100,145) = 145

    Rc=64Rb=145Rd=145Ra=100Ix=145

    NCHU

  • 4.2 Adaptive correctionC = , C is the prediction of correction value.

    Example 1 B = -1, N = 2

    C = = -1

    To P23 Px = 145, SIGN = +1 Px = Px + C = 145 + (-1) = 144

    NCHU

  • 4.3 Compute the prediction errorErrval is the prediction error.

    Example 1 1. Errval = Ix Px.2. Errval = Errval, if SIGN = 1. Errval = Ix - Px = 145 144 = 1 Ix = 145 Px = 144 SIGN = +1

    NCHU

  • 4.4 Modulo reduction of the errorThe prediction error will be reduced to the range relevant for coding,-127~+128.

    Example 1 1. Errval = Errval + 256, if Errval < 0.1. Errval = Errval 256, if Errval 128.Errval = 1 (1 > 0 and 1 128) Errval = 1

    NCHU

  • 4.5 Error mapping (1/2)The prediction error, Errval will be mapped to a non-negative value.MErrval is the Errval mapped to non-negative integers in regular mode.

    Example 1 Errval = 1 (1 0) MErrval = 2 * 1 = 2

    NCHU

  • 4.5 Error mapping (2/2)

    Prediction error 0 -1 1 -2 2 -3 3 127 -128 0 1 2 3 4 5 6 254 255 Mapped value

    NCHU

  • 4.6 Compute the Golomb coding parameter k

    K is the Golomb coding parameter for regular mode. k = min {k|2k * N A}

    Example 1

    N = 2, A = 64 2k * 2 64 2k 32 k = 5

    NCHU

  • 4.7 Golomb Code (1/3)A formula MErrval = q * m + rA parameterm (m = 2k)Two partsunary code (q) and modified binary code (r)Example MErrval = 13, k = 2 m = 22 = 4 13 = 3 x 4 + 1 q = 3, r = 1 unary code=3, modified binary code=1 unary code=000, modified binary code=01 000101

    NCHU

  • 4.7 Golomb Code (2/3)Table. Golomb code for m = 4 (k=2).

    nqrCodewordnqrCodeword000 100820 00100101 101921 00101202 1101022 00110303 1111123 00111410 01001230 000100511 01011331 000101612 01101432 000110713 01111533 000111

    NCHU

  • 4.7 Golomb Code (3/3)Properties - n code length - one pass encoding - without to store the code tables - Golomb code are optimal for one sided geometric distributions of nonnegative integers

    NCHU

  • 4.8 Mapped-error encodingExample 1 k = 5 m = 2k = 25 = 32

    MErrval = 2 2 = q * m + r = 0 * 32 + 2 q = 0, r = 2 unary code= 0, modified binary code=2 unary code= null, modified binary code=00010 100010

    NCHU

  • 4.9 Update the variables (1/2)The variables A, B and N are updated according to the current prediction error.A, B are counters for the accumulated prediction error.N is counter for frequency of occurrence of the context.

    NCHU

  • 4.9 Update the variables (2/2)The variables before encoding are A = 64, B = -1, N = 2 .

    The variables after updating areExample 1: Errval = 1A = A + | Errval | = 64 + 1 = 65. B = B + Errval = -1 + 1 = 0. N = N + 1 = 2 + 1 = 3.To P13

    NCHU

  • 5. Run model5.1 Run scanning 5.2 Run-length coding

    NCHU

  • 5.1 Run scanningRUNval is the value of repetitived sample.RUNcnt is the value of repetitived sample count for run mode.

    Example 2 RUNval = Ra = 145 Ix = 145 = RUNval RUNcnt = 2{RUNval = Ra;while (Ix == RUNval) { RUNcnt = RUNcnt + 1;}

    145145145145145145145

    NCHU

  • 5.2 Run-length codingRUNcnt is the value represents the run-length.

    Example 2 RUNcnt = 2 11

    {while (RUNcnt >0) { Append 1 to bit stream; RUNcnt = RUNcnt 1; }

    NCHU

  • 6. Coded dataTable. Coded segment.PS:The last five bits in the above table are padding with 0.

    BinaryHexadecimal1100 00000000 00000000 0000 0110 1100C0 00 00 6C1000 00000010 00001000 11100000 000180 20 8E 011100 00000000 00000000 00000101 0111C0 00 00 570100 00000000 00000000 00000000 111040 00 00 6E1110 01100000 00000000 00000000 0001E6 00 00 011011 11000001 10000000 00000000 0000BC 18 00 000000 01011101 10000000 00000000 000005 D8 00 001001 00010110 0000 91 60

    NCHU

  • 7. Results (1/2)Table Compression Results On ISO/IEC 10918-1 Image Test Set (In Bits/Sample)

    ImageLOCO-IJPEG-LSBalloon2.682.67Barb 13.883.89Barb 23.994.00Board3.203.21Boats3.343.34Girl3.393.40Gold3.923.91Hotel3.783.80Zelda3.353.35Average3.503.51

    NCHU

  • 7. Results (2/2) Table Compression Results On New Image Test Set (In Bits/Sample)

    ImageLOCO-IJPEG-LSLosslessJPEGHuffmanLosslessJPEGarithmCALICarithmLOCO-A(arithm)bike3.593.364.063.923.503.54cafe4.804.835.315.354.694.75woman4.174.204.584.474.054.11tools5.075.085.425.474.955.01bike34.374.384.674.784.234.33cats2.592.613.322.742.512.54water1.791.812.361.871.741.75finger5.635.666.115.855.475.50us2.672.633.282.522.342.45chart1.331.322.141.451.281.18chart_s2.742.773.443.072.662.65compound11.301.272.391.501.241.21compound21.351.332.401.541.241.25aerial24.014.114.494.143.833.58Faxballs0.970.901.740.840.750.64Gold3.923.914.104.133.833.85hotel3.783.804.064.153.713.72Average3.183.193.763.403.063.06

    NCHU

  • 8. ConclusionLOCO-I/JPEG-LS significantly outperforms other schemes of comparable complexity (e.g.,JPEG-Huffman), and it attains compression rations similar or superior to those of higher complexity schemes based on arithmetic coding (e.g.,JPEG-Arithm, CALIC Arithm).

    LOCO-I performed within a few percentage points of the best available compression ratios (given, in practice, by CALIC), at a much lower complexity level.

    NCHU

  • 9. CommentsJPEG-LS

    NCHU

  • The end

    Thank you!!

    NCHU

    The LOCO-I Lossless image Compression AlgorithmPrinciples and Standardization into JPEG-LSLOCO-IPaperJPEG-LSJPEG-LS(M. J. Weinberger, G. Seroussi, G. Sapiro)IEEE Transaction. On Image Processing20008Speaker

    NTIT IMD(1) LOCO-I(2) 4x4(3) JPEG-LS(4) 4x4JPEG-LS(5) Paper(6) Comment

    NTIT IMD1.(1/2)(1) LOCO-I (LOw COmplexity LOssless COmpression for Image ) JPEG-LS(2) HP JPEG-LSLOCO-IJPEG-LS(CALIC)(3)JPEG-LSJPEG(DPCM) JPEG-LS(heuristics)(edges)

    lossless () near-lossless ()

    NTIT IMD1.(2/2)(1) JPEG-LS(2) JPEG-LS (Modeler)(Coder)(3) (Image Sample)(Gradients) (Flat Region)(4) (5) (Image Sample)(Compressed bitstream)

    NTIT IMD2.(1) 2JPEG-LS4x4(2) 4x4(3) 4x4 4RaRb RcRd(4) 4x4145(regular mode) 145(Run mode)(5) When encoding the first line of an image component, the samples at positions Rb, Rc, and Rd are not present, and their reconstructed values are defined to be zero. If the sample at position Ix is at the start or end of a line so that either Ra and Rc, or Rd is not present, the reconstructed value for a sample in position Ra or Rd is defined to be equal to Rb, the reconstructed value of the sample at position Rb, or zero for the first line in the component. The reconstructed value at a sample in position Rc, in turn, is copied for lines other than the first line) from the value that was assigned to Ra when encoding the first sample in the previous line.

    NTIT IMD3.3.1 3.2 3.3 3.4

    NTIT IMD3.1.(1) (2) Ix(3) RaRbRcRd(Ix)(4) (g1g2g3)RaRbRcRd 1. g1 = Rd Rb 1. g2 = Rb Rc 2. g3 = Rc Ra(5) Example1Ra = 100Rb = 145Rc = 64Rd = 145 g1 = Rd Rb = 145 145 = 0 g2 = Rb Rc = 145 64 = 81 g3 = Rc Ra = 64 100 = 36

    Example2Ra = 145Rb = 145Rc = 145Rd = 145 g1 = Rd Rb = 145 145 = 0 g2 = Rb Rc = 145 145 = 0 g3 = Rc Ra = 145 145 = 0

    NTIT IMD3.2.(1) (g1,g2,g3)(2) Q1,Q2,Q3(3) Example1g1 = 0g2 = 81g3 =-36 Q1 = 0 Q2 = 4Q3 = -4 Example2g1 = 0g2 = 0g3 = 0 Q1 = 0 Q2 = 0Q3 = 0

    NTIT IMD3.3. (2) SIGN(3) 0Qi(Q1,Q2,Q3)(-Q1,-Q2,-Q3) SIGN-1SIGN+1(4) Example1 Q1 = 0 Q2 = 4Q3 = -4 Q1 = 0 Q2 = 4Q3 = -4 , SIGN = +1 Example2 Q1 = 0 Q2 = 0Q3 = 0 Q1 = 0 Q2 = 0Q3 = 0 , SIGN = +1

    NTIT IMD3.4.(1) 0(Regular mode)(2) 0(Run mode)(3) Example1Q1 = 0 Q2 = 4Q3 = -4 (Regular mode) Example2 Q1 = 0 Q2 = 0Q3 = 0 (Run mode)

    NTIT IMD4.4.1 4.2 4.3 4.4 4.5 Mapping4.6 Golomb CodesJPEG-LS4.7 Golomb codingk4.8 Mapping

    NTIT IMD4.1.(1/2)(1) (2) RaRbRcIx(3) PxIx(4) PxRaRbRc 1. Px = min(Ra,Rb) ,if Rc max(Ra,Rb). 1. Px = max(Ra,Rb) ,if Rc min(Ra,Rb). 2. Px = Ra+RbRc ,otherwise.(5) Example1Ra = 100Rb = 145Rc = 64 Rc = 64 min(100,145) 100 Px = max(100,145) = 145

    NTIT IMD4.2.(1) (Px) (2) CPx(3) CBN(BN23~24) 1. Px = Px + C,if SIGN = +1. 1. Px = Px - C ,if SIGN = -1.(4) BNC Example1B = -1N = 2 C = [B/N] = [-1/2] = -1 Px = 145SIGN = +1 Px = Px + C = 145 + (-1) = 144

    NTIT IMD4.3.(1) (Errval)(Px)(Ix)(2) Errval(3) ErrvalIxPx 1. Errval = Ix - Px 1. Errval = -Errval ,if SIGN = -1.(4) IxPxSIGN Errval Example1Ix = 145Px = 144SIGN = +1 Errval = Ix - Px = 145 144 = 1

    NTIT IMD4.4.(1) (Errval)-127~+128(2) Errval 1. Errval = Errval +256, if Errval < 0. 1. Errval = Errval - 256, if Errval 128.(3) Errval, Errval Example1Errval = 1 (1 > 0 and 1 128) Errval = 1NTIT IMD4.5.Mapping(1/2)(1) (Errval)Mapping(2) MErrvalMapping(Errval)(3) ErrvalMapping 1. MErrval = 2 * Errval , if Errval 0. 1. MErrval = -2 * Errval - 1,if Errval < 0.(4) Errval, Mapping(Errval) Example1Errval = 1 (1 0) MErrval = 2 * 1 = 2NTIT IMD4.5.Mapping(2/2)(1) Mapping-128+127Mapping0255

    NTIT IMD4.6.Golomb Codek(1) kGolomb Code(2) k 1. k = min{k|2k * N A}. ps:k2k * N A(3) AN(AN25~26) Golomb Codek Example1N = 2, A = 64 2k * 2 64 2k 32 k = 5

    NTIT IMD2.Golomb Code(1/3)(1) Golomb CodeJPEG-LS(2) n = q * m + r(3) m (m 2k) n m qn/m rn/m (4) Golomb Codes(unary code)(modified binary code )(5) qr1 q550 q0 k4r4(6) (n)13(k)2 (1) k=2 => m = 2 ^ 2 = 4 (2) 13 / 4 = 3 1 q = 3, r = 1 (3) q = 3 000 (4) r = 1, k = 2 01 (5) Golomb Codes 000101NTIT IMD2.Golomb Code(2/3)(1) n 015 k 2Golomb Code

    NTIT IMD2.Golomb Code(3/3)Golomb Code(1) (n)(2) (3) (4) Golomb code

    NTIT IMD4.8.MappingMErrval(1) MappingMErrvalGolomb Code Golomb Code(2) KMErrval Example1k = 5 m = 2k = 25 = 32 MErrval = 2 2 = q * m + r = 0 * 32 + 2 q = 0, r = 2 unary code=0 , modified binary code=2 unary code=null, modified binary code=00010 100010

    NTIT IMD4.9.(1/2)(1) (Errval)ABN(2) AB(Errval) A(Errval)(3) N(context)(4) ABN 1. A = A + | Errval |. 1. B = B + Errval. 2. N = N + 1.

    NTIT IMD4.9.(2/2)(1) ABN A = 64, B = -1, N = 2(2) ABN ABNErrval Example1Errval = 1 A = A + | Errval | = 64 + 1 = 65. B = B + Errval = -1 + 1 = 0. N = N + 1 = 2 + 1 = 3.

    NTIT IMD5.5.1 Run scanning5.2 Run-length coding

    NTIT IMD5.1.Run scanning(1) Run scanning(2) RUNval(3) RUNcnt(4) (RUNcnt) 1. RUNval = Ra; 1. while (Ix == RUNval) { RUNcnt = RUNcnt + 1; } (5) (RUNcnt) Example2Ra = 145 RUNval = Ra = 145 Ix = 145 = RUNval RUNcnt = 2

    NTIT IMD5.2.Run-length coding(1) Run-length coding(2) RUNcnt(run-length)(4) (RUNcnt) 1. while (RUNcnt >0) { Append 1 to bit stream; RUNcnt = RUNcnt 1; } (5) (RUNcnt) Example2RUNcnt = 2 11

    NTIT IMD6.Coded data(1) 4x4Golomb CodeRun-length(2) 5bits08Bits

    NTIT IMD7.(1/2)(1) 9LOCO-IJPEG-LS

    NTIT IMD7.(2/2) 17LOCO-IJPEG-LS JPEG-LS(2) JPEG-LSCALIC8

    NTIT IMD8.(1) LOCO-IJPEG-LSJPEG-Huffman JPEG-Arithm, CALIC Arithm (2) LOCO-I CALIC

    NTIT IMDNTIT IMD

    NTIT IMD