[FFmpeg-devel] [PATCH] Implement pixdesc.h:write_line()

Kostya kostya.shishkov
Fri Apr 3 08:21:59 CEST 2009


On Thu, Apr 02, 2009 at 11:31:45PM +0200, Stefano Sabatini wrote:
> On date Thursday 2009-04-02 23:03:04 +0200, Michael Niedermayer encoded:
> > On Thu, Apr 02, 2009 at 10:53:25PM +0200, Stefano Sabatini wrote:
> > > On date Thursday 2009-04-02 22:40:50 +0200, Michael Niedermayer encoded:
> [...]
> > > > [...]
> > > > > +        while (w--) {
> > > > > +            int val = *src++;
> > > > > +            put_bits(&pb, depth, val);
> > > > > +            if (step - depth)
> > > > 
> > > > > +                skip_put_bits(&pb, step - depth);
> > > > 
> > > > i suspect this will randomize the bits
> > > 
> > > That's why I added the if (step - depth) check (yes without that it
> > > was broken).
> > > Am I missing something?
> > /**
> >  * Skips the given number of bits.
> >  * Must only be used if the actual values in the bitstream do not matter.
> >     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Well I read it as "the actual values in the bitstream do not matter,
> that is the skipped bits are simply discarded".
> 
> Now I can't say if the various put_bits() optimized implementation
> randomize the skipped bits or not.

It should be rather obvious - skipping bits in this situation means that
bits that were in that buffer before are unchanged. Since you don't know
what values were there, output values may differ (which is not good for
bitexact output).
 
> So I cannot say if we have to simply update the documentation or we
> have somehow to extend the API to support such a functionality (which
> looks to me - preserving the skipped bits - such a basic requirement
> that I'm puzzled discovering that it isn't supported).
> 
> Regards.



More information about the ffmpeg-devel mailing list