SlideShare uma empresa Scribd logo
1 de 66
Baixar para ler offline
Post Processing Deblocking Filter
Shereef Shehata
Blocking artifacts
• Picture coding/comprssion standards such as JPEG and MPEG
are based on block-based discrete cosine transform.
• Thus, a loss of quality might occur in an encoded image such
as blocking or ringing artifacts.
• Blocking artifacts or “MacroBlocking” are most visible on fast
moving images such as sports or action scenes.
Origin of blocking artifacts
Two components can be the source of blocking artifacts:
• The most significant source is the block-based Discrete Cosine
Transform (DCTs) in intra and inter frame prediction coding.
Coarse Quantization of the transform coefficients can cause
visually disturbing discontinuities at the block boundaries.
• The second source of blocking artifact is motion compensated
prediction.
Motion compensated blocks are generated by copying
interpolated pixel data from different locations of possibly
different reference frames.
In fact, in the copying process, existing edge discontinuties in
reference frames could be carried into the interior of the block to
be compensated. (Does this apply to mpeg-2?)
Blocking artifacts within the blocks
• Blocking artifacts will be propagated within the block as a
result of motion compensation.
• These artifacts will be more visible within the flat regions than
the complex detailed regions.
• This implies that smoothing the flat regions should cover the
inside of the block as well as the outside of the block.
• Practical aspects of implementing something to detect what
happen to the pixels within the block is difficult.
• H264 specs almost touches all luma pixels, as it filters two
pixels on each side of the 4x4 boundary.
• In MPEG-2, the block is 8x8 and it is not clear how to check
what happened within the block, as opposed to the edges.
Post-processing deblocking filter
• In post-processing approach: The deblocking filter operates
on the display buffer outside of the coding loop.
• In the post-processing approach, the frame is first decoded
into a reference frame buffer. The deblocking filter is then
applied on the decoded pixel values.
• An additional frame storage may be needed to store the
filtered frame to be passed to the display device.
• This is one of the reasons that H.264 and H.263+ have
proposed to use the deblocking filter within the coding loop.
Other reasons for including the deblocking filter within the
loop is the fact that performing motion compensation on the
filtered values produces better results.
MPEG-2 Quantization in the encoder
• When the DCT is computed for a block, the coefficients for
high spatial frequencies are represented with less precision.
This is done through Quantization.
• DCT coefficients are quantized by a non-zero positive integer
called the quantization value (quantization scale) and
rounding the quotient, i.e. the quantized DCT coefficient to the
nearest integer value.
• The bigger the quantization value is, the lower the precision of
the quantized DCT coefficients. This leads to more blocking
artifacts.
Description of the reconstruction filter in H263+
• H263+ = H.263 plus more options such as:
• Arbitrary frame size, pixel aspect ratio square), and picture
clock frequency
• Loop de-blocking filter
• The ITU-T H.263 video compression standard were developed
to implement video conferencing via LANs, DSL, ..etc. The
H.263 supports video resolutions of 1408x1152(16CIF),
704x576(4CIF),352x288(CIF),176x144(QCIF) and
128x96(SQCIF) at up to 29.97 frames per second.
Deblocking filter mode in H263+
• The H263+ introduces a deblocking filter inside the coding
loop.
• The filter is applied to the edge boundaries of 8x8 blocks to
reduce the blocking artifacts.
• The filter coefficients depends on the macroblock’s quantizer’s
step size, with larger coefficients used for a coarser quantizer.
Deblocking filter mode in H263+(is in the coding loop)
• Filter pixels along block boundaries while preserving edges in the image
content.
• Filter is in the coding loop which means it filters the decoded reference frame
used for motion compensation.
• Can be used in conjunction with a post-filter to further reduce coding artifacts.
Deblocking filter mode in H263+
• Block Boundary
Deblocking Filter mode in H263+
• A,B,C and D are replaced by new values, A1,B1,C1, and D1
based on a set of non-linear equations.
• The strength of the filter is proportional to the quantization
strength.
Deblocking filter mode in H263+
• A,B,C, D are replaced by A1,B1,C1,D1:
• B1 = clip(B+d1)
• C1=clip(C- d1)
• A1 = A – d2
• D1 = D + d2
• d2= clipd1((A-D)/4,d1/3)
• d1 = Filter((A-4B+4C-D)/8, strength(QUANT)
• Filter(x,strength) = sign(x) * * (MAX(0, abs(x) – MAX(0, 2*( abs(x) - Strength) ) ) )
The deblocking filter is in the “coding loop”
Post-filter in H263+
• Filter the decoded frames horizontally first, then vertically
using a 1-D filter
• The post-filter strength is proportional to the quantization:
strength(QUANT).
• D1 = D + Filter((A+B+C+E+F+G-6D)/8,Strength)
• This filter is supposed to work with the filter within the
loop. It is not clear that this filter by itself is enough.
JPEG deblocking algorithms
• The main issue with JPEG or still image deblocking
techniques, is the fact that they are developed for non real-
time processing.
• Due to this fact, they tend to be computationally very
expensive to implement.
Video Decoder
Video Decoder
• The video decoder (VDCD) fetches video elementary stream
(ES) from external memory.It removes sequence, Group of
Pictures (GOP), picture and slice headers.
• Picture and user information are extracted and encoded MPEG
is decoded.
• The decoded video data is stored in external memory.
• The decoded data is stored to be fetched later by motion
compensation and display.
Video Decoder
• The video decoder is composed of:
– Variable Length Decoder (VLD)
– Dequantizer (DQNT)
– Inverse Discrete Cosine Transform (IDCT)
– Final Adder (FA)
– Video Controller (VC)
– Motion Compensator (MO)
Dequantizer
• The dequantizer module(DQNT) receives commands and data from the
Variable Length Decoder module (VLD) and generates non-zero
coefficients which are processed by the discrete Cosine Transform (IDCT)
module.
• DQNT module decodes and unzigs run/level coded data. DQNT module
stores quantizer scale factors and matrix values from bitstreams.
Dequantizer
Final Adder
Sequence
Type
Picture
Structure
IDCT Motion
Type
Output
Format
IDCT
read
Motion
read
interlaced field/frame field field field consecutive consecutive
interlaced frame field frame field consecutive alter-line
interlaced frame frame field field alter-line consecutive
interlaced frame frame frame field alter-line Alter-line
Progressive frame frame frame frame consecutive consecutive
MPEG2 vs. H.264
• Both algorithms are based on a common heritage of DCT based, hybrid
image coding, first used in H.261 and MPEG1.
• Both algorithms can be represented by the same high-level block diagrams.
Both algorithms are image transform coded, forward/backward block
motion compensated prediction with entropy coded transform coefficients.
• However the algorithms differ significantly in the methods selected for
image transforms and entropy coding.
• H.264 achieves at least a 2X improvement over MPEG4. Thus H.264 is
likely to supplant MPEG2 and MPEG4 in new applications.
• Example: To achieve a PSNR(Peak Signal to RMS Noise Ratio ) level
of 28, NBA must be coded at a rate of 5 mbps using MPEG2, but only
1.8 mbps using H.264.
MPEG2 vs. H.264
• MPEG2 vs. H.264
MPEG2 vs. H.264
Algorithm Characteristic MPEG2/MPEG4 H.264
General Motion compensated predictive,
residual transformed, entropy
coded
similar
Intra Prediction None Multi-direction, Multi-
pattern
Coded Image Types I,B,P I,B,P, SP
Transform 8x8 DCT 4x4 DCT-like Integer
Transform
Motion Estimation
Blocks
16x16 16x16, 8x8, 8x4, 4x4
Entropy Coding Multiple VLC Tables Arithmetic Coding and
adaptive VLC Tables
MPEG2 vs. H.264
Algorithm Characteristic MPEG2/MPEG4 H.264
Frame Distance for
Prediction
+/- 1 Unlimited
forward/backward
Fractional Motion
Estimation
1/2 Pixel (MPEG2)
1/4 Pixel (MPEG4)
1/4 Pixel
Deblocking Filter None Dynamic edge filters
Description of the Reconstruction Filter in H264
• A filter is applied to every decoded macroblock in order to
reduce blocking distortion.
• There are three types (3, 4, 5 taps) of filters for both
• vertical and horizontal directions and the filter decision is
based on the combinations of conditions including boundary
strengths, image gradients and thresholds that are affected by
the average quantization parameters across the block
boundary.
Deblocking Loop Filter in H264: Boundary Strength
Block modes and conditions Boundary-
strength
One of the blocks(4x4 block) is an intra and the
edge is a macro-block edge(lies on 16x16
boundary).
4
One of the blocks is intra and the edge is not a
macro-block edge.
3
One of the blocks has coded residuals 2
Difference of block motion >= 1 luma sample
distance
1
Motion compensation from different reference
frames
1
else 0
Orderofconditionevaluation
Deblocking Loop Filter in H264: Boundary Strength
Block boundary
between block p and q
Block p or q
intra coded or
slice type is SI or SP
?
Bs=3
Block boundary
is also Macroblock
boundary
?
Coefficients
coded in block
p or q
?
Bs=2Bs=4
|V1(p,x) - V1(q,x)| >= 1 or
|V1
(p,y) - V1
(q,y)| >= 1 or
if bi-predictive
|V2(p,x) - V2(q,x)| >= 1 or
|V2(p,y) - V2(q,y)| >= 1
Bs=0
(skip)
Bs=1
YES NO
YES
YES
NO
NO
Block p and q have
different reference frames
or a different number of
reference frames?
YES
NO YES
NO
Boundary Strength
• To every edge between two 4x4 luminance sample blocks, a Boundary
strength Bs parameter is assigned an integer value form 0 to 4.
• The value of “Bs” depend on the modes and coding conditions of the two
adjacent blocks.
• Conditions are evaluated from top to bottom, until one of the conditions
holds true and the corresponding value is assigned to Bs.
• Bs determines the strength of the filtering performed on the edge, including
a selection between two filtering modes.
Deblocking Filtering Condition
• Filtering conditions: are used to decide whether or not to switch off the
filtering when there is enough change across the block boundary in the
original image to indicate a real edge and not some blocking artifact.
• The decision is based on threshold values: α and β
• As the blocking artifacts change with the value of the Quantization
parameter, The threshold values should adapt to the value of Qp (the
quantization parameter).
• It is expected that as “Qp” increases, the blocking artifacts contribution to
the change in pixel-value across the block boundary would also increase.
• Conversely, when “Qp” is small, blocking effects should not affect the
image boundary significantly, and as such, the thresholds are set very low.
• Any change, other than a small gradient at the boundary is more likely to
be an image feature than a blocking artifacts/
Alpha α -table
• IndexA = clip3(0,51,QPav + Filter_offset_A)
• The α-table is indexed by IndexA which is related to Qp as shown.
• Filtering is only performed for points that lie below the curve.
0 10 20 30 40 50 60
0
50
100
150
200
250
300
alpha index vs. QPav
QPav
alpha
Filtering
No-Filtering
Beta β -table
• IndexB = clip3(0,51,QPav + Filter_offset_B)
• The β -table is indexed by IndexB which is related to Qp as
shown above
0 10 20 30 40 50 60
0
2
4
6
8
10
12
14
16
18
beta vs. QP
av
QP
av
beta
Filtering
No Filtering
Value for filter clipping parameter C0 as a function of
IndexA and Bs (boundary strength)
0 10 20 30 40 50 60
0
5
10
15
20
25
C0 vs. QPav
QPav
C0
Bs=1
Bs=2
Bs=3
• C0 is used as a limiting value.
Boundaries of macr-blocks to be filtered, H.264
• 4x4 block boundary represent the boundaries to be filtered for luma in both vertical
and horizontal direction.
16x16 block boundary
(solid red line)
4x4 block boundary (solid blue line)
Horizontal edges
for chroma
filtering (green
dashed line)
Vertical edges for
chroma filtering
(green dashed
line)
H.264 Deblocking Filter
β<−= |02| ppap
β<− |01| qq
β<− |01| pp
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
α<− |00| qp
β<−= |02| qqaq
Deblocking Filtering Condition: for Bs < 4
• iff
Bs ≠ 0 &&
|p0 – q0| < α &&
|p1 – p0| < β &&
|q1 – q0| < β is true
• The values of the thresholds α and β are dependent on the
average value of QP for the two blocks
p3 p2 p1 p0 q0 q1 q2 q3
H.264 : P0,Q0 filtering of edges with Bs < 4
• A 4-tap linear! filter, is applied with inputs p1, p0, q1,q0, producing filtered
output P0 and Q0
• C is determined by setting it equal to C0. The value of C could be
incremented by a “1” or “2” depending on the relations described above.





<∧<+
<+
≥∧≥
=
−=
−=
∆−=
∆+=
+−+−
−=∆
)()(20
)(10
)()(0
02
02
)0(10
)0(10
)
8
4)11()00(*4
,,(3
ββ
β
ββ
qp
p
qp
q
p
aaiffC
aiffC
aaiffC
C
qqa
ppa
qclipQ
pclipP
qppq
CCclip p3 p2 p1 p0 q0 q1 q2 q3
H.264 : P0,Q0 filtering of edges with Bs < 4
• The new pixel values P0,Q0 showing the contribution of the term 4(q0-p0)/8,
will align P0 and Q0
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
0)00( ≥− pqP0,Q0
H.264 : P0,Q0 filtering of edges with Bs < 4
• The new pixel values P0,Q0 showing the contribution of the term (p1-q1)/8,
will adjust the position of P0 and Q0 accordingly
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
0)11( ≤− qp
P0
Q0
Final edge
Final Q0
Final P0
H.264 : P1,Q1 filtering of edges with Bs < 4
• Moreover, if |p2-p0| is less than a threshold, then a 4-tap linear! filter is applied on
the points p2,p1,p0,q0. This is used to compute the new value of P1. Similarly for Q1.
• The filter for p1 does in fact assume that the two pixels around p1 are represented by
p2, and (p0+q0)/2 which is the average value of p0 and q0.
• The difference between p1 and the two surrounding pixels dscribed above is
computed. The average value of these two differences is computed, and added to the
original value of p1 to compute the new value of P1.
• Similar argument apply to Q1 computation
02
02
:
)02()
2
1*22/)00(2
,0,0(311
)02()
2
1*22/)00(2
,0,0(311
qqa
ppa
where
qqaiff
qpqq
CCclipqQ
ppaiff
ppqp
CCclippP
q
p
q
p
−=
−=
<−=
−++
−+=
<−=
−++
−+=
β
β p3 p2 p1 p0 q0 q1 q2 q3
p3 p2 p1 p0 q0 q1 q2 q3
H.264 : P1 filtering of edges with Bs < 4
• The average value of (p2-p1) and ((p0+q0)/2-p1) is added to p1 to form the new
value P1
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
)
2
00
(
qp +
P0
Q0
0)12( ≥− pp
0)1)
2
00
(( ≥−
+
p
qp
H.264 : P1 filtering of edges with Bs < 4
• So, if (p2-p0) is below some threshold β, which indicates the image does
not have a lot of details, then filtering is done on p1, and the resulting pixel
P1 is shown as indicated. Otherwise, p1 retain its original value.
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
)
2
00
(
qp +
P0
Q0
P1
Final P1
H.264 : Q1 filtering of edges with Bs < 4
• The average value of (q2-q1) and ((p0+q0)/2-q1) is added to q1 to
form the new value Q1
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
)
2
00
(
qp +
P0
Q0
0)1)
2
00
(( ≤−
+
q
qp
P1
0)12( ≥− qq
H.264 : Q1 filtering of edges with Bs < 4
• The average value of (q2-q1) and ((p0+q0)/2-q1) is added to q1 to
form the new value Q1
p3 p2 p1 p0 q0 q1 q2 q3
Block Boundary
p2 p1 p0 q1 q2q0
Decoded pixel positions
q3p3
p0
q0
)
2
00
(
qp +
P0
Q0
P1 Final Q1
Q1
H.264 : P0,P1,P2 Strong filtering of edges with Bs = 4
• Strong filtering is performed when the following
conditions hold:
• Bs = 4 &&
iff
(ap=|p2 – p0|) < β &&
|p0– q0| < (α/4 + 2) is true  Apply strong filtering to
P0,P1,P2 as described next
Else  only filter P0 as follows:
p3 p2 p1 p0 q0 q1 q2 q3
4
2101*2
0
+++
=
qpp
P
H.264 : Q0,Q1,Q2 Strong filtering of edges with Bs = 4
• Strong filtering is performed when the following
conditions hold:
• Bs = 4 &&
iff
(aq=|q2 – q0|) < β &&
|p0– q0| < (α/4 + 2) is true  Apply strong filtering to
Q0,Q1,Q2 as described next
Else  only filter Q0 as follows:
p3 p2 p1 p0 q0 q1 q2 q3
4
2101*2
0
+++
=
pqq
Q
αs= (α/4 + 2) is significantly less than α. This indicates that the application
of the strong filtering(Bs=4) will be more limited than the moderate filter
case (0<Bs<4)
p3 p2 p1 p0 q0 q1 q2 q3
0 10 20 30 40 50 60
0
50
100
150
200
250
300
alpha and alphas
vs. QPav
QPav
alpha alpha
alphas
H.264 : αs for Strong filtering of edges with Bs = 4
H.264 : P0,P1,P2 filtering of edges with Bs =4
• A 5-tap linear! filter, is applied, with inputs p2,p1, p0,q0,q1
producing filtered output P0.
• A 4-tap linear! filter, is applied, with inputs p2,p1,p0,q0
producing filtered output P1.
• In the case of luma filtering, p2 is also filtered, with inputs
p3,p2,p1,p0,q0 producing filtered output P2
8
40012*33*2
2
4
20012
1
8
410*20*21*22
0
+++++
=
++++
=
+++++
=
qpppp
P
filteringlumaiff
qppp
P
qqppp
P
p3 p2 p1 p0 q0 q1 q2 q3
p3 p2 p1 p0 q0 q1 q2 q3
p3 p2 p1 p0 q0 q1 q2 q3
H.264 : Q0,Q1,Q2 filtering of edges with Bs = 4
• A 5-tap linear! filter, is applied, with inputs q2,q1, q0,p0,p1
producing filtered output Q0.
• A 4-tap linear! filter, is applied, with inputs q2,q1,q0,p0
producing filtered output Q1.
• In the case of luma filtering, q2 is also filtered, with inputs
q3,q2,q1,q0,p0 producing filtered output Q2
8
40012*33*2
2
4
20012
1
8
410*20*21*22
0
+++++
=
++++
=
+++++
=
pqqqq
Q
filteringlumaiff
pqqq
Q
ppqqq
Q
p3 p2 p1 p0 q0 q1 q2 q3
p3 p2 p1 p0 q0 q1 q2 q3
p3 p2 p1 p0 q0 q1 q2 q3
A post-processing deblocking filter for MPEG2/4
A B C E FD
Decoded pixel positions
Block Boundary
X=|D-C|
PixelValue
A post-processing deblocking filter,(moderate Filtering)
8x8 block boundary
C
B
E
D
p0
p1
q1
q0
q2
CB D E p1 p0 q0 q1 q2p2
p2 A
F
FA
If |C-D|<1.25*Quant_scale
{
x = D-C
A’ = A
B’ = B + x/8
C’ = C + x/2
D’ = D – x/2
E’ = E - x/8
F’ = F
}
A post-processing deblocking filter,(moderate Filtering)PixelValue
A B C E FD
Decoded pixel positions
Block Boundary
x=|D-C|
X/2
X/8
A’
B’
C’,D’
E’
F’
A post-processing deblocking filter,(moderate Filtering)
• The proposed moderate filter, changes only 4 pixels at the block boundary.
• The advantage of using such a moderate filter, is the fact that it does not
blur the regions with high spatial details.
• The filtering effect is restricted to regions with strong blocking effects,
specially those locacted near the edge of the block.
A post-processing deblocking filter,(Strong Filtering)
C
B
E
D
p0
p1
q1
q0
q2
CB D E p1 p0 q0 q1 q2p2
p2
8x8 block boundary
A
F
FA
If |C-D|<2*Quant_scale
{
x = D-C
A’ = A + x/8
B’ = B + x/4
C’ = C + x/2
D’ = D – x/2
E’ = E – x/4
F’ = F – x/8
}
A post-processing deblocking filter,(Strong Filtering)
A B C E FD
Decoded pixel positions
Block Boundary
X=|D-C|
PixelValue
X/2 X/4
X/8
A post-processing deblocking filter,(Adaptive Filtering)
• The moderate filter, changes only 4 pixels at the block boundary.
• The strong filter, changes 6 pixels at the block boundary.
• The strength of the filter is to be chosen adaptively according to the
blocking effect.
• … Next time, we will describe how to adaptively determine between the
strong and moderate filtering.
• Start using an mpeg-2 encoder and use it under different quantization
scales/parameters, see how the different filtering algorithms behave.
Post processing deblocking filter (input,3Mbps)
• gfg
Post processing deblocking medium-filter (output,3Mbps)
• dd
Post processing deblocking strong-filter (output,3Mbps)
• dfg
The original
• frs
Computing the Power Signal to Noise Ratio
• MSE = Mean squared Error
• PSNR = Power Signal to Noise Ratio
2
1 1
]),(ˆ),([
1
∑∑= =
−⋅
⋅
=
x yN
i
N
jyy
jifjif
NN
MSE
2
1 1
]),(ˆ),([
1
∑∑= =
−⋅
⋅
=
x yN
i
N
jyy
jifjif
NN
RMSE
)
255
log(20
RMSE
PSNR ⋅=
Deblocking an arbitrary scaled Frame: Horizontal
Direction
• Create a histogram that takes into account that scaling might have been
implemented on the frame in the horizontal direction.
• ff
Detecting vertical block boundary
• Evaluation of the
∑=
−=
V
i
ii PPBV
1
2,1,)1(
Detecting vertical block boundary
• Detecting the vertical block boundary
• H is the number of pixel in the horizontal direction (no of pixels per line)
• V is the number of lines (number of lines per frame)
∑
∑
∑
=
−−
=
=
−=
−=
−=
V
i
HiHiH
V
i
ii
V
i
ii
PPBV
PPBV
PPBV
1
1,,)1(
1
3,2,)2(
1
2,1,)1(
...
Detecting a horizontal block boundary
• Detecting the horizontal block boundary
Detecting a horizontal block boundary
• Detecting the horizontal block boundary
• H is the number of pixel in the horizontal direction (no of pixels per line)
• V is the number of lines (number of lines per frame)
∑
∑
∑
=
−−
=
=
−=
−=
−=
H
j
jVjVV
H
j
jj
H
j
jj
PPBH
PPBH
PPBH
1
,1,)1(
1
,2,3)2(
1
,1,2)1(
...

Mais conteúdo relacionado

Mais procurados

Cyclone II FPGA Overview
Cyclone II FPGA OverviewCyclone II FPGA Overview
Cyclone II FPGA OverviewPremier Farnell
 
Introduction to Video Compression Techniques - Anurag Jain
Introduction to Video Compression Techniques - Anurag JainIntroduction to Video Compression Techniques - Anurag Jain
Introduction to Video Compression Techniques - Anurag JainVideoguy
 
H.264 video standard
H.264 video standardH.264 video standard
H.264 video standardSajan Sahu
 
Video Coding Standard
Video Coding StandardVideo Coding Standard
Video Coding StandardVideoguy
 
VVC tutorial at ICME 2020 together with Benjamin Bross
VVC tutorial at ICME 2020 together with Benjamin BrossVVC tutorial at ICME 2020 together with Benjamin Bross
VVC tutorial at ICME 2020 together with Benjamin BrossMathias Wien
 
ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)Sudhanshu Janwadkar
 
A short history of video coding
A short history of video codingA short history of video coding
A short history of video codingIain Richardson
 
HEVC Definitions and high-level syntax
HEVC Definitions and high-level syntaxHEVC Definitions and high-level syntax
HEVC Definitions and high-level syntaxYoss Cohen
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagramTeam-VLSI-ITMU
 
Video Compression, Part 3-Section 1, Some Standard Video Codecs
Video Compression, Part 3-Section 1, Some Standard Video CodecsVideo Compression, Part 3-Section 1, Some Standard Video Codecs
Video Compression, Part 3-Section 1, Some Standard Video CodecsDr. Mohieddin Moradi
 
Bidirectional Bus Modelling
Bidirectional Bus ModellingBidirectional Bus Modelling
Bidirectional Bus ModellingArrow Devices
 
Video Compression, Part 4 Section 1, Video Quality Assessment
Video Compression, Part 4 Section 1,  Video Quality Assessment Video Compression, Part 4 Section 1,  Video Quality Assessment
Video Compression, Part 4 Section 1, Video Quality Assessment Dr. Mohieddin Moradi
 
Low power ldpc decoder implementation using layer decoding
Low power ldpc decoder implementation using layer decodingLow power ldpc decoder implementation using layer decoding
Low power ldpc decoder implementation using layer decodingajithc0003
 
02 ldpc bit flipping_decoding_dark knight
02 ldpc bit flipping_decoding_dark knight02 ldpc bit flipping_decoding_dark knight
02 ldpc bit flipping_decoding_dark knightDevanshi Piprottar
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect AndromedaElectronic Arts / DICE
 

Mais procurados (20)

Cyclone II FPGA Overview
Cyclone II FPGA OverviewCyclone II FPGA Overview
Cyclone II FPGA Overview
 
HEVC overview main
HEVC overview mainHEVC overview main
HEVC overview main
 
Introduction to Video Compression Techniques - Anurag Jain
Introduction to Video Compression Techniques - Anurag JainIntroduction to Video Compression Techniques - Anurag Jain
Introduction to Video Compression Techniques - Anurag Jain
 
HEVC intra coding
HEVC intra codingHEVC intra coding
HEVC intra coding
 
Understanding Reed-Solomon code
Understanding Reed-Solomon codeUnderstanding Reed-Solomon code
Understanding Reed-Solomon code
 
H.264 video standard
H.264 video standardH.264 video standard
H.264 video standard
 
Video Coding Standard
Video Coding StandardVideo Coding Standard
Video Coding Standard
 
Fpga
FpgaFpga
Fpga
 
VVC tutorial at ICME 2020 together with Benjamin Bross
VVC tutorial at ICME 2020 together with Benjamin BrossVVC tutorial at ICME 2020 together with Benjamin Bross
VVC tutorial at ICME 2020 together with Benjamin Bross
 
ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)
 
