[FFmpeg-devel] [PATCH] h264_cabac.c: branchless (amvd>2)+(amvd>32)
John Cox
jc
Fri Feb 26 19:03:25 CET 2010
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
John Cox
More information about the ffmpeg-devel
mailing list