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>
This commit is contained in:
Andreas Rheinhardt 2022-06-30 20:31:35 +02:00
parent db99ca2150
commit b4ca3c7e4e
4 changed files with 4 additions and 16 deletions

View File

@ -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;

View File

@ -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));
}

View File

@ -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);

View File

@ -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)
{
}