Message ID | 20171111221656.12096-1-michael@niedermayer.cc |
---|---|
State | Superseded |
Headers | show |
On 11 November 2017 at 22:31, James Almer <jamrial@gmail.com> wrote: > 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 <michael@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. > I'd like for that too, there's only avpriv_atomic leftovers in libavutil/opencl.c and h264 ER
On 11/11/2017 7:49 PM, Rostislav Pehlivanov wrote: > On 11 November 2017 at 22:31, James Almer <jamrial@gmail.com> wrote: > >> 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 <michael@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. >> > > > I'd like for that too, there's only avpriv_atomic leftovers in > libavutil/opencl.c and h264 ER There's also lavc, lavf and lavfi's utils.c, where avpriv_atomic_ptr_cas() is used one or two times, and that should be ported to atomic_compare_exchange_strong or atomic_compare_exchange_weak.
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); } @@ -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];
This is more correct if multiple slices are handled in parallel Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/error_resilience.c | 4 ++-- libavcodec/error_resilience.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)