[FFmpeg-devel] [PATCHv4] VP4 video decoder

Peter Ross pross at xvid.org
Thu May 23 14:57:31 EEST 2019


On Wed, May 22, 2019 at 09:45:46PM +0200, Reimar Döffinger wrote:
> On Tue, May 21, 2019 at 09:30:54PM +0200, Reimar Döffinger wrote:
> > > +#define SHIFT(v, shift) ((v) >> (shift))
> > > +#define ABS_SHIFT(v, shift) ((v) > 0 ? SHIFT(v, shift) : -SHIFT(-v, shift))
> >
> > Don't we have something like that already?
> 
> Seems we don't
> 
> > I think this should rather be:
> > (v - (v >> 31)) >> shift
> > ?
> 
> Not right for shift > 1.
> But this one according to my testing is equivalent:
> ((a + (a >> 31)) >> b) - (a >> 31)
> Not certain it will be fewer instructions,
> but it is branchless.

> On some ISAs the simple
> a / (1 << b)

this is best, and the compiler can decode. thanks.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190523/0940fd04/attachment.sig>


More information about the ffmpeg-devel mailing list