Commit 3fe327c6 authored by Thomas Guillem's avatar Thomas Guillem

contrib: update libplacebo to v0.2.0

parent 9cf9c390
From 2f3ec424ca2dcfdd1abe5f1774c35aea1c9b0088 Mon Sep 17 00:00:00 2001
From 3899884d6c15251255b8217ae19f78a8f5d0a08c Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Mon, 30 Oct 2017 14:32:03 +0100
Subject: [PATCH 1/2] build: use a Makefile
Subject: [PATCH 1/3] build: use a Makefile
Only needed for VLC 3.0
---
Makefile | 38 ++++++++++++++++++++++++++++++++++++++
Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++
src/config.h | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+)
2 files changed, 86 insertions(+)
create mode 100644 Makefile
create mode 100644 src/config.h
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13f661b
index 0000000..4c431cf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+SRCS := colorspace.c common.c context.c dispatch.c filters.c ra.c shaders.c \
@@ -0,0 +1,45 @@
+SRCS := colorspace.c common.c context.c dither.c dispatch.c filters.c ra.c renderer.c shaders.c \
+ shaders/colorspace.c shaders/sampling.c spirv.c bstr/bstr.c siphash.c \
+ ta/ta.c ta/ta_utils.c ta/talloc.c osdep/printf_useloc_posix.c
+ ta/ta.c ta/ta_utils.c ta/talloc.c
+
+ifdef HAVE_WIN32
+SRCS += osdep/printf_useloc_win.c
+CFLAGS += -DPTW32_STATIC_LIB
+lpthread_libs = -lpthreadGC2 -lws2_32
+else
+SRCS += osdep/printf_useloc_posix.c
+lpthread_libs = $(shell $(LD) -lpthread && echo "-lpthread" || echo "")
+endif
+
+OBJS = $(patsubst %.c, $(OBJDIR)src/%.o, $(SRCS))
+
......@@ -32,8 +41,6 @@ index 0000000..13f661b
+
+all: $(targets)
+
+lpthread_libs = $(shell $(LD) -lpthread && echo "-lpthread" || echo "")
+
+install: $(targets)
+ rm -rf $(PREFIX)/include/libplacebo
+ mkdir -p $(PREFIX)/lib/pkgconfig/ $(PREFIX)/include/libplacebo
......@@ -42,7 +49,7 @@ index 0000000..13f661b
+ cp libplacebo.a $(PREFIX)/lib/
+ @echo "Name: libplacebo" > $(PREFIX)/lib/pkgconfig/libplacebo.pc
+ @echo "Description: Reusable library for GPU-accelerated video/image rendering" >> $(PREFIX)/lib/pkgconfig/libplacebo.pc
+ @echo "Version: 0.1.2" >> $(PREFIX)/lib/pkgconfig/libplacebo.pc
+ @echo "Version: 0.2.0" >> $(PREFIX)/lib/pkgconfig/libplacebo.pc
+ @echo "Libs: -L$(PREFIX)/lib -lplacebo $(lpthread_libs)" >> $(PREFIX)/lib/pkgconfig/libplacebo.pc
+ @echo "Cflags: -I$(PREFIX)/include" >> $(PREFIX)/lib/pkgconfig/libplacebo.pc
+
......@@ -57,7 +64,7 @@ index 0000000..13f661b
+ rm -f $(targets)
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 0000000..d49992f
index 0000000..85aac82
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,41 @@
......@@ -86,13 +93,13 @@ index 0000000..d49992f
+
+// Increased any time the API changes. (Note: Does not reset when PL_MAJOR_VER
+// is increased)
+#define PL_API_VER 1
+#define PL_API_VER 2
+
+// Increased any time a fix is made to a given API version.
+#define PL_FIX_VER 0
+
+// Friendly name (`git describe`) for the overall version of the library
+#define PL_VERSION "v0.1.0"
+#define PL_VERSION "v0.2.0"
+
+// Feature tests. These aren't described in further detail, but may be useful
+// for programmers wanting to programmatically check for feature support
......
From 91ec35bff6d1b45d79a81566b03b399c87784d85 Mon Sep 17 00:00:00 2001
From 158a429154af39896a7c6edcd0d07e83b2a4368e Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Mon, 13 Nov 2017 15:00:04 +0100
Subject: [PATCH 2/2] build: fix win32 build
Subject: [PATCH 2/3] build: fix win32 build
- Remove pthread (disable TA_MEMORY_DEBUGGING and always init/deinit).
- Remove msvcr100.dll dependency. This dell is not avaible on old Windows
versions. Don't set locale on Windows, this doesn't seem to have any
consequences with VLC on windows (tested with US/FR locales).
Remove msvcr100.dll dependency. This dll is not avaible on old Windows
versions. Don't set locale on Windows, this doesn't seem to have any
consequences with VLC on windows (tested with US/FR locales).
---
Makefile | 9 ++++++++-
src/context.c | 12 ++++++++++++
src/osdep/printf_useloc_win.c | 18 ++++++------------
src/ta/ta.c | 4 ++++
4 files changed, 30 insertions(+), 13 deletions(-)
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 13f661b..0d29744 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,13 @@
SRCS := colorspace.c common.c context.c dispatch.c filters.c ra.c shaders.c \
shaders/colorspace.c shaders/sampling.c spirv.c bstr/bstr.c siphash.c \
- ta/ta.c ta/ta_utils.c ta/talloc.c osdep/printf_useloc_posix.c
+ ta/ta.c ta/ta_utils.c ta/talloc.c
+
+ifdef HAVE_WIN32
+SRCS += osdep/printf_useloc_win.c
+else
+SRCS += osdep/printf_useloc_posix.c
+lpthread_libs = $(shell $(LD) -lpthread && echo "-lpthread" || echo "")
+endif
OBJS = $(patsubst %.c, $(OBJDIR)src/%.o, $(SRCS))
diff --git a/src/context.c b/src/context.c
index a325fb8..312e9d7 100644
--- a/src/context.c
+++ b/src/context.c
@@ -17,13 +17,17 @@
#include <stdio.h>
#include <locale.h>
+#ifndef _WIN32
#include <pthread.h>
+#endif
#include "common.h"
#include "context.h"
+#ifndef _WIN32
static pthread_mutex_t pl_ctx_mutex = PTHREAD_MUTEX_INITIALIZER;
static int pl_ctx_refcount;
+#endif
static void global_init(void)
{
@@ -59,11 +63,15 @@ struct pl_context *pl_context_create(int api_ver,
abort();
}
+#ifdef _WIN32
+ global_init();
+#else
// Do global initialization only when refcount is 0
pthread_mutex_lock(&pl_ctx_mutex);
if (pl_ctx_refcount++ == 0)
global_init();
pthread_mutex_unlock(&pl_ctx_mutex);
+#endif
struct pl_context *ctx = talloc_zero(NULL, struct pl_context);
ctx->params = *PL_DEF(params, &pl_context_default_params);
@@ -77,10 +85,14 @@ void pl_context_destroy(struct pl_context **ctx)
TA_FREEP(ctx);
// Do global uninitialization only when refcount reaches 0
+#ifdef _WIN32
+ global_uninit();
+#else
pthread_mutex_lock(&pl_ctx_mutex);
if (--pl_ctx_refcount == 0)
global_uninit();
pthread_mutex_unlock(&pl_ctx_mutex);
+#endif
}
static FILE *default_stream(void *stream, enum pl_log_level level)
diff --git a/src/osdep/printf_useloc_win.c b/src/osdep/printf_useloc_win.c
index 0c4c3be..fc56f90 100644
--- a/src/osdep/printf_useloc_win.c
......@@ -141,21 +64,6 @@ index 0c4c3be..fc56f90 100644
}
#define WRAP(fn, ...) \
diff --git a/src/ta/ta.c b/src/ta/ta.c
index c6f8116..dec9cb7 100644
--- a/src/ta/ta.c
+++ b/src/ta/ta.c
@@ -29,6 +29,10 @@
#define TA_MEMORY_DEBUGGING
#endif
+#ifdef _WIN32
+#undef TA_MEMORY_DEBUGGING
+#endif
+
struct ta_header {
size_t size; // size of the user allocation
struct ta_header *prev; // ring list containing siblings
--
2.11.0
From e8f45790dbf39ac39ac81ef47bde84fd92282ae2 Mon Sep 17 00:00:00 2001
From: Niklas Haas <git@haasn.xyz>
Date: Tue, 26 Dec 2017 04:14:53 +0100
Subject: [PATCH 3/3] 2.0 fixup
Include the following commits:
- shaders: fix typo in comment
- dither: minor fixes
- shaders: fix typo in gamut warning shader
---
src/dither.c | 3 ++-
src/include/libplacebo/shaders/colorspace.h | 2 +-
src/shaders/colorspace.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/dither.c b/src/dither.c
index 4a08e5c..e2b54ae 100644
--- a/src/dither.c
+++ b/src/dither.c
@@ -34,6 +34,7 @@
void pl_generate_bayer_matrix(float *data, int size)
{
pl_assert(size >= 0);
+
// Start with a single entry of 0
data[0] = 0;
@@ -73,7 +74,7 @@ struct ctx {
static void makegauss(struct ctx *k, unsigned int sizeb)
{
- assert(sizeb >= 1 && sizeb <= MAX_SIZEB);
+ pl_assert(sizeb >= 1 && sizeb <= MAX_SIZEB);
k->sizeb = sizeb;
k->size = 1 << k->sizeb;
diff --git a/src/include/libplacebo/shaders/colorspace.h b/src/include/libplacebo/shaders/colorspace.h
index fb80bea..82bfc69 100644
--- a/src/include/libplacebo/shaders/colorspace.h
+++ b/src/include/libplacebo/shaders/colorspace.h
@@ -159,7 +159,7 @@ enum pl_dither_method {
// Dither with blue noise. Very high quality, but requires the use of a
// LUT. Warning: Computing a blue noise texture with a large size can be
// very slow, however this only needs to be performed once. Even so, using
- // this with a `lut_size` greater than 8 is generally ill-advised. This is
+ // this with a `lut_size` greater than 6 is generally ill-advised. This is
// the preferred/default dither method.
PL_DITHER_BLUE_NOISE,
diff --git a/src/shaders/colorspace.c b/src/shaders/colorspace.c
index b85e1b2..6d467f5 100644
--- a/src/shaders/colorspace.c
+++ b/src/shaders/colorspace.c
@@ -749,7 +749,7 @@ void pl_shader_color_map(struct pl_shader *sh,
if (params->gamut_warning) {
GLSL("if (any(greaterThan(color.rgb, vec3(1.01))) ||\n"
" any(lessThan(color.rgb, vec3(-0.01))))\n"
- " color.rgb = vec3(1.0) - color.rgb;) // invert\n");
+ " color.rgb = vec3(1.0) - color.rgb; // invert\n");
}
if (src.light != dst.light)
--
2.11.0
From e0a1db693f38eb40437b1aaa81a72848ce02210b Mon Sep 17 00:00:00 2001
From: ePirat <epirat07@gmail.com>
Date: Thu, 16 Nov 2017 03:53:40 +0100
Subject: [PATCH 3/3] osdep: explicitly set a category mask for newlocale
While on Linux it works fine to not specify one, as Linux will fill all
not given ones from the POSIX locale, on BSD using `xlocale.h` this does
not work.
When no base locale is given, BSD uses the current locale and fills not
matching bitmasks with values from that one, not with values from the
POSIX locale.
---
src/osdep/printf_useloc_posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/osdep/printf_useloc_posix.c b/src/osdep/printf_useloc_posix.c
index 9bb1812..7ddc01f 100644
--- a/src/osdep/printf_useloc_posix.c
+++ b/src/osdep/printf_useloc_posix.c
@@ -31,7 +31,7 @@ static locale_t cloc;
void printf_c_init()
{
- cloc = newlocale(0, "C", (locale_t) 0);
+ cloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
if (!cloc)
abort();
}
--
2.11.0
e36eaee9149ac7925db20c6d2087d480c999c564482dad18789521d128da54a75c9738cc094ee32e00178842a76f123f563df677ed2dbe4367a4ecacca6a125a libplacebo-0.1.2.tar.gz
5b1079d21684ffe7bb7e1984bdff8ed3b2a4c5d0454758ed9764bab3947fed693147ace9ec877f758e1c5c466a560fceaf4975666ca26d47c2278182dc60e2eb libplacebo-0.2.0.tar.gz
# libplacebo
PLACEBO_VERSION := 0.1.2
PLACEBO_VERSION := 0.2.0
PLACEBO_URL := https://github.com/haasn/libplacebo/archive/v$(PLACEBO_VERSION).tar.gz
PLACEBO_ARCHIVE = libplacebo-$(PLACEBO_VERSION).tar.gz
......@@ -28,7 +28,7 @@ libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
ifdef HAVE_WIN32
$(APPLY) $(SRC)/libplacebo/0002-build-fix-win32-build.patch
endif
$(APPLY) $(SRC)/libplacebo/0003-osdep-explicitly-set-a-category-mask-for-newlocale.patch
$(APPLY) $(SRC)/libplacebo/0003-2.0-fixup.patch
$(MOVE)
.libplacebo: libplacebo
......
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