[vlc-devel] [PATCH] adding posterize video filter

Rémi Denis-Courmont remi at remlab.net
Tue Sep 14 04:00:13 CEST 2010

On Saturday 11 September 2010, Branko Kokanovic wrote:
> Only thing I'm not satisfied with is that I
> implemented my own functions for RGB<->YUV conversion, but since I asked
> here that before[2] and no one replied, I didn't had much choice.

In some cases, a filter can request a different input format than comes from 
upstream (or more commonly output format than is expected downstream). But 
this all depends on the core logic for chaining the filters of each types 
(audio, video).

On top of my head, I don't know the rules for video filtering. In practice, 
most filters are implemented directly (at the very least) for I420, which is by 
far the most common chroma outputted by video decoders. Chromatic conversion 
is an intensive CPU operation in the context of real-time video playback. 
Conversion from YCbCr to RGB spaces is normally offloaded to the GPU as part of 
rendering, which is not possible if you want to post-process the RGB values.

If you really need to convert on-the-fly to RGB, you should try to force an RGB 
chroma as input from the filter activation function. If that is not implemented 
by the core, you should get a video chroma plugin to do it. Video chroma 
plugins provide CPU-specific vectorized assembly code, which is much faster 
than normal C functions. You can use module_need(), or a higher level function 
if available - I don't know that area of VLC much.

Rémi Denis-Courmont

More information about the vlc-devel mailing list