summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-06-30 20:31:35 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-25 23:32:34 +0200
commitb4ca3c7e4e4a098651f013b80d9d88cc1dc4d6b7 (patch)
tree253184b90a808629433917b8459c42169b0635a0
parentdb99ca21500534d1ca3eecc1039f1f45394569e1 (diff)
avcodec/pthread_slice: Combine allocating and zeroing entries
Actually, ff_slice_thread_allocz_entries() always already allocates zeroed entries, so ff_reset_entries() was already unnecessary. Make this more clear by renaming it to ff_slice_thread_allocz_entries(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/hevcdec.c3
-rw-r--r--libavcodec/pthread_slice.c8
-rw-r--r--libavcodec/thread.h3
-rw-r--r--libavcodec/utils.c6
4 files changed, 4 insertions, 16 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 8f7c186b00..f2d8044cd9 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2702,10 +2702,9 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
}
atomic_store(&s->wpp_err, 0);
- res = ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
+ res = ff_slice_thread_allocz_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
if (res < 0)
goto error;
- ff_reset_entries(s->avctx);
for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {
ret[i] = 0;
diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index e34116116d..756cc59dbf 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -237,7 +237,7 @@ void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int
pthread_mutex_unlock(&progress->mutex);
}
-int ff_alloc_entries(AVCodecContext *avctx, int count)
+int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
{
if (avctx->active_thread_type & FF_THREAD_SLICE) {
SliceThreadContext *p = avctx->internal->thread_ctx;
@@ -256,9 +256,3 @@ int ff_alloc_entries(AVCodecContext *avctx, int count)
return 0;
}
-
-void ff_reset_entries(AVCodecContext *avctx)
-{
- SliceThreadContext *p = avctx->internal->thread_ctx;
- memset(p->entries, 0, p->entries_count * sizeof(int));
-}
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index 92cbd927f1..d5673f25ea 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -104,8 +104,7 @@ int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),
int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);
void ff_thread_free(AVCodecContext *s);
-int ff_alloc_entries(AVCodecContext *avctx, int count);
-void ff_reset_entries(AVCodecContext *avctx);
+int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count);
int ff_slice_thread_init_progress(AVCodecContext *avctx);
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n);
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f78475d0ad..cae61d80ff 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -963,15 +963,11 @@ int ff_slice_thread_init_progress(AVCodecContext *avctx)
return 0;
}
-int ff_alloc_entries(AVCodecContext *avctx, int count)
+int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
{
return 0;
}
-void ff_reset_entries(AVCodecContext *avctx)
-{
-}
-
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
{
}