[Ffmpeg-devel] Some possible libswscale cleanups?

Aurelien Jacobs aurel
Thu Dec 21 16:55:07 CET 2006


On Thu, 21 Dec 2006 16:46:25 +0100
Luca Abeni <lucabe72 at email.it> wrote:

> Hi Michael,
> 
> On Thu, 2006-12-21 at 16:12 +0100, Michael Niedermayer wrote:
> [...]
> > >  #define YSCALE_YUV_2_RGBX_C(type) \
> > >  			YSCALE_YUV_2_PACKEDX_C(type)\
> > > -			r = c->table_rV[V];\
> > > -			g = c->table_gU[U] + c->table_gV[V];\
> > > -			b = c->table_bU[U];\
> > > +			r = (type *)c->table_rV[V];\
> > > +			g = (type *)c->table_gU[U] + c->table_gV[V];\
> > > +			b = (type *)c->table_bU[U];\
> > 
> > void* + int != random_type* + int
> Ughh... This is embarassing :( I just added "(type *)" without looking
> at the code (and when I tested it "type" probably was "uint8_t").
> I think the correct version should be
> -			b = c->table_bU[U];\
> +			r = (type *)c->table_rV[V];\
> +			g = (type *)(c->table_gU[U] + c->table_gV[V]);\
> right?

No, because here you still do arithmetic with void pointer !
You probably want something like this:

+	g = (type *)c->table_gU[U] + c->table_gV[V]/sizeof(type);\

Aurel




More information about the ffmpeg-devel mailing list