exercise 5a first prediction between transform blocks
play

Exercise 5a: First Prediction between Transform Blocks DC Prediction - PowerPoint PPT Presentation

Exercise 5a: First Prediction between Transform Blocks DC Prediction ( Goal : utilization of dependencies between blocks) Predict mean value of block using already coded and reconstructed neighboring samples reconstructed border Generation of


  1. Exercise 5a: First Prediction between Transform Blocks DC Prediction ( Goal : utilization of dependencies between blocks) Predict mean value of block using already coded and reconstructed neighboring samples reconstructed border Generation of Prediction Signal Implement a class for intra prediction with DC prediction being one method (note: we will add more prediction modes later) DC prediction: Generate prediction signal for a current block, with all current samples being set to mean of left and top border samples block Special cases: Only one border available: Use mean of that border No border available: Use 128 as mean value Integration into Codec Encoder : Subtract prediction signal (instead of 128) before forward transform Decoder : Add prediction signal (instead of 128) after inverse transform Run simulations to check whether DC prediction improves coding efficiency Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  2. Exercise 5b: Improved Coding of Zero Levels at High-Frequency Positions Goal : Efficient representation of zero levels for high frequency components code for 4 × 4 blocks New Concept for Coding Block of Quantization Indexes value codeword 1 coded block flag (cbf): Single bit specifying whether block includes non-zero levels 0 0 1 1 1 2 last position : x and y coordinate for last non-zero position 2 1 0 0 in scanning order (use diagonal scan) 3 1 0 1 3 actual levels : quant. indexes in scanning order (up to last position) code for 8 × 8 blocks Coding Coded Block Flag and X/Y Coordinates of Last Position value codeword Restrict block size to integer powers of 2 (add check in encoder) 0 0 Add methods for coding cbf and x/y to EntropyEncoder and EntropyDecoder 1 1 1 2 1 01 0 Use following code for x and y coordinates (see examples): 3 1 01 1 first bit signaling whether the coordinate is zero 4 1 00 00 5 1 00 01 modified Exp-Golomb code for remainder (prefix + suffix) 6 1 00 10 last bit of unary prefix part is not transmitted if it can be inferred 7 1 00 11 to be equal to one (we know the maximum value = block size - 1 !) Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  3. Exercise 5c: Modified Coding of Quantization Indexes Goal : Improve coding efficiency for quantization indexes modified code Prepare the integration of adaptive arithmetic coding value codeword (s = sign) 0 0 ± 1 1 0 s Modified Entropy Code ± 2 1 1 1 s Modify coding of levels in EntropyEncoder and EntropyDecoder ± 3 1 1 01 0 s ± 4 1 1 01 1 s The modified code consists of the following parts: ± 5 1 1 001 00 s ± 6 1 1 001 01 s sig flag: (new) Indicating whether levels unequal to zero ± 7 1 1 001 10 s gt1 flag: (new) Indicating whether abs. value is greater than one ± 8 1 1 001 11 s ± 9 1 1 0001 000 s remainder: Absolute values minus 2 using Exp-Golomb code ± 10 1 1 0001 001 s (consisting of unary prefix and fixed-length suffix) ± 11 1 1 0001 010 s ± 12 1 1 0001 011 s sign flag: Indicating whether level is negative ± 13 1 1 0001 100 s ± 14 1 1 0001 101 s ± 15 1 1 0001 110 s Combination with Exercise 5b ± 16 1 1 0001 111 s ± 17 1 1 00001 0000 s For last position (indicated by x , y ) we know that sig flag = 1 ± 18 1 1 00001 0001 s · · · · · · Do not code sig flag for last position Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  4. Exercise 5d: Integration and Testing Integration DC prediction (exercise 5a) Encoder operation per block Modified entropy coding 1 Predict block (DC) (ex. 5a) 2 Subtract prediction signal (ex. 5a) coded block flag (exercise 5b) 3 Transform + Quantization last position (exercise 5b) 4 Entropy coding (ex. 5b, 5c) levels up to last position (exercise 5c) Testing and Evaluation Decoder operation per block Select at least 3 different test images 1 Predict block (DC) (ex. 5a) Generate rate-PSNR curves by running codec 2 Entropy decoding (ex. 5b, 5c) with different QP values { 8 , 12 , 16 , 20 , 24 } 3 Dequantization + Inverse transform measure rate and PSNR (using PSNR tool) 4 Add prediction signal (ex. 5a) 5 Clip to 8-bit range [ 0 ; 255 ] Use different block sizes { 4 , 8 , 16 , 32 } Compare curves to JPEG (see git repository) Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  5. Next Exercise (Outlook): Integration of Binary Arithmetic Coding syntax elements bins bits entropy encoder binary arithmetic bitstream (codeword tables) encoding engine probability model index Main Changes Bits of codewords are not directly written to bitstream Bins are processed by binary arithmetic coding engine (which writes final codeword) Adaptive Binary Arithmetic Coding Efficient coding of binary decisions (bins) based on associated probability models { p 0 , 1 − p 0 } Use adaptive probability models Probability p 0 is updated after each coding of a bin Need to associate each bin (bit of a codeword) with a probability model Need to maintain set of adaptive probability models (in EntropyEncoder and EntropyDecoder ) Arithmetic coder includes non-adaptive bypass mode (using probabilities p 0 = p 1 = 0 . 5) Sufficient for rarely coded bins Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  6. Next Exercise (Outlook): Basic Interfaces of Arithmetic Encoder/Decoder # ----- binary arithmetic encoding ----- # ----- binary arithmetic encoding ----- class ArithEncoder : class ArithDecoder : # constructor : # constructor : # - uses class OBitstream for output # - uses class IBitstream for input def __init__( self , bitstream ): def __init__( self , bitstream ): # adaptive coding: # adaptive coding: # - encodes binary decision (bin) # - decodes binary decision (bin) # using specified probability model # using specified probability model # - updates probability model # - updates probability model # based on value of bin # based on value of decoded bin def encode( self , bin , probModel ): # - returns value of decoded bin def decode( self , probModel ): # bypass coding: # (1) encodes bin in bypass mode # bypass coding: # (2) multiple bins in bypass mode # (1) decodes bin in bypass mode def encodeEP( self , bin ): # - returns bin def encodeEPs( self , pattern , numBins ): # (2) multiple bins in bypass mode # - returns bin pattern # finalization of arithmetic codeword: def decodeEP( self ): # - finalization of codeword def decodeEPs( self , numBins ): # - write remaining bits to bitstream def finalize( self ): Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

  7. Next Exercise (Outlook): Assignment of Probability Models Adaptive Probability Models (8 in total) x/y for 4 × 4 blocks code for levels value codeword (s = sign) 1 coded block flag value codeword 0 0 0 0 X coordinate of last position ± 1 1 0 s 1 1 1 ± 2 1 1 1 s 2 1 0 0 2 first bin (indicating whether x > 0) ± 3 1 1 01 0 s 3 1 0 1 3 all bins of prefix part of mod. Exp-Golomb code ± 4 1 1 01 1 s ± 5 1 1 001 00 s Y coordinate of last position ± 6 1 1 001 01 s x/y for 8 × 8 blocks ± 7 1 1 001 10 s 4 first bin (indicating whether y > 0) ± 8 1 1 001 11 s value codeword ± 9 1 1 0001 000 s 5 all bins of prefix part of mod. Exp-Golomb code 0 0 ± 10 1 1 0001 001 s 1 1 1 ± 11 1 1 0001 010 s Values of quantization indexes 2 1 01 0 ± 12 1 1 0001 011 s 3 1 01 1 6 significance bin (indicating whether | q | > 0) ± 13 1 1 0001 100 s 4 1 00 00 ± 14 1 1 0001 101 s 7 greater-than-1 bin (indicating whether | q | > 1) 5 1 00 01 ± 15 1 1 0001 110 s 6 1 00 10 ± 16 1 1 0001 111 s 8 all bins of prefix part of Exp-Golomb code 7 1 00 11 ± 17 1 1 00001 0000 s ± 18 1 1 00001 0001 s · · · · · · All other bins (suffix parts, sign) are coded in bypass mode Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding

Recommend


More recommend