Commit 28a2d7af authored by Loren Merritt's avatar Loren Merritt

checkasm cabac

parent 1877d1c4
......@@ -895,8 +895,7 @@ static inline void x264_cabac_encode_renorm( x264_cabac_t *cb )
x264_cabac_putbyte( cb );
}
#ifndef HAVE_MMX
void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx, int b )
void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b )
{
int i_state = cb->state[i_ctx];
int i_range_lps = x264_cabac_range_lps[i_state][(cb->i_range>>6)&0x03];
......@@ -909,7 +908,6 @@ void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx, int b )
cb->state[i_ctx] = x264_cabac_transition[i_state][b];
x264_cabac_encode_renorm( cb );
}
#endif
void x264_cabac_encode_bypass( x264_cabac_t *cb, int b )
{
......
......@@ -53,12 +53,19 @@ void x264_cabac_context_init( x264_cabac_t *cb, int i_slice_type, int i_qp, int
/* encoder only: */
void x264_cabac_encode_init ( x264_cabac_t *cb, uint8_t *p_data, uint8_t *p_end );
void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx, int b );
void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b );
void x264_cabac_encode_decision_asm( x264_cabac_t *cb, int i_ctx, int b );
void x264_cabac_encode_bypass( x264_cabac_t *cb, int b );
void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val );
void x264_cabac_encode_terminal( x264_cabac_t *cb );
void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb );
#ifdef HAVE_MMX
#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
#else
#define x264_cabac_encode_decision x264_cabac_encode_decision_c
#endif
static inline int x264_cabac_pos( x264_cabac_t *cb )
{
return (cb->p - cb->p_start + cb->i_bytes_outstanding) * 8 + cb->i_queue;
......
......@@ -81,7 +81,7 @@ endstruc
%endif
%endmacro
cglobal x264_cabac_encode_decision, 0,7
cglobal x264_cabac_encode_decision_asm, 0,7
movifnidn t0d, r0m
movifnidn t1d, r1m
picgetgot t2
......
......@@ -41,6 +41,7 @@ static uint16_t cabac_prefix_size[15][128];
/* CABAC: not exactly the same. x264_cabac_size_decision() keeps track of
* fractional bits, but only finite precision. */
#undef x264_cabac_encode_decision
#define x264_cabac_encode_decision(c,x,v) x264_cabac_size_decision(c,x,v)
#define x264_cabac_encode_terminal(c) x264_cabac_size_decision(c,276,0)
#define x264_cabac_encode_bypass(c,v) ((c)->f8_bits_encoded += 256)
......
......@@ -854,6 +854,36 @@ static int check_intra( int cpu_ref, int cpu_new )
return ret;
}
#define DECL_CABAC(cpu) \
static void run_cabac_##cpu( uint8_t *dst )\
{\
int i;\
x264_cabac_t cb;\
x264_cabac_context_init( &cb, SLICE_TYPE_P, 26, 0 );\
x264_cabac_encode_init( &cb, dst, dst+0xff0 );\
for( i=0; i<0x400; i++ )\
x264_cabac_encode_decision_##cpu( &cb, buf1[i]>>1, buf1[i]&1 );\
}
DECL_CABAC(c)
#ifdef HAVE_MMX
DECL_CABAC(asm)
#else
#define run_cabac_asm run_cabac_c
#endif
static int check_cabac( int cpu_ref, int cpu_new )
{
int ret = 0, ok, used_asm = 1;
if( cpu_ref || run_cabac_c == run_cabac_asm)
return 0;
memcpy( buf4, buf3, 0x1000 );
call_c( run_cabac_c, buf3 );
call_a( run_cabac_asm, buf4 );
ok = !memcmp( buf3, buf4, 0x1000 );
report( "cabac :" );
return ret;
}
int check_all( int cpu_ref, int cpu_new )
{
return check_pixel( cpu_ref, cpu_new )
......@@ -861,7 +891,8 @@ int check_all( int cpu_ref, int cpu_new )
+ check_mc( cpu_ref, cpu_new )
+ check_intra( cpu_ref, cpu_new )
+ check_deblock( cpu_ref, cpu_new )
+ check_quant( cpu_ref, cpu_new );
+ check_quant( cpu_ref, cpu_new )
+ check_cabac( cpu_ref, cpu_new );
}
int add_flags( int *cpu_ref, int *cpu_new, int flags, const char *name )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment