On Sat, Mar 24, 2012 at 11:26 PM, Alexander Strange <[email protected]> wrote: > On Thu, Mar 22, 2012 at 9:53 AM, Ronald S. Bultje <[email protected]> wrote: >> Hi, >> >> 2012/3/20 Måns Rullgård <[email protected]>: >>> "Ronald S. Bultje" <[email protected]> writes: >>> >>>> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind >>>> --- >>>> libavcodec/x86/cabac.h | 15 ++++++++++----- >>>> libavcodec/x86/h264_i386.h | 18 ++++++++++++------ >>>> 2 files changed, 22 insertions(+), 11 deletions(-) >>>> >>>> diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h >>>> index 78d8af7..082395c 100644 >>>> --- a/libavcodec/x86/cabac.h >>>> +++ b/libavcodec/x86/cabac.h >>>> @@ -51,7 +51,7 @@ >>>> "xor "tmp" , "ret" \n\t" >>>> #endif /* HAVE_FAST_CMOV */ >>>> >>>> -#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, >>>> tmpbyte, byte) \ >>>> +#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, >>>> tmpbyte, byte, end) \ >>>> "movzbl "statep" , "ret" \n\t"\ >>>> "mov "range" , "tmp" \n\t"\ >>>> "and $0xC0 , "range" \n\t"\ >>>> @@ -64,9 +64,12 @@ >>>> "shl %%cl , "low" \n\t"\ >>>> "mov "tmpbyte" , "statep" \n\t"\ >>>> "test "lowword" , "lowword" \n\t"\ >>>> - " jnz 1f \n\t"\ >>>> + " jnz 2f \n\t"\ >>> >>> Why do you renumber these? Number labels don't need to be in ascending >>> order or anything like that. >> >> Because it's cleaner. >> >>>> "mov "byte" , %%"REG_c" \n\t"\ >>>> + "cmp "end" , %%"REG_c" \n\t"\ >>>> + "jge 1f \n\t"\ >>>> "add"OPSIZE" $2 , "byte" \n\t"\ >>>> + "1: \n\t"\ >>> >>> Is there no way of doing this with cmov instead of branching? >> >> No. If you have suggestions, I'm naturally very open to them. >> >> Any other review? Again, this patch + other cabac ones depending on it >> has been sitting here for days with no review, no progress and no >> plan. >> >> Ping. >> >> Ronald > > Because this only changes the refill operation I don't think it's > seriously performance-sensitive; that branch doesn't run often. But > how about a benchmark?
I agree; if we're just adding a check in refill, the cost is completely negligible. Jason _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
