[Ffmpeg-devel] H.264 encoder

Panagiotis Issaris takis.issaris
Wed Oct 4 19:02:49 CEST 2006


Hi,

On wo, 2006-10-04 at 18:49 +0200, Christian Iversen wrote:
> On Wednesday 04 October 2006 17:51, Panagiotis Issaris wrote:
> 
> > > [...]
> > >
> > > > +                if (val > 0)
> > > > +                    val--;
> > > > +                else // < 0
> > > > +                    val++;
> > >
> > > val -= (val>>31)|1;
> >
> > Fixed.
> 
> Is it because I appearantly don't understand C, or is that a pretty odd 
> expression? 
> 
> You take the sign bit, and "or" it with 1, leaving ... 1, in all cases.
No, the sign bit is still there (arithmetic shift, sign bit gets
propagated), so together with the |1 it results in either -1 or +1.

> Is this expression equiv. to val--; ? 
Yes.

With friendly regards,
Takis





More information about the ffmpeg-devel mailing list