[Ffmpeg-devel] [PATCH] C93 demuxer and decoder (GSoC qualification task)

Diego Biurrun diego
Sat Apr 7 16:28:44 CEST 2007


On Fri, Apr 06, 2007 at 10:23:29PM +0200, Michael Niedermayer wrote:
> 
> On Fri, Apr 06, 2007 at 09:49:45PM +0300, Anssi Hannula wrote:
> [...]
> > > i think the following is more readable and simpler
> > 
> > I agree.
> > 
> > > static inline void draw_n_color(uint8_t *out, int stride, int width, int height,
> > >                                 int bpp, uint8_t cols[2], uint8_t grps[4], uint32_t col){
> > >     int x,y;
> > >     for(y=0; y<height; y++){
> > >         if(grps)
> > >             cols[1]= grps[3*(y>>1)];
> > >         for(x=0; x<width; x++){
> > >             if(grps)
> > >                 cols[0]= grps[(x>>1)+1];
> > >             out[x + y*stride] = cols[col >> (32-bpp)];
> > >             col<<=bpp;
> > 
> > You're reading col data backwards, this won't work.
> > We need
> >              out[x + y*stride] = cols[col & ((bpp & 2) + 1)];
> >              col >>= bpp;
> > or more generic
> >              out[x + y*stride] = cols[col & ((1 << bpp) - 1)];
> >              col >>= bpp;
> > unless you come up with something simpler (again), of course ;)
> > 
> > I put the latter one into the attached patch which includes your
> > approach with minor fixes.
> 
> patch looks ok

Applied.

Diego




More information about the ffmpeg-devel mailing list