[FFmpeg-devel] [PATCH] [RFC] Second try at pixdesc.h:write_line()

Stefano Sabatini stefano.sabatini-lala
Sun Apr 19 12:35:44 CEST 2009


On date Saturday 2009-04-18 20:48:03 +0200, Michael Niedermayer encoded:
> On Sat, Apr 18, 2009 at 08:31:35PM +0200, Stefano Sabatini wrote:
> > On date Saturday 2009-04-18 19:00:45 +0200, Michael Niedermayer encoded:
> > [...]
> > > here is my suggestion again:
> > > 
> > > > > for(){
> > > > >     *buf |= *pixel++ << s;
> > > > >     s-= C;
> 
> > > > >     buf -= s>>8;
> 
> that should be s>>3
> 
> 
> > > > >     s&=7;
> > > > > }
> > 
> > Maybe I'm dumb, I failed to get it the first time, and failing again.
> > 
> 
> > What does C stand for? What is s supposed to be?
> 
> constant, that is a value that doesnt change during the loop
> 
> 
> > Are you suggesting to
> > use a pointer to int8_t, int32_t, what?
> 
> *buf is uint8_t

Mmh what about this?

        while (w--) {
            *p |= *src++ << (8 - depth + shift);
            shift -= step;
            p -= shift >> 3;
            shift &= 7;
        }

I'm not still sure it is what you meant.  Also AFAIU this can only
work for a pixel depth of 1, while pixel/source can contain pixels
with a depth up to 16 bits (uint16_t).

Note that I cannot shift for a negative value (result is undefined).

Complete patch attached.

Regards.
-- 
FFmpeg = Foolish and Frightening Mythic Proud Eager Generator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixdesc-write-line.patch
Type: text/x-diff
Size: 2161 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090419/291c91c9/attachment.patch>



More information about the ffmpeg-devel mailing list