[FFmpeg-devel] [PATCH 10/20] swscale/output: add VYU444 output support

Michael Niedermayer michael at niedermayer.cc
Tue Oct 8 22:56:56 EEST 2024


On Mon, Oct 07, 2024 at 09:29:45AM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libswscale/output.c                      | 43 ++++++++++++++++++++++++
>  libswscale/utils.c                       |  2 +-
>  tests/ref/fate/filter-pixdesc-vyu444     |  1 +
>  tests/ref/fate/filter-pixfmts-copy       |  1 +
>  tests/ref/fate/filter-pixfmts-crop       |  1 +
>  tests/ref/fate/filter-pixfmts-field      |  1 +
>  tests/ref/fate/filter-pixfmts-fieldorder |  1 +
>  tests/ref/fate/filter-pixfmts-hflip      |  1 +
>  tests/ref/fate/filter-pixfmts-il         |  1 +
>  tests/ref/fate/filter-pixfmts-null       |  1 +
>  tests/ref/fate/filter-pixfmts-pad        |  1 +
>  tests/ref/fate/filter-pixfmts-scale      |  1 +
>  tests/ref/fate/filter-pixfmts-transpose  |  1 +
>  tests/ref/fate/filter-pixfmts-vflip      |  1 +
>  14 files changed, 56 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/filter-pixdesc-vyu444
> 
> diff --git a/libswscale/output.c b/libswscale/output.c
> index a11bedde95..6716cfad34 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -2931,6 +2931,46 @@ yuv2uyva_X_c(SwsContext *c, const int16_t *lumFilter,
>      }
>  }
>  
> +static void
> +yuv2vyu444_X_c(SwsContext *c, const int16_t *lumFilter,
> +               const int16_t **lumSrc, int lumFilterSize,
> +               const int16_t *chrFilter, const int16_t **chrUSrc,
> +               const int16_t **chrVSrc, int chrFilterSize,
> +               const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
> +{
> +    int i;
> +
> +    for (i = 0; i < dstW; i++) {
> +        int j;
> +        int Y = 1 << 18, U = 1 << 18;
> +        int V = 1 << 18;
> +
> +        for (j = 0; j < lumFilterSize; j++)
> +            Y += lumSrc[j][i] * lumFilter[j];
> +
> +        for (j = 0; j < chrFilterSize; j++)
> +            U += chrUSrc[j][i] * chrFilter[j];
> +
> +        for (j = 0; j < chrFilterSize; j++)
> +            V += chrVSrc[j][i] * chrFilter[j];
> +
> +        Y >>= 19;
> +        U >>= 19;
> +        V >>= 19;
> +
> +        if (Y  & 0x100)
> +            Y = av_clip_uint8(Y);
> +        if (U  & 0x100)
> +            U = av_clip_uint8(U);
> +        if (V  & 0x100)
> +            V = av_clip_uint8(V);
> +
> +        dest[3 * i    ] = V;
> +        dest[3 * i + 1] = Y;
> +        dest[3 * i + 2] = U;
> +    }
> +}
> +
>  #define output_pixel(pos, val, bits) \
>      AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
>  
> @@ -3465,6 +3505,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
>          *yuv2packed2 = yuv2uyvy422_2_c;
>          *yuv2packedX = yuv2uyvy422_X_c;
>          break;
> +    case AV_PIX_FMT_VYU444:
> +        *yuv2packedX = yuv2vyu444_X_c;
> +        break;

does this work in the unscaled and 2 tap scaling cases ? (which would normally
use teh other 2pointers

thx

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241008/1f7c4fc1/attachment.sig>


More information about the ffmpeg-devel mailing list