[FFmpeg-devel] [PATCH] swscale: RGBA64 output (broken)

Michael Niedermayer michaelni at gmx.at
Tue Feb 26 01:34:08 CET 2013


On Mon, Feb 25, 2013 at 12:14:57PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libswscale/output.c  | 188 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  libswscale/utils.c   |   4 +-
>  libswscale/yuv2rgb.c |  50 ++++++++++++++
>  3 files changed, 240 insertions(+), 2 deletions(-)
[...]
> diff --git a/libswscale/utils.c b/libswscale/utils.c
> index 932cf94..e3cf10d 100644
> --- a/libswscale/utils.c
> +++ b/libswscale/utils.c
> @@ -136,8 +136,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
>      [AV_PIX_FMT_YUVA444P16LE]= { 1, 1 },
>      [AV_PIX_FMT_RGB48BE]     = { 1, 1 },
>      [AV_PIX_FMT_RGB48LE]     = { 1, 1 },
> -    [AV_PIX_FMT_RGBA64BE]    = { 1, 0 },
> -    [AV_PIX_FMT_RGBA64LE]    = { 1, 0 },
> +    [AV_PIX_FMT_RGBA64BE]    = { 1, 1 },
> +    [AV_PIX_FMT_RGBA64LE]    = { 1, 1 },
>      [AV_PIX_FMT_RGB565BE]    = { 1, 1 },
>      [AV_PIX_FMT_RGB565LE]    = { 1, 1 },
>      [AV_PIX_FMT_RGB555BE]    = { 1, 1 },
> diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
> index d12abda..e3dee18 100644
> --- a/libswscale/yuv2rgb.c
> +++ b/libswscale/yuv2rgb.c
> @@ -109,6 +109,18 @@ const int *sws_getCoefficients(int colorspace)
>      dst[12 * i +  8] = dst[12 * i +  9] = g[Y];     \
>      dst[12 * i + 10] = dst[12 * i + 11] = b[Y];
>  
> +#define PUTRGBA64(dst, ysrc, asrc, i)                      \
> +    Y                = ysrc[ 2 * i];                 \
> +    dst[16 * i +  0] = dst[16 * i +  1] = r[Y];     \
> +    dst[16 * i +  2] = dst[16 * i +  3] = g[Y];     \
> +    dst[16 * i +  4] = dst[16 * i +  5] = b[Y];     \
> +    dst[16 * i +  6] = dst[16 * i +  7] = asrc[2 * i];     \
> +    Y                = ysrc[ 2 * i + 1];             \
> +    dst[16 * i +  8] = dst[16 * i +  9] = r[Y];     \
> +    dst[16 * i + 10] = dst[16 * i + 11] = g[Y];     \
> +    dst[16 * i + 12] = dst[16 * i + 13] = b[Y];     \
> +    dst[16 * i + 14] = dst[16 * i + 15] = asrc[2 * i + 1];
> +
>  #define PUTBGR48(dst, src, i)                       \
>      Y                = src[2 * i];                  \
>      dst[12 * i +  0] = dst[12 * i +  1] = b[Y];     \

> @@ -170,6 +182,40 @@ const int *sws_getCoefficients(int colorspace)
>      ENDYUV2RGBLINE(dst_delta, 0)                    \
>      ENDYUV2RGBFUNC()
>  
> +YUV2RGBFUNC(yuv2rgb_c_64, uint8_t, 0)
                                      ^
shouldnt that be 1


> +    LOADCHROMA(0);
> +    PUTRGBA64(dst_1, py_1, pa_1, 0);
> +    PUTRGBA64(dst_2, py_2, pa_2, 0);
> +
> +    LOADCHROMA(1);
> +    PUTRGBA64(dst_2, py_2, pa_2, 1);
> +    PUTRGBA64(dst_1, py_1, pa_1, 1);
> +
> +    LOADCHROMA(2);
> +    PUTRGBA64(dst_1, py_1, pa_1, 2);
> +    PUTRGBA64(dst_2, py_2, pa_2, 2);
> +
> +    LOADCHROMA(3);
> +    PUTRGBA64(dst_2, py_2, pa_1, 3);
> +    PUTRGBA64(dst_1, py_1, pa_2, 3);

the _1 and _2 look a bit oddly mixed


[...]

> @@ -625,6 +671,9 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
>             av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat));
>  
>      switch (c->dstFormat) {
> +    case AV_PIX_FMT_RGBA64BE:
> +    case AV_PIX_FMT_RGBA64LE:
> +        return yuv2rgb_c_64;

this is missing a check that the source contains alpha (and possibly
a seperate function that works without alpha free source)

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130226/3433e3f9/attachment.asc>


More information about the ffmpeg-devel mailing list