Log in

View Full Version : VP9 Loopfilter sizing.


Dorian
19th January 2016, 11:44
Hello everyone!

I'm trying to size a VP9 decoder. To do so I'm trying to understand the VP9 loopfilter system.

More specifically, I'm trying to know the theoretical maximum number of filtering that can occur when decoding a frame given a certain resolution.

When I say "number of filtering" I mean: the number of time the processing part of filter4, filter8 or filter16 (from libvpx) are called.

I've been trying several time to understand the mask mechanism used in libvpx, but I always failed to do it entirely. Maybe you guys know where I can find a simpler explanation ? I've been looking on this (http://forum.doom9.org/showthread.php?t=168947) thread from pieter3d which was a great help in my overall understanding of the codec, but not specific enough to compute what I wanted.

I've monitored libvpx to see if I could figure a relation between resolution and number of filtering but I haven't been successful. Here's what I measured:

on a 8x8 resolution: a maximum of 16 filtering occurred
on a 16x16 resolution: a maximum of 128 filtering occurred
on a 32x32 resolution: a maximum of 1072 filtering occurred
on a 64x64 resolution: a maximum of 3664 filtering occurred

Any hint to find the theoretical maximum of filtering ?

Thanks a lot!

Dorian

Jamaika
19th January 2016, 15:14
What do you mean? Macroblocks.
The codec VP8 is described here (http://blog.webmproject.org/2010/07/inside-webm-technology-vp8-intra-and.html).
In the decoder VPXdec (v1.5.0-132 LigH) you can't turn off the blocks for VP9 / VP10. There are no such functions.
They are only:
VP8 Postprocessing Options:
--noise-level=<arg> Enable VP8 postproc add noise
--deblock Enable VP8 deblocking
--demacroblock-level=<arg> Enable VP8 demacroblocking, w/ level
--pp-debug-info=<arg> Enable VP8 visible debug info
--pp-dbg-ref-frame=<arg> Display only selected reference frame per macro block
--pp-dbg-mb-modes=<arg> Display only selected macro block modes
--pp-dbg-b-modes=<arg> Display only selected block modes
--pp-dbg-mvs=<arg> Draw only selected motion vectors
--mfqe Enable multiframe quality enhancement

You can use video analyzer VP9. (https://software.intel.com/en-us/intel-video-pro-analyzer)

foxyshadis
19th January 2016, 16:52
I don't think a full final spec was ever released, nor is there a way (without changing the internals) to force the loop filter to always be one size, to profile each size's maximum, which makes answering that very difficult. It'd probably be best to ask Google directly (https://bugs.chromium.org/p/webm/issues/list).

Dorian
19th January 2016, 17:04
I don't think a full final spec was ever released

Well I use the libvpx source code as "specification". I discussed with google's vp9 team, this seems to be the best way (since the actual spec is more of a draft and the bistream is frozen)

, nor is there a way (without changing the internals) to force the loop filter to always be one size, to profile each size's maximum, which makes answering that very difficult.

Let's assume I can force 4x4 partitioning in an encoder. This way, if I understood the code correctly, all filters must be filter4. But I don't understand why there are so many filtering actually being done. Even if I add all the left edge and top edge of every 4x4 partitions both for luma and chroma, my theoretical result is far below the empirical measures.

MasterNobody
19th January 2016, 18:24
I didn't seen the code so this is only guess but may be additional filtering is due RDO i.e. it is used to calculate possible decisions distortion/bitcost and not only of final MBs that are written to bitstream.

Dorian
20th January 2016, 09:31
I didn't seen the code so this is only guess but may be additional filtering is due RDO i.e. it is used to calculate possible decisions distortion/bitcost and not only of final MBs that are written to bitstream.

Well I'm trying to monitor the number of filtering in the decoder. So no RDO :)

pieter3d
21st January 2016, 02:56
The filter8 and filter16 are only called for large transforms. For each 64x64 superblock, the filters are applied at the left and top edge of each transform block, and the no wider than half that transform block. So 16x16 and 32x32 transforms are the only ones that get filter16 applied. Note that it doesn't matter what the size is of the blocks on the other side, i.e. to the left or above.

If all transforms are 4x4, only filter4 will be applied.

Remember that the filters are cascaded. If filter16 is attempted but the threshold condition fails, filter8 is attempted next and so on. So the threshold conditions can be evaluated multiple times per edge, but only one filter is ever finally applied.

Dorian
21st January 2016, 09:24
Thank you for the detailed explanation. It matches what I understood from the code and the commentaries, so I guess I'm not far from getting the whole thing figured out ;). I will give it another try.

PS: and thanks again for both your posts on HEVC and VP9