[FFmpeg-devel] [PATCH/WIP] lavfi: hqx filters.

Michael Niedermayer michaelni at gmx.at
Tue Jun 10 03:55:09 CEST 2014


On Sun, Jun 08, 2014 at 11:15:17PM +0200, Clément Bœsch wrote:
> ---
> Only hq2x for now.
> 
> Original code for hq2x is about 2800 lines of unrolled code. Current filter is
> about 300 lines of code. The code in hq2x_interp() is generated from
> https://github.com/ubitux/hqx ("make code" - see also "make show"), which is
> done by parsing, analyzing and cutting down hq2x.c and friends.
> 
> The same need to be done for hq3x and hq4x. I don't know how long it will take.
> Help welcome for those interested.
> 
> See also Ticket #3404.
[...]

> +static av_always_inline uint32_t interp_2px(uint32_t c1, int w1, uint32_t c2, int w2, int s)
> +{
> +    return (((((c1 & 0xff000000) >> 24) * w1 + ((c2 & 0xff000000) >> 24) * w2) << (24 - s)) & 0xff000000) |
> +           (((((c1 & 0x00ff0000) >> 16) * w1 + ((c2 & 0x00ff0000) >> 16) * w2) << (16 - s)) & 0x00ff0000) |
> +           (((((c1 & 0x0000ff00) >>  8) * w1 + ((c2 & 0x0000ff00) >>  8) * w2) << ( 8 - s)) & 0x0000ff00) |
> +           (((((c1 & 0x000000ff)      ) * w1 + ((c2 & 0x000000ff)      ) * w2) >>       s ) & 0x000000ff);
> +}
> +
> +static av_always_inline uint32_t interp_3px(uint32_t c1, int w1, uint32_t c2, int w2, uint32_t c3, int w3, int s)
> +{
> +    return (((((c1 & 0xff000000) >> 24) * w1 + ((c2 & 0xff000000) >> 24) * w2 + ((c3 & 0xff000000) >> 24) * w3) << (24 - s)) & 0xff000000) |
> +           (((((c1 & 0x00ff0000) >> 16) * w1 + ((c2 & 0x00ff0000) >> 16) * w2 + ((c3 & 0x00ff0000) >> 16) * w3) << (16 - s)) & 0x00ff0000) |
> +           (((((c1 & 0x0000ff00) >>  8) * w1 + ((c2 & 0x0000ff00) >>  8) * w2 + ((c3 & 0x0000ff00) >>  8) * w3) << ( 8 - s)) & 0x0000ff00) |
> +           (((((c1 & 0x000000ff)      ) * w1 + ((c2 & 0x000000ff)      ) * w2 + ((c3 & 0x000000ff)      ) * w3) >>       s ) & 0x000000ff);
> +}

not sure its a good idea at this point but
even / odd samples could be scaled together
(((c1 & 0x00FF00FF) * w1 + (c2 & 0x00FF00FF) * w2) >> s) & 0x00FF00FF



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140610/52056b1c/attachment.asc>


More information about the ffmpeg-devel mailing list