comparison cabac.h @ 4050:2c79a8281cb6 libavcodec

Protect code that uses CMOV instructions with HAVE_CMOV, Make configure set CMOV_IS_FAST on arches on which cmov has a low latency (typically non-Netburst based processor)
author gpoirier
date Fri, 20 Oct 2006 17:53:19 +0000
parents 8c1a5ed03a00
children 19f07b651d79
comparison
equal deleted inserted replaced
4049:8c1a5ed03a00 4050:2c79a8281cb6
30 #include <assert.h> 30 #include <assert.h>
31 31
32 #define CABAC_BITS 16 32 #define CABAC_BITS 16
33 #define CABAC_MASK ((1<<CABAC_BITS)-1) 33 #define CABAC_MASK ((1<<CABAC_BITS)-1)
34 #define BRANCHLESS_CABAC_DECODER 1 34 #define BRANCHLESS_CABAC_DECODER 1
35 #define CMOV_IS_FAST 1
36 //#define ARCH_X86_DISABLED 1 35 //#define ARCH_X86_DISABLED 1
37 36
38 typedef struct CABACContext{ 37 typedef struct CABACContext{
39 int low; 38 int low;
40 int range; 39 int range;
452 ); 451 );
453 bit&=1; 452 bit&=1;
454 #else /* BRANCHLESS_CABAC_DECODER */ 453 #else /* BRANCHLESS_CABAC_DECODER */
455 454
456 455
457 #if (defined CMOV_IS_FAST && __CPU__ >= 686) 456 #if defined CMOV_IS_FAST
458 #define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ 457 #define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\
459 "mov "tmp" , %%ecx \n\t"\ 458 "mov "tmp" , %%ecx \n\t"\
460 "shl $17 , "tmp" \n\t"\ 459 "shl $17 , "tmp" \n\t"\
461 "cmp "low" , "tmp" \n\t"\ 460 "cmp "low" , "tmp" \n\t"\
462 "cmova %%ecx , "range" \n\t"\ 461 "cmova %%ecx , "range" \n\t"\