Update to dav1d-0.3.1.

from Brad (maintainer)
This commit is contained in:
ajacoutot 2019-05-17 17:24:20 +00:00
parent c4a12c8a3c
commit 9f2fd98deb
6 changed files with 4 additions and 144 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.12 2019/05/10 19:11:13 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.13 2019/05/17 17:24:20 ajacoutot Exp $
COMMENT= small and fast AV1 decoder
VER= 0.3.0
VER= 0.3.1
DISTNAME= dav1d-${VER}
REVISION= 1
CATEGORIES= multimedia
MASTER_SITES= https://code.videolan.org/videolan/dav1d/-/archive/${VER}/
EXTRACT_SUFX= .tar.bz2

View File

@ -1,2 +1,2 @@
SHA256 (dav1d-0.3.0.tar.bz2) = IpRt3YxRItNJCyUJMzKMMnjaIbBlnbm3+o+HXkc1wuY=
SIZE (dav1d-0.3.0.tar.bz2) = 435690
SHA256 (dav1d-0.3.1.tar.bz2) = vlEdRlIjzHSqtQf+Om5OdkUBZi6/Gl4jOFTtBkp64gQ=
SIZE (dav1d-0.3.1.tar.bz2) = 438676

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_itx_tmpl_c,v 1.1 2019/05/06 08:22:31 ajacoutot Exp $
itx_tmpl: Fix the assert in inv_txfm_add_c
Index: src/itx_tmpl.c
--- src/itx_tmpl.c.orig
+++ src/itx_tmpl.c
@@ -50,7 +50,7 @@ inv_txfm_add_c(pixel *dst, const ptrdiff_t stride,
const int has_dconly HIGHBD_DECL_SUFFIX)
{
int i, j;
- assert((h >= 4 || h <= 64) && (w >= 4 || w <= 64));
+ assert((h >= 4 && h <= 64) && (w >= 4 && w <= 64));
const int is_rect2 = w * 2 == h || h * 2 == w;
const int bitdepth = bitdepth_from_max(bitdepth_max);
const int rnd = (1 << shift) >> 1;

View File

@ -1,50 +0,0 @@
$OpenBSD: patch-src_lib_c,v 1.2 2019/05/10 19:11:13 ajacoutot Exp $
Control the stack size of spawned threads
Index: src/lib.c
--- src/lib.c.orig
+++ src/lib.c
@@ -90,6 +90,10 @@ int dav1d_open(Dav1dContext **const c_out,
validate_input_or_ret(s->operating_point >= 0 &&
s->operating_point <= 31, -EINVAL);
+ pthread_attr_t thread_attr;
+ if (pthread_attr_init(&thread_attr)) return -ENOMEM;
+ pthread_attr_setstacksize(&thread_attr, 1024 * 1024);
+
Dav1dContext *const c = *c_out = dav1d_alloc_aligned(sizeof(*c), 32);
if (!c) goto error;
memset(c, 0, sizeof(*c));
@@ -151,7 +155,7 @@ int dav1d_open(Dav1dContext **const c_out,
goto error;
}
t->tile_thread.fttd = &f->tile_thread;
- if (pthread_create(&t->tile_thread.td.thread, NULL, dav1d_tile_task, t)) {
+ if (pthread_create(&t->tile_thread.td.thread, &thread_attr, dav1d_tile_task, t)) {
pthread_cond_destroy(&t->tile_thread.td.cond);
pthread_mutex_destroy(&t->tile_thread.td.lock);
goto error;
@@ -167,7 +171,7 @@ int dav1d_open(Dav1dContext **const c_out,
pthread_mutex_destroy(&f->frame_thread.td.lock);
goto error;
}
- if (pthread_create(&f->frame_thread.td.thread, NULL, dav1d_frame_task, f)) {
+ if (pthread_create(&f->frame_thread.td.thread, &thread_attr, dav1d_frame_task, f)) {
pthread_cond_destroy(&f->frame_thread.td.cond);
pthread_mutex_destroy(&f->frame_thread.td.lock);
goto error;
@@ -182,10 +186,13 @@ int dav1d_open(Dav1dContext **const c_out,
c->intra_edge.root[BL_64X64] = &c->intra_edge.branch_sb64[0].node;
dav1d_init_mode_tree(c->intra_edge.root[BL_64X64], c->intra_edge.tip_sb64, 0);
+ pthread_attr_destroy(&thread_attr);
+
return 0;
error:
if (c) close_internal(c_out, 0);
+ pthread_attr_destroy(&thread_attr);
return -ENOMEM;
}

View File

@ -1,47 +0,0 @@
$OpenBSD: patch-src_thread_h,v 1.1 2019/05/06 08:22:31 ajacoutot Exp $
Control the stack size of spawned threads
Index: src/thread.h
--- src/thread.h.orig
+++ src/thread.h
@@ -40,11 +40,15 @@ typedef struct {
void *arg;
} pthread_t;
+typedef struct {
+ unsigned stack_size;
+} pthread_attr_t;
+
typedef SRWLOCK pthread_mutex_t;
typedef CONDITION_VARIABLE pthread_cond_t;
typedef INIT_ONCE pthread_once_t;
-int dav1d_pthread_create(pthread_t *thread, const void *attr,
+int dav1d_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*func)(void*), void *arg);
int dav1d_pthread_join(pthread_t *thread, void **res);
int dav1d_pthread_once(pthread_once_t *once_control,
@@ -53,6 +57,22 @@ int dav1d_pthread_once(pthread_once_t *once_control,
#define pthread_create dav1d_pthread_create
#define pthread_join(thread, res) dav1d_pthread_join(&(thread), res)
#define pthread_once dav1d_pthread_once
+
+static inline int pthread_attr_init(pthread_attr_t *const attr) {
+ attr->stack_size = 0;
+ return 0;
+}
+
+static inline int pthread_attr_destroy(pthread_attr_t *const attr) {
+ return 0;
+}
+
+static inline int pthread_attr_setstacksize(pthread_attr_t *const attr,
+ const unsigned stack_size)
+{
+ attr->stack_size = stack_size;
+ return 0;
+}
static inline int pthread_mutex_init(pthread_mutex_t *const mutex,
const void *const attr)

View File

@ -1,26 +0,0 @@
$OpenBSD: patch-src_win32_thread_c,v 1.1 2019/05/06 08:22:31 ajacoutot Exp $
Control the stack size of spawned threads
Index: src/win32/thread.c
--- src/win32/thread.c.orig
+++ src/win32/thread.c
@@ -41,13 +41,15 @@ static unsigned __stdcall thread_entrypoint(void *cons
return 0;
}
-int dav1d_pthread_create(pthread_t *const thread, const void *const attr,
+int dav1d_pthread_create(pthread_t *const thread,
+ const pthread_attr_t *const attr,
void *(*const func)(void*), void *const arg)
{
+ const unsigned stack_size = attr ? attr->stack_size : 0;
thread->func = func;
thread->arg = arg;
- thread->h = (HANDLE)_beginthreadex(NULL, 0, thread_entrypoint,
- thread, 0, NULL);
+ thread->h = (HANDLE)_beginthreadex(NULL, stack_size, thread_entrypoint, thread,
+ STACK_SIZE_PARAM_IS_A_RESERVATION, NULL);
return !thread->h;
}