Exercise 7a: Additional Intra Prediction Modes Implement Additional Block Prediction Modes Add the following two modes (in addition to DC mode) vertical prediction (see figure & lecture) horizontal prediction (see figure & lecture) Use 128 for non-available border samples vertical horizontal Entropy Coding of Prediction Mode Add entropy encoding and decoding of mode (new functions) mode codeword Use shown table with two additional probability models DC 0 one for first bin, another for second bin hor 1 0 ver 1 1 Test Your Implementation Select prediction mode for each block randomly in encoder Encode/decode prediction mode at start of block Check whether decoder produces correct result Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding
Exercise 7b: Preparation for Mode Decision – Estimate Bits Goal : Implement a function for estimating the number of bits that would be written for a block Implementation (encoder only) Function should return the total number of bits that would be written for a block the bitstream must not be modified actual entropy coding (incl. arithmetic coding) for the block should be taken into account Total number of bits can be estimated as follows: Each bypass coded bin produces 1 bit The bits for a regular coded bin can be estimated using ArithEncoder::getEstBits( probModel ) Testing the Implementation Verify that calling the function does not result in a different bitstream Use the implemented function for estimating the total number of bits written for an image (function calls have to be interleaved with the actual entropy coding for the blocks) Compare that number to the size of the bitstream (without header) — should be similar Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding
Exercise 7c: Preparation for Mode Decision – Distortion Goal : Implement a function for calculating SSD distortion that would be obtained for a block Implement the following processing for each block (encoder only) 1 Intra prediction (DC prediction) and determination of prediction error 2 Transform (of prediction error) and quantization 3 Dequantization and inverse transform 4 Reconstruction (add prediction signal) 5 Calculate SSD distortion (new function) � 2 � � s [ x , y ] − s ′ [ x , y ] D = x , y Testing the Implementation Verify that the modified processing does not result in a different bitstream Calculate the PSNR based on the sum of the calculated SSD distortions D Compare the PSNR with the PSNR that is calculated by the PSNR tool Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding
Exercise 7d: Multiple Prediction Modes + Lagrangian Mode Decision Goal : Improve coding efficiency by block-adaptive selection of prediction mode Encoder processing for each block Set Lagrange multiplier according to λ = 0 . 1 · ∆ 2 (you may try other factors) Check all prediction modes m (DC, horizontal vertical): 1 Test encoding/decoding and determine distortion D m (exercise 7a, 7c) 2 Determine number of required bits R m , which is the sum of bits for coding of quantization indexes (exercise 7b) bits for coding of prediction mode (new function similar to exercise 7b, using coding of exercise 7a) 3 Calculate Lagrangian cost J m = D m + λ · R m Selection prediction mode m with minimum cost J m and perform final encoding using this mode Testing the Implementation Run coding experiments for 2-3 images (QPs = 8,12,16,20,24,28) Plot PSNR-rate curves in comparison to version of last week (DC prediction only) Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding
Recommend
More recommend