On 11/11/2017 7:16 PM, Michael Niedermayer wrote:
> This is more correct if multiple slices are handled in parallel
> 
> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> ---
>  libavcodec/error_resilience.c | 4 ++--
>  libavcodec/error_resilience.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
> index 0c7f29d171..4c517335cf 100644
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -864,7 +864,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
>      }
>  
>      if (status & ER_MB_ERROR) {
> -        s->error_occurred = 1;
> +        avpriv_atomic_int_set(&s->error_occurred, 1);
>          avpriv_atomic_int_set(&s->error_count, INT_MAX);

Could you try to port ER to C11 atomics instead? There are only a few
modules left using the libavutil avpriv_ stuff and it would be really
great if we could remove its usage before the unstable ABI period ends,
since after that the symbols will become part of the new ABI and we'll
have to stick with them until the next bump.

>      }
>  
> @@ -892,7 +892,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
>  
>          prev_status &= ~ VP_START;
>          if (prev_status != (ER_MV_END | ER_DC_END | ER_AC_END)) {
> -            s->error_occurred = 1;
> +            avpriv_atomic_int_set(&s->error_occurred, 1);
>              avpriv_atomic_int_set(&s->error_count, INT_MAX);
>          }
>      }
> diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
> index 27c2008694..0eb07b1d30 100644
> --- a/libavcodec/error_resilience.h
> +++ b/libavcodec/error_resilience.h
> @@ -61,7 +61,7 @@ typedef struct ERContext {
>      ptrdiff_t b8_stride;
>  
>      volatile int error_count;
> -    int error_occurred;
> +    volatile int error_occurred;
>      uint8_t *error_status_table;
>      uint8_t *er_temp_buffer;
>      int16_t *dc_val[3];
> 

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to