Kogge Stone Adder
Kogge Stone AdderKogge Stone Adder
Kogge Stone Adder
 
A short history of video coding
A short history of video codingA short history of video coding
A short history of video coding
 
HEVC Definitions and high-level syntax
HEVC Definitions and high-level syntaxHEVC Definitions and high-level syntax
HEVC Definitions and high-level syntax
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagram
 
Video Compression, Part 3-Section 1, Some Standard Video Codecs
Video Compression, Part 3-Section 1, Some Standard Video CodecsVideo Compression, Part 3-Section 1, Some Standard Video Codecs
Video Compression, Part 3-Section 1, Some Standard Video Codecs
 
Bidirectional Bus Modelling
Bidirectional Bus ModellingBidirectional Bus Modelling
Bidirectional Bus Modelling
 
Video Compression, Part 4 Section 1, Video Quality Assessment
Video Compression, Part 4 Section 1,  Video Quality Assessment Video Compression, Part 4 Section 1,  Video Quality Assessment
Video Compression, Part 4 Section 1, Video Quality Assessment
 
Low power ldpc decoder implementation using layer decoding
Low power ldpc decoder implementation using layer decodingLow power ldpc decoder implementation using layer decoding
Low power ldpc decoder implementation using layer decoding
 
02 ldpc bit flipping_decoding_dark knight
02 ldpc bit flipping_decoding_dark knight02 ldpc bit flipping_decoding_dark knight
02 ldpc bit flipping_decoding_dark knight
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 

