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

Michael Niedermayer michaelni
Sun Apr 19 15:56:10 CEST 2009


On Sun, Apr 19, 2009 at 12:35:44PM +0200, Stefano Sabatini wrote:
> 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).

i meant what i wrote
*p |= *src++ << shift;

and 
shift &= 7; done priorly in all cases makes sure this is not negative
so i am no sure what you meant
did i miss something ?

and yes it of course wont work with >8bit per sample or where a sample
crosses a byte boundary but i dont think there are any pixel formats that
would use the bitstream case and require these that we want to support.
If you know of a specific example pixel format that would fail and that
actually exists iam interrested ...

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20090419/02a5e219/attachment.pgp>



More information about the ffmpeg-devel mailing list