FFmpeg
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
thread.c File Reference
#include <stdatomic.h>
#include "libavutil/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 ADD(dx, dy, stage)   frame_thread_add_score(s, ft, t->rx + (dx), t->ry + (dy), stage)
 
#define CHECK(a, b)
 
#define VVC_THREAD_DEBUG
 

Typedefs

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

Enumerations

enum  VVCTaskStage {
  VVC_TASK_STAGE_PARSE, 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 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 int task_ready (const AVTask *_t, void *user_data)
 
static int task_priority_higher (const AVTask *_a, const AVTask *_b)
 
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_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 (AVTask *_t, void *local_context, void *user_data)
 
AVExecutorff_vvc_executor_alloc (VVCContext *s, const int thread_count)
 
void ff_vvc_executor_free (AVExecutor **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)
 
static void check_colocation (VVCContext *s, VVCTask *t)
 
static void submit_entry_point (VVCContext *s, VVCFrameThread *ft, SliceContext *sc, EntryPoint *ep)
 
int ff_vvc_frame_submit (VVCContext *s, VVCFrameContext *fc)
 
int ff_vvc_frame_wait (VVCContext *s, VVCFrameContext *fc)
 

Variables

const static char * task_name []
 

Macro Definition Documentation

◆ ADD

#define ADD (   dx,
  dy,
  stage 
)    frame_thread_add_score(s, ft, t->rx + (dx), t->ry + (dy), stage)

◆ CHECK

#define CHECK (   a,
  b 
)
Value:
do { \
if ((a) != (b)) \
return (a) < (b); \
} while (0)

Definition at line 377 of file thread.c.

◆ VVC_THREAD_DEBUG

#define VVC_THREAD_DEBUG

Definition at line 545 of file thread.c.

Typedef Documentation

◆ run_func

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

Definition at line 559 of file thread.c.

Enumeration Type Documentation

◆ VVCTaskStage

Enumerator
VVC_TASK_STAGE_PARSE 
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 105 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 114 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 127 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 140 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 145 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 151 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 163 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 210 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 219 of file thread.c.

Referenced by mv_done(), and pixel_done().

◆ pixel_done()

static void pixel_done ( VVCProgressListener l)
static

Definition at line 229 of file thread.c.

Referenced by listener_init().

◆ mv_done()

static void mv_done ( VVCProgressListener l)
static

Definition at line 234 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 239 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 252 of file thread.c.

Referenced by check_colocation(), and schedule_inter().

◆ schedule_next_parse()

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

Definition at line 262 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 288 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 309 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 321 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 360 of file thread.c.

Referenced by task_ready(), and task_run().

◆ task_ready()

static int task_ready ( const AVTask _t,
void *  user_data 
)
static

Definition at line 370 of file thread.c.

Referenced by ff_vvc_executor_alloc().

◆ task_priority_higher()

static int task_priority_higher ( const AVTask _a,
const AVTask _b 
)
static

Definition at line 383 of file thread.c.

Referenced by ff_vvc_executor_alloc().

◆ report_frame_progress()

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

Definition at line 401 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 423 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 442 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 455 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 462 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 475 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 491 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 509 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 528 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 561 of file thread.c.

Referenced by task_run().

◆ task_run()

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

Definition at line 602 of file thread.c.

Referenced by ff_vvc_executor_alloc().

◆ ff_vvc_executor_alloc()

AVExecutor* ff_vvc_executor_alloc ( VVCContext s,
const int  thread_count 
)

Definition at line 624 of file thread.c.

Referenced by vvc_decode_init().

◆ ff_vvc_executor_free()

void ff_vvc_executor_free ( AVExecutor **  e)

Definition at line 636 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 641 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 655 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 681 of file thread.c.

Referenced by frame_start().

◆ check_colocation()

static void check_colocation ( VVCContext s,
VVCTask t 
)
static

Definition at line 746 of file thread.c.

Referenced by ff_vvc_frame_submit().

◆ submit_entry_point()

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

Definition at line 763 of file thread.c.

Referenced by ff_vvc_frame_submit().

◆ ff_vvc_frame_submit()

int ff_vvc_frame_submit ( VVCContext s,
VVCFrameContext fc 
)

Definition at line 771 of file thread.c.

Referenced by submit_frame().

◆ ff_vvc_frame_wait()

int ff_vvc_frame_wait ( VVCContext s,
VVCFrameContext fc 
)

Definition at line 802 of file thread.c.

Referenced by wait_delayed_frame().

Variable Documentation

◆ task_name

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

Definition at line 547 of file thread.c.

Referenced by task_run_stage().

b
#define b
Definition: input.c:41
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41