[FFmpeg-devel] [PATCH] Implement brg4 and rgb4 input support in libswscale

Michael Niedermayer michaelni
Thu May 20 21:40:58 CEST 2010


On Wed, May 19, 2010 at 12:18:36AM +0200, Stefano Sabatini wrote:
> On date Friday 2010-05-14 03:16:33 +0200, Michael Niedermayer encoded:
> > On Fri, May 14, 2010 at 01:33:38AM +0200, Stefano Sabatini wrote:
> > > On date Friday 2010-05-14 00:50:29 +0200, Michael Niedermayer encoded:
> > > > On Fri, May 14, 2010 at 12:46:10AM +0200, Stefano Sabatini wrote:
> > > > > Hi,
> > > > > 
> > > > > here it is my naive implementation of subject, first attachment shows
> > > > > the code used to generate the used tables.
> > > > 
> > > > the table coefficients should be adjusted depenending on the
> > > > yuv type (sws_setColorspaceDetails)
> > > > 
> > > > (and yes i know we are missing this in other rgb->yuv code so its not
> > > >  mandatory for patch approval but would be very nice if we would be
> > > >  slowly fixing these shortcommings)
> > > 
> > > Do you prefer to use hardcoded tables or dynamically generated ones?
> > 
> > dynamically generate
> 
> This requires also to change the signatures for the
> c->chrToYV12 and c->lumToYV12 functions.
> 
> Also I'm not sure where the tables should be initialized.
> 
> Regards.
> -- 
> FFmpeg = Freak Fascinating Most Picky Ecumenical Guru

>  swscale.c          |   55 +++++++++++++++++++++++++++++++++++++----------------
>  swscale_internal.h |    6 +++++
>  utils.c            |   12 +++++++++++
>  3 files changed, 57 insertions(+), 16 deletions(-)
> 8d553520e505ed4fe02ba4e29ca1f000ea836e20  0005-Dymamically-generate-xgx42yuv-conversions-tables.patch
> >From fc4c16e07ea587320eb26ee70892f11ce811853f Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Tue, 18 May 2010 23:48:04 +0200
> Subject: [PATCH 5/5] Dymamically generate xgx42yuv conversions tables.
> 
> ---
>  swscale.c          |   55 ++++++++++++++++++++++++++++++++++++---------------
>  swscale_internal.h |    6 +++++
>  utils.c            |   12 +++++++++++
>  3 files changed, 57 insertions(+), 16 deletions(-)
> 
> diff --git a/swscale.c b/swscale.c
> index 6628eb1..2187da8 100644
> --- a/swscale.c
> +++ b/swscale.c
> @@ -1143,17 +1143,40 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin
>      }
>  }
>  
> -static const uint8_t rgb4ToYUV_table[3][16] = {
> -    {  16,  81,  58, 124, 101, 167, 144, 210,  40, 106,  83, 149, 126, 192, 169, 234 },
> -    { 128, 239,  96, 208,  65, 177,  34, 146, 109, 221,  78, 190,  47, 159,  15, 127 },
> -    { 128,  90, 103,  65,  78,  40,  53,  15, 239, 202, 215, 177, 190, 152, 165, 127 }
> -};
> +static uint8_t rgb4ToYUV_table[8][3][16];
> +static uint8_t bgr4ToYUV_table[8][3][16];

the used table should be in the context and initializd based on the
colorspace choosen by sws_setColorspaceDetails()

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20100520/55d42cf8/attachment.pgp>



More information about the ffmpeg-devel mailing list