Destaque

How Great Leaders Listen
How Great Leaders ListenHow Great Leaders Listen
How Great Leaders ListenHannah Knapp
 
Presentacion basica cucarachas 2016
Presentacion   basica cucarachas 2016Presentacion   basica cucarachas 2016
Presentacion basica cucarachas 2016jomiqui1
 
Presentación sin título
Presentación sin títuloPresentación sin título
Presentación sin títuloeduardorzcn
 
Presentation at G20 MACS XIAN 2016/6
Presentation at G20 MACS  XIAN 2016/6Presentation at G20 MACS  XIAN 2016/6
Presentation at G20 MACS XIAN 2016/6Johannes Keizer
 
El gasto en ocio y cultura (El periódico de Aragón)
El gasto en ocio y cultura (El periódico de Aragón)El gasto en ocio y cultura (El periódico de Aragón)
El gasto en ocio y cultura (El periódico de Aragón)EAE Business School
 
Chandan -Resturant Manager boi -datta _1_
Chandan -Resturant Manager boi -datta _1_Chandan -Resturant Manager boi -datta _1_
Chandan -Resturant Manager boi -datta _1_Chandan Mallick
 
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный веб
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный вебHappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный веб
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный вебHappyDev-lite
 
Actividad2.1 lenny sanchez_tic-1
Actividad2.1 lenny sanchez_tic-1Actividad2.1 lenny sanchez_tic-1
Actividad2.1 lenny sanchez_tic-1Lenny Sanchez
 

