[FFmpeg-devel] [PATCH 1/4] cabac-test: Return 1 if there are any errors

James Almer jamrial at gmail.com
Fri Apr 10 20:36:29 CEST 2015


On 10/04/15 2:27 PM, Timothy Gu wrote:
> ---
>  libavcodec/cabac.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
> index 81a75dd..c755d7f 100644
> --- a/libavcodec/cabac.c
> +++ b/libavcodec/cabac.c
> @@ -174,7 +174,7 @@ int main(void){
>      CABACContext c;
>      uint8_t b[9*SIZE];
>      uint8_t r[9*SIZE];
> -    int i;
> +    int i, ret = 0;
>      uint8_t state[10]= {0};
>      AVLFG prng;
>  
> @@ -207,21 +207,27 @@ STOP_TIMER("put_cabac")
>  
>      for(i=0; i<SIZE; i++){
>  START_TIMER

Unrelated to this patch, but why are these used here?
Especially now that this is going to be run by FATE and the output pretty much ignored outside 
of success/failure return values, benchmarking code shouldn't be hardcoded like this.

> -        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);
> +            ret = 1;
> +        }
>  STOP_TIMER("get_cabac_bypass")
>      }
>  
>      for(i=0; i<SIZE; i++){
>  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);
> +            ret = 1;
> +        }
>  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");
> +        ret = 1;
> +    }
>  
> -    return 0;
> +    return ret;
>  }
>  
>  #endif /* TEST */
> 



More information about the ffmpeg-devel mailing list