You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/pthread*: Mark init, free, flush functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -29,13 +29,13 @@
|
|||||||
* @see doc/multithreading.txt
|
* @see doc/multithreading.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/thread.h"
|
#include "libavutil/thread.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "avcodec_internal.h"
|
#include "avcodec_internal.h"
|
||||||
#include "codec_internal.h"
|
#include "codec_internal.h"
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
#include "thread.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the threading algorithms used.
|
* Set the threading algorithms used.
|
||||||
@ -46,7 +46,7 @@
|
|||||||
*
|
*
|
||||||
* @param avctx The context.
|
* @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)
|
int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
|
||||||
&& !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
|
&& !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
|
||||||
@ -69,7 +69,7 @@ static void validate_thread_parameters(AVCodecContext *avctx)
|
|||||||
avctx->thread_count, MAX_AUTO_THREADS);
|
avctx->thread_count, MAX_AUTO_THREADS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_thread_init(AVCodecContext *avctx)
|
av_cold int ff_thread_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
validate_thread_parameters(avctx);
|
validate_thread_parameters(avctx);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ int ff_thread_init(AVCodecContext *avctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_thread_free(AVCodecContext *avctx)
|
av_cold void ff_thread_free(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
if (avctx->active_thread_type&FF_THREAD_FRAME)
|
if (avctx->active_thread_type&FF_THREAD_FRAME)
|
||||||
ff_frame_thread_free(avctx, avctx->thread_count);
|
ff_frame_thread_free(avctx, avctx->thread_count);
|
||||||
|
@ -718,7 +718,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Waits for all threads to finish.
|
/// 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;
|
int i;
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ DEFINE_OFFSET_ARRAY(PerThreadContext, per_thread, pthread_init_cnt,
|
|||||||
(OFF(input_cond), OFF(progress_cond), OFF(output_cond)));
|
(OFF(input_cond), OFF(progress_cond), OFF(output_cond)));
|
||||||
#undef OFF
|
#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;
|
FrameThreadContext *fctx = avctx->internal->thread_ctx;
|
||||||
const FFCodec *codec = ffcodec(avctx->codec);
|
const FFCodec *codec = ffcodec(avctx->codec);
|
||||||
@ -922,7 +922,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_frame_thread_init(AVCodecContext *avctx)
|
av_cold int ff_frame_thread_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
int thread_count = avctx->thread_count;
|
int thread_count = avctx->thread_count;
|
||||||
const FFCodec *codec = ffcodec(avctx->codec);
|
const FFCodec *codec = ffcodec(avctx->codec);
|
||||||
@ -985,7 +985,7 @@ error:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_thread_flush(AVCodecContext *avctx)
|
av_cold void ff_thread_flush(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FrameThreadContext *fctx = avctx->internal->thread_ctx;
|
FrameThreadContext *fctx = avctx->internal->thread_ctx;
|
||||||
@ -1087,7 +1087,7 @@ void ff_thread_release_ext_buffer(ThreadFrame *f)
|
|||||||
av_frame_unref(f->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;
|
PerThreadContext *p;
|
||||||
const void *ref;
|
const void *ref;
|
||||||
|
@ -22,19 +22,16 @@
|
|||||||
* @see doc/multithreading.txt
|
* @see doc/multithreading.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "codec_internal.h"
|
#include "codec_internal.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/common.h"
|
|
||||||
#include "libavutil/cpu.h"
|
#include "libavutil/cpu.h"
|
||||||
|
#include "libavutil/macros.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "libavutil/thread.h"
|
|
||||||
#include "libavutil/slicethread.h"
|
#include "libavutil/slicethread.h"
|
||||||
|
|
||||||
typedef int (action_func)(AVCodecContext *c, void *arg);
|
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;
|
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;
|
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);
|
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;
|
SliceThreadContext *c;
|
||||||
int thread_count = avctx->thread_count;
|
int thread_count = avctx->thread_count;
|
||||||
|
Reference in New Issue
Block a user