[FFmpeg-devel] [PATCH] Swscale YUV2RGB table generator

Michael Niedermayer michaelni
Sun Feb 8 21:08:01 CET 2009


On Sun, Feb 08, 2009 at 08:27:49PM +0200, Kostya wrote:
> Here's LGPLed version of YUV2RGB tables generator.
> While it may be not perfect, it seems to work.
> 
> Please test and/or give your comments.
[...]
> @@ -0,0 +1,740 @@
> +/*
> + * yuv2rgb2.c, Software YUV to RGB converter
> + *
> + *  Copyright (C) 2009, Konstantin Shishkov
> + *
> + *  MMX/MMX2 template stuff (needed for fast movntq support),
> + *  1,4,8bpp support and context / deglobalize stuff
> + *  by Michael Niedermayer (michaelni at gmx.at)
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
[...]

> +const int32_t Inverse_Table_6_9[8][4] = {

missing ff_ prefix


> +    {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
> +    {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
> +    {104597, 132201, 25675, 53279}, /* unspecified */
> +    {104597, 132201, 25675, 53279}, /* reserved */
> +    {104448, 132798, 24759, 53109}, /* FCC */
> +    {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
> +    {104597, 132201, 25675, 53279}, /* SMPTE 170M */
> +    {117579, 136230, 16907, 35559}  /* SMPTE 240M (1987) */
> +};
> +
> +#define RGB(i)                                      \
> +    U = pu[i];                                      \
> +    V = pv[i];                                      \
> +    r = (void *)c->table_rV[V];                     \
> +    g = (void *)(c->table_gU[U] + c->table_gV[V]);  \
> +    b = (void *)c->table_bU[U];
> +
> +#define DST1(i)                         \
> +    Y = py_1[2*i];                      \
> +    dst_1[2*i] = r[Y] + g[Y] + b[Y];    \
> +    Y = py_1[2*i+1];                    \
> +    dst_1[2*i+1] = r[Y] + g[Y] + b[Y];
> +
> +#define DST2(i)                         \
> +    Y = py_2[2*i];                      \
> +    dst_2[2*i] = r[Y] + g[Y] + b[Y];    \
> +    Y = py_2[2*i+1];                    \
> +    dst_2[2*i+1] = r[Y] + g[Y] + b[Y];
> +
> +#define DST1RGB(i)                                                \
> +    Y = py_1[2*i];                                                \
> +    dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y];  \
> +    Y = py_1[2*i+1];                                              \
> +    dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y];
> +
> +#define DST2RGB(i)                                                \
> +    Y = py_2[2*i];                                                \
> +    dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y];  \
> +    Y = py_2[2*i+1];                                              \
> +    dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y];
> +
> +#define DST1BGR(i)                                                \
> +    Y = py_1[2*i];                                                \
> +    dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y];  \
> +    Y = py_1[2*i+1];                                              \
> +    dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y];
> +
> +#define DST2BGR(i)                                                \
> +    Y = py_2[2*i];                                                \
> +    dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y];  \
> +    Y = py_2[2*i+1];                                              \
> +    dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
> +

this doesnt look rewritten
i think this has to be split out into a seperate GPL file or it has to
be rewritten as well


[...]

> +#if ARCH_BFIN

> +    if (c->flags & SWS_CPU_CAPS_BFIN)
> +    {

{ placement is not K&R


[...]

> +int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)

av_cold


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

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090208/ee909db5/attachment.pgp>



More information about the ffmpeg-devel mailing list