[FFmpeg-devel] [RFC] Documenting RV40 Loop Filter

Michael Niedermayer michaelni
Sun Nov 9 19:47:59 CET 2008

On Sun, Nov 09, 2008 at 05:47:51PM +0200, Kostya wrote:
> I post this in hope to clarify details of RV40 loop filter, since I don't
> understand all details of its work and hope to determine correct comments
> and variable names for my loop filter patch.
> Please comment. I will try to find to provide an additional information if
> possible.
> == Strong loop filter ==
> In strong filtering mode elements are replaced with values obtained from
> FIR filter with coefficients {25/128, 26/128, 26/128, 26/128, 25/128}
> (i.e. averaging pixel with two neighbours on each side). Filtered value
> may be clipped in order to not differ from original value by more than some
> limit value.
> For luma blocks pair (p3, q3) is also filtered but with filter
> {26/128, 51/128, 26/128, 26/128} where coefficient 51/128 is for original
> value and other values are for p1, p2, p4 or q1, q2, q4

you have a typo here, 26+51+26+26 is 129 but iam pretty sure it should be 128

also a clearer description of this would be
the middle 6 samples, that is 3 of each block are filtered by the 
(25,26,26,26,25)/128 FIR filter. The filter is mirrored at the 4x4 block
edges thus resulting in (26,51,26,25)/128 for p3 and similarly for q3.

> === Deblock patterns calculation (aka very black magic) ===
> Horizontal deblock pattern for luma is made from:
>  CBP for the current MB
>  coded block pattern made for the MB shifted one row of subblocks up
>  (i.e. its first row is really a bottom row of top neighbour MB, second row is
>   the first row of current MB, etc.)
>  top row CBP for the bottom neighbour is appended at the end
>  motion vectors pattern, i.e. when subblock lies on the edge of 8x8 block with
>   significant MV difference from its neighbour, then this subblock is also
>   marked in deblock pattern
>  some other values (maybe for B-frames)
> Vertical deblock pattern for luma is made from:
>  CBP for the current MB
>  CBP for the MB shifted left by one subblock column (i.e. its left column is
>   really right column of the left neighbour MB)
>  motion vector pattern
>  some other B-frame specific stuff (I hope)

Let me try a far fetched guess:
a edge is filtered (that is enabled in the pattern) if either of the 2
adjacent blocks are coded (that is the corresponding cbp bit being set
for either block) or their mv difference being "significant"


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081109/0d049834/attachment.pgp>

More information about the ffmpeg-devel mailing list