You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	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:
		| @@ -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; | ||||
|   | ||||
| @@ -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)); | ||||
| } | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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) | ||||
| { | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user