[FFmpeg-devel] [PATCH] h264_cabac.c: branchless (amvd>2)+(amvd>32)
Michael Niedermayer
michaelni
Sat Feb 27 00:11:57 CET 2010
On Fri, Feb 26, 2010 at 06:03:25PM +0000, John Cox wrote:
> Hi
>
> >Modified patch:
> >
> >Index: libavcodec/h264_cabac.c
> >===================================================================
> >--- libavcodec/h264_cabac.c (revision 22075)
> >+++ libavcodec/h264_cabac.c (working copy)
> >@@ -912,7 +912,7 @@
> > static int decode_cabac_mb_mvd( H264Context *h, int ctxbase, int amvd, int *mvda) {
> > int mvd;
> >
> >- if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+(amvd>2)+(amvd>32)])){
> >+ if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+((amvd-3)>>(INT_BIT-1))+((amvd-33)>>(INT_BIT-1))+2])){
> > *mvda= 0;
> > return 0;
> > }
>
> I admit I can't remember if 2-amvd can be done in a single instruction but if
> it can then ((unsigned int)(2 - amvd)>>(INT_BIT-1))+((unsigned int)(32 -
> amvd)>>(INT_BIT-1)) saves you a +2
theres another way to avoid the +2, look at where the ctxbase comes from
(though it seems that is not faster here)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- 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/20100227/908c883d/attachment.pgp>
More information about the ffmpeg-devel
mailing list