aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2017-03-22 18:23:17 +0100
committerClément Bœsch <u@pkh.me>2017-03-22 18:38:27 +0100
commite28bd75f7cfd17169562d7c7f5a4a5386aba68e1 (patch)
treee1144b9236b705bf8f447c4e05c2c9c04434cd87 /libavcodec
parent38d7cc22f7782de2e7aca8eda2c2c2996f7f5700 (diff)
downloadffmpeg-e28bd75f7cfd17169562d7c7f5a4a5386aba68e1.tar.gz
lavc/hevc: use atomics for wpp_err
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc.c11
-rw-r--r--libavcodec/hevc.h4
2 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 0b4a719fe7..0b007f16e5 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -23,7 +23,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/atomic.h"
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/display.h"
@@ -2406,7 +2405,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int
ff_thread_await_progress2(s->avctx, ctb_row, thread, SHIFT_CTB_WPP);
- if (avpriv_atomic_int_get(&s1->wpp_err)){
+ if (atomic_load(&s1->wpp_err)) {
ff_thread_report_progress2(s->avctx, ctb_row , thread, SHIFT_CTB_WPP);
return 0;
}
@@ -2417,7 +2416,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int
if (more_data < 0) {
s->tab_slice_address[ctb_addr_rs] = -1;
- avpriv_atomic_int_set(&s1->wpp_err, 1);
+ atomic_store(&s1->wpp_err, 1);
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
return more_data;
}
@@ -2429,7 +2428,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int
ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size);
if (!more_data && (x_ctb+ctb_size) < s->ps.sps->width && ctb_row != s->sh.num_entry_point_offsets) {
- avpriv_atomic_int_set(&s1->wpp_err, 1);
+ atomic_store(&s1->wpp_err, 1);
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
return 0;
}
@@ -2530,7 +2529,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
s->sList[i]->HEVClc = s->HEVClcList[i];
}
- avpriv_atomic_int_set(&s->wpp_err, 0);
+ atomic_store(&s->wpp_err, 0);
ff_reset_entries(s->avctx);
for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {
@@ -3340,6 +3339,8 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
s->picture_struct = 0;
s->eos = 1;
+ atomic_init(&s->wpp_err, 0);
+
if(avctx->active_thread_type & FF_THREAD_SLICE)
s->threads_number = avctx->thread_count;
else
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 6a3c7506c2..ff9a6cbf6d 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -23,6 +23,8 @@
#ifndef AVCODEC_HEVC_H
#define AVCODEC_HEVC_H
+#include <stdatomic.h>
+
#include "libavutil/buffer.h"
#include "libavutil/md5.h"
@@ -885,7 +887,7 @@ typedef struct HEVCContext {
uint16_t seq_output;
int enable_parallel_tiles;
- int wpp_err;
+ atomic_int wpp_err;
const uint8_t *data;