aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-03-09 20:39:25 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-03-12 17:00:24 +0100
commit34aa8449b8169783f2b15e3e4c3338e77584c865 (patch)
treeaa6242ebeb5f2800c5cf1f4bab2b28edd2ea12b7
parent8abac5898ba55280907253848f8121507c068305 (diff)
downloadffmpeg-34aa8449b8169783f2b15e3e4c3338e77584c865.tar.gz
avcodec/pthread*: Mark init, free, flush functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/pthread.c8
-rw-r--r--libavcodec/pthread_frame.c10
-rw-r--r--libavcodec/pthread_slice.c11
3 files changed, 13 insertions, 16 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index d32e56de0d..6d604566e3 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -29,13 +29,13 @@
* @see doc/multithreading.txt
*/
+#include "libavutil/attributes.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "avcodec_internal.h"
#include "codec_internal.h"
#include "pthread_internal.h"
-#include "thread.h"
/**
* Set the threading algorithms used.
@@ -46,7 +46,7 @@
*
* @param avctx The context.
*/
-static void validate_thread_parameters(AVCodecContext *avctx)
+static av_cold void validate_thread_parameters(AVCodecContext *avctx)
{
int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
&& !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
@@ -69,7 +69,7 @@ static void validate_thread_parameters(AVCodecContext *avctx)
avctx->thread_count, MAX_AUTO_THREADS);
}
-int ff_thread_init(AVCodecContext *avctx)
+av_cold int ff_thread_init(AVCodecContext *avctx)
{
validate_thread_parameters(avctx);
@@ -81,7 +81,7 @@ int ff_thread_init(AVCodecContext *avctx)
return 0;
}
-void ff_thread_free(AVCodecContext *avctx)
+av_cold void ff_thread_free(AVCodecContext *avctx)
{
if (avctx->active_thread_type&FF_THREAD_FRAME)
ff_frame_thread_free(avctx, avctx->thread_count);
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index d9df0d62a8..b982315f4e 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -718,7 +718,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
}
/// Waits for all threads to finish.
-static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count)
+static av_cold void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count)
{
int i;
@@ -750,7 +750,7 @@ DEFINE_OFFSET_ARRAY(PerThreadContext, per_thread, pthread_init_cnt,
(OFF(input_cond), OFF(progress_cond), OFF(output_cond)));
#undef OFF
-void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
+av_cold void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
{
FrameThreadContext *fctx = avctx->internal->thread_ctx;
const FFCodec *codec = ffcodec(avctx->codec);
@@ -922,7 +922,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
return 0;
}
-int ff_frame_thread_init(AVCodecContext *avctx)
+av_cold int ff_frame_thread_init(AVCodecContext *avctx)
{
int thread_count = avctx->thread_count;
const FFCodec *codec = ffcodec(avctx->codec);
@@ -985,7 +985,7 @@ error:
return err;
}
-void ff_thread_flush(AVCodecContext *avctx)
+av_cold void ff_thread_flush(AVCodecContext *avctx)
{
int i;
FrameThreadContext *fctx = avctx->internal->thread_ctx;
@@ -1087,7 +1087,7 @@ void ff_thread_release_ext_buffer(ThreadFrame *f)
av_frame_unref(f->f);
}
-enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset)
+av_cold enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset)
{
PerThreadContext *p;
const void *ref;
diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index ac455e48ed..83d5c1b16a 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -22,19 +22,16 @@
* @see doc/multithreading.txt
*/
-#include "config.h"
-
#include "avcodec.h"
#include "codec_internal.h"
#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
-#include "libavutil/avassert.h"
-#include "libavutil/common.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/macros.h"
#include "libavutil/mem.h"
-#include "libavutil/thread.h"
#include "libavutil/slicethread.h"
typedef int (action_func)(AVCodecContext *c, void *arg);
@@ -69,7 +66,7 @@ static void worker_func(void *priv, int jobnr, int threadnr, int nb_jobs, int nb
c->rets[jobnr] = ret;
}
-void ff_slice_thread_free(AVCodecContext *avctx)
+av_cold void ff_slice_thread_free(AVCodecContext *avctx)
{
SliceThreadContext *c = avctx->internal->thread_ctx;
@@ -112,7 +109,7 @@ int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2* f
return thread_execute(avctx, NULL, arg, ret, job_count, 0);
}
-int ff_slice_thread_init(AVCodecContext *avctx)
+av_cold int ff_slice_thread_init(AVCodecContext *avctx)
{
SliceThreadContext *c;
int thread_count = avctx->thread_count;