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

Michael Niedermayer michaelni
Mon Apr 20 00:00:53 CEST 2009


On Sun, Apr 19, 2009 at 11:08:42PM +0200, Stefano Sabatini wrote:
> On date Sunday 2009-04-19 20:30:01 +0200, Michael Niedermayer encoded:
> > On Sun, Apr 19, 2009 at 06:43:15PM +0200, Stefano Sabatini wrote:
> [...]
> > > Well but I was looking for a more general solution, for which this one
> > > couldn't work.
> > 
> > but why? which pixel format can not be handled?
> 
> I didn't know that, I supposed that there could be in this wild wild
> world, now I'm happy that there are not. 
> > > 
> > > BTW, should be change accordingly read_line()?
> > 
> > i cant parse this sentance
> 
> I meant:
> "BTW, should we change read_line() accordingly?
> 
> What I meant was to remove dependancy on get_bits.h, like in the
> attached patch.

benchmark?


[...]
> @@ -111,16 +110,18 @@
>      int flags= desc->flags;
>  
>      if (flags & PIX_FMT_BITSTREAM){
> -        GetBitContext gb;
> -        init_get_bits(&gb, data[plane] + y*linesize[plane], linesize[plane]*8);
> -        skip_bits_long(&gb, x*step + comp.offset_plus1-1);
> +        int skip = x*step + comp.offset_plus1-1;
> +        const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
> +        int shift = 8 - depth - (skip&7);
>  
>          while(w--){
> -            int val = show_bits(&gb, depth);
> +            int val = (*p >> shift) & mask;
> -            if(read_pal_component)
> +            if (read_pal_component)
> -                val= data[1][4*val + c];
> +                val = data[1][4*val + c];

cosmetic & functional mix

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

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- 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/20090420/c33356fd/attachment.pgp>



More information about the ffmpeg-devel mailing list