1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

cabac-test: Return 1 if there are any errors

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Timothy Gu 2015-04-10 10:27:34 -07:00 committed by Michael Niedermayer
parent 61090db29a
commit 744594685e

View File

@ -174,7 +174,7 @@ int main(void){
CABACContext c; CABACContext c;
uint8_t b[9*SIZE]; uint8_t b[9*SIZE];
uint8_t r[9*SIZE]; uint8_t r[9*SIZE];
int i; int i, ret = 0;
uint8_t state[10]= {0}; uint8_t state[10]= {0};
AVLFG prng; AVLFG prng;
@ -207,21 +207,27 @@ STOP_TIMER("put_cabac")
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
START_TIMER START_TIMER
if( (r[i]&1) != get_cabac_bypass(&c) ) if( (r[i]&1) != get_cabac_bypass(&c) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i); av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i);
ret = 1;
}
STOP_TIMER("get_cabac_bypass") STOP_TIMER("get_cabac_bypass")
} }
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
START_TIMER START_TIMER
if( (r[i]&1) != get_cabac_noinline(&c, state) ) if( (r[i]&1) != get_cabac_noinline(&c, state) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i); av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
ret = 1;
}
STOP_TIMER("get_cabac") STOP_TIMER("get_cabac")
} }
if(!get_cabac_terminate(&c)) if(!get_cabac_terminate(&c)) {
av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n"); av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n");
ret = 1;
}
return 0; return ret;
} }
#endif /* TEST */ #endif /* TEST */