gavl
Typedefs
Multithreading

Multithreading. More...

Typedefs

typedef void(* gavl_video_process_func )(void *data, int start, int end)
 Prototype of a process function. More...
 
typedef void(* gavl_video_run_func )(gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)
 Run a piece of a calculation. More...
 
typedef void(* gavl_video_stop_func )(void *client_data, int thread)
 Wait until a piece of a calculation finished. More...
 

Detailed Description

Multithreading.

gavl has generic multithreading support for video processing. It's done by splitting the calculations in smaller pieces (usually slices of the destination images) and calling user supplied functions, which can transfer the tasks to worker threads. Multithreading is configured with gavl_video_options_set_num_threads, gavl_video_options_set_run_func and gavl_video_options_set_stop_func

Typedef Documentation

typedef void(* gavl_video_process_func)(void *data, int start, int end)

Prototype of a process function.

Parameters
dataPrivate data
startWhere the function should start
endWhere the function should end (exclusive)

This function is supplied by gavl and passed to the application, which then executes multiple instances of the functions in multiple threads

typedef void(* gavl_video_run_func)(gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)

Run a piece of a calculation.

Parameters
funcFunction to execute
gavl_data1. Argument for func
start2. Argument for func
end3. Argument for func
client_dataData passed with gavl_video_options_set_run_func
threadNumber of processing thread (starting with 0)

This function supplied by the application and passed to gavl via gavl_video_options_set_run_func. It should call func with the given parameters in a worker thread.

typedef void(* gavl_video_stop_func)(void *client_data, int thread)

Wait until a piece of a calculation finished.

client_data Data passed with gavl_video_options_set_stop_func

Parameters
threadNumber of processing thread (starting with 0)

This function must make sure that the task started by gavl_video_run_func is finished.