Image and Video Coding: Encoder Control
D = -λ R d
D R
Image and Video Coding: Encoder Control D D = - R d R Problem - - PowerPoint PPT Presentation
Image and Video Coding: Encoder Control D D = - R d R Problem Statement / Scope of Image and Video Coding Standards Image and Video Coding input output pre- bitstream post- image/video image/video processing processing encoder
D = -λ R d
D R
Problem Statement / Scope of Image and Video Coding Standards
scope of standards
pre- processing image/video encoder image/video decoder post- processing
input samples bitstream
samples
1 Bitstream syntax
2 Decoding process
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 2 / 35
Problem Statement / Coding Efficiency
max
— Image and Video Coding: Encoder Control 3 / 35
Problem Statement / Coding Efficiency
35 36 37 38 39 40 41 1000 2000 3000 4000 5000 codec B codec A RB RA example target quality ( 39 dB ) PSNR [dB] bit rate [kbit/s] 10 20 30 40 50 60 70 36 37 38 39 40 41 BBA = (RA - RB) / RA target quality ( 39 dB ) example bit rate saving of codec B vs. codec A bit-rate saving [%] PSNR [dB]
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 4 / 35
Problem Statement / Impact of Encoder Control
syntax & decoding process
samples bitstream reconstructed samples
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 5 / 35
Problem Statement / Impact of Encoder Control
93 46 24 4 2 1 3 4 37 4 4 3 1 2 6 14 4 2 3 2 3 3 1 7 3 1 3 1 2 3 1 2 1 4 3 2 4 2 1 2 1 1 3 1 1 1 2 2 1 2 1 2 1 3 1 excerpt of MPEG-2 table (run, level) codeword (s = sign) (eob) 10 (0, ±1) 11s (0, ±4) 0000 110s (0, ±5) 0010 0110 s (0, ±9) 0000 0001 1101 s (1, ±2) 0001 10s (3, ±1) 0011 1s (escape) 0000 01 (+18 bits) note: there is no (32, ±1) pair
simple rounding: qk = round uk ∆
∆ = 10
9 5 2 0 4 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
run-level pairs (absolute levels): (0,9) (0,5) (0,4) (0,1) (1,2) (3,1) (32,1) (eob) distortion (SSD): D1 =
(uk − ∆·qk)2 = 371 number of bits: R1 = 13 + 9 + 8 + 3 + 7 + 6 + 24 + 2 R1 = 72 bits run-level pairs (absolute levels): (0,9) (0,5) (0,4) (0,1) (1,2) (3,1) (eob) distortion (SSD): D2 =
(uk − ∆·qk)2 = 391 (- 0.23 dB) number of bits: R1 = 13 + 9 + 8 + 3 + 7 + 6 + 2 R2 = 48 bits (- 33.3 %)
alternative quantization method
quantization step size
∆ = 10
9 5 2 0 4 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 6 / 35
Problem Statement / Impact of Encoder Control
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 7 / 35
Problem Statement / Impact of Encoder Control
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 8 / 35
Lagrangian Encoder Control / Encoding Problem
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 9 / 35
Lagrangian Encoder Control / Encoding Problem
∀ b∈B
v(b)
v(b) :
v) :
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 10 / 35
Lagrangian Encoder Control / Lagrangian Optimization
p
λ = arg min p
λ is an optimal solution, {p∗ λ} ⊆ {popt}
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 11 / 35
Lagrangian Encoder Control / Lagrangian Optimization
λ for a particular value of λ, with λ ≥ 0
λ) + λ · R(p∗ λ)
λ) ≥ λ ·
λ) − R(p)
λ),
λ)
λ is a solution of the constrained problem
λ = arg min p
λ)
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 12 / 35
Lagrangian Encoder Control / Lagrangian Optimization
D = -λ R d solution of constrained problem solution of unconstrained problem convex hull tangent with slope -λ
d (1+λ2)0.5 solution of unconstrained problem convex hull tangent parallel to R-axis
λ} lies on convex hull of area of all possible rate-distortion points
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 13 / 35
Lagrangian Encoder Control / Lagrangian Bit Allocation
0, p∗ 1, · · · } = arg
p0,p1,···
k = min pk
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 14 / 35
Lagrangian Encoder Control / Lagrangian Bit Allocation
D R subset A subset B subset C subset D subset E convex hull D R not optimal
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 15 / 35
Lagrangian Encoder Control / Lagrangian Bit Allocation
k = arg min pk
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 16 / 35
Optimized Image and Video Encoders / Overview
pk
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 17 / 35
Optimized Image and Video Encoders / Overview
k
k
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 18 / 35
Optimized Image and Video Encoders / Mode Decision
k = arg min c∈Ck Dk(c | pk(c), · · · ) + λ · Rk(c | pk(c), · · · )
current video picture each block can be coded in one of multiple supported coding modes: intra coding motion-compensated prediction ...
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 19 / 35
Optimized Image and Video Encoders / Mode Decision
1 Check intra coding mode
2 Check inter coding mode
3 Check additional coding modes (if supported) 4 Choose coding mode m ∈ {intra, inter, · · · } that minimizes
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 20 / 35
Optimized Image and Video Encoders / Motion Estimation
m
reconstructed reference picture block in current picture
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 21 / 35
Optimized Image and Video Encoders / Quantization
k)2 =
k)2
k = ∆ · qk
N−1
N−1
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 22 / 35
Optimized Image and Video Encoders / Quantization
q∈QN D(q) + λ · R(q)
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 23 / 35
Optimized Image and Video Encoders / Quantization / Rate-Distortion Optimized Quantization
q∈QN D(q) + λ · R(q)
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 24 / 35
Optimized Image and Video Encoders / Quantization / Rate-Distortion Optimized Quantization
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 25 / 35
Optimized Image and Video Encoders / Quantization / Rate-Distortion Optimized Quantization
k
1 qk = 0
2 qk = 0
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 26 / 35
Optimized Image and Video Encoders / Quantization / Toy Example: RDOQ for Run-Level Coding
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 27 / 35
Optimized Image and Video Encoders / Quantization / Toy Example: RDOQ for Run-Level Coding
RDOQ algorithm for run-level coding tk qk,i (q0, · · · , qk) distortion D number of bits R D + λR 36 3 {3} 62 = 36 R(0, 3) = 6 96 discard 4 {4} 42 = 16 R(0, 4) = 8 96 −8 {4, 0} 16 + 82 = 80 8+? = ? ? [ incomplete ] −1 {4, −1} 16 + 22 = 20 8 + R(0, 1) = 11 130 12 1 {4, 0, 1} 80 + 22 = 84 8 + R(1, 1) = 12 204 discard {4, −1, 1} 20 + 22 = 24 11 + R(0, 1) = 14 164 7 {4, −1, 1, 0} 24 + 72 = 73 14+? = ? ? [ incomplete ] 1 {4, −1, 1, 1} 24 + 32 = 33 14 + R(0, 1) = 17 203 −2 {4, −1, 1, 0, 0} 73 + 22 = 77 14+? = ? ? [ incomplete ] {4, −1, 1, 1, 0} 33 + 22 = 37 17+? = ? ? [ incomplete ] 6 {4, −1, 1, 0, 0, 0} 77 + 62 = 113 14 + R(eob) = 16 273 {4, −1, 1, 1, 0, 0} 37 + 62 = 73 17 + R(eob) = 19 263 choose 1 {4, −1, 1, 0, 0, 1} 77 + 42 = 93 14 + R(2, 1) + R(eob) = 21 303 {4, −1, 1, 1, 0, 1} 37 + 42 = 53 17 + R(1, 1) + R(eob) = 23 283 MPEG-2 code (s=sign) (run, level) codeword (0, ±1) 11s (0, ±3) 0010 1s (0, ±4) 0000 110s (1, ±1) 011s (2, ±1) 0101 s (eob) 10
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 28 / 35
Optimized Image and Video Encoders / Quantization / Toy Example: RDOQ for Run-Level Coding
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 29 / 35
Optimized Image and Video Encoders / Quantization / Low-Complexity Quantization Improvement
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 30 / 35
Optimized Image and Video Encoders / Quantization / Comparison of Quantization Methods
38 39 40 41 42 43 44 5 10 15 20 25 30 rounding (fk = 0.5) fk = 0.2 RDOQ PSNR (Y) [dB] bit rate [Mbit/s] Kimono (1920×1080, 24 Hz) 10 20 30 40 50 38 39 40 41 42 43 44 RDOQ vs fk=0.5 (avg. 21 %) fk=0.2 vs fk=0.5 (avg. 16 %) bit-rate saving [%] PSNR (Y) [dB] Kimono (1920×1080, 24 Hz)
1 Quantization with simple rounding (fk = 0.5) 2 Rate-distortion optimized quantization 3 Experimentally optimized rounding offset
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 31 / 35
Optimized Image and Video Encoders / Selection of Lagrange Multiplier
k}∗ = arg min c∈C QP∈Q
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 32 / 35
Optimized Image and Video Encoders / Selection of Lagrange Multiplier
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 33 / 35
Optimized Image and Video Encoders / Coding Efficiency
36 37 38 39 40 41 42 43 44 5 10 15 20 25 30 Test Model 5 (TM5)
PSNR (Y) [dB] bit rate [Mbit/s] Kimono (1920×1080, 24 Hz) 10 20 30 40 50 36 37 38 39 40 41 42 43 44
bit-rate saving vs TM5 [%] PSNR (Y) [dB] Kimono (1920×1080, 24 Hz)
1 Lagrangian mode decision 2 Lagrangian motion estimation 3 Lagrangian quantization (RDOQ)
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 34 / 35
Summary
Heiko Schwarz (Freie Universität Berlin) — Image and Video Coding: Encoder Control 35 / 35