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

Michael Niedermayer michaelni
Fri Apr 6 22:23:29 CEST 2007


Hi

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

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070406/a6526b5d/attachment.pgp>



More information about the ffmpeg-devel mailing list