FFmpeg
Loading...
Searching...
No Matches
thread.c File Reference
#include <stdatomic.h>
#include "libavcodec/executor.h"
#include "libavutil/mem.h"
#include "libavutil/thread.h"
#include "thread.h"
#include "ctu.h"
#include "filter.h"
#include "inter.h"
#include "intra.h"
#include "refs.h"

Go to the source code of this file.

Data Structures

struct  ProgressListener
 
struct  VVCTask
 
struct  VVCRowThread
 
struct  VVCFrameThread
 

Macros

#define PRIORITY_LOWEST   2
 
#define ADD(dx, dy, stage)
 

Typedefs

typedef int(* run_func) (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 

Enumerations

enum  VVCTaskStage {
  VVC_TASK_STAGE_INIT , VVC_TASK_STAGE_PARSE , VVC_TASK_STAGE_DEBLOCK_BS , VVC_TASK_STAGE_INTER ,
  VVC_TASK_STAGE_RECON , VVC_TASK_STAGE_LMCS , VVC_TASK_STAGE_DEBLOCK_V , VVC_TASK_STAGE_DEBLOCK_H ,
  VVC_TASK_STAGE_SAO , VVC_TASK_STAGE_ALF , VVC_TASK_STAGE_LAST
}
 

Functions

static void add_task (VVCContext *s, VVCTask *t)
 
static void task_init (VVCTask *t, VVCTaskStage stage, VVCFrameContext *fc, const int rx, const int ry)
 
static int task_init_parse (VVCTask *t, SliceContext *sc, EntryPoint *ep, const int ctu_idx)
 
static uint8_t task_add_score (VVCTask *t, const VVCTaskStage stage)
 
static uint8_t task_get_score (VVCTask *t, const VVCTaskStage stage)
 
static int is_first_row (const VVCFrameContext *fc, const int rx, const int ry)
 
static int task_has_target_score (VVCTask *t, const VVCTaskStage stage, const uint8_t score)
 
static void frame_thread_add_score (VVCContext *s, VVCFrameThread *ft, const int rx, const int ry, const VVCTaskStage stage)
 
static void sheduled_done (VVCFrameThread *ft, atomic_int *scheduled)
 
static void progress_done (VVCProgressListener *_l, const int type)
 
static void pixel_done (VVCProgressListener *l)
 
static void mv_done (VVCProgressListener *l)
 
static void listener_init (ProgressListener *l, VVCTask *t, VVCContext *s, const VVCProgress vp, const int y)
 
static void add_progress_listener (VVCFrame *ref, ProgressListener *l, VVCTask *t, VVCContext *s, const VVCProgress vp, const int y)
 
static void ep_init_wpp (EntryPoint *next, const EntryPoint *ep, const VVCSPS *sps)
 
static void schedule_next_parse (VVCContext *s, VVCFrameContext *fc, const SliceContext *sc, const VVCTask *t)
 
static void schedule_inter (VVCContext *s, VVCFrameContext *fc, const SliceContext *sc, VVCTask *t, const int rs)
 
static void parse_task_done (VVCContext *s, VVCFrameContext *fc, const int rx, const int ry)
 
static void task_stage_done (const VVCTask *t, VVCContext *s)
 
static int task_is_stage_ready (VVCTask *t, int add)
 
static void check_colocation (VVCContext *s, VVCTask *t)
 
static void submit_entry_point (VVCContext *s, VVCFrameThread *ft, SliceContext *sc, EntryPoint *ep)
 
static int run_init (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static void report_frame_progress (VVCFrameContext *fc, const int ry, const VVCProgress idx)
 
static int run_parse (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_deblock_bs (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_inter (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_recon (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_lmcs (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_deblock_v (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_deblock_h (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_sao (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static int run_alf (VVCContext *s, VVCLocalContext *lc, VVCTask *t)
 
static void task_run_stage (VVCTask *t, VVCContext *s, VVCLocalContext *lc)
 
static int task_run (FFTask *_t, void *local_context, void *user_data)
 
av_cold FFExecutorff_vvc_executor_alloc (VVCContext *s, const int thread_count)
 
av_cold void ff_vvc_executor_free (FFExecutor **e)
 
void ff_vvc_frame_thread_free (VVCFrameContext *fc)
 
static void frame_thread_init_score (VVCFrameContext *fc)
 
int ff_vvc_frame_thread_init (VVCFrameContext *fc)
 
int ff_vvc_frame_submit (VVCContext *s, VVCFrameContext *fc)
 
int ff_vvc_frame_wait (VVCContext *s, VVCFrameContext *fc)
 

Variables

static const char * task_name []
 

Macro Definition Documentation

◆ PRIORITY_LOWEST

#define PRIORITY_LOWEST   2

Definition at line 107 of file thread.c.

Referenced by add_task(), and ff_vvc_executor_alloc().

◆ ADD

#define ADD ( dx,
dy,
stage )
Value:
frame_thread_add_score(s, ft, t->rx + (dx), t->ry + (dy), stage)
#define s(width, name)
Definition cbs_vp9.c:198
static void frame_thread_add_score(VVCContext *s, VVCFrameThread *ft, const int rx, const int ry, const VVCTaskStage stage)
Definition thread.c:217

Referenced by task_stage_done().

Typedef Documentation

◆ run_func

typedef int(* run_func) (VVCContext *s, VVCLocalContext *lc, VVCTask *t)

Definition at line 622 of file thread.c.

Enumeration Type Documentation

◆ VVCTaskStage

Enumerator
VVC_TASK_STAGE_INIT 
VVC_TASK_STAGE_PARSE 
VVC_TASK_STAGE_DEBLOCK_BS 
VVC_TASK_STAGE_INTER 
VVC_TASK_STAGE_RECON 
VVC_TASK_STAGE_LMCS 
VVC_TASK_STAGE_DEBLOCK_V 
VVC_TASK_STAGE_DEBLOCK_H 
VVC_TASK_STAGE_SAO 
VVC_TASK_STAGE_ALF 
VVC_TASK_STAGE_LAST 

Definition at line 42 of file thread.c.

Function Documentation

◆ add_task()

static void add_task ( VVCContext * s,
VVCTask * t )
static

Definition at line 108 of file thread.c.

Referenced by frame_thread_add_score().

◆ task_init()

static void task_init ( VVCTask * t,
VVCTaskStage stage,
VVCFrameContext * fc,
const int rx,
const int ry )
static

Definition at line 132 of file thread.c.

Referenced by ff_vvc_frame_thread_init(), and frame_thread_init_score().

◆ task_init_parse()

static int task_init_parse ( VVCTask * t,
SliceContext * sc,
EntryPoint * ep,
const int ctu_idx )
static

Definition at line 145 of file thread.c.

Referenced by ff_vvc_frame_submit().

◆ task_add_score()

static uint8_t task_add_score ( VVCTask * t,
const VVCTaskStage stage )
static

Definition at line 158 of file thread.c.

Referenced by frame_thread_add_score().

◆ task_get_score()

static uint8_t task_get_score ( VVCTask * t,
const VVCTaskStage stage )
static

Definition at line 163 of file thread.c.

Referenced by task_is_stage_ready().

◆ is_first_row()

static int is_first_row ( const VVCFrameContext * fc,
const int rx,
const int ry )
static

Definition at line 169 of file thread.c.

Referenced by decode_cell_data(), schedule_next_parse(), and task_has_target_score().

◆ task_has_target_score()

static int task_has_target_score ( VVCTask * t,
const VVCTaskStage stage,
const uint8_t score )
static

Definition at line 181 of file thread.c.

Referenced by frame_thread_add_score(), and task_is_stage_ready().

◆ frame_thread_add_score()

static void frame_thread_add_score ( VVCContext * s,
VVCFrameThread * ft,
const int rx,
const int ry,
const VVCTaskStage stage )
static

◆ sheduled_done()

static void sheduled_done ( VVCFrameThread * ft,
atomic_int * scheduled )
static

Definition at line 234 of file thread.c.

Referenced by progress_done(), and task_run().

◆ progress_done()

static void progress_done ( VVCProgressListener * _l,
const int type )
static

Definition at line 243 of file thread.c.

Referenced by mv_done(), and pixel_done().

◆ pixel_done()

static void pixel_done ( VVCProgressListener * l)
static

Definition at line 253 of file thread.c.

Referenced by listener_init().

◆ mv_done()

static void mv_done ( VVCProgressListener * l)
static

Definition at line 258 of file thread.c.

Referenced by filter_mb_dir(), and listener_init().

◆ listener_init()

static void listener_init ( ProgressListener * l,
VVCTask * t,
VVCContext * s,
const VVCProgress vp,
const int y )
static

Definition at line 263 of file thread.c.

Referenced by add_progress_listener().

◆ add_progress_listener()

static void add_progress_listener ( VVCFrame * ref,
ProgressListener * l,
VVCTask * t,
VVCContext * s,
const VVCProgress vp,
const int y )
static

Definition at line 276 of file thread.c.

Referenced by check_colocation(), and schedule_inter().

◆ ep_init_wpp()

static void ep_init_wpp ( EntryPoint * next,
const EntryPoint * ep,
const VVCSPS * sps )
static

Definition at line 286 of file thread.c.

Referenced by schedule_next_parse().

◆ schedule_next_parse()

static void schedule_next_parse ( VVCContext * s,
VVCFrameContext * fc,
const SliceContext * sc,
const VVCTask * t )
static

Definition at line 293 of file thread.c.

Referenced by parse_task_done().

◆ schedule_inter()

static void schedule_inter ( VVCContext * s,
VVCFrameContext * fc,
const SliceContext * sc,
VVCTask * t,
const int rs )
static

Definition at line 317 of file thread.c.

Referenced by parse_task_done().

◆ parse_task_done()

static void parse_task_done ( VVCContext * s,
VVCFrameContext * fc,
const int rx,
const int ry )
static

Definition at line 338 of file thread.c.

Referenced by task_stage_done().

◆ task_stage_done()

static void task_stage_done ( const VVCTask * t,
VVCContext * s )
static

Definition at line 350 of file thread.c.

Referenced by frame_thread_init_score(), and task_run_stage().

◆ task_is_stage_ready()

static int task_is_stage_ready ( VVCTask * t,
int add )
static

Definition at line 393 of file thread.c.

Referenced by task_run().

◆ check_colocation()

static void check_colocation ( VVCContext * s,
VVCTask * t )
static

Definition at line 403 of file thread.c.

Referenced by run_init().

◆ submit_entry_point()

static void submit_entry_point ( VVCContext * s,
VVCFrameThread * ft,
SliceContext * sc,
EntryPoint * ep )
static

Definition at line 420 of file thread.c.

Referenced by run_init().

◆ run_init()

static int run_init ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 428 of file thread.c.

Referenced by task_run_stage().

◆ report_frame_progress()

static void report_frame_progress ( VVCFrameContext * fc,
const int ry,
const VVCProgress idx )
static

Definition at line 452 of file thread.c.

Referenced by run_alf(), run_inter(), and run_parse().

◆ run_parse()

static int run_parse ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 478 of file thread.c.

Referenced by task_run_stage().

◆ run_deblock_bs()

static int run_deblock_bs ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 497 of file thread.c.

Referenced by task_run_stage().

◆ run_inter()

static int run_inter ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 505 of file thread.c.

Referenced by task_run_stage().

◆ run_recon()

static int run_recon ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 521 of file thread.c.

Referenced by task_run_stage().

◆ run_lmcs()

static int run_lmcs ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 526 of file thread.c.

Referenced by task_run_stage().

◆ run_deblock_v()

static int run_deblock_v ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 539 of file thread.c.

Referenced by task_run_stage().

◆ run_deblock_h()

static int run_deblock_h ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 555 of file thread.c.

Referenced by task_run_stage().

◆ run_sao()

static int run_sao ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 573 of file thread.c.

Referenced by task_run_stage().

◆ run_alf()

static int run_alf ( VVCContext * s,
VVCLocalContext * lc,
VVCTask * t )
static

Definition at line 592 of file thread.c.

Referenced by task_run_stage().

◆ task_run_stage()

static void task_run_stage ( VVCTask * t,
VVCContext * s,
VVCLocalContext * lc )
static

Definition at line 624 of file thread.c.

Referenced by task_run().

◆ task_run()

static int task_run ( FFTask * _t,
void * local_context,
void * user_data )
static

Definition at line 665 of file thread.c.

Referenced by ff_vvc_executor_alloc().

◆ ff_vvc_executor_alloc()

av_cold FFExecutor * ff_vvc_executor_alloc ( VVCContext * s,
const int thread_count )

Definition at line 687 of file thread.c.

Referenced by vvc_decode_init().

◆ ff_vvc_executor_free()

av_cold void ff_vvc_executor_free ( FFExecutor ** e)

Definition at line 698 of file thread.c.

Referenced by vvc_decode_free().

◆ ff_vvc_frame_thread_free()

void ff_vvc_frame_thread_free ( VVCFrameContext * fc)

Definition at line 703 of file thread.c.

Referenced by ff_vvc_frame_thread_init(), and frame_context_free().

◆ frame_thread_init_score()

static void frame_thread_init_score ( VVCFrameContext * fc)
static

Definition at line 717 of file thread.c.

Referenced by ff_vvc_frame_thread_init().

◆ ff_vvc_frame_thread_init()

int ff_vvc_frame_thread_init ( VVCFrameContext * fc)

Definition at line 743 of file thread.c.

Referenced by frame_start().

◆ ff_vvc_frame_submit()

int ff_vvc_frame_submit ( VVCContext * s,
VVCFrameContext * fc )

Definition at line 808 of file thread.c.

Referenced by submit_frame().

◆ ff_vvc_frame_wait()

int ff_vvc_frame_wait ( VVCContext * s,
VVCFrameContext * fc )

Definition at line 837 of file thread.c.

Referenced by wait_delayed_frame().

Variable Documentation

◆ task_name

const char* task_name[]
static
Initial value:
= {
"INIT",
"P",
"B",
"I",
"R",
"L",
"V",
"H",
"S",
"A"
}

Definition at line 609 of file thread.c.

Referenced by task_run_stage().