FFmpeg
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
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)   frame_thread_add_score(s, ft, t->rx + (dx), t->ry + (dy), stage)
 
#define VVC_THREAD_DEBUG
 

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 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)
 
FFExecutorff_vvc_executor_alloc (VVCContext *s, const int thread_count)
 
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

const static char * task_name []
 

Macro Definition Documentation

◆ PRIORITY_LOWEST

#define PRIORITY_LOWEST   2

Definition at line 107 of file thread.c.

◆ ADD

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

◆ VVC_THREAD_DEBUG

#define VVC_THREAD_DEBUG

Definition at line 604 of file thread.c.

Typedef Documentation

◆ run_func

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

Definition at line 620 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().

◆ schedule_next_parse()

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

Definition at line 286 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 312 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 333 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 345 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 388 of file thread.c.

Referenced by task_run().

◆ check_colocation()

static void check_colocation ( VVCContext s,
VVCTask t 
)
static

Definition at line 398 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 415 of file thread.c.

Referenced by run_init().

◆ run_init()

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

Definition at line 423 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 447 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 473 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 492 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 500 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 516 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 521 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 534 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 550 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 568 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 587 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 622 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()

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()

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 830 of file thread.c.

Referenced by wait_delayed_frame().

Variable Documentation

◆ task_name

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

Definition at line 606 of file thread.c.

Referenced by task_run_stage().