Destaque (13)

Lesson 4
Lesson 4Lesson 4
Lesson 4
 
How Great Leaders Listen
How Great Leaders ListenHow Great Leaders Listen
How Great Leaders Listen
 
Presentacion basica cucarachas 2016
Presentacion   basica cucarachas 2016Presentacion   basica cucarachas 2016
Presentacion basica cucarachas 2016
 
Presentación sin título
Presentación sin títuloPresentación sin título
Presentación sin título
 
Richard Avedon
Richard AvedonRichard Avedon
Richard Avedon
 
Presentation at G20 MACS XIAN 2016/6
Presentation at G20 MACS  XIAN 2016/6Presentation at G20 MACS  XIAN 2016/6
Presentation at G20 MACS XIAN 2016/6
 
El gasto en ocio y cultura (El periódico de Aragón)
El gasto en ocio y cultura (El periódico de Aragón)El gasto en ocio y cultura (El periódico de Aragón)
El gasto en ocio y cultura (El periódico de Aragón)
 
4572_001
4572_0014572_001
4572_001
 
Chandan -Resturant Manager boi -datta _1_
Chandan -Resturant Manager boi -datta _1_Chandan -Resturant Manager boi -datta _1_
Chandan -Resturant Manager boi -datta _1_
 
Organigrama
OrganigramaOrganigrama
Organigrama
 
Seminar prezentatsia
Seminar prezentatsiaSeminar prezentatsia
Seminar prezentatsia
 
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный веб
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный вебHappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный веб
HappyDev-lite-2016-весна 02 Дмитрий Пашкевич. Нетривиальный веб
 
Actividad2.1 lenny sanchez_tic-1
Actividad2.1 lenny sanchez_tic-1Actividad2.1 lenny sanchez_tic-1
Actividad2.1 lenny sanchez_tic-1
 

Semelhante a Deblocking_Filter_v2

Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)danishrafiq
 
Overview_of_H.264.pdf
Overview_of_H.264.pdfOverview_of_H.264.pdf
Overview_of_H.264.pdfJunZhao68
 
High Efficiency Video Codec
High Efficiency Video CodecHigh Efficiency Video Codec
High Efficiency Video CodecTejus Adiga M
 
28 h 264-avc_by_dhchang
28   h 264-avc_by_dhchang28   h 264-avc_by_dhchang
28 h 264-avc_by_dhchangBadri Patro
 
Aruna Ravi - M.S Thesis
Aruna Ravi - M.S ThesisAruna Ravi - M.S Thesis
Aruna Ravi - M.S ThesisArunaRavi
 
H.265ImprovedCE_over_H.264-HarmonicMay2014Final
H.265ImprovedCE_over_H.264-HarmonicMay2014FinalH.265ImprovedCE_over_H.264-HarmonicMay2014Final
H.265ImprovedCE_over_H.264-HarmonicMay2014FinalDonald Pian
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image CompressionA B Shinde
 
H 264 in cuda presentation
H 264 in cuda presentationH 264 in cuda presentation
H 264 in cuda presentationashoknaik120
 
Mpeg4copy 120428133000-phpapp01
Mpeg4copy 120428133000-phpapp01Mpeg4copy 120428133000-phpapp01
Mpeg4copy 120428133000-phpapp01netzwelt12345
 
notes_Image Compression_edited.ppt
notes_Image Compression_edited.pptnotes_Image Compression_edited.ppt
notes_Image Compression_edited.pptHarisMasood20
 
Video Compression Basics by sahil jain
Video Compression Basics by sahil jainVideo Compression Basics by sahil jain
Video Compression Basics by sahil jainSahil Jain
 
An Overview of the ATSC 3.0 Physical Layer Specification
An Overview of the ATSC 3.0 Physical Layer SpecificationAn Overview of the ATSC 3.0 Physical Layer Specification
An Overview of the ATSC 3.0 Physical Layer SpecificationAlwin Poulose
 
Multimedia basic video compression techniques
Multimedia basic video compression techniquesMultimedia basic video compression techniques
Multimedia basic video compression techniquesMazin Alwaaly
 
HC05.5.3-Bolton-SGS-Thomson-MPEG
HC05.5.3-Bolton-SGS-Thomson-MPEGHC05.5.3-Bolton-SGS-Thomson-MPEG
HC05.5.3-Bolton-SGS-Thomson-MPEGDavid Parre
 

Semelhante a Deblocking_Filter_v2 (20)

Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)
 
Overview_of_H.264.pdf
Overview_of_H.264.pdfOverview_of_H.264.pdf
Overview_of_H.264.pdf
 
THE H.264/MPEG4 AND ITS APPLICATIONS
THE H.264/MPEG4 AND ITS APPLICATIONSTHE H.264/MPEG4 AND ITS APPLICATIONS
THE H.264/MPEG4 AND ITS APPLICATIONS
 
High Efficiency Video Codec
High Efficiency Video CodecHigh Efficiency Video Codec
High Efficiency Video Codec
 
28 h 264-avc_by_dhchang
28   h 264-avc_by_dhchang28   h 264-avc_by_dhchang
28 h 264-avc_by_dhchang
 
PPT
PPTPPT
PPT
 
WT in IP.ppt
WT in IP.pptWT in IP.ppt
WT in IP.ppt
 
Aruna Ravi - M.S Thesis
Aruna Ravi - M.S ThesisAruna Ravi - M.S Thesis
Aruna Ravi - M.S Thesis
 
H.265ImprovedCE_over_H.264-HarmonicMay2014Final
H.265ImprovedCE_over_H.264-HarmonicMay2014FinalH.265ImprovedCE_over_H.264-HarmonicMay2014Final
H.265ImprovedCE_over_H.264-HarmonicMay2014Final
 
Moving object detection on FPGA
Moving object detection on FPGAMoving object detection on FPGA
Moving object detection on FPGA
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image Compression
 
H 264 in cuda presentation
H 264 in cuda presentationH 264 in cuda presentation
H 264 in cuda presentation
 
Mmclass5b
Mmclass5bMmclass5b
Mmclass5b
 
Mpeg4copy 120428133000-phpapp01
Mpeg4copy 120428133000-phpapp01Mpeg4copy 120428133000-phpapp01
Mpeg4copy 120428133000-phpapp01
 
notes_Image Compression_edited.ppt
notes_Image Compression_edited.pptnotes_Image Compression_edited.ppt
notes_Image Compression_edited.ppt
 
Video Compression Basics by sahil jain
Video Compression Basics by sahil jainVideo Compression Basics by sahil jain
Video Compression Basics by sahil jain
 
MPEG4 vs H.264
MPEG4 vs H.264MPEG4 vs H.264
MPEG4 vs H.264
 
An Overview of the ATSC 3.0 Physical Layer Specification
An Overview of the ATSC 3.0 Physical Layer SpecificationAn Overview of the ATSC 3.0 Physical Layer Specification
An Overview of the ATSC 3.0 Physical Layer Specification
 
Multimedia basic video compression techniques
Multimedia basic video compression techniquesMultimedia basic video compression techniques
Multimedia basic video compression techniques
 
HC05.5.3-Bolton-SGS-Thomson-MPEG
HC05.5.3-Bolton-SGS-Thomson-MPEGHC05.5.3-Bolton-SGS-Thomson-MPEG
HC05.5.3-Bolton-SGS-Thomson-MPEG
 

Mais de Shereef Shehata

Windows_Scaling_2X_Speedup
Windows_Scaling_2X_SpeedupWindows_Scaling_2X_Speedup
Windows_Scaling_2X_SpeedupShereef Shehata
 
2D_block_scaling_Software
2D_block_scaling_Software2D_block_scaling_Software
2D_block_scaling_SoftwareShereef Shehata
 
2D_BLIT_software_Blackness
2D_BLIT_software_Blackness2D_BLIT_software_Blackness
2D_BLIT_software_BlacknessShereef Shehata
 
CIECAM02_Color_Management
CIECAM02_Color_ManagementCIECAM02_Color_Management
CIECAM02_Color_ManagementShereef Shehata
 
Temporal_video_noise_reduction
Temporal_video_noise_reductionTemporal_video_noise_reduction
Temporal_video_noise_reductionShereef Shehata
 
Shereef_Color_Processing
Shereef_Color_ProcessingShereef_Color_Processing
Shereef_Color_ProcessingShereef Shehata
 
The_Mismatch_Noise_Cancellation_Architecture
The_Mismatch_Noise_Cancellation_ArchitectureThe_Mismatch_Noise_Cancellation_Architecture
The_Mismatch_Noise_Cancellation_ArchitectureShereef Shehata
 
Architectural_Synthesis_for_DSP_Structured_Datapaths
Architectural_Synthesis_for_DSP_Structured_DatapathsArchitectural_Synthesis_for_DSP_Structured_Datapaths
Architectural_Synthesis_for_DSP_Structured_DatapathsShereef Shehata
 
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAs
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAsHigh_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAs
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAsShereef Shehata
 

Mais de Shereef Shehata (19)

Windows_Scaling_2X_Speedup
Windows_Scaling_2X_SpeedupWindows_Scaling_2X_Speedup
Windows_Scaling_2X_Speedup
 
2D_block_scaling_Software
2D_block_scaling_Software2D_block_scaling_Software
2D_block_scaling_Software
 
2D_BLIT_software_Blackness
2D_BLIT_software_Blackness2D_BLIT_software_Blackness
2D_BLIT_software_Blackness
 
CIECAM02_Color_Management
CIECAM02_Color_ManagementCIECAM02_Color_Management
CIECAM02_Color_Management
 
log_algorithm
log_algorithmlog_algorithm
log_algorithm
 
Temporal_video_noise_reduction
Temporal_video_noise_reductionTemporal_video_noise_reduction
Temporal_video_noise_reduction
 
Shereef_Color_Processing
Shereef_Color_ProcessingShereef_Color_Processing
Shereef_Color_Processing
 
Inertial_Sensors
Inertial_SensorsInertial_Sensors
Inertial_Sensors
 
magentometers
magentometersmagentometers
magentometers
 
Shereef_MP3_decoder
Shereef_MP3_decoderShereef_MP3_decoder
Shereef_MP3_decoder
 
Fusion_Class
Fusion_ClassFusion_Class
Fusion_Class
 
Gyroscope_sensors
Gyroscope_sensorsGyroscope_sensors
Gyroscope_sensors
 
2DCompsitionEngine
2DCompsitionEngine2DCompsitionEngine
2DCompsitionEngine
 
Block_Scaler_Control
Block_Scaler_ControlBlock_Scaler_Control
Block_Scaler_Control
 
2D_BitBlt_Scale
2D_BitBlt_Scale2D_BitBlt_Scale
2D_BitBlt_Scale
 
xvYCC_RGB
xvYCC_RGBxvYCC_RGB
xvYCC_RGB
 
The_Mismatch_Noise_Cancellation_Architecture
The_Mismatch_Noise_Cancellation_ArchitectureThe_Mismatch_Noise_Cancellation_Architecture
The_Mismatch_Noise_Cancellation_Architecture
 
Architectural_Synthesis_for_DSP_Structured_Datapaths
Architectural_Synthesis_for_DSP_Structured_DatapathsArchitectural_Synthesis_for_DSP_Structured_Datapaths
Architectural_Synthesis_for_DSP_Structured_Datapaths
 
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAs
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAsHigh_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAs
High_Level_Synthesis_of_DSP_Archiectures_Targeting_FPGAs
 

Deblocking_Filter_v2

  • 1. Post Processing Deblocking Filter Shereef Shehata
  • 2. Blocking artifacts • Picture coding/comprssion standards such as JPEG and MPEG are based on block-based discrete cosine transform. • Thus, a loss of quality might occur in an encoded image such as blocking or ringing artifacts. • Blocking artifacts or “MacroBlocking” are most visible on fast moving images such as sports or action scenes.
  • 3. Origin of blocking artifacts Two components can be the source of blocking artifacts: • The most significant source is the block-based Discrete Cosine Transform (DCTs) in intra and inter frame prediction coding. Coarse Quantization of the transform coefficients can cause visually disturbing discontinuities at the block boundaries. • The second source of blocking artifact is motion compensated prediction. Motion compensated blocks are generated by copying interpolated pixel data from different locations of possibly different reference frames. In fact, in the copying process, existing edge discontinuties in reference frames could be carried into the interior of the block to be compensated. (Does this apply to mpeg-2?)
  • 4. Blocking artifacts within the blocks • Blocking artifacts will be propagated within the block as a result of motion compensation. • These artifacts will be more visible within the flat regions than the complex detailed regions. • This implies that smoothing the flat regions should cover the inside of the block as well as the outside of the block. • Practical aspects of implementing something to detect what happen to the pixels within the block is difficult. • H264 specs almost touches all luma pixels, as it filters two pixels on each side of the 4x4 boundary. • In MPEG-2, the block is 8x8 and it is not clear how to check what happened within the block, as opposed to the edges.
  • 5. Post-processing deblocking filter • In post-processing approach: The deblocking filter operates on the display buffer outside of the coding loop. • In the post-processing approach, the frame is first decoded into a reference frame buffer. The deblocking filter is then applied on the decoded pixel values. • An additional frame storage may be needed to store the filtered frame to be passed to the display device. • This is one of the reasons that H.264 and H.263+ have proposed to use the deblocking filter within the coding loop. Other reasons for including the deblocking filter within the loop is the fact that performing motion compensation on the filtered values produces better results.
  • 6. MPEG-2 Quantization in the encoder • When the DCT is computed for a block, the coefficients for high spatial frequencies are represented with less precision. This is done through Quantization. • DCT coefficients are quantized by a non-zero positive integer called the quantization value (quantization scale) and rounding the quotient, i.e. the quantized DCT coefficient to the nearest integer value. • The bigger the quantization value is, the lower the precision of the quantized DCT coefficients. This leads to more blocking artifacts.
  • 7. Description of the reconstruction filter in H263+ • H263+ = H.263 plus more options such as: • Arbitrary frame size, pixel aspect ratio square), and picture clock frequency • Loop de-blocking filter • The ITU-T H.263 video compression standard were developed to implement video conferencing via LANs, DSL, ..etc. The H.263 supports video resolutions of 1408x1152(16CIF), 704x576(4CIF),352x288(CIF),176x144(QCIF) and 128x96(SQCIF) at up to 29.97 frames per second.
  • 8. Deblocking filter mode in H263+ • The H263+ introduces a deblocking filter inside the coding loop. • The filter is applied to the edge boundaries of 8x8 blocks to reduce the blocking artifacts. • The filter coefficients depends on the macroblock’s quantizer’s step size, with larger coefficients used for a coarser quantizer.
  • 9. Deblocking filter mode in H263+(is in the coding loop) • Filter pixels along block boundaries while preserving edges in the image content. • Filter is in the coding loop which means it filters the decoded reference frame used for motion compensation. • Can be used in conjunction with a post-filter to further reduce coding artifacts.
  • 10. Deblocking filter mode in H263+ • Block Boundary
  • 11. Deblocking Filter mode in H263+ • A,B,C and D are replaced by new values, A1,B1,C1, and D1 based on a set of non-linear equations. • The strength of the filter is proportional to the quantization strength.
  • 12. Deblocking filter mode in H263+ • A,B,C, D are replaced by A1,B1,C1,D1: • B1 = clip(B+d1) • C1=clip(C- d1) • A1 = A – d2 • D1 = D + d2 • d2= clipd1((A-D)/4,d1/3) • d1 = Filter((A-4B+4C-D)/8, strength(QUANT) • Filter(x,strength) = sign(x) * * (MAX(0, abs(x) – MAX(0, 2*( abs(x) - Strength) ) ) ) The deblocking filter is in the “coding loop”
  • 13. Post-filter in H263+ • Filter the decoded frames horizontally first, then vertically using a 1-D filter • The post-filter strength is proportional to the quantization: strength(QUANT). • D1 = D + Filter((A+B+C+E+F+G-6D)/8,Strength) • This filter is supposed to work with the filter within the loop. It is not clear that this filter by itself is enough.
  • 14. JPEG deblocking algorithms • The main issue with JPEG or still image deblocking techniques, is the fact that they are developed for non real- time processing. • Due to this fact, they tend to be computationally very expensive to implement.
  • 16. Video Decoder • The video decoder (VDCD) fetches video elementary stream (ES) from external memory.It removes sequence, Group of Pictures (GOP), picture and slice headers. • Picture and user information are extracted and encoded MPEG is decoded. • The decoded video data is stored in external memory. • The decoded data is stored to be fetched later by motion compensation and display.
  • 17. Video Decoder • The video decoder is composed of: – Variable Length Decoder (VLD) – Dequantizer (DQNT) – Inverse Discrete Cosine Transform (IDCT) – Final Adder (FA) – Video Controller (VC) – Motion Compensator (MO)
  • 18. Dequantizer • The dequantizer module(DQNT) receives commands and data from the Variable Length Decoder module (VLD) and generates non-zero coefficients which are processed by the discrete Cosine Transform (IDCT) module. • DQNT module decodes and unzigs run/level coded data. DQNT module stores quantizer scale factors and matrix values from bitstreams.
  • 20. Final Adder Sequence Type Picture Structure IDCT Motion Type Output Format IDCT read Motion read interlaced field/frame field field field consecutive consecutive interlaced frame field frame field consecutive alter-line interlaced frame frame field field alter-line consecutive interlaced frame frame frame field alter-line Alter-line Progressive frame frame frame frame consecutive consecutive
  • 21. MPEG2 vs. H.264 • Both algorithms are based on a common heritage of DCT based, hybrid image coding, first used in H.261 and MPEG1. • Both algorithms can be represented by the same high-level block diagrams. Both algorithms are image transform coded, forward/backward block motion compensated prediction with entropy coded transform coefficients. • However the algorithms differ significantly in the methods selected for image transforms and entropy coding. • H.264 achieves at least a 2X improvement over MPEG4. Thus H.264 is likely to supplant MPEG2 and MPEG4 in new applications. • Example: To achieve a PSNR(Peak Signal to RMS Noise Ratio ) level of 28, NBA must be coded at a rate of 5 mbps using MPEG2, but only 1.8 mbps using H.264.
  • 22. MPEG2 vs. H.264 • MPEG2 vs. H.264
  • 23. MPEG2 vs. H.264 Algorithm Characteristic MPEG2/MPEG4 H.264 General Motion compensated predictive, residual transformed, entropy coded similar Intra Prediction None Multi-direction, Multi- pattern Coded Image Types I,B,P I,B,P, SP Transform 8x8 DCT 4x4 DCT-like Integer Transform Motion Estimation Blocks 16x16 16x16, 8x8, 8x4, 4x4 Entropy Coding Multiple VLC Tables Arithmetic Coding and adaptive VLC Tables
  • 24. MPEG2 vs. H.264 Algorithm Characteristic MPEG2/MPEG4 H.264 Frame Distance for Prediction +/- 1 Unlimited forward/backward Fractional Motion Estimation 1/2 Pixel (MPEG2) 1/4 Pixel (MPEG4) 1/4 Pixel Deblocking Filter None Dynamic edge filters
  • 25. Description of the Reconstruction Filter in H264 • A filter is applied to every decoded macroblock in order to reduce blocking distortion. • There are three types (3, 4, 5 taps) of filters for both • vertical and horizontal directions and the filter decision is based on the combinations of conditions including boundary strengths, image gradients and thresholds that are affected by the average quantization parameters across the block boundary.
  • 26. Deblocking Loop Filter in H264: Boundary Strength Block modes and conditions Boundary- strength One of the blocks(4x4 block) is an intra and the edge is a macro-block edge(lies on 16x16 boundary). 4 One of the blocks is intra and the edge is not a macro-block edge. 3 One of the blocks has coded residuals 2 Difference of block motion >= 1 luma sample distance 1 Motion compensation from different reference frames 1 else 0 Orderofconditionevaluation
  • 27. Deblocking Loop Filter in H264: Boundary Strength Block boundary between block p and q Block p or q intra coded or slice type is SI or SP ? Bs=3 Block boundary is also Macroblock boundary ? Coefficients coded in block p or q ? Bs=2Bs=4 |V1(p,x) - V1(q,x)| >= 1 or |V1 (p,y) - V1 (q,y)| >= 1 or if bi-predictive |V2(p,x) - V2(q,x)| >= 1 or |V2(p,y) - V2(q,y)| >= 1 Bs=0 (skip) Bs=1 YES NO YES YES NO NO Block p and q have different reference frames or a different number of reference frames? YES NO YES NO
  • 28. Boundary Strength • To every edge between two 4x4 luminance sample blocks, a Boundary strength Bs parameter is assigned an integer value form 0 to 4. • The value of “Bs” depend on the modes and coding conditions of the two adjacent blocks. • Conditions are evaluated from top to bottom, until one of the conditions holds true and the corresponding value is assigned to Bs. • Bs determines the strength of the filtering performed on the edge, including a selection between two filtering modes.
  • 29. Deblocking Filtering Condition • Filtering conditions: are used to decide whether or not to switch off the filtering when there is enough change across the block boundary in the original image to indicate a real edge and not some blocking artifact. • The decision is based on threshold values: α and β • As the blocking artifacts change with the value of the Quantization parameter, The threshold values should adapt to the value of Qp (the quantization parameter). • It is expected that as “Qp” increases, the blocking artifacts contribution to the change in pixel-value across the block boundary would also increase. • Conversely, when “Qp” is small, blocking effects should not affect the image boundary significantly, and as such, the thresholds are set very low. • Any change, other than a small gradient at the boundary is more likely to be an image feature than a blocking artifacts/
  • 30. Alpha α -table • IndexA = clip3(0,51,QPav + Filter_offset_A) • The α-table is indexed by IndexA which is related to Qp as shown. • Filtering is only performed for points that lie below the curve. 0 10 20 30 40 50 60 0 50 100 150 200 250 300 alpha index vs. QPav QPav alpha Filtering No-Filtering
  • 31. Beta β -table • IndexB = clip3(0,51,QPav + Filter_offset_B) • The β -table is indexed by IndexB which is related to Qp as shown above 0 10 20 30 40 50 60 0 2 4 6 8 10 12 14 16 18 beta vs. QP av QP av beta Filtering No Filtering
  • 32. Value for filter clipping parameter C0 as a function of IndexA and Bs (boundary strength) 0 10 20 30 40 50 60 0 5 10 15 20 25 C0 vs. QPav QPav C0 Bs=1 Bs=2 Bs=3 • C0 is used as a limiting value.
  • 33. Boundaries of macr-blocks to be filtered, H.264 • 4x4 block boundary represent the boundaries to be filtered for luma in both vertical and horizontal direction. 16x16 block boundary (solid red line) 4x4 block boundary (solid blue line) Horizontal edges for chroma filtering (green dashed line) Vertical edges for chroma filtering (green dashed line)
  • 34. H.264 Deblocking Filter β<−= |02| ppap β<− |01| qq β<− |01| pp Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 α<− |00| qp β<−= |02| qqaq
  • 35. Deblocking Filtering Condition: for Bs < 4 • iff Bs ≠ 0 && |p0 – q0| < α && |p1 – p0| < β && |q1 – q0| < β is true • The values of the thresholds α and β are dependent on the average value of QP for the two blocks p3 p2 p1 p0 q0 q1 q2 q3
  • 36. H.264 : P0,Q0 filtering of edges with Bs < 4 • A 4-tap linear! filter, is applied with inputs p1, p0, q1,q0, producing filtered output P0 and Q0 • C is determined by setting it equal to C0. The value of C could be incremented by a “1” or “2” depending on the relations described above.      <∧<+ <+ ≥∧≥ = −= −= ∆−= ∆+= +−+− −=∆ )()(20 )(10 )()(0 02 02 )0(10 )0(10 ) 8 4)11()00(*4 ,,(3 ββ β ββ qp p qp q p aaiffC aiffC aaiffC C qqa ppa qclipQ pclipP qppq CCclip p3 p2 p1 p0 q0 q1 q2 q3
  • 37. H.264 : P0,Q0 filtering of edges with Bs < 4 • The new pixel values P0,Q0 showing the contribution of the term 4(q0-p0)/8, will align P0 and Q0 p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 0)00( ≥− pqP0,Q0
  • 38. H.264 : P0,Q0 filtering of edges with Bs < 4 • The new pixel values P0,Q0 showing the contribution of the term (p1-q1)/8, will adjust the position of P0 and Q0 accordingly p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 0)11( ≤− qp P0 Q0 Final edge Final Q0 Final P0
  • 39. H.264 : P1,Q1 filtering of edges with Bs < 4 • Moreover, if |p2-p0| is less than a threshold, then a 4-tap linear! filter is applied on the points p2,p1,p0,q0. This is used to compute the new value of P1. Similarly for Q1. • The filter for p1 does in fact assume that the two pixels around p1 are represented by p2, and (p0+q0)/2 which is the average value of p0 and q0. • The difference between p1 and the two surrounding pixels dscribed above is computed. The average value of these two differences is computed, and added to the original value of p1 to compute the new value of P1. • Similar argument apply to Q1 computation 02 02 : )02() 2 1*22/)00(2 ,0,0(311 )02() 2 1*22/)00(2 ,0,0(311 qqa ppa where qqaiff qpqq CCclipqQ ppaiff ppqp CCclippP q p q p −= −= <−= −++ −+= <−= −++ −+= β β p3 p2 p1 p0 q0 q1 q2 q3 p3 p2 p1 p0 q0 q1 q2 q3
  • 40. H.264 : P1 filtering of edges with Bs < 4 • The average value of (p2-p1) and ((p0+q0)/2-p1) is added to p1 to form the new value P1 p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 ) 2 00 ( qp + P0 Q0 0)12( ≥− pp 0)1) 2 00 (( ≥− + p qp
  • 41. H.264 : P1 filtering of edges with Bs < 4 • So, if (p2-p0) is below some threshold β, which indicates the image does not have a lot of details, then filtering is done on p1, and the resulting pixel P1 is shown as indicated. Otherwise, p1 retain its original value. p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 ) 2 00 ( qp + P0 Q0 P1 Final P1
  • 42. H.264 : Q1 filtering of edges with Bs < 4 • The average value of (q2-q1) and ((p0+q0)/2-q1) is added to q1 to form the new value Q1 p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 ) 2 00 ( qp + P0 Q0 0)1) 2 00 (( ≤− + q qp P1 0)12( ≥− qq
  • 43. H.264 : Q1 filtering of edges with Bs < 4 • The average value of (q2-q1) and ((p0+q0)/2-q1) is added to q1 to form the new value Q1 p3 p2 p1 p0 q0 q1 q2 q3 Block Boundary p2 p1 p0 q1 q2q0 Decoded pixel positions q3p3 p0 q0 ) 2 00 ( qp + P0 Q0 P1 Final Q1 Q1
  • 44. H.264 : P0,P1,P2 Strong filtering of edges with Bs = 4 • Strong filtering is performed when the following conditions hold: • Bs = 4 && iff (ap=|p2 – p0|) < β && |p0– q0| < (α/4 + 2) is true  Apply strong filtering to P0,P1,P2 as described next Else  only filter P0 as follows: p3 p2 p1 p0 q0 q1 q2 q3 4 2101*2 0 +++ = qpp P
  • 45. H.264 : Q0,Q1,Q2 Strong filtering of edges with Bs = 4 • Strong filtering is performed when the following conditions hold: • Bs = 4 && iff (aq=|q2 – q0|) < β && |p0– q0| < (α/4 + 2) is true  Apply strong filtering to Q0,Q1,Q2 as described next Else  only filter Q0 as follows: p3 p2 p1 p0 q0 q1 q2 q3 4 2101*2 0 +++ = pqq Q
  • 46. αs= (α/4 + 2) is significantly less than α. This indicates that the application of the strong filtering(Bs=4) will be more limited than the moderate filter case (0<Bs<4) p3 p2 p1 p0 q0 q1 q2 q3 0 10 20 30 40 50 60 0 50 100 150 200 250 300 alpha and alphas vs. QPav QPav alpha alpha alphas H.264 : αs for Strong filtering of edges with Bs = 4
  • 47. H.264 : P0,P1,P2 filtering of edges with Bs =4 • A 5-tap linear! filter, is applied, with inputs p2,p1, p0,q0,q1 producing filtered output P0. • A 4-tap linear! filter, is applied, with inputs p2,p1,p0,q0 producing filtered output P1. • In the case of luma filtering, p2 is also filtered, with inputs p3,p2,p1,p0,q0 producing filtered output P2 8 40012*33*2 2 4 20012 1 8 410*20*21*22 0 +++++ = ++++ = +++++ = qpppp P filteringlumaiff qppp P qqppp P p3 p2 p1 p0 q0 q1 q2 q3 p3 p2 p1 p0 q0 q1 q2 q3 p3 p2 p1 p0 q0 q1 q2 q3
  • 48. H.264 : Q0,Q1,Q2 filtering of edges with Bs = 4 • A 5-tap linear! filter, is applied, with inputs q2,q1, q0,p0,p1 producing filtered output Q0. • A 4-tap linear! filter, is applied, with inputs q2,q1,q0,p0 producing filtered output Q1. • In the case of luma filtering, q2 is also filtered, with inputs q3,q2,q1,q0,p0 producing filtered output Q2 8 40012*33*2 2 4 20012 1 8 410*20*21*22 0 +++++ = ++++ = +++++ = pqqqq Q filteringlumaiff pqqq Q ppqqq Q p3 p2 p1 p0 q0 q1 q2 q3 p3 p2 p1 p0 q0 q1 q2 q3 p3 p2 p1 p0 q0 q1 q2 q3
  • 49. A post-processing deblocking filter for MPEG2/4 A B C E FD Decoded pixel positions Block Boundary X=|D-C| PixelValue
  • 50. A post-processing deblocking filter,(moderate Filtering) 8x8 block boundary C B E D p0 p1 q1 q0 q2 CB D E p1 p0 q0 q1 q2p2 p2 A F FA If |C-D|<1.25*Quant_scale { x = D-C A’ = A B’ = B + x/8 C’ = C + x/2 D’ = D – x/2 E’ = E - x/8 F’ = F }
  • 51. A post-processing deblocking filter,(moderate Filtering)PixelValue A B C E FD Decoded pixel positions Block Boundary x=|D-C| X/2 X/8 A’ B’ C’,D’ E’ F’
  • 52. A post-processing deblocking filter,(moderate Filtering) • The proposed moderate filter, changes only 4 pixels at the block boundary. • The advantage of using such a moderate filter, is the fact that it does not blur the regions with high spatial details. • The filtering effect is restricted to regions with strong blocking effects, specially those locacted near the edge of the block.
  • 53. A post-processing deblocking filter,(Strong Filtering) C B E D p0 p1 q1 q0 q2 CB D E p1 p0 q0 q1 q2p2 p2 8x8 block boundary A F FA If |C-D|<2*Quant_scale { x = D-C A’ = A + x/8 B’ = B + x/4 C’ = C + x/2 D’ = D – x/2 E’ = E – x/4 F’ = F – x/8 }
  • 54. A post-processing deblocking filter,(Strong Filtering) A B C E FD Decoded pixel positions Block Boundary X=|D-C| PixelValue X/2 X/4 X/8
  • 55. A post-processing deblocking filter,(Adaptive Filtering) • The moderate filter, changes only 4 pixels at the block boundary. • The strong filter, changes 6 pixels at the block boundary. • The strength of the filter is to be chosen adaptively according to the blocking effect. • … Next time, we will describe how to adaptively determine between the strong and moderate filtering. • Start using an mpeg-2 encoder and use it under different quantization scales/parameters, see how the different filtering algorithms behave.
  • 56. Post processing deblocking filter (input,3Mbps) • gfg
  • 57. Post processing deblocking medium-filter (output,3Mbps) • dd
  • 58. Post processing deblocking strong-filter (output,3Mbps) • dfg
  • 60. Computing the Power Signal to Noise Ratio • MSE = Mean squared Error • PSNR = Power Signal to Noise Ratio 2 1 1 ]),(ˆ),([ 1 ∑∑= = −⋅ ⋅ = x yN i N jyy jifjif NN MSE 2 1 1 ]),(ˆ),([ 1 ∑∑= = −⋅ ⋅ = x yN i N jyy jifjif NN RMSE ) 255 log(20 RMSE PSNR ⋅=
  • 61. Deblocking an arbitrary scaled Frame: Horizontal Direction • Create a histogram that takes into account that scaling might have been implemented on the frame in the horizontal direction.
  • 63. Detecting vertical block boundary • Evaluation of the ∑= −= V i ii PPBV 1 2,1,)1(
  • 64. Detecting vertical block boundary • Detecting the vertical block boundary • H is the number of pixel in the horizontal direction (no of pixels per line) • V is the number of lines (number of lines per frame) ∑ ∑ ∑ = −− = = −= −= −= V i HiHiH V i ii V i ii PPBV PPBV PPBV 1 1,,)1( 1 3,2,)2( 1 2,1,)1( ...
  • 65. Detecting a horizontal block boundary • Detecting the horizontal block boundary
  • 66. Detecting a horizontal block boundary • Detecting the horizontal block boundary • H is the number of pixel in the horizontal direction (no of pixels per line) • V is the number of lines (number of lines per frame) ∑ ∑ ∑ = −− = = −= −= −= H j jVjVV H j jj H j jj PPBH PPBH PPBH 1 ,1,)1( 1 ,2,3)2( 1 ,1,2)1( ...