Commit d2d79ed7 authored by Henrik Gramner's avatar Henrik Gramner Committed by Jean-Baptiste Kempf

Remove dav1d_init()

Perform the library initialization as part of dav1d_open() instead.
parent c6788ed5
......@@ -40,11 +40,6 @@ typedef struct Dav1dSettings {
int n_tile_threads;
} Dav1dSettings;
/*
* Init the library.
*/
DAV1D_API void dav1d_init(void);
/**
* Get library version.
*/
......
......@@ -50,12 +50,6 @@ static void init_internal(void) {
av1_init_qm_tables();
}
static pthread_once_t initted = PTHREAD_ONCE_INIT;
void dav1d_init(void) {
pthread_once(&initted, init_internal);
}
const char *dav1d_version(void) {
return DAV1D_VERSION;
}
......@@ -68,6 +62,9 @@ void dav1d_default_settings(Dav1dSettings *const s) {
int dav1d_open(Dav1dContext **const c_out,
const Dav1dSettings *const s)
{
static pthread_once_t initted = PTHREAD_ONCE_INIT;
pthread_once(&initted, init_internal);
validate_input_or_ret(c_out != NULL, -EINVAL);
validate_input_or_ret(s != NULL, -EINVAL);
validate_input_or_ret(s->n_tile_threads >= 1 &&
......
......@@ -3105,7 +3105,7 @@ static void untriangle(uint8_t *dst, const uint8_t *src, const int sz) {
}
void av1_init_qm_tables(void) {
// This function is guaranteed to be called only once by dav1d_init
// This function is guaranteed to be called only once
for (int i = 0; i < 15; i++)
for (int j = 0; j < 2; j++) {
......
......@@ -223,7 +223,7 @@ static void fill2d_16x2(uint8_t *dst, const int w, const int h,
}
void av1_init_wedge_masks(void) {
// This function is guaranteed to be called only once by dav1d_init
// This function is guaranteed to be called only once
enum WedgeMasterLineType {
WEDGE_MASTER_LINE_ODD,
......@@ -322,7 +322,7 @@ static void build_nondc_ii_masks(uint8_t *const mask_v,
}
void av1_init_interintra_masks(void) {
// This function is guaranteed to be called only once by dav1d_init
// This function is guaranteed to be called only once
memset(ii_dc_mask, 32, 32 * 32);
#define set(a) a[II_VERT_PRED - 1], a[II_HOR_PRED - 1], a[II_SMOOTH_PRED - 1]
......
......@@ -78,7 +78,6 @@ int main(const int argc, char *const *const argv) {
return -1;
}
dav1d_init();
init_demuxers();
init_muxers();
parse(argc, argv, &cli_settings, &lib_settings);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment