mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-03-01 10:39:28 +00:00
Compare commits
270 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ad99776be8 | ||
|
f3ae69042f | ||
|
6768bc5b18 | ||
|
e624e9c83d | ||
|
c907239bb5 | ||
|
2c8e75e3ff | ||
|
e3fe68d7e6 | ||
|
41da5ca526 | ||
|
68fc7e4511 | ||
|
46df18afe0 | ||
|
0ff83f0e31 | ||
|
230bb5ca11 | ||
|
f026e8e86d | ||
|
9dd936df86 | ||
|
4e5529efcf | ||
|
20f1bd45e6 | ||
|
7a7e09ff7a | ||
|
c4a660ede2 | ||
|
8e495266e2 | ||
|
f27e4fb35f | ||
|
e14ea73a00 | ||
|
72cb77f771 | ||
|
c679d812d1 | ||
|
47b461ab46 | ||
|
8629946041 | ||
|
a222f6a1d5 | ||
|
b51589aaa9 | ||
|
c3af54aae0 | ||
|
7e387fa3f1 | ||
|
f3e5a14fdf | ||
|
aa0c2f80e4 | ||
|
215f251572 | ||
|
a425ec94e0 | ||
|
91961bdffe | ||
|
f741dff042 | ||
|
7a31761c89 | ||
|
d5ca73c22f | ||
|
6704b2ca5a | ||
|
e0bbaceec0 | ||
|
45043b9ffc | ||
|
a56b3737c7 | ||
|
e59eeba0d2 | ||
|
838dfab45b | ||
|
ddd44e6f62 | ||
|
1390139cbd | ||
|
f72653c3c1 | ||
|
4b9cd22405 | ||
|
38bda0c834 | ||
|
45c86f12dd | ||
|
e2e9ae94d7 | ||
|
4837f7fa35 | ||
|
7f054f8320 | ||
|
ad7acde1f4 | ||
|
e5c48a4bb7 | ||
|
fb67617d63 | ||
|
8aa807eec6 | ||
|
0621ed064d | ||
|
9219f06c5a | ||
|
4e96489e35 | ||
|
65017da5ac | ||
|
7b41b9b45a | ||
|
58c39d51f4 | ||
|
d78e905411 | ||
|
7b10c2d0a3 | ||
|
9714824a5a | ||
|
3e9b909685 | ||
|
464f7de014 | ||
|
da33b90f94 | ||
|
90194d4b6c | ||
|
45a83eaa3f | ||
|
37f87e2511 | ||
|
bd9184db01 | ||
|
101bffd01f | ||
|
43085a3608 | ||
|
3de7a17105 | ||
|
c229e77151 | ||
|
af370721d4 | ||
|
79fa8efc6a | ||
|
d5dec38d62 | ||
|
74847c9bed | ||
|
115f3b1fce | ||
|
ff16beb515 | ||
|
25f70cd820 | ||
|
16c734b9e3 | ||
|
6e2bcd73de | ||
|
fefd3e83f6 | ||
|
5c6514929d | ||
|
ce71019f44 | ||
|
f24ae68a8d | ||
|
cf1a661c7b | ||
|
a072caf133 | ||
|
43135c43bc | ||
|
177e44de98 | ||
|
987ff6ba12 | ||
|
1878eaec88 | ||
|
3ca2a06e9d | ||
|
cc099e24ea | ||
|
59a82d409e | ||
|
eabbbcb442 | ||
|
8f96c06595 | ||
|
267dccf87a | ||
|
2562c4eac5 | ||
|
017ad3f61b | ||
|
dfeb75cc51 | ||
|
b2247ebb9b | ||
|
8c89787269 | ||
|
a4fe3aa31c | ||
|
fde863adaf | ||
|
891d432536 | ||
|
c09bad125d | ||
|
e9cfe530ba | ||
|
8018f7d921 | ||
|
d553a8108d | ||
|
cb4515f6b7 | ||
|
277d7fbd86 | ||
|
9347f2a502 | ||
|
6dfd2d96aa | ||
|
a7471e8800 | ||
|
184cc1aa05 | ||
|
072e1d6847 | ||
|
6c13195fda | ||
|
6a31404aa0 | ||
|
a424a57036 | ||
|
05c2585238 | ||
|
a28e368c1b | ||
|
e4115f348b | ||
|
03b770ce47 | ||
|
c7c4cb06a6 | ||
|
a41f6b22fd | ||
|
628bad5006 | ||
|
cb466dd894 | ||
|
3578e3212d | ||
|
78337f5933 | ||
|
2fea2ee69f | ||
|
c1c345dd4d | ||
|
a3eedbff0c | ||
|
309ad1c90e | ||
|
23651104f2 | ||
|
36c208967e | ||
|
d1a1329beb | ||
|
5875e10479 | ||
|
a6e65d953e | ||
|
fecb81486d | ||
|
f756334187 | ||
|
14ba527a45 | ||
|
ec09dbfb25 | ||
|
34b1fccb28 | ||
|
5586618c6e | ||
|
4dbf2dcc84 | ||
|
74a2285af0 | ||
|
b2bff4ebd0 | ||
|
84501d314e | ||
|
04e1b8732d | ||
|
3e649a5cea | ||
|
feb7479ff8 | ||
|
3590eadbaa | ||
|
6c0f80979f | ||
|
189d8cfa53 | ||
|
73b355c52d | ||
|
3d23288bdc | ||
|
b1a642e64a | ||
|
1b7bfd2087 | ||
|
03e69b5e26 | ||
|
a5b81f8de1 | ||
|
2485929c2b | ||
|
b9fed82109 | ||
|
49db402de6 | ||
|
7ce842b989 | ||
|
9d0417045e | ||
|
f7449c8d3a | ||
|
5ef6597340 | ||
|
c06b891c2b | ||
|
26945ef9d2 | ||
|
e0239a549e | ||
|
431e37e93f | ||
|
4b5b27382a | ||
|
2ec7a250a3 | ||
|
1674600882 | ||
|
269c396a2c | ||
|
ce3813a9e9 | ||
|
53314a17f5 | ||
|
e4e6a81f54 | ||
|
70b67f4466 | ||
|
2f0b1d0df9 | ||
|
dfe70f4f96 | ||
|
fe3681f6eb | ||
|
50299f178f | ||
|
6ea4f5076b | ||
|
3cb66dd3de | ||
|
68fa4fe4dc | ||
|
463109fcb6 | ||
|
d1bc51edb8 | ||
|
67832ac333 | ||
|
1274e673ec | ||
|
4334894515 | ||
|
d2dedb40dd | ||
|
3bed988b14 | ||
|
f17e58c7c5 | ||
|
5cd68b6eed | ||
|
1a56d620ac | ||
|
695a6495dd | ||
|
780c594ba2 | ||
|
8838d4c754 | ||
|
b883fa606b | ||
|
6acd2feb3f | ||
|
499731fc1f | ||
|
a4bee138f2 | ||
|
146b826b4d | ||
|
3dfaeaf7e2 | ||
|
132caa81de | ||
|
9ebdd3baae | ||
|
43fa0b8929 | ||
|
2cd8415f2b | ||
|
2d3a7339e8 | ||
|
c4a7aefc20 | ||
|
bdfe1a62c9 | ||
|
1bf5a841e9 | ||
|
7269e28f9a | ||
|
b83cb6167c | ||
|
7b0984381d | ||
|
ed5fa65837 | ||
|
70ef3d6602 | ||
|
557c17982f | ||
|
01a564cf3d | ||
|
6044db40f3 | ||
|
ed53dd21ca | ||
|
5653e31466 | ||
|
59354108fc | ||
|
d25f456e67 | ||
|
9e8cd60f28 | ||
|
6fbf240f6e | ||
|
51e2aaaeb0 | ||
|
d03bd4661b | ||
|
11ea3baba3 | ||
|
ce294f55e8 | ||
|
35cc401e13 | ||
|
f80d757704 | ||
|
40115f4fc6 | ||
|
9003beee34 | ||
|
e09d5a8001 | ||
|
6d91af9d74 | ||
|
cd4611d5cd | ||
|
06918ebbd2 | ||
|
a2b52bb804 | ||
|
6eb0a7f35a | ||
|
5fa43b5d71 | ||
|
4d2735a971 | ||
|
cdac2bcc3d | ||
|
18759e8dab | ||
|
9d84e34318 | ||
|
74c5a1f3ea | ||
|
6d7ef37384 | ||
|
6849d4d54f | ||
|
5c2b801a45 | ||
|
fae0d3a9bd | ||
|
053fd53bc4 | ||
|
de7311d233 | ||
|
71fb080fe4 | ||
|
7dbfba85f4 | ||
|
7e5c6f349d | ||
|
8682ab01c4 | ||
|
24ccfefff3 | ||
|
33a3316344 | ||
|
8b16c0b490 | ||
|
6c5b65ed82 | ||
|
003d06b946 | ||
|
24f679e1d3 | ||
|
6787d9601b | ||
|
3d183b0fdc | ||
|
56ee6f0cec |
6
.clang-format
Normal file
6
.clang-format
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
UseTab: Never
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentCaseLabels: true
|
||||||
|
ColumnLimit: 119
|
265
Makefile
265
Makefile
@ -7,40 +7,84 @@
|
|||||||
# This name will be used in the '-P...' option of VDR to load the plugin.
|
# This name will be used in the '-P...' option of VDR to load the plugin.
|
||||||
# By default the main source file also carries this name.
|
# By default the main source file also carries this name.
|
||||||
|
|
||||||
PLUGIN = softhdcuvid
|
|
||||||
|
|
||||||
### Configuration (edit this for your needs)
|
### Configuration (edit this for your needs)
|
||||||
|
# comment out if not needed
|
||||||
|
|
||||||
# support alsa audio output module
|
# what kind of decoder do we make -
|
||||||
ALSA ?= $(shell pkg-config --exists alsa && echo 1)
|
# if VAAPI is enabled the pluginname is softhdvaapi
|
||||||
# support OSS audio output module
|
# if CUVID is enabled the pluginname is softhdcuvid
|
||||||
OSS ?= 1
|
# if DRM is enabled the pluginname is softhddrm
|
||||||
# support OPENGLOSD
|
VAAPI ?= 0
|
||||||
|
CUVID ?= 0
|
||||||
|
|
||||||
|
# if you enable DRM then the plugin will only run without X server
|
||||||
|
# only valid for VAAPI
|
||||||
|
DRM ?= 0
|
||||||
|
|
||||||
|
# use libplacebo -
|
||||||
|
# available for all decoders but for DRM and VAAPI you need LIBPLACEBO_GL
|
||||||
|
LIBPLACEBO ?= 0
|
||||||
|
LIBPLACEBO_GL ?= 0
|
||||||
|
|
||||||
|
# use YADIF deint - only available with cuvid
|
||||||
|
YADIF = 1
|
||||||
|
|
||||||
|
# use gamma correction
|
||||||
|
#GAMMA ?= 0
|
||||||
|
|
||||||
|
CONFIG := -DDEBUG # remove '#' to enable debug output
|
||||||
|
|
||||||
|
#--------------------- no more config needed past this point--------------------------------
|
||||||
|
|
||||||
|
# sanitize selections --------
|
||||||
|
ifneq "$(MAKECMDGOALS)" "clean"
|
||||||
|
ifneq "$(MAKECMDGOALS)" "indent"
|
||||||
|
|
||||||
|
ifeq ($(VAAPI),0)
|
||||||
|
ifeq ($(CUVID),0)
|
||||||
|
ifeq ($(DRM),0)
|
||||||
|
$(error Please define a plugin in the Makefile)
|
||||||
|
exit 1;
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(CUVID),1)
|
||||||
|
ifeq ($(DRM),1)
|
||||||
|
$(error Mismatch in Plugin selection)
|
||||||
|
exit 1;
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(CUVID),1)
|
||||||
|
ifeq ($(VAAPI),1)
|
||||||
|
$(error Mismatch in Plugin selection)
|
||||||
|
exit 1;
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif # MAKECMDGOALS!=indent
|
||||||
|
endif # MAKECMDGOALS!=clean
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------
|
||||||
|
|
||||||
|
PLUGIN = softhdcuvid
|
||||||
|
|
||||||
|
# support OPENGLOSD always needed
|
||||||
OPENGLOSD=1
|
OPENGLOSD=1
|
||||||
|
|
||||||
# use Libplacebo
|
# use DMPS
|
||||||
LIBPLACEBO=0
|
|
||||||
|
|
||||||
# use DMPS
|
|
||||||
SCREENSAVER=1
|
SCREENSAVER=1
|
||||||
|
|
||||||
OPENGL=1
|
OPENGL=1
|
||||||
# use ffmpeg libswresample
|
|
||||||
#SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 1)
|
|
||||||
SWRESAMPLE = 1
|
|
||||||
# use libav libavresample
|
|
||||||
ifneq ($(SWRESAMPLE),1)
|
|
||||||
AVRESAMPLE ?= $(shell pkg-config --exists libavresample && echo 1)
|
|
||||||
AVRESAMPLE = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG := #-DDEBUG #-DOSD_DEBUG # enable debug output+functions
|
|
||||||
CONFIG += -DCUVID # enable CUVID decoder
|
|
||||||
CONFIG += -DHAVE_GL # needed for mpv libs
|
CONFIG += -DHAVE_GL # needed for mpv libs
|
||||||
#CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level
|
#CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level
|
||||||
|
|
||||||
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # info/debug a/v sync
|
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # info/debug a/v sync
|
||||||
CONFIG += -DUSE_PIP # PIP support
|
|
||||||
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
|
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
|
||||||
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
|
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
|
||||||
#CONFIG += -DUSE_TS_VIDEO # build new ts video parser
|
#CONFIG += -DUSE_TS_VIDEO # build new ts video parser
|
||||||
@ -53,8 +97,9 @@ CONFIG += -DUSE_VDR_SPU # use VDR SPU decoder.
|
|||||||
|
|
||||||
### The version number of this plugin (taken from the main source file):
|
### The version number of this plugin (taken from the main source file):
|
||||||
|
|
||||||
VERSION = $(shell grep 'static const char \*const VERSION *=' $(PLUGIN).cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
|
VERSION = $(shell grep 'static const char \*const VERSION *=' softhdcuvid.cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
|
||||||
GIT_REV = $(shell git describe --always 2>/dev/null)
|
GIT_REV = $(shell git describe --always 2>/dev/null)
|
||||||
|
### The name of the distribution archive:
|
||||||
|
|
||||||
### The directory environment:
|
### The directory environment:
|
||||||
|
|
||||||
@ -68,8 +113,8 @@ TMPDIR ?= /tmp
|
|||||||
|
|
||||||
### The compiler options:
|
### The compiler options:
|
||||||
|
|
||||||
export CFLAGS = $(call PKGCFG,cflags)
|
export CFLAGS = $(call PKGCFG,cflags) -fpermissive
|
||||||
export CXXFLAGS = $(call PKGCFG,cxxflags)
|
export CXXFLAGS = $(call PKGCFG,cxxflags) -fpermissive
|
||||||
|
|
||||||
ifeq ($(CFLAGS),)
|
ifeq ($(CFLAGS),)
|
||||||
$(warning CFLAGS not set)
|
$(warning CFLAGS not set)
|
||||||
@ -86,7 +131,64 @@ APIVERSION = $(call PKGCFG,apiversion)
|
|||||||
|
|
||||||
-include $(PLGCFG)
|
-include $(PLGCFG)
|
||||||
|
|
||||||
### The name of the distribution archive:
|
### Parse softhddevice config
|
||||||
|
|
||||||
|
ifeq ($(OPENGL),1)
|
||||||
|
#_CFLAGS += $(shell pkg-config --cflags libva-glx)
|
||||||
|
#LIBS += $(shell pkg-config --libs libva-glx)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OPENGLOSD),1)
|
||||||
|
CONFIG += -DUSE_OPENGLOSD
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OPENGL),1)
|
||||||
|
CONFIG += -DUSE_GLX
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
|
||||||
|
#LIBS += $(shell pkg-config --libs glu glew)
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags freetype2)
|
||||||
|
LIBS += $(shell pkg-config --libs freetype2)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(VAAPI),1)
|
||||||
|
CONFIG += -DVAAPI
|
||||||
|
#LIBPLACEBO=1
|
||||||
|
PLUGIN = softhdvaapi
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LIBPLACEBO_GL),1)
|
||||||
|
CONFIG += -DPLACEBO_GL -DPLACEBO
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags libplacebo)
|
||||||
|
LIBS += $(shell pkg-config --libs epoxy libplacebo)
|
||||||
|
else
|
||||||
|
LIBS += $(shell pkg-config --libs egl)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LIBPLACEBO),1)
|
||||||
|
CONFIG += -DPLACEBO
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags libplacebo)
|
||||||
|
LIBS += $(shell pkg-config --libs egl libplacebo)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DRM),1)
|
||||||
|
PLUGIN = softhddrm
|
||||||
|
CONFIG += -DUSE_DRM -DVAAPI
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags libdrm)
|
||||||
|
LIBS += $(shell pkg-config --libs egl gbm libdrm)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CUVID),1)
|
||||||
|
#CONFIG += -DUSE_PIP # PIP support
|
||||||
|
CONFIG += -DCUVID # enable CUVID decoder
|
||||||
|
LIBS += $(shell pkg-config --libs egl gl)
|
||||||
|
ifeq ($(YADIF),1)
|
||||||
|
CONFIG += -DYADIF # Yadif only with CUVID
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(GAMMA),1)
|
||||||
|
CONFIG += -DGAMMA
|
||||||
|
endif
|
||||||
|
|
||||||
ARCHIVE = $(PLUGIN)-$(VERSION)
|
ARCHIVE = $(PLUGIN)-$(VERSION)
|
||||||
PACKAGE = vdr-$(ARCHIVE)
|
PACKAGE = vdr-$(ARCHIVE)
|
||||||
@ -95,47 +197,19 @@ PACKAGE = vdr-$(ARCHIVE)
|
|||||||
|
|
||||||
SOFILE = libvdr-$(PLUGIN).so
|
SOFILE = libvdr-$(PLUGIN).so
|
||||||
|
|
||||||
### Parse softhddevice config
|
|
||||||
|
|
||||||
ifeq ($(ALSA),1)
|
|
||||||
CONFIG += -DUSE_ALSA
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags alsa)
|
|
||||||
LIBS += $(shell pkg-config --libs alsa)
|
|
||||||
endif
|
|
||||||
ifeq ($(OSS),1)
|
|
||||||
CONFIG += -DUSE_OSS
|
|
||||||
endif
|
|
||||||
ifeq ($(OPENGL),1)
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags libva-glx)
|
|
||||||
LIBS += $(shell pkg-config --libs libva-glx)
|
|
||||||
endif
|
|
||||||
ifeq ($(OPENGLOSD),1)
|
|
||||||
CONFIG += -DUSE_OPENGLOSD
|
|
||||||
endif
|
|
||||||
ifeq ($(OPENGL),1)
|
|
||||||
CONFIG += -DUSE_GLX
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
|
|
||||||
LIBS += $(shell pkg-config --libs gl glu glew)
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags glew)
|
|
||||||
LIBS += $(shell pkg-config --libs glew)
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags freetype2)
|
|
||||||
LIBS += $(shell pkg-config --libs freetype2)
|
|
||||||
endif
|
|
||||||
ifeq ($(LIBPLACEBO),1)
|
|
||||||
CONFIG += -DPLACEBO
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test that libswresample is available
|
# Test that libswresample is available
|
||||||
#
|
#
|
||||||
ifneq (exists, $(shell pkg-config libswresample && echo exists))
|
ifneq (exists, $(shell pkg-config libswresample && echo exists))
|
||||||
$(warning ******************************************************************)
|
$(warning ******************************************************************)
|
||||||
$(warning 'libswresample' not found!)
|
$(warning 'libswresample' not found!)
|
||||||
$(error ******************************************************************)
|
$(error ******************************************************************)
|
||||||
endif
|
endif
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags libswresample)
|
||||||
|
LIBS += $(shell pkg-config --libs libswresample)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test and set config for libavutil
|
# Test and set config for libavutil
|
||||||
#
|
#
|
||||||
ifneq (exists, $(shell pkg-config libavutil && echo exists))
|
ifneq (exists, $(shell pkg-config libavutil && echo exists))
|
||||||
$(warning ******************************************************************)
|
$(warning ******************************************************************)
|
||||||
@ -146,7 +220,7 @@ _CFLAGS += $(shell pkg-config --cflags libavutil)
|
|||||||
LIBS += $(shell pkg-config --libs libavutil)
|
LIBS += $(shell pkg-config --libs libavutil)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test and set config for libswscale
|
# Test and set config for libswscale
|
||||||
#
|
#
|
||||||
ifneq (exists, $(shell pkg-config libswscale && echo exists))
|
ifneq (exists, $(shell pkg-config libswscale && echo exists))
|
||||||
$(warning ******************************************************************)
|
$(warning ******************************************************************)
|
||||||
@ -165,41 +239,42 @@ ifneq (exists, $(shell pkg-config libavcodec && echo exists))
|
|||||||
$(error ******************************************************************)
|
$(error ******************************************************************)
|
||||||
endif
|
endif
|
||||||
_CFLAGS += $(shell pkg-config --cflags libavcodec)
|
_CFLAGS += $(shell pkg-config --cflags libavcodec)
|
||||||
LIBS += $(shell pkg-config --libs libavcodec)
|
LIBS += $(shell pkg-config --libs libavcodec libavfilter)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test and set config for alsa
|
||||||
|
#
|
||||||
|
ifneq (exists, $(shell pkg-config alsa && echo exists))
|
||||||
|
$(warning ******************************************************************)
|
||||||
|
$(warning 'alsa' not found!)
|
||||||
|
$(error ******************************************************************)
|
||||||
|
endif
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags alsa)
|
||||||
|
LIBS += $(shell pkg-config --libs alsa)
|
||||||
|
|
||||||
ifeq ($(SCREENSAVER),1)
|
ifeq ($(SCREENSAVER),1)
|
||||||
CONFIG += -DUSE_SCREENSAVER
|
CONFIG += -DUSE_SCREENSAVER
|
||||||
_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
|
_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
|
||||||
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
|
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
|
||||||
endif
|
endif
|
||||||
ifeq ($(SWRESAMPLE),1)
|
|
||||||
CONFIG += -DUSE_SWRESAMPLE
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags libswresample)
|
|
||||||
LIBS += $(shell pkg-config --libs libswresample)
|
|
||||||
endif
|
|
||||||
#ifeq ($(AVRESAMPLE),1)
|
|
||||||
#CONFIG += -DUSE_AVRESAMPLE
|
|
||||||
#_CFLAGS += $(shell pkg-config --cflags libavresample)
|
|
||||||
#LIBS += $(shell pkg-config --libs libavresample)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#_CFLAGS += $(shell pkg-config --cflags libavcodec x11 x11-xcb xcb xcb-icccm)
|
#_CFLAGS += $(shell pkg-config --cflags libavcodec x11 x11-xcb xcb xcb-icccm)
|
||||||
#LIBS += -lrt $(shell pkg-config --libs libavcodec x11 x11-xcb xcb xcb-icccm)
|
#LIBS += -lrt $(shell pkg-config --libs libavcodec x11 x11-xcb xcb xcb-icccm)
|
||||||
_CFLAGS += $(shell pkg-config --cflags x11 x11-xcb xcb xcb-icccm)
|
_CFLAGS += $(shell pkg-config --cflags x11 x11-xcb xcb xcb-icccm)
|
||||||
LIBS += -lrt $(shell pkg-config --libs x11 x11-xcb xcb xcb-icccm)
|
LIBS += -lrt $(shell pkg-config --libs x11 x11-xcb xcb xcb-icccm)
|
||||||
|
|
||||||
_CFLAGS += -I/usr/local/cuda/include
|
|
||||||
_CFLAGS += -I./opengl -I./
|
_CFLAGS += -I./opengl -I./
|
||||||
|
|
||||||
LIBS += -L/usr/lib64/opengl/nvidia/lib
|
LIBS += -L/usr/lib64
|
||||||
LIBS += -L/usr/local/cuda/lib64
|
|
||||||
|
|
||||||
ifeq ($(LIBPLACEBO),1)
|
|
||||||
LIBS += -lplacebo -lglut
|
ifeq ($(CUVID),1)
|
||||||
|
LIBS += -lcuda -lnvcuvid
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid
|
LIBS += -lGLEW -lGLU -ldl -lglut
|
||||||
|
#LIBS += -ldl $(shell pkg-config --libs glew glu glut)
|
||||||
|
|
||||||
### Includes and Defines (add further entries here):
|
### Includes and Defines (add further entries here):
|
||||||
|
|
||||||
INCLUDES +=
|
INCLUDES +=
|
||||||
@ -210,19 +285,23 @@ DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D_GNU_SOURCE $(CONFIG) \
|
|||||||
### Make it standard
|
### Make it standard
|
||||||
|
|
||||||
override CXXFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
override CXXFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||||
-g -Wextra -Winit-self -Werror=overloaded-virtual -std=c++0x
|
-g -W -Wextra -Werror=overloaded-virtual -Wno-unused-parameter
|
||||||
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||||
-g -W -Wextra -Winit-self -Wdeclaration-after-statement
|
-g -W -Wextra
|
||||||
|
|
||||||
|
|
||||||
### The object files (add further files here):
|
### The object files (add further files here):
|
||||||
|
|
||||||
OBJS = $(PLUGIN).o softhddev.o video.o audio.o codec.o ringbuffer.o
|
OBJS = softhdcuvid.o softhddev.o video.o audio.o codec.o ringbuffer.o openglosd.o
|
||||||
ifeq ($(OPENGLOSD),1)
|
ifeq ($(GAMMA),1)
|
||||||
OBJS += openglosd.o
|
OBJS += colorramp.o
|
||||||
|
ifeq ($(DRM),1)
|
||||||
|
OBJS += gamma-drm.o
|
||||||
|
else
|
||||||
|
OBJS += gamma-vidmode.o
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SRCS = $(wildcard $(OBJS:.o=.c)) $(PLUGIN).cpp
|
SRCS = $(wildcard $(OBJS:.o=.c)) *.cpp
|
||||||
|
|
||||||
### The main target:
|
### The main target:
|
||||||
|
|
||||||
@ -269,9 +348,8 @@ install-i18n: $(I18Nmsgs)
|
|||||||
|
|
||||||
$(OBJS): Makefile
|
$(OBJS): Makefile
|
||||||
|
|
||||||
|
|
||||||
$(SOFILE): $(OBJS) shaders.h
|
$(SOFILE): $(OBJS) shaders.h
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
|
||||||
|
|
||||||
install-lib: $(SOFILE)
|
install-lib: $(SOFILE)
|
||||||
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
|
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
|
||||||
@ -290,17 +368,14 @@ clean:
|
|||||||
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
|
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
|
||||||
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
|
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
|
||||||
|
|
||||||
## Private Targets:
|
HDRS = $(wildcard *.h)
|
||||||
|
|
||||||
HDRS= $(wildcard *.h)
|
|
||||||
|
|
||||||
indent:
|
indent:
|
||||||
for i in $(SRCS) $(HDRS); do \
|
for i in $(SRCS) drm.c hdr.c $(HDRS); do \
|
||||||
indent $$i; \
|
clang-format -i $$i; \
|
||||||
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
|
|
||||||
mv $$i.up $$i; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## Private Targets:
|
||||||
|
|
||||||
video_test: video.c Makefile
|
video_test: video.c Makefile
|
||||||
$(CC) -DVIDEO_TEST -DVERSION='"$(VERSION)"' $(CFLAGS) $(LDFLAGS) $< \
|
$(CC) -DVIDEO_TEST -DVERSION='"$(VERSION)"' $(CFLAGS) $(LDFLAGS) $< \
|
||||||
$(LIBS) -o $@
|
$(LIBS) -o $@
|
||||||
|
199
README.md
199
README.md
@ -5,7 +5,7 @@ Copyright (c) 2018 by jojo61. All Rights Reserved.
|
|||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
||||||
jojo61
|
jojo61
|
||||||
|
|
||||||
License: AGPLv3
|
License: AGPLv3
|
||||||
|
|
||||||
@ -23,52 +23,43 @@ $Id: 5267da021a68b4a727b479417334bfbe67bbba14 $
|
|||||||
|
|
||||||
A software and GPU emulated UHD output device plugin for VDR.
|
A software and GPU emulated UHD output device plugin for VDR.
|
||||||
|
|
||||||
o Video decoder CPU / VDPAU
|
o Video decoder CUVID or VAAPI
|
||||||
o Video output opengl
|
o Video output opengl or DRM
|
||||||
o Audio FFMpeg / Alsa / Analog
|
o Audio FFMpeg / ALSA / Analog
|
||||||
o Audio FFMpeg / Alsa / Digital
|
o Audio FFMpeg / ALSA / Digital
|
||||||
o Audio FFMpeg / OSS / Analog
|
|
||||||
o HDMI/SPDIF pass-through
|
o HDMI/SPDIF pass-through
|
||||||
o Software volume, compression, normalize and channel resample
|
o Software volume, compression, normalize and channel resample
|
||||||
o VDR ScaleVideo API
|
o VDR ScaleVideo API
|
||||||
o CUDA deinterlacer
|
o CUDA deinterlacer
|
||||||
o Autocrop
|
o Suspend / Detach
|
||||||
o Suspend / Dettach
|
o Support for ambilight
|
||||||
o PIP (Picture-in-Picture) (not working yet)
|
o Support for Screencopy
|
||||||
|
o PIP (Picture-in-Picture) (only for CUVID)
|
||||||
|
|
||||||
|
|
||||||
To compile you must have the 'requires' installed.
|
|
||||||
|
|
||||||
|
|
||||||
This is a fork of johns original softhddevice work and I reworked ist to support HEVC with CUDA and opengl output.
|
This is a fork of johns original softhddevice work and I reworked it to support HEVC with CUDA and opengl output.
|
||||||
Currently I have tested it with a GTX 1050 from NVIDIA. SD, HD and UHD is working.
|
Currently I have tested it with a GTX 1050 from NVIDIA. SD, HD and UHD is working.
|
||||||
|
|
||||||
Current Status NVIDA:
|
Current Status NVIDIA:
|
||||||
The CUDA driver supports HEVC with 8 Bit and 10 Bit up to UHD resolution. Opengl is able to output also 10 Bit, but NVIDIA does not support to output 10 Bit via HDMI.
|
The CUDA driver supports HEVC with 8 Bit and 10 Bit up to UHD resolution. Opengl is able to output also 10 Bit, but NVIDIA does not support to output 10 Bit via HDMI.
|
||||||
Only via DisplayPort you can get 10 Bit output to a compatible screen. This is a restriction from NVIDIA.
|
Only via DisplayPort you can get 10 Bit output to a compatible screen. This is a restriction from NVIDIA.
|
||||||
|
|
||||||
|
Current Status with VAAPI:
|
||||||
|
I tested it with Intel VAAPI. If you have problmes with the shaders then copy the drirc file in your home directory as .drirc
|
||||||
|
AMD VAAPI is broken by AMD and will not work currently.
|
||||||
|
|
||||||
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
|
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
|
||||||
The Makefile expects the CUDA SDK in /usr/local/cuda. Currently it is tested with CUDA 10
|
|
||||||
|
|
||||||
Unfortunatly older FFMEGs has a bug with deinterlacing cuda frames. Best to get the latest FFMPEG Version.
|
This Version supports building with libplacebo. https://github.com/haasn/libplacebo
|
||||||
|
|
||||||
Otherwise you have to patch the file in libavcodec/cuviddec.c
|
|
||||||
Somewhere near line 860 and 1066 depending on your release:
|
|
||||||
old:
|
|
||||||
ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame));
|
|
||||||
|
|
||||||
new:
|
|
||||||
ctx->frame_queue = av_fifo_alloc((ctx->nb_surfaces + 2 ) * sizeof(CuvidParsedFrame));
|
|
||||||
|
|
||||||
This Version supports building with libplacebo. https://github.com/haasn/libplacebo
|
|
||||||
You have to enable it in the Makefile and install libplacebo yourself.
|
You have to enable it in the Makefile and install libplacebo yourself.
|
||||||
At the moment this is Work in progress.
|
|
||||||
It also needs the NVIDIA driver 410.48 or newer as well as CUDA 10.
|
It also needs the NVIDIA driver 410.48 or newer as well as CUDA 10.
|
||||||
|
|
||||||
In the settings you can enable a correction for Colorblindness. First you have to decide what kind of colorblindness to use. And then the faktor of correction. If the faktor is negativ than the selected type of colorblindness is simulated. If the faktor is positiv then the colors are enhanced to try to correct the deficiency.
|
I recommend to use libplacebo. It has much better scaler and does colorconversion for HDR the correct way.
|
||||||
|
|
||||||
Also you can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test is activ.
|
If your FFMEG supports it then you can enable YADIF in the Makefile and select between the buildin NVIDIA CUDA deinterlacer and the YADIF cuda deinterlacer.
|
||||||
|
|
||||||
Good luck
|
Good luck
|
||||||
jojo61
|
jojo61
|
||||||
@ -76,7 +67,22 @@ jojo61
|
|||||||
Quickstart:
|
Quickstart:
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Just type make and use.
|
You have to adapt the Makefile. There are 3 possible Version that you can build:
|
||||||
|
|
||||||
|
softhdcuvid (CUVID=1)
|
||||||
|
This is for NVIDA cards and uses cuvid as decoder. It uses xcb for output and needs a X Server to run.
|
||||||
|
I recommend to use libplacebo and set LIBPLACEBO=1 in the Makefile
|
||||||
|
|
||||||
|
softhdvaapi (VAAPI=1)
|
||||||
|
This is for INTEL cards and uses Vaapi as decoder. It uses xcb for output and needs a X Server to run.
|
||||||
|
I recommend to use libplacebo and set LIBPLACEBO=1 in the Makefile. Also LIBPLACEBO_GL is supportet here.
|
||||||
|
|
||||||
|
softhddrm (DRM=1)
|
||||||
|
This is for INTEL cards and also uses Vaapi as decoder. It uses the DRM API for output and
|
||||||
|
runs without X Server. There are several commandline options to select the resolution and refresh rate.
|
||||||
|
I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Install:
|
Install:
|
||||||
--------
|
--------
|
||||||
@ -87,38 +93,69 @@ Install:
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
You can edit Makefile to enable/disable Alsa / OSS
|
|
||||||
support. The default is to autodetect as much as possible.
|
|
||||||
|
|
||||||
You have to start vdr with -P 'softhdcuvid -d :0.0 ..<more option>.. '
|
You have to start vdr with -P 'softhdcuvid -d :0.0 ..<more option>.. '
|
||||||
|
|
||||||
|
Beginners Guide for libplacebo:
|
||||||
|
-------------------------------
|
||||||
|
When using libplacebo you will find several config options.
|
||||||
|
|
||||||
|
First of all you need to set the right scaler for each resolution:
|
||||||
|
Best you begin with setting all to "bilinear". If that works ok for you, you can try to change them
|
||||||
|
for more advanced scaler. I use ewa_robidouxsharp on my GTX1050, but your mileage may vary.
|
||||||
|
Unfortunatly on INTEL not all scalers may work or crash.
|
||||||
|
The Intel GPU is much slower than NVIDIA and for UHD you most likly need to set the scaler to bilinear.
|
||||||
|
|
||||||
|
You can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will
|
||||||
|
see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the
|
||||||
|
Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test
|
||||||
|
is activ.
|
||||||
|
|
||||||
|
Then you should set the Monitor Type to "sRGB". This guarantees you the best colors on your screen.
|
||||||
|
At the moment all calculations internaly are done in RGB space and all cards output also RGB.
|
||||||
|
If you use the softhddrm Version then you should set the Monitor Type to HD TV or UHD-HDR TV if you have
|
||||||
|
connected one of those.
|
||||||
|
|
||||||
|
If you are colorblind you could try to remedy this with the Colorblind Settings. Realy only needed
|
||||||
|
in rare cases.
|
||||||
|
|
||||||
|
All other settings can be in their default state.
|
||||||
|
|
||||||
|
Note for NUC11/12 Users:
|
||||||
|
Provide paramete -w alsa-no-test to get Audio working.
|
||||||
|
|
||||||
|
Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader.
|
||||||
|
The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is
|
||||||
|
provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start
|
||||||
|
vdr -P 'softhdcuvid -S filmgrain.glsl ...'
|
||||||
|
I use KrigBilateral for UV scaling and then adaptive-sharpen for sharpening. This results in a perfect
|
||||||
|
picture for me.
|
||||||
|
|
||||||
|
You can also use a custon LUT File. It is located in $ConfigDir/shaders/lut/lut.cube. If you provide there
|
||||||
|
a lut file it will be automaticly used. In the Mainmenue you can switch LUT on and off.
|
||||||
|
|
||||||
|
Konfig Guide for softhddrm Version
|
||||||
|
----------------------------------
|
||||||
|
You should set the Monitor Type to HD TV or UHD-HDR TV depending on your TV Set
|
||||||
|
With softhddrm and a HDR TV Set you can view HDR-HLG content. This is tested with Kernel 5.12 and a Intel NUC.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Setup: environment
|
Setup: environment
|
||||||
------
|
------
|
||||||
Following is supported:
|
Following is supported:
|
||||||
|
|
||||||
DISPLAY=:0.0
|
DISPLAY=:0.0
|
||||||
x11 display name
|
X11 display name
|
||||||
|
|
||||||
only if alsa is configured
|
ALSA configuration:
|
||||||
ALSA_DEVICE=default
|
ALSA_DEVICE=default
|
||||||
alsa PCM device name
|
ALSA PCM device name
|
||||||
ALSA_PASSTHROUGH_DEVICE=
|
ALSA_PASSTHROUGH_DEVICE=
|
||||||
alsa pass-though (AC-3,E-AC-3,DTS,...) device name
|
ALSA pass-though (AC-3,E-AC-3,DTS,...) device name
|
||||||
ALSA_MIXER=default
|
ALSA_MIXER=default
|
||||||
alsa control device name
|
ALSA control device name
|
||||||
ALSA_MIXER_CHANNEL=PCM
|
ALSA_MIXER_CHANNEL=PCM
|
||||||
alsa control channel name
|
ALSA control channel name
|
||||||
|
|
||||||
only if oss is configured
|
|
||||||
OSS_AUDIODEV=/dev/dsp
|
|
||||||
oss dsp device name
|
|
||||||
OSS_PASSTHROUGHDEV=
|
|
||||||
oss pass-though (AC-3,E-AC-3,DTS,...) device name
|
|
||||||
OSS_MIXERDEV=/dev/mixer
|
|
||||||
oss mixer device name
|
|
||||||
OSS_MIXER_CHANNEL=pcm
|
|
||||||
oss mixer channel name
|
|
||||||
|
|
||||||
Setup: /etc/vdr/setup.conf
|
Setup: /etc/vdr/setup.conf
|
||||||
------
|
------
|
||||||
@ -147,7 +184,7 @@ Setup: /etc/vdr/setup.conf
|
|||||||
(only 0, 1, 4 supported with VA-API)
|
(only 0, 1, 4 supported with VA-API)
|
||||||
|
|
||||||
softhddevice.<res>.SkipChromaDeinterlace = 0
|
softhddevice.<res>.SkipChromaDeinterlace = 0
|
||||||
0 = disabled, 1 = enabled (for slower cards, poor qualität)
|
0 = disabled, 1 = enabled (for slower cards, poor qualit<EFBFBD>t)
|
||||||
|
|
||||||
softhddevice.<res>.InverseTelecine = 0
|
softhddevice.<res>.InverseTelecine = 0
|
||||||
0 = disabled, 1 = enabled
|
0 = disabled, 1 = enabled
|
||||||
@ -205,18 +242,6 @@ Setup: /etc/vdr/setup.conf
|
|||||||
0 = default (336 ms)
|
0 = default (336 ms)
|
||||||
1 - 1000 = size of the buffer in ms
|
1 - 1000 = size of the buffer in ms
|
||||||
|
|
||||||
softhddevice.AutoCrop.Interval = 0
|
|
||||||
0 disables auto-crop
|
|
||||||
n each 'n' frames auto-crop is checked.
|
|
||||||
|
|
||||||
softhddevice.AutoCrop.Delay = 0
|
|
||||||
if auto-crop is over 'n' intervals the same, the cropping is
|
|
||||||
used.
|
|
||||||
|
|
||||||
softhddevice.AutoCrop.Tolerance = 0
|
|
||||||
if detected crop area is too small, cut max 'n' pixels at top and
|
|
||||||
bottom.
|
|
||||||
|
|
||||||
softhddevice.Background = 0
|
softhddevice.Background = 0
|
||||||
32bit RGBA background color
|
32bit RGBA background color
|
||||||
(Red * 16777216 + Green * 65536 + Blue * 256 + Alpha)
|
(Red * 16777216 + Green * 65536 + Blue * 256 + Alpha)
|
||||||
@ -226,8 +251,8 @@ Setup: /etc/vdr/setup.conf
|
|||||||
(Red * 65536 + Green * 256 + Blue)
|
(Red * 65536 + Green * 256 + Blue)
|
||||||
|
|
||||||
softhddevice.StudioLevels = 0
|
softhddevice.StudioLevels = 0
|
||||||
0 use PC levels (0-255) with vdpau.
|
0 use limited RGB (16-235) with placebo.
|
||||||
1 use studio levels (16-235) with vdpau.
|
1 use full RGB (0-255) with placebo.
|
||||||
|
|
||||||
softhddevice.Suspend.Close = 0
|
softhddevice.Suspend.Close = 0
|
||||||
1 suspend closes x11 window, connection and audio device.
|
1 suspend closes x11 window, connection and audio device.
|
||||||
@ -256,11 +281,13 @@ Setup: /etc/vdr/setup.conf
|
|||||||
0 pan and scan
|
0 pan and scan
|
||||||
1 letter box
|
1 letter box
|
||||||
2 center cut-out
|
2 center cut-out
|
||||||
|
3 original
|
||||||
|
|
||||||
softhddevice.VideoOtherDisplayFormat = 1
|
softhddevice.VideoOtherDisplayFormat = 1
|
||||||
0 pan and scan
|
0 pan and scan
|
||||||
1 pillar box
|
1 pillar box
|
||||||
2 center cut-out
|
2 center cut-out
|
||||||
|
3 original
|
||||||
|
|
||||||
softhddevice.pip.X = 79
|
softhddevice.pip.X = 79
|
||||||
softhddevice.pip.Y = 78
|
softhddevice.pip.Y = 78
|
||||||
@ -287,22 +314,6 @@ Setup: /etc/vdr/setup.conf
|
|||||||
PIP alternative video window position and size in percent.
|
PIP alternative video window position and size in percent.
|
||||||
|
|
||||||
|
|
||||||
Setup: /etc/vdr/remote.conf
|
|
||||||
------
|
|
||||||
|
|
||||||
Add "XKeySym." definitions to /etc/vdr/remote.conf to control
|
|
||||||
the vdr and plugin with the connected input device.
|
|
||||||
|
|
||||||
fe.
|
|
||||||
XKeySym.Up Up
|
|
||||||
XKeySym.Down Down
|
|
||||||
...
|
|
||||||
|
|
||||||
Additional to the x11 input sends the window close button "Close".
|
|
||||||
|
|
||||||
fe.
|
|
||||||
XKeySym.Power Close
|
|
||||||
|
|
||||||
Commandline:
|
Commandline:
|
||||||
------------
|
------------
|
||||||
|
|
||||||
@ -312,10 +323,7 @@ Commandline:
|
|||||||
|
|
||||||
Selects audio output module and device.
|
Selects audio output module and device.
|
||||||
"" to disable audio output
|
"" to disable audio output
|
||||||
/... to use oss audio module (if compiled with oss
|
other to use ALSA audio module
|
||||||
support)
|
|
||||||
other to use alsa audio module (if compiled with alsa
|
|
||||||
support)
|
|
||||||
|
|
||||||
SVDRP:
|
SVDRP:
|
||||||
------
|
------
|
||||||
@ -350,25 +358,4 @@ Running:
|
|||||||
|
|
||||||
Known Bugs:
|
Known Bugs:
|
||||||
-----------
|
-----------
|
||||||
SD Stream not working very well
|
SD Streams not working very well on vaapi
|
||||||
RESUME starts wirh black screen (channelswitch needed)
|
|
||||||
|
|
||||||
Requires:
|
|
||||||
---------
|
|
||||||
media-video/vdr (version >=1.7.xx)
|
|
||||||
Video Disk Recorder - turns a pc into a powerful set top box
|
|
||||||
for DVB.
|
|
||||||
http://www.tvdr.de/
|
|
||||||
|
|
||||||
media-video/ffmpeg (version >=0.7)
|
|
||||||
Complete solution to record, convert and stream audio and
|
|
||||||
video. Includes libavcodec and libswresample.
|
|
||||||
http://ffmpeg.org
|
|
||||||
media-libs/alsa-lib
|
|
||||||
Advanced Linux Sound Architecture Library
|
|
||||||
http://www.alsa-project.org
|
|
||||||
or
|
|
||||||
kernel support for oss/oss4 or alsa oss emulation
|
|
||||||
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 3, 19 November 2007
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
for software and other kinds of works, specifically designed to ensure
|
software and other kinds of works, specifically designed to ensure
|
||||||
cooperation with the community in the case of network server software.
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
The licenses for most software and other practical works are
|
The licenses for most software and other practical works are designed
|
||||||
designed to take away your freedom to share and change the works. By
|
to take away your freedom to share and change the works. By contrast,
|
||||||
contrast, our General Public Licenses are intended to guarantee your
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
freedom to share and change all versions of a program--to make sure it
|
share and change all versions of a program--to make sure it remains free
|
||||||
remains free software for all its users.
|
software for all its users.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
@ -60,11 +60,10 @@ modification follow.
|
|||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
of works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
@ -377,12 +376,12 @@ that material) supplement the terms of this License with terms:
|
|||||||
All other non-permissive additional terms are considered "further
|
All other non-permissive additional terms are considered "further
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
received it, or any part of it, contains a notice stating that it is
|
received it, or any part of it, contains a notice stating that it is
|
||||||
governed by this License along with a term that is a further restriction,
|
governed by this License along with a term that is a further
|
||||||
you may remove that term. If a license document contains a further
|
restriction, you may remove that term. If a license document contains
|
||||||
restriction but permits relicensing or conveying under this License, you
|
a further restriction but permits relicensing or conveying under this
|
||||||
may add to a covered work material governed by the terms of that license
|
License, you may add to a covered work material governed by the terms
|
||||||
document, provided that the further restriction does not survive such
|
of that license document, provided that the further restriction does
|
||||||
relicensing or conveying.
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
If you add terms to a covered work in accord with this section, you
|
||||||
must place, in the relevant source files, a statement of the
|
must place, in the relevant source files, a statement of the
|
||||||
@ -551,34 +550,34 @@ shall include the Corresponding Source for any work covered by version 3
|
|||||||
of the GNU General Public License that is incorporated pursuant to the
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
following paragraph.
|
following paragraph.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have permission
|
Notwithstanding any other provision of this License, you have
|
||||||
to link or combine any covered work with a work licensed under version 3
|
permission to link or combine any covered work with a work licensed
|
||||||
of the GNU General Public License into a single combined work, and to
|
under version 3 of the GNU General Public License into a single
|
||||||
convey the resulting work. The terms of this License will continue to
|
combined work, and to convey the resulting work. The terms of this
|
||||||
apply to the part which is the covered work, but the work with which it is
|
License will continue to apply to the part which is the covered work,
|
||||||
combined will remain governed by version 3 of the GNU General Public
|
but the work with which it is combined will remain governed by version
|
||||||
License.
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU Affero General Public License from time to time. Such new
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
versions will be similar in spirit to the present version, but may differ
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
in detail to address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU Affero
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
General Public License "or any later version" applies to it, you have
|
Public License "or any later version" applies to it, you have the
|
||||||
the option of following the terms and conditions either of that
|
option of following the terms and conditions either of that numbered
|
||||||
numbered version or of any later version published by the Free
|
version or of any later version published by the Free Software
|
||||||
Software Foundation. If the Program does not specify a version number
|
Foundation. If the Program does not specify a version number of the
|
||||||
of the GNU Affero General Public License, you may choose any version
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
ever published by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU Affero General Public License can be used, that
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
proxy's public statement of acceptance of a version permanently
|
public statement of acceptance of a version permanently authorizes you
|
||||||
authorizes you to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
Later license versions may give you additional or different
|
||||||
permissions. However, no additional obligations are imposed on any
|
permissions. However, no additional obligations are imposed on any
|
||||||
@ -617,9 +616,9 @@ an absolute waiver of all civil liability in connection with the
|
|||||||
Program, unless a warranty or assumption of liability accompanies a
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, the best way to achieve this is to make it
|
possible use to the public, the best way to achieve this is to make it
|
||||||
@ -634,9 +633,9 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
published by the Free Software Foundation, either version 3 of the
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@ -644,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
@ -659,4 +658,4 @@ specific requirements.
|
|||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
83
audio.h
83
audio.h
@ -1,67 +1,68 @@
|
|||||||
///
|
///
|
||||||
/// @file audio.h @brief Audio module headerfile
|
/// @file audio.h @brief Audio module headerfile
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: da055758af70cfdb9ab1989d5fcfb218c5d6a366 $
|
/// $Id: da055758af70cfdb9ab1989d5fcfb218c5d6a366 $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup Audio
|
/// @addtogroup Audio
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
|
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
|
||||||
extern void AudioFlushBuffers(void); ///< flush audio buffers
|
extern void AudioFlushBuffers(void); ///< flush audio buffers
|
||||||
extern void AudioPoller(void); ///< poll audio events/handling
|
extern void AudioPoller(void); ///< poll audio events/handling
|
||||||
extern int AudioFreeBytes(void); ///< free bytes in audio output
|
extern int AudioFreeBytes(void); ///< free bytes in audio output
|
||||||
extern int AudioUsedBytes(void); ///< used bytes in audio output
|
extern int AudioUsedBytes(void); ///< used bytes in audio output
|
||||||
extern int64_t AudioGetDelay(void); ///< get current audio delay
|
extern int64_t AudioGetDelay(void); ///< get current audio delay
|
||||||
extern void AudioSetClock(int64_t); ///< set audio clock base
|
extern void AudioSetClock(int64_t); ///< set audio clock base
|
||||||
extern int64_t AudioGetClock(); ///< get current audio clock
|
extern int64_t AudioGetClock(); ///< get current audio clock
|
||||||
extern void AudioSetVolume(int); ///< set volume
|
extern void AudioSetVolume(int); ///< set volume
|
||||||
extern int AudioSetup(int *, int *, int); ///< setup audio output
|
extern int AudioSetup(int *, int *, int); ///< setup audio output
|
||||||
|
|
||||||
extern void AudioPlay(void); ///< play audio
|
extern void AudioPlay(void); ///< play audio
|
||||||
extern void AudioPause(void); ///< pause audio
|
extern void AudioPause(void); ///< pause audio
|
||||||
|
|
||||||
extern void AudioSetBufferTime(int); ///< set audio buffer time
|
extern void AudioSetBufferTime(int); ///< set audio buffer time
|
||||||
extern void AudioSetSoftvol(int); ///< enable/disable softvol
|
extern void AudioSetSoftvol(int); ///< enable/disable softvol
|
||||||
extern void AudioSetNormalize(int, int); ///< set normalize parameters
|
extern void AudioSetNormalize(int, int); ///< set normalize parameters
|
||||||
extern void AudioSetCompression(int, int); ///< set compression parameters
|
extern void AudioSetCompression(int, int); ///< set compression parameters
|
||||||
extern void AudioSetStereoDescent(int); ///< set stereo loudness descent
|
extern void AudioSetStereoDescent(int); ///< set stereo loudness descent
|
||||||
|
|
||||||
extern void AudioSetDevice(const char *); ///< set PCM audio device
|
extern void AudioSetDevice(const char *); ///< set PCM audio device
|
||||||
|
|
||||||
/// set pass-through device
|
/// set pass-through device
|
||||||
extern void AudioSetPassthroughDevice(const char *);
|
extern void AudioSetPassthroughDevice(const char *);
|
||||||
extern void AudioSetChannel(const char *); ///< set mixer channel
|
extern void AudioSetChannel(const char *); ///< set mixer channel
|
||||||
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
|
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
|
||||||
extern void AudioInit(void); ///< setup audio module
|
extern void AudioInit(void); ///< setup audio module
|
||||||
extern void AudioExit(void); ///< cleanup and exit audio module
|
extern void AudioExit(void); ///< cleanup and exit audio module
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern char AudioAlsaDriverBroken; ///< disable broken driver message
|
extern char AudioAlsaNotest; ///< disable Alsa capability test
|
||||||
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
extern char AudioAlsaDriverBroken; ///< disable broken driver message
|
||||||
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
||||||
|
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
175
codec.h
175
codec.h
@ -1,173 +1,176 @@
|
|||||||
///
|
///
|
||||||
/// @file codec.h @brief Codec module headerfile
|
/// @file codec.h @brief Codec module headerfile
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2013, 2015 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2013, 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: bdb4d18dbe371e497d039e45faa7c134b019860a $
|
/// $Id: bdb4d18dbe371e497d039e45faa7c134b019860a $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup Codec
|
/// @addtogroup Codec
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Defines
|
// Defines
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define CodecPCM 0x01 ///< PCM bit mask
|
#define CodecPCM 0x01 ///< PCM bit mask
|
||||||
#define CodecMPA 0x02 ///< MPA bit mask (planned)
|
#define CodecMPA 0x02 ///< MPA bit mask (planned)
|
||||||
#define CodecAC3 0x04 ///< AC-3 bit mask
|
#define CodecAC3 0x04 ///< AC-3 bit mask
|
||||||
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
|
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
|
||||||
#define CodecDTS 0x10 ///< DTS bit mask (planned)
|
#define CodecDTS 0x10 ///< DTS bit mask (planned)
|
||||||
|
|
||||||
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
|
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
|
||||||
|
|
||||||
enum HWAccelID {
|
enum HWAccelID {
|
||||||
HWACCEL_NONE = 0,
|
HWACCEL_NONE = 0,
|
||||||
HWACCEL_AUTO,
|
HWACCEL_AUTO,
|
||||||
HWACCEL_VDPAU,
|
HWACCEL_VDPAU,
|
||||||
HWACCEL_DXVA2,
|
HWACCEL_DXVA2,
|
||||||
HWACCEL_VDA,
|
HWACCEL_VDA,
|
||||||
HWACCEL_VIDEOTOOLBOX,
|
HWACCEL_VIDEOTOOLBOX,
|
||||||
HWACCEL_QSV,
|
HWACCEL_QSV,
|
||||||
HWACCEL_VAAPI,
|
HWACCEL_VAAPI,
|
||||||
HWACCEL_CUVID,
|
HWACCEL_CUVID,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern AVBufferRef *hw_device_ctx;
|
extern AVBufferRef *hw_device_ctx;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Video decoder structure.
|
/// Video decoder structure.
|
||||||
///
|
///
|
||||||
struct _video_decoder_
|
struct _video_decoder_ {
|
||||||
{
|
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
||||||
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
|
||||||
|
int GetFormatDone; ///< flag get format called!
|
||||||
int GetFormatDone; ///< flag get format called!
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
||||||
AVCodec *VideoCodec; ///< video codec
|
AVCodec *VideoCodec; ///< video codec
|
||||||
AVCodecContext *VideoCtx; ///< video codec context
|
#else
|
||||||
//#ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
const AVCodec *VideoCodec; ///< video codec
|
||||||
int FirstKeyFrame; ///< flag first frame
|
#endif
|
||||||
//#endif
|
AVCodecContext *VideoCtx; ///< video codec context
|
||||||
AVFrame *Frame; ///< decoded video frame
|
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
|
int FirstKeyFrame; ///< flag first frame
|
||||||
/* hwaccel options */
|
// #endif
|
||||||
enum HWAccelID hwaccel_id;
|
// AVFrame *Frame; ///< decoded video frame
|
||||||
char *hwaccel_device;
|
|
||||||
enum AVPixelFormat hwaccel_output_format;
|
|
||||||
|
|
||||||
/* hwaccel context */
|
|
||||||
enum HWAccelID active_hwaccel_id;
|
|
||||||
void *hwaccel_ctx;
|
|
||||||
void (*hwaccel_uninit)(AVCodecContext *s);
|
|
||||||
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
|
|
||||||
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
|
|
||||||
enum AVPixelFormat hwaccel_pix_fmt;
|
|
||||||
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
|
|
||||||
AVBufferRef *hw_frames_ctx;
|
|
||||||
|
|
||||||
void *hwdec_priv;
|
int filter; // flag for deint filter
|
||||||
// For HDR side-data caching
|
|
||||||
double cached_hdr_peak;
|
|
||||||
// From VO
|
|
||||||
struct mp_hwdec_devices *hwdec_devs;
|
|
||||||
|
|
||||||
|
/* hwaccel options */
|
||||||
|
enum HWAccelID hwaccel_id;
|
||||||
|
char *hwaccel_device;
|
||||||
|
enum AVPixelFormat hwaccel_output_format;
|
||||||
|
|
||||||
|
/* hwaccel context */
|
||||||
|
enum HWAccelID active_hwaccel_id;
|
||||||
|
void *hwaccel_ctx;
|
||||||
|
void (*hwaccel_uninit)(AVCodecContext *s);
|
||||||
|
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
|
||||||
|
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
|
||||||
|
enum AVPixelFormat hwaccel_pix_fmt;
|
||||||
|
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
|
||||||
|
AVBufferRef *hw_frames_ctx;
|
||||||
|
|
||||||
|
void *hwdec_priv;
|
||||||
|
// For HDR side-data caching
|
||||||
|
double cached_hdr_peak;
|
||||||
|
// From VO
|
||||||
|
struct mp_hwdec_devices *hwdec_devs;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Typedefs
|
// Typedefs
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Video decoder typedef.
|
/// Video decoder typedef.
|
||||||
typedef struct _video_decoder_ VideoDecoder;
|
typedef struct _video_decoder_ VideoDecoder;
|
||||||
|
|
||||||
/// Audio decoder typedef.
|
/// Audio decoder typedef.
|
||||||
typedef struct _audio_decoder_ AudioDecoder;
|
typedef struct _audio_decoder_ AudioDecoder;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// x11 display name
|
/// x11 display name
|
||||||
extern const char *X11DisplayName;
|
extern const char *X11DisplayName;
|
||||||
|
|
||||||
/// HW device context from video module
|
/// HW device context from video module
|
||||||
extern AVBufferRef *HwDeviceContext;
|
extern AVBufferRef *HwDeviceContext;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Flag prefer fast xhannel switch
|
/// Flag prefer fast xhannel switch
|
||||||
extern char CodecUsePossibleDefectFrames;
|
extern char CodecUsePossibleDefectFrames;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Allocate a new video decoder context.
|
/// Allocate a new video decoder context.
|
||||||
extern VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder *);
|
extern VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder *);
|
||||||
|
|
||||||
/// Deallocate a video decoder context.
|
/// Deallocate a video decoder context.
|
||||||
extern void CodecVideoDelDecoder(VideoDecoder *);
|
extern void CodecVideoDelDecoder(VideoDecoder *);
|
||||||
|
|
||||||
/// Open video codec.
|
/// Open video codec.
|
||||||
extern void CodecVideoOpen(VideoDecoder *, int);
|
extern void CodecVideoOpen(VideoDecoder *, int);
|
||||||
|
|
||||||
/// Close video codec.
|
/// Close video codec.
|
||||||
extern void CodecVideoClose(VideoDecoder *);
|
extern void CodecVideoClose(VideoDecoder *);
|
||||||
|
|
||||||
/// Decode a video packet.
|
/// Decode a video packet.
|
||||||
extern void CodecVideoDecode(VideoDecoder *, const AVPacket *);
|
extern void CodecVideoDecode(VideoDecoder *, const AVPacket *);
|
||||||
|
|
||||||
/// Flush video buffers.
|
/// Flush video buffers.
|
||||||
extern void CodecVideoFlushBuffers(VideoDecoder *);
|
extern void CodecVideoFlushBuffers(VideoDecoder *);
|
||||||
|
|
||||||
/// Allocate a new audio decoder context.
|
/// Allocate a new audio decoder context.
|
||||||
extern AudioDecoder *CodecAudioNewDecoder(void);
|
extern AudioDecoder *CodecAudioNewDecoder(void);
|
||||||
|
|
||||||
/// Deallocate an audio decoder context.
|
/// Deallocate an audio decoder context.
|
||||||
extern void CodecAudioDelDecoder(AudioDecoder *);
|
extern void CodecAudioDelDecoder(AudioDecoder *);
|
||||||
|
|
||||||
/// Open audio codec.
|
/// Open audio codec.
|
||||||
extern void CodecAudioOpen(AudioDecoder *, int);
|
extern void CodecAudioOpen(AudioDecoder *, int);
|
||||||
|
|
||||||
/// Close audio codec.
|
/// Close audio codec.
|
||||||
extern void CodecAudioClose(AudioDecoder *);
|
extern void CodecAudioClose(AudioDecoder *);
|
||||||
|
|
||||||
/// Set audio drift correction.
|
/// Set audio drift correction.
|
||||||
extern void CodecSetAudioDrift(int);
|
extern void CodecSetAudioDrift(int);
|
||||||
|
|
||||||
/// Set audio pass-through.
|
/// Set audio pass-through.
|
||||||
extern void CodecSetAudioPassthrough(int);
|
extern void CodecSetAudioPassthrough(int);
|
||||||
|
|
||||||
/// Set audio downmix.
|
/// Set audio downmix.
|
||||||
extern void CodecSetAudioDownmix(int);
|
extern void CodecSetAudioDownmix(int);
|
||||||
|
|
||||||
/// Decode an audio packet.
|
/// Decode an audio packet.
|
||||||
extern void CodecAudioDecode(AudioDecoder *, const AVPacket *);
|
extern void CodecAudioDecode(AudioDecoder *, const AVPacket *);
|
||||||
|
|
||||||
/// Flush audio buffers.
|
/// Flush audio buffers.
|
||||||
extern void CodecAudioFlushBuffers(AudioDecoder *);
|
extern void CodecAudioFlushBuffers(AudioDecoder *);
|
||||||
|
|
||||||
/// Setup and initialize codec module.
|
/// Setup and initialize codec module.
|
||||||
extern void CodecInit(void);
|
extern void CodecInit(void);
|
||||||
|
|
||||||
/// Cleanup and exit codec module.
|
/// Cleanup and exit codec module.
|
||||||
extern void CodecExit(void);
|
extern void CodecExit(void);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
303
common.h
303
common.h
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of mpv.
|
* This file is part of mpv.
|
||||||
*
|
*
|
||||||
@ -8,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
* mpv is distributed in the hope that it will be useful,
|
* mpv is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
@ -18,17 +19,17 @@
|
|||||||
#ifndef MPLAYER_GL_COMMON_H
|
#ifndef MPLAYER_GL_COMMON_H
|
||||||
#define MPLAYER_GL_COMMON_H
|
#define MPLAYER_GL_COMMON_H
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#if 0
|
#if 0
|
||||||
#include "config.h"
|
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
|
#include "config.h"
|
||||||
#include "misc/bstr.h"
|
#include "misc/bstr.h"
|
||||||
|
|
||||||
#include "video/out/vo.h"
|
|
||||||
#include "video/csputils.h"
|
#include "video/csputils.h"
|
||||||
#include "video/mp_image.h"
|
#include "video/mp_image.h"
|
||||||
|
#include "video/out/vo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GL_COCOA
|
#if HAVE_GL_COCOA
|
||||||
@ -53,190 +54,170 @@ struct GL;
|
|||||||
typedef struct GL GL;
|
typedef struct GL GL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
|
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
|
||||||
MPGL_CAP_FB = (1 << 5),
|
MPGL_CAP_FB = (1 << 5),
|
||||||
MPGL_CAP_VAO = (1 << 6),
|
MPGL_CAP_VAO = (1 << 6),
|
||||||
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
|
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
|
||||||
MPGL_CAP_VDPAU = (1 << 11), // GL_NV_vdpau_interop
|
MPGL_CAP_VDPAU = (1 << 11), // GL_NV_vdpau_interop
|
||||||
MPGL_CAP_APPLE_RGB_422 = (1 << 12), // GL_APPLE_rgb_422
|
MPGL_CAP_APPLE_RGB_422 = (1 << 12), // GL_APPLE_rgb_422
|
||||||
MPGL_CAP_1D_TEX = (1 << 14),
|
MPGL_CAP_1D_TEX = (1 << 14),
|
||||||
MPGL_CAP_3D_TEX = (1 << 15),
|
MPGL_CAP_3D_TEX = (1 << 15),
|
||||||
MPGL_CAP_DEBUG = (1 << 16),
|
MPGL_CAP_DEBUG = (1 << 16),
|
||||||
MPGL_CAP_DXINTEROP = (1 << 17), // WGL_NV_DX_interop
|
MPGL_CAP_DXINTEROP = (1 << 17), // WGL_NV_DX_interop
|
||||||
MPGL_CAP_EXT16 = (1 << 18), // GL_EXT_texture_norm16
|
MPGL_CAP_EXT16 = (1 << 18), // GL_EXT_texture_norm16
|
||||||
MPGL_CAP_ARB_FLOAT = (1 << 19), // GL_ARB_texture_float
|
MPGL_CAP_ARB_FLOAT = (1 << 19), // GL_ARB_texture_float
|
||||||
MPGL_CAP_EXT_CR_HFLOAT = (1 << 20), // GL_EXT_color_buffer_half_float
|
MPGL_CAP_EXT_CR_HFLOAT = (1 << 20), // GL_EXT_color_buffer_half_float
|
||||||
|
|
||||||
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
|
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
|
||||||
};
|
};
|
||||||
|
|
||||||
// E.g. 310 means 3.1
|
// E.g. 310 means 3.1
|
||||||
// Code doesn't have to use the macros; they are for convenience only.
|
// Code doesn't have to use the macros; they are for convenience only.
|
||||||
#define MPGL_VER(major, minor) (((major) * 100) + (minor) * 10)
|
#define MPGL_VER(major, minor) (((major)*100) + (minor)*10)
|
||||||
#define MPGL_VER_GET_MAJOR(ver) ((unsigned)(ver) / 100)
|
#define MPGL_VER_GET_MAJOR(ver) ((unsigned)(ver) / 100)
|
||||||
#define MPGL_VER_GET_MINOR(ver) ((unsigned)(ver) % 100 / 10)
|
#define MPGL_VER_GET_MINOR(ver) ((unsigned)(ver) % 100 / 10)
|
||||||
|
|
||||||
#define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver)
|
#define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver)
|
||||||
|
|
||||||
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
|
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), const char *ext2, struct mp_log *log);
|
||||||
const char *ext2, struct mp_log *log);
|
void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), void *fn_ctx, const char *ext2,
|
||||||
void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
|
struct mp_log *log);
|
||||||
void *fn_ctx, const char *ext2, struct mp_log *log);
|
|
||||||
|
|
||||||
typedef void (GLAPIENTRY *MP_GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum,
|
typedef void(GLAPIENTRY *MP_GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *);
|
||||||
GLsizei, const GLchar *,const void *);
|
|
||||||
|
|
||||||
//function pointers loaded from the OpenGL library
|
// function pointers loaded from the OpenGL library
|
||||||
struct GL {
|
struct GL {
|
||||||
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
|
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
|
||||||
int es; // es version (e.g. 300), 0 for desktop GL
|
int es; // es version (e.g. 300), 0 for desktop GL
|
||||||
int glsl_version; // e.g. 130 for GLSL 1.30
|
int glsl_version; // e.g. 130 for GLSL 1.30
|
||||||
char *extensions; // Equivalent to GL_EXTENSIONS
|
char *extensions; // Equivalent to GL_EXTENSIONS
|
||||||
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
||||||
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
||||||
GLuint main_fb; // framebuffer to render to (normally 0)
|
GLuint main_fb; // framebuffer to render to (normally 0)
|
||||||
|
|
||||||
void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
|
void(GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
|
||||||
void (GLAPIENTRY *Clear)(GLbitfield);
|
void(GLAPIENTRY *Clear)(GLbitfield);
|
||||||
void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *);
|
void(GLAPIENTRY *GenTextures)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
|
void(GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
|
||||||
void (GLAPIENTRY *Enable)(GLenum);
|
void(GLAPIENTRY *Enable)(GLenum);
|
||||||
void (GLAPIENTRY *Disable)(GLenum);
|
void(GLAPIENTRY *Disable)(GLenum);
|
||||||
const GLubyte *(GLAPIENTRY * GetString)(GLenum);
|
const GLubyte *(GLAPIENTRY *GetString)(GLenum);
|
||||||
void (GLAPIENTRY *BlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum);
|
void(GLAPIENTRY *BlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum);
|
||||||
void (GLAPIENTRY *Flush)(void);
|
void(GLAPIENTRY *Flush)(void);
|
||||||
void (GLAPIENTRY *Finish)(void);
|
void(GLAPIENTRY *Finish)(void);
|
||||||
void (GLAPIENTRY *PixelStorei)(GLenum, GLint);
|
void(GLAPIENTRY *PixelStorei)(GLenum, GLint);
|
||||||
void (GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint,
|
void(GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||||
GLenum, GLenum, const GLvoid *);
|
void(GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||||
void (GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei,
|
void(GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||||
GLint, GLenum, GLenum, const GLvoid *);
|
void(GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint);
|
||||||
void (GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint,
|
void(GLAPIENTRY *GetIntegerv)(GLenum, GLint *);
|
||||||
GLsizei, GLsizei, GLenum, GLenum,
|
void(GLAPIENTRY *ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
|
||||||
const GLvoid *);
|
void(GLAPIENTRY *ReadBuffer)(GLenum);
|
||||||
void (GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint);
|
void(GLAPIENTRY *DrawArrays)(GLenum, GLint, GLsizei);
|
||||||
void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *);
|
GLenum(GLAPIENTRY *GetError)(void);
|
||||||
void (GLAPIENTRY *ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum,
|
void(GLAPIENTRY *GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
|
||||||
GLenum, GLvoid *);
|
void(GLAPIENTRY *Scissor)(GLint, GLint, GLsizei, GLsizei);
|
||||||
void (GLAPIENTRY *ReadBuffer)(GLenum);
|
|
||||||
void (GLAPIENTRY *DrawArrays)(GLenum, GLint, GLsizei);
|
|
||||||
GLenum (GLAPIENTRY *GetError)(void);
|
|
||||||
void (GLAPIENTRY *GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
|
|
||||||
void (GLAPIENTRY *Scissor)(GLint, GLint, GLsizei, GLsizei);
|
|
||||||
|
|
||||||
void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
|
void(GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY *BindBuffer)(GLenum, GLuint);
|
void(GLAPIENTRY *BindBuffer)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY *BindBufferBase)(GLenum, GLuint, GLuint);
|
void(GLAPIENTRY *BindBufferBase)(GLenum, GLuint, GLuint);
|
||||||
GLvoid * (GLAPIENTRY *MapBufferRange)(GLenum, GLintptr, GLsizeiptr,
|
GLvoid *(GLAPIENTRY *MapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield);
|
||||||
GLbitfield);
|
GLboolean(GLAPIENTRY *UnmapBuffer)(GLenum);
|
||||||
GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum);
|
void(GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
|
||||||
void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
|
void(GLAPIENTRY *ActiveTexture)(GLenum);
|
||||||
void (GLAPIENTRY *ActiveTexture)(GLenum);
|
void(GLAPIENTRY *BindTexture)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY *BindTexture)(GLenum, GLuint);
|
int(GLAPIENTRY *SwapInterval)(int);
|
||||||
int (GLAPIENTRY *SwapInterval)(int);
|
void(GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum,
|
||||||
void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei,
|
const GLvoid *);
|
||||||
GLsizei, GLint, GLenum, GLenum,
|
|
||||||
const GLvoid *);
|
|
||||||
|
|
||||||
void (GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
|
void(GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY *BindVertexArray)(GLuint);
|
void(GLAPIENTRY *BindVertexArray)(GLuint);
|
||||||
GLint (GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
|
GLint(GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
|
||||||
void (GLAPIENTRY *EnableVertexAttribArray)(GLuint);
|
void(GLAPIENTRY *EnableVertexAttribArray)(GLuint);
|
||||||
void (GLAPIENTRY *DisableVertexAttribArray)(GLuint);
|
void(GLAPIENTRY *DisableVertexAttribArray)(GLuint);
|
||||||
void (GLAPIENTRY *VertexAttribPointer)(GLuint, GLint, GLenum, GLboolean,
|
void(GLAPIENTRY *VertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
|
||||||
GLsizei, const GLvoid *);
|
void(GLAPIENTRY *DeleteVertexArrays)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY *DeleteVertexArrays)(GLsizei, const GLuint *);
|
void(GLAPIENTRY *UseProgram)(GLuint);
|
||||||
void (GLAPIENTRY *UseProgram)(GLuint);
|
GLint(GLAPIENTRY *GetUniformLocation)(GLuint, const GLchar *);
|
||||||
GLint (GLAPIENTRY *GetUniformLocation)(GLuint, const GLchar *);
|
void(GLAPIENTRY *CompileShader)(GLuint);
|
||||||
void (GLAPIENTRY *CompileShader)(GLuint);
|
GLuint(GLAPIENTRY *CreateProgram)(void);
|
||||||
GLuint (GLAPIENTRY *CreateProgram)(void);
|
GLuint(GLAPIENTRY *CreateShader)(GLenum);
|
||||||
GLuint (GLAPIENTRY *CreateShader)(GLenum);
|
void(GLAPIENTRY *ShaderSource)(GLuint, GLsizei, const GLchar **, const GLint *);
|
||||||
void (GLAPIENTRY *ShaderSource)(GLuint, GLsizei, const GLchar **,
|
void(GLAPIENTRY *LinkProgram)(GLuint);
|
||||||
const GLint *);
|
void(GLAPIENTRY *AttachShader)(GLuint, GLuint);
|
||||||
void (GLAPIENTRY *LinkProgram)(GLuint);
|
void(GLAPIENTRY *DeleteShader)(GLuint);
|
||||||
void (GLAPIENTRY *AttachShader)(GLuint, GLuint);
|
void(GLAPIENTRY *DeleteProgram)(GLuint);
|
||||||
void (GLAPIENTRY *DeleteShader)(GLuint);
|
void(GLAPIENTRY *GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
||||||
void (GLAPIENTRY *DeleteProgram)(GLuint);
|
void(GLAPIENTRY *GetShaderiv)(GLuint, GLenum, GLint *);
|
||||||
void (GLAPIENTRY *GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
void(GLAPIENTRY *GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
||||||
void (GLAPIENTRY *GetShaderiv)(GLuint, GLenum, GLint *);
|
void(GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *);
|
||||||
void (GLAPIENTRY *GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
const GLubyte *(GLAPIENTRY *GetStringi)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *);
|
void(GLAPIENTRY *BindAttribLocation)(GLuint, GLuint, const GLchar *);
|
||||||
const GLubyte* (GLAPIENTRY *GetStringi)(GLenum, GLuint);
|
void(GLAPIENTRY *BindFramebuffer)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY *BindAttribLocation)(GLuint, GLuint, const GLchar *);
|
void(GLAPIENTRY *GenFramebuffers)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY *BindFramebuffer)(GLenum, GLuint);
|
void(GLAPIENTRY *DeleteFramebuffers)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY *GenFramebuffers)(GLsizei, GLuint *);
|
GLenum(GLAPIENTRY *CheckFramebufferStatus)(GLenum);
|
||||||
void (GLAPIENTRY *DeleteFramebuffers)(GLsizei, const GLuint *);
|
void(GLAPIENTRY *FramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint);
|
||||||
GLenum (GLAPIENTRY *CheckFramebufferStatus)(GLenum);
|
void(GLAPIENTRY *BlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
|
||||||
void (GLAPIENTRY *FramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint,
|
void(GLAPIENTRY *GetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint *);
|
||||||
GLint);
|
|
||||||
void (GLAPIENTRY *BlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint,
|
|
||||||
GLint, GLint, GLbitfield, GLenum);
|
|
||||||
void (GLAPIENTRY *GetFramebufferAttachmentParameteriv)(GLenum, GLenum,
|
|
||||||
GLenum, GLint *);
|
|
||||||
|
|
||||||
void (GLAPIENTRY *Uniform1f)(GLint, GLfloat);
|
void(GLAPIENTRY *Uniform1f)(GLint, GLfloat);
|
||||||
void (GLAPIENTRY *Uniform2f)(GLint, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform2f)(GLint, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY *Uniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY *Uniform1i)(GLint, GLint);
|
void(GLAPIENTRY *Uniform1i)(GLint, GLint);
|
||||||
void (GLAPIENTRY *UniformMatrix2fv)(GLint, GLsizei, GLboolean,
|
void(GLAPIENTRY *UniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
|
||||||
const GLfloat *);
|
void(GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
|
||||||
void (GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean,
|
|
||||||
const GLfloat *);
|
|
||||||
|
|
||||||
void (GLAPIENTRY *InvalidateFramebuffer)(GLenum, GLsizei, const GLenum *);
|
void(GLAPIENTRY *InvalidateFramebuffer)(GLenum, GLsizei, const GLenum *);
|
||||||
|
|
||||||
GLsync (GLAPIENTRY *FenceSync)(GLenum, GLbitfield);
|
GLsync(GLAPIENTRY *FenceSync)(GLenum, GLbitfield);
|
||||||
GLenum (GLAPIENTRY *ClientWaitSync)(GLsync, GLbitfield, GLuint64);
|
GLenum(GLAPIENTRY *ClientWaitSync)(GLsync, GLbitfield, GLuint64);
|
||||||
void (GLAPIENTRY *DeleteSync)(GLsync sync);
|
void(GLAPIENTRY *DeleteSync)(GLsync sync);
|
||||||
|
|
||||||
void (GLAPIENTRY *GenQueries)(GLsizei, GLuint *);
|
void(GLAPIENTRY *GenQueries)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY *DeleteQueries)(GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteQueries)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY *BeginQuery)(GLenum, GLuint);
|
void(GLAPIENTRY *BeginQuery)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY *EndQuery)(GLenum);
|
void(GLAPIENTRY *EndQuery)(GLenum);
|
||||||
void (GLAPIENTRY *QueryCounter)(GLuint, GLenum);
|
void(GLAPIENTRY *QueryCounter)(GLuint, GLenum);
|
||||||
GLboolean (GLAPIENTRY *IsQuery)(GLuint);
|
GLboolean(GLAPIENTRY *IsQuery)(GLuint);
|
||||||
void (GLAPIENTRY *GetQueryObjectiv)(GLuint, GLenum, GLint *);
|
void(GLAPIENTRY *GetQueryObjectiv)(GLuint, GLenum, GLint *);
|
||||||
void (GLAPIENTRY *GetQueryObjecti64v)(GLuint, GLenum, GLint64 *);
|
void(GLAPIENTRY *GetQueryObjecti64v)(GLuint, GLenum, GLint64 *);
|
||||||
void (GLAPIENTRY *GetQueryObjectuiv)(GLuint, GLenum, GLuint *);
|
void(GLAPIENTRY *GetQueryObjectuiv)(GLuint, GLenum, GLuint *);
|
||||||
void (GLAPIENTRY *GetQueryObjectui64v)(GLuint, GLenum, GLuint64 *);
|
void(GLAPIENTRY *GetQueryObjectui64v)(GLuint, GLenum, GLuint64 *);
|
||||||
|
|
||||||
void (GLAPIENTRY *VDPAUInitNV)(const GLvoid *, const GLvoid *);
|
void(GLAPIENTRY *VDPAUInitNV)(const GLvoid *, const GLvoid *);
|
||||||
void (GLAPIENTRY *VDPAUFiniNV)(void);
|
void(GLAPIENTRY *VDPAUFiniNV)(void);
|
||||||
GLvdpauSurfaceNV (GLAPIENTRY *VDPAURegisterOutputSurfaceNV)
|
GLvdpauSurfaceNV(GLAPIENTRY *VDPAURegisterOutputSurfaceNV)(GLvoid *, GLenum, GLsizei, const GLuint *);
|
||||||
(GLvoid *, GLenum, GLsizei, const GLuint *);
|
GLvdpauSurfaceNV(GLAPIENTRY *VDPAURegisterVideoSurfaceNV)(GLvoid *, GLenum, GLsizei, const GLuint *);
|
||||||
GLvdpauSurfaceNV (GLAPIENTRY *VDPAURegisterVideoSurfaceNV)
|
void(GLAPIENTRY *VDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV);
|
||||||
(GLvoid *, GLenum, GLsizei, const GLuint *);
|
void(GLAPIENTRY *VDPAUSurfaceAccessNV)(GLvdpauSurfaceNV, GLenum);
|
||||||
void (GLAPIENTRY *VDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV);
|
void(GLAPIENTRY *VDPAUMapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
||||||
void (GLAPIENTRY *VDPAUSurfaceAccessNV)(GLvdpauSurfaceNV, GLenum);
|
void(GLAPIENTRY *VDPAUUnmapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
||||||
void (GLAPIENTRY *VDPAUMapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
|
||||||
void (GLAPIENTRY *VDPAUUnmapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
|
||||||
|
|
||||||
#if HAVE_GL_WIN32
|
#if HAVE_GL_WIN32
|
||||||
// The HANDLE type might not be present on non-Win32
|
// The HANDLE type might not be present on non-Win32
|
||||||
BOOL (GLAPIENTRY *DXSetResourceShareHandleNV)(void *dxObject,
|
BOOL(GLAPIENTRY *DXSetResourceShareHandleNV)
|
||||||
HANDLE shareHandle);
|
(void *dxObject, HANDLE shareHandle);
|
||||||
HANDLE (GLAPIENTRY *DXOpenDeviceNV)(void *dxDevice);
|
HANDLE(GLAPIENTRY *DXOpenDeviceNV)(void *dxDevice);
|
||||||
BOOL (GLAPIENTRY *DXCloseDeviceNV)(HANDLE hDevice);
|
BOOL(GLAPIENTRY *DXCloseDeviceNV)(HANDLE hDevice);
|
||||||
HANDLE (GLAPIENTRY *DXRegisterObjectNV)(HANDLE hDevice, void *dxObject,
|
HANDLE(GLAPIENTRY *DXRegisterObjectNV)
|
||||||
GLuint name, GLenum type, GLenum access);
|
(HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||||
BOOL (GLAPIENTRY *DXUnregisterObjectNV)(HANDLE hDevice, HANDLE hObject);
|
BOOL(GLAPIENTRY *DXUnregisterObjectNV)(HANDLE hDevice, HANDLE hObject);
|
||||||
BOOL (GLAPIENTRY *DXLockObjectsNV)(HANDLE hDevice, GLint count,
|
BOOL(GLAPIENTRY *DXLockObjectsNV)
|
||||||
HANDLE *hObjects);
|
(HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||||
BOOL (GLAPIENTRY *DXUnlockObjectsNV)(HANDLE hDevice, GLint count,
|
BOOL(GLAPIENTRY *DXUnlockObjectsNV)
|
||||||
HANDLE *hObjects);
|
(HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLint (GLAPIENTRY *GetVideoSync)(GLuint *);
|
GLint(GLAPIENTRY *GetVideoSync)(GLuint *);
|
||||||
GLint (GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);
|
GLint(GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);
|
||||||
|
|
||||||
void (GLAPIENTRY *GetTranslatedShaderSourceANGLE)(GLuint, GLsizei,
|
void(GLAPIENTRY *GetTranslatedShaderSourceANGLE)(GLuint, GLsizei, GLsizei *, GLchar *source);
|
||||||
GLsizei*, GLchar* source);
|
|
||||||
|
|
||||||
void (GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback,
|
void(GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback, const void *userParam);
|
||||||
const void *userParam);
|
|
||||||
|
|
||||||
void *(GLAPIENTRY *MPGetNativeDisplay)(const char *name);
|
void *(GLAPIENTRY *MPGetNativeDisplay)(const char *name);
|
||||||
};
|
};
|
||||||
|
4
config.h
4
config.h
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of libplacebo.
|
* This file is part of libplacebo.
|
||||||
*
|
*
|
||||||
@ -8,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
* libplacebo is distributed in the hope that it will be useful,
|
* libplacebo is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
@ -39,5 +40,4 @@
|
|||||||
#define PL_HAVE_SHADERC 0
|
#define PL_HAVE_SHADERC 0
|
||||||
#define PL_HAVE_VULKAN 1
|
#define PL_HAVE_VULKAN 1
|
||||||
|
|
||||||
|
|
||||||
#endif // LIBPLACEBO_CONTEXT_H_
|
#endif // LIBPLACEBO_CONTEXT_H_
|
||||||
|
54
drirc
Normal file
54
drirc
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<driconf>
|
||||||
|
<device screen="0" driver="i965">
|
||||||
|
<application name="Default">
|
||||||
|
<option name="always_flush_cache" value="false" />
|
||||||
|
<option name="mesa_no_error" value="false" />
|
||||||
|
<option name="precise_trig" value="false" />
|
||||||
|
<option name="mesa_glthread" value="false" />
|
||||||
|
<option name="disable_glsl_line_continuations" value="false" />
|
||||||
|
<option name="disable_blend_func_extended" value="false" />
|
||||||
|
<option name="shader_precompile" value="true" />
|
||||||
|
<option name="clamp_max_samples" value="-1" />
|
||||||
|
<option name="allow_glsl_extension_directive_midshader" value="false" />
|
||||||
|
<option name="allow_rgb10_configs" value="true" />
|
||||||
|
<option name="allow_glsl_cross_stage_interpolation_mismatch" value="false" />
|
||||||
|
<option name="force_glsl_abs_sqrt" value="false" />
|
||||||
|
<option name="dual_color_blend_by_location" value="false" />
|
||||||
|
<option name="bo_reuse" value="1" />
|
||||||
|
<option name="always_flush_batch" value="false" />
|
||||||
|
<option name="allow_rgb565_configs" value="true" />
|
||||||
|
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
|
||||||
|
<option name="force_glsl_extensions_warn" value="false" />
|
||||||
|
<option name="disable_throttling" value="false" />
|
||||||
|
<option name="force_glsl_version" value="330" />
|
||||||
|
<option name="glsl_zero_init" value="false" />
|
||||||
|
<option name="allow_higher_compat_version" value="true" />
|
||||||
|
</application>
|
||||||
|
</device>
|
||||||
|
<device screen="0" driver="radeonsi">
|
||||||
|
<application name="Default">
|
||||||
|
<option name="always_flush_cache" value="false" />
|
||||||
|
<option name="mesa_no_error" value="false" />
|
||||||
|
<option name="precise_trig" value="false" />
|
||||||
|
<option name="mesa_glthread" value="false" />
|
||||||
|
<option name="disable_glsl_line_continuations" value="false" />
|
||||||
|
<option name="disable_blend_func_extended" value="false" />
|
||||||
|
<option name="shader_precompile" value="true" />
|
||||||
|
<option name="clamp_max_samples" value="-1" />
|
||||||
|
<option name="allow_glsl_extension_directive_midshader" value="false" />
|
||||||
|
<option name="allow_rgb10_configs" value="true" />
|
||||||
|
<option name="allow_glsl_cross_stage_interpolation_mismatch" value="false" />
|
||||||
|
<option name="force_glsl_abs_sqrt" value="false" />
|
||||||
|
<option name="dual_color_blend_by_location" value="false" />
|
||||||
|
<option name="bo_reuse" value="1" />
|
||||||
|
<option name="always_flush_batch" value="false" />
|
||||||
|
<option name="allow_rgb565_configs" value="true" />
|
||||||
|
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
|
||||||
|
<option name="force_glsl_extensions_warn" value="false" />
|
||||||
|
<option name="disable_throttling" value="false" />
|
||||||
|
<option name="force_glsl_version" value="330" />
|
||||||
|
<option name="glsl_zero_init" value="false" />
|
||||||
|
<option name="allow_higher_compat_version" value="true" />
|
||||||
|
</application>
|
||||||
|
</device>
|
||||||
|
</driconf>
|
646
drm.c
Normal file
646
drm.c
Normal file
@ -0,0 +1,646 @@
|
|||||||
|
#include <drm_fourcc.h>
|
||||||
|
#include <gbm.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
|
#define DRM_DEBUG
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// DRM
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct _Drm_Render_ {
|
||||||
|
int fd_drm;
|
||||||
|
drmModeModeInfo mode;
|
||||||
|
drmModeCrtc *saved_crtc;
|
||||||
|
// drmEventContext ev;
|
||||||
|
int bpp;
|
||||||
|
uint32_t connector_id, crtc_id, video_plane;
|
||||||
|
uint32_t hdr_metadata;
|
||||||
|
uint32_t mmWidth, mmHeight; // Size in mm
|
||||||
|
uint32_t hdr_blob_id;
|
||||||
|
};
|
||||||
|
typedef struct _Drm_Render_ VideoRender;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct gbm_device *dev;
|
||||||
|
struct gbm_surface *surface;
|
||||||
|
} gbm;
|
||||||
|
|
||||||
|
VideoRender *render;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Helper functions
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
#ifndef ARRAY_SIZE
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
#endif
|
||||||
|
struct type_name {
|
||||||
|
unsigned int type;
|
||||||
|
const char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *util_lookup_type_name(unsigned int type, const struct type_name *table, unsigned int count) {
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (table[i].type == type)
|
||||||
|
return table[i].name;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct type_name connector_type_names[] = {
|
||||||
|
{DRM_MODE_CONNECTOR_Unknown, "unknown"},
|
||||||
|
{DRM_MODE_CONNECTOR_VGA, "VGA"},
|
||||||
|
{DRM_MODE_CONNECTOR_DVII, "DVI-I"},
|
||||||
|
{DRM_MODE_CONNECTOR_DVID, "DVI-D"},
|
||||||
|
{DRM_MODE_CONNECTOR_DVIA, "DVI-A"},
|
||||||
|
{DRM_MODE_CONNECTOR_Composite, "composite"},
|
||||||
|
{DRM_MODE_CONNECTOR_SVIDEO, "s-video"},
|
||||||
|
{DRM_MODE_CONNECTOR_LVDS, "LVDS"},
|
||||||
|
{DRM_MODE_CONNECTOR_Component, "component"},
|
||||||
|
{DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN"},
|
||||||
|
{DRM_MODE_CONNECTOR_DisplayPort, "DP"},
|
||||||
|
{DRM_MODE_CONNECTOR_HDMIA, "HDMI-A"},
|
||||||
|
{DRM_MODE_CONNECTOR_HDMIB, "HDMI-B"},
|
||||||
|
{DRM_MODE_CONNECTOR_TV, "TV"},
|
||||||
|
{DRM_MODE_CONNECTOR_eDP, "eDP"},
|
||||||
|
{DRM_MODE_CONNECTOR_VIRTUAL, "Virtual"},
|
||||||
|
{DRM_MODE_CONNECTOR_DSI, "DSI"},
|
||||||
|
{DRM_MODE_CONNECTOR_DPI, "DPI"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *util_lookup_connector_type_name(unsigned int type) {
|
||||||
|
return util_lookup_type_name(type, connector_type_names, ARRAY_SIZE(connector_type_names));
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t GetPropertyValue(int fd_drm, uint32_t objectID, uint32_t objectType, const char *propName) {
|
||||||
|
uint32_t i;
|
||||||
|
int found = 0;
|
||||||
|
uint64_t value = 0;
|
||||||
|
drmModePropertyPtr Prop;
|
||||||
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
|
|
||||||
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
|
fprintf(stderr, "GetPropertyValue: Unable to query property.\n");
|
||||||
|
|
||||||
|
if (strcmp(propName, Prop->name) == 0) {
|
||||||
|
value = objectProps->prop_values[i];
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeFreeProperty(Prop);
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeFreeObjectProperties(objectProps);
|
||||||
|
|
||||||
|
#ifdef DRM_DEBUG
|
||||||
|
if (!found)
|
||||||
|
fprintf(stderr, "GetPropertyValue: Unable to find value for property \'%s\'.\n", propName);
|
||||||
|
#endif
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
static uint32_t GetPropertyID(int fd_drm, uint32_t objectID, uint32_t objectType, const char *propName) {
|
||||||
|
uint32_t i;
|
||||||
|
int found = 0;
|
||||||
|
uint32_t value = -1;
|
||||||
|
drmModePropertyPtr Prop;
|
||||||
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
|
|
||||||
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
|
fprintf(stderr, "GetPropertyValue: Unable to query property.\n");
|
||||||
|
|
||||||
|
if (strcmp(propName, Prop->name) == 0) {
|
||||||
|
value = objectProps->props[i];
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
drmModeFreeProperty(Prop);
|
||||||
|
if (found)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
drmModeFreeObjectProperties(objectProps);
|
||||||
|
|
||||||
|
#ifdef DRM_DEBUG
|
||||||
|
if (!found)
|
||||||
|
Debug(3, "GetPropertyValue: Unable to find ID for property \'%s\'.\n", propName);
|
||||||
|
#endif
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SetPropertyRequest(drmModeAtomicReqPtr ModeReq, int fd_drm, uint32_t objectID, uint32_t objectType,
|
||||||
|
const char *propName, uint64_t value) {
|
||||||
|
uint32_t i;
|
||||||
|
uint64_t id = 0;
|
||||||
|
drmModePropertyPtr Prop;
|
||||||
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
|
|
||||||
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
|
printf("SetPropertyRequest: Unable to query property.\n");
|
||||||
|
|
||||||
|
if (strcmp(propName, Prop->name) == 0) {
|
||||||
|
id = Prop->prop_id;
|
||||||
|
drmModeFreeProperty(Prop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeFreeProperty(Prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeFreeObjectProperties(objectProps);
|
||||||
|
|
||||||
|
if (id == 0)
|
||||||
|
printf("SetPropertyRequest: Unable to find value for property \'%s\'.\n", propName);
|
||||||
|
|
||||||
|
return drmModeAtomicAddProperty(ModeReq, objectID, id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CuvidSetVideoMode(void);
|
||||||
|
void set_video_mode(int width, int height) {
|
||||||
|
drmModeConnector *connector;
|
||||||
|
drmModeModeInfo *mode;
|
||||||
|
int ii;
|
||||||
|
printf("Set video mode %d &%d\n",width,height);
|
||||||
|
if (height != 1080 && height != 2160)
|
||||||
|
return;
|
||||||
|
connector = drmModeGetConnector(render->fd_drm, render->connector_id);
|
||||||
|
for (ii = 0; ii < connector->count_modes; ii++) {
|
||||||
|
mode = &connector->modes[ii];
|
||||||
|
printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
|
if (width == mode->hdisplay && height == mode->vdisplay && mode->vrefresh == DRMRefresh &&
|
||||||
|
render->mode.hdisplay != width && render->mode.vdisplay != height &&
|
||||||
|
!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
|
VideoWindowWidth = mode->hdisplay;
|
||||||
|
VideoWindowHeight = mode->vdisplay;
|
||||||
|
eglDestroySurface(eglDisplay, eglSurface);
|
||||||
|
EglCheck();
|
||||||
|
gbm_surface_destroy(gbm.surface);
|
||||||
|
InitBo(render->bpp);
|
||||||
|
CuvidSetVideoMode();
|
||||||
|
Debug(3, "Set new mode %d:%d\n", mode->hdisplay, mode->vdisplay);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FindDevice(VideoRender *render) {
|
||||||
|
drmVersion *version;
|
||||||
|
drmModeRes *resources;
|
||||||
|
drmModeConnector *connector;
|
||||||
|
drmModeEncoder *encoder = 0;
|
||||||
|
drmModeModeInfo *mode;
|
||||||
|
drmModePlane *plane;
|
||||||
|
drmModePlaneRes *plane_res;
|
||||||
|
drmModeObjectPropertiesPtr props;
|
||||||
|
uint32_t j, k;
|
||||||
|
uint64_t has_dumb;
|
||||||
|
uint64_t has_prime;
|
||||||
|
int i, ii = 0;
|
||||||
|
char connectorstr[10];
|
||||||
|
int found = 0;
|
||||||
|
render->fd_drm = open("/dev/dri/card0", O_RDWR);
|
||||||
|
if (render->fd_drm < 0) {
|
||||||
|
render->fd_drm = open("/dev/dri/card1", O_RDWR);
|
||||||
|
if (render->fd_drm < 0) {
|
||||||
|
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0 or card1: %m\n");
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = drmSetMaster(render->fd_drm);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
drm_magic_t magic;
|
||||||
|
|
||||||
|
ret = drmGetMagic(render->fd_drm, &magic);
|
||||||
|
if (ret < 0) {
|
||||||
|
Debug(3, "drm:%s - failed to get drm magic: %s\n", __FUNCTION__, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = drmAuthMagic(render->fd_drm, magic);
|
||||||
|
if (ret < 0) {
|
||||||
|
Debug(3, "drm:%s - failed to authorize drm magic: %s\n", __FUNCTION__, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
version = drmGetVersion(render->fd_drm);
|
||||||
|
fprintf(stderr, "FindDevice: open /dev/dri/card0: %s\n", version->name);
|
||||||
|
|
||||||
|
// check capability
|
||||||
|
if (drmGetCap(render->fd_drm, DRM_CAP_DUMB_BUFFER, &has_dumb) < 0 || has_dumb == 0)
|
||||||
|
fprintf(stderr, "FindDevice: drmGetCap DRM_CAP_DUMB_BUFFER failed or doesn't have dumb buffer\n");
|
||||||
|
|
||||||
|
if (drmSetClientCap(render->fd_drm, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) != 0)
|
||||||
|
fprintf(stderr, "FindDevice: DRM_CLIENT_CAP_UNIVERSAL_PLANES not available.\n");
|
||||||
|
|
||||||
|
if (drmSetClientCap(render->fd_drm, DRM_CLIENT_CAP_ATOMIC, 1) != 0)
|
||||||
|
fprintf(stderr, "FindDevice: DRM_CLIENT_CAP_ATOMIC not available.\n");
|
||||||
|
|
||||||
|
if (drmGetCap(render->fd_drm, DRM_CAP_PRIME, &has_prime) < 0)
|
||||||
|
fprintf(stderr, "FindDevice: DRM_CAP_PRIME not available.\n");
|
||||||
|
|
||||||
|
if (drmGetCap(render->fd_drm, DRM_PRIME_CAP_EXPORT, &has_prime) < 0)
|
||||||
|
fprintf(stderr, "FindDevice: DRM_PRIME_CAP_EXPORT not available.\n");
|
||||||
|
|
||||||
|
if (drmGetCap(render->fd_drm, DRM_PRIME_CAP_IMPORT, &has_prime) < 0)
|
||||||
|
fprintf(stderr, "FindDevice: DRM_PRIME_CAP_IMPORT not available.\n");
|
||||||
|
|
||||||
|
if ((resources = drmModeGetResources(render->fd_drm)) == NULL) {
|
||||||
|
fprintf(stderr, "FindDevice: cannot retrieve DRM resources (%d): %m\n", errno);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
Debug(3, "[FindDevice] DRM have %i connectors, %i crtcs, %i encoders\n", resources->count_connectors,
|
||||||
|
resources->count_crtcs, resources->count_encoders);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// find all available connectors
|
||||||
|
for (i = 0; i < resources->count_connectors; i++) {
|
||||||
|
connector = drmModeGetConnector(render->fd_drm, resources->connectors[i]);
|
||||||
|
if (!connector) {
|
||||||
|
fprintf(stderr, "FindDevice: cannot retrieve DRM connector (%d): %m\n", errno);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(connectorstr, "%s-%u", util_lookup_connector_type_name(connector->connector_type),
|
||||||
|
connector->connector_type_id);
|
||||||
|
printf("Connector >%s< is %sconnected\n", connectorstr,
|
||||||
|
connector->connection == DRM_MODE_CONNECTED ? "" : "not ");
|
||||||
|
Debug(3,"Connector >%s< is %sconnected\n", connectorstr,
|
||||||
|
connector->connection == DRM_MODE_CONNECTED ? "" : "not ");
|
||||||
|
if (DRMConnector && strcmp(DRMConnector, connectorstr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (/*connector->connection == DRM_MODE_CONNECTED && */ connector->count_modes > 0) {
|
||||||
|
float aspect = (float)connector->mmWidth / (float)connector->mmHeight;
|
||||||
|
if ((aspect > 1.70) && (aspect < 1.85)) {
|
||||||
|
render->mmHeight = 90;
|
||||||
|
render->mmWidth = 160;
|
||||||
|
} else {
|
||||||
|
render->mmHeight = connector->mmHeight;
|
||||||
|
render->mmWidth = connector->mmWidth;
|
||||||
|
}
|
||||||
|
render->connector_id = connector->connector_id;
|
||||||
|
// FIXME: use default encoder/crtc pair
|
||||||
|
if ((encoder = drmModeGetEncoder(render->fd_drm, connector->encoder_id)) == NULL) {
|
||||||
|
fprintf(stderr, "FindDevice: cannot retrieve encoder (%d): %m\n", errno);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
render->crtc_id = encoder->crtc_id;
|
||||||
|
|
||||||
|
render->hdr_metadata = GetPropertyID(render->fd_drm, connector->connector_id, DRM_MODE_OBJECT_CONNECTOR,
|
||||||
|
"HDR_OUTPUT_METADATA");
|
||||||
|
printf("ID %d of METADATA in Connector %d connected %d\n", render->hdr_metadata, connector->connector_id,
|
||||||
|
connector->connection);
|
||||||
|
|
||||||
|
memcpy(&render->mode, &connector->modes[0], sizeof(drmModeModeInfo)); // set fallback
|
||||||
|
// search Modes for Connector
|
||||||
|
for (ii = 0; ii < connector->count_modes; ii++) {
|
||||||
|
mode = &connector->modes[ii];
|
||||||
|
|
||||||
|
printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
|
Debug(3,"Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
|
if (VideoWindowWidth && VideoWindowHeight) { // preset by command line
|
||||||
|
if (VideoWindowWidth == mode->hdisplay && VideoWindowHeight == mode->vdisplay &&
|
||||||
|
mode->vrefresh == DRMRefresh && !(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
|
VideoWindowWidth = mode->hdisplay;
|
||||||
|
VideoWindowHeight = mode->vdisplay;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found = 1;
|
||||||
|
i = resources->count_connectors; // uuuuhh
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
VideoWindowWidth = render->mode.hdisplay;
|
||||||
|
VideoWindowHeight = render->mode.vdisplay;
|
||||||
|
|
||||||
|
printf("Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay,
|
||||||
|
render->mode.vrefresh);
|
||||||
|
Debug(3,"Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay,
|
||||||
|
render->mode.vrefresh);
|
||||||
|
}
|
||||||
|
drmModeFreeConnector(connector);
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
Debug(3, "Requested Connector not found or not connected\n");
|
||||||
|
printf("Requested Connector not found or not connected\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find first plane
|
||||||
|
if ((plane_res = drmModeGetPlaneResources(render->fd_drm)) == NULL)
|
||||||
|
fprintf(stderr, "FindDevice: cannot retrieve PlaneResources (%d): %m\n", errno);
|
||||||
|
|
||||||
|
for (j = 0; j < plane_res->count_planes; j++) {
|
||||||
|
plane = drmModeGetPlane(render->fd_drm, plane_res->planes[j]);
|
||||||
|
|
||||||
|
if (plane == NULL)
|
||||||
|
fprintf(stderr, "FindDevice: cannot query DRM-KMS plane %d\n", j);
|
||||||
|
|
||||||
|
for (i = 0; i < resources->count_crtcs; i++) {
|
||||||
|
if (plane->possible_crtcs & (1 << i))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t type = GetPropertyValue(render->fd_drm, plane_res->planes[j], DRM_MODE_OBJECT_PLANE, "type");
|
||||||
|
uint64_t zpos = 0;
|
||||||
|
|
||||||
|
#ifdef DRM_DEBUG // If more then 2 crtcs this must rewriten!!!
|
||||||
|
printf("[FindDevice] Plane id %i crtc_id %i possible_crtcs %i possible CRTC %i type %s\n", plane->plane_id,
|
||||||
|
plane->crtc_id, plane->possible_crtcs, resources->crtcs[i],
|
||||||
|
(type == DRM_PLANE_TYPE_PRIMARY) ? "primary plane"
|
||||||
|
: (type == DRM_PLANE_TYPE_OVERLAY) ? "overlay plane"
|
||||||
|
: (type == DRM_PLANE_TYPE_CURSOR) ? "cursor plane"
|
||||||
|
: "No plane type");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// test pixel format and plane caps
|
||||||
|
for (k = 0; k < plane->count_formats; k++) {
|
||||||
|
if (encoder->possible_crtcs & plane->possible_crtcs) {
|
||||||
|
switch (plane->formats[k]) {
|
||||||
|
case DRM_FORMAT_XRGB2101010:
|
||||||
|
if (!render->video_plane) {
|
||||||
|
render->video_plane = plane->plane_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drmModeFreePlane(plane);
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeFreePlaneResources(plane_res);
|
||||||
|
|
||||||
|
drmModeFreeEncoder(encoder);
|
||||||
|
drmModeFreeResources(resources);
|
||||||
|
|
||||||
|
#ifdef DRM_DEBUG
|
||||||
|
printf("[FindDevice] DRM setup CRTC: %i video_plane: %i \n", render->crtc_id, render->video_plane);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// save actual modesetting
|
||||||
|
render->saved_crtc = drmModeGetCrtc(render->fd_drm, render->crtc_id);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Initialize video output module.
|
||||||
|
///
|
||||||
|
void VideoInitDrm() {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!(render = calloc(1, sizeof(*render)))) {
|
||||||
|
Fatal(_("video/DRM: out of memory\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindDevice(render)) {
|
||||||
|
Fatal(_("VideoInit: FindDevice() failed\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
gbm.dev = gbm_create_device(render->fd_drm);
|
||||||
|
assert(gbm.dev != NULL);
|
||||||
|
|
||||||
|
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
|
||||||
|
|
||||||
|
get_platform_display = (void *)eglGetProcAddress("eglGetPlatformDisplayEXT");
|
||||||
|
assert(get_platform_display != NULL);
|
||||||
|
|
||||||
|
eglDisplay = get_platform_display(EGL_PLATFORM_GBM_KHR, gbm.dev, NULL);
|
||||||
|
|
||||||
|
EglCheck();
|
||||||
|
|
||||||
|
assert(eglDisplay != NULL);
|
||||||
|
// return;
|
||||||
|
|
||||||
|
drmModeAtomicReqPtr ModeReq;
|
||||||
|
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
|
uint32_t modeID = 0;
|
||||||
|
|
||||||
|
if (drmModeCreatePropertyBlob(render->fd_drm, &render->mode, sizeof(render->mode), &modeID) != 0) {
|
||||||
|
fprintf(stderr, "Failed to create mode property.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(ModeReq = drmModeAtomicAlloc())) {
|
||||||
|
fprintf(stderr, "cannot allocate atomic request (%d): %m\n", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("set CRTC %d of Connector %d aktiv\n", render->crtc_id, render->connector_id);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
|
render->crtc_id);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
|
|
||||||
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
|
if (drmModeDestroyPropertyBlob(render->fd_drm, modeID) != 0)
|
||||||
|
fprintf(stderr, "cannot destroy property blob (%d): %m\n", errno);
|
||||||
|
|
||||||
|
drmModeAtomicFree(ModeReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_drm_aspect(int *num, int *den) {
|
||||||
|
*num = VideoWindowWidth;
|
||||||
|
*den = VideoWindowHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct gbm_bo *bo = NULL, *next_bo = NULL;
|
||||||
|
struct drm_fb *fb;
|
||||||
|
static int m_need_modeset = 0;
|
||||||
|
static int old_color = -1, old_trc = -1;
|
||||||
|
|
||||||
|
void InitBo(int bpp) {
|
||||||
|
// create the GBM and EGL surface
|
||||||
|
|
||||||
|
render->bpp = bpp;
|
||||||
|
gbm.surface = gbm_surface_create(gbm.dev, VideoWindowWidth, VideoWindowHeight,
|
||||||
|
bpp == 10 ? GBM_FORMAT_XRGB2101010 : GBM_FORMAT_ARGB8888,
|
||||||
|
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||||
|
assert(gbm.surface != NULL);
|
||||||
|
eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, gbm.surface, NULL);
|
||||||
|
assert(eglSurface != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct gbm_bo *previous_bo = NULL;
|
||||||
|
static uint32_t previous_fb;
|
||||||
|
static int has_modeset = 0;
|
||||||
|
|
||||||
|
static void drm_swap_buffers() {
|
||||||
|
|
||||||
|
uint32_t fb;
|
||||||
|
|
||||||
|
eglSwapBuffers(eglDisplay, eglSurface);
|
||||||
|
usleep(1000);
|
||||||
|
struct gbm_bo *bo = gbm_surface_lock_front_buffer(gbm.surface);
|
||||||
|
#if 1
|
||||||
|
if (bo == NULL)
|
||||||
|
bo = gbm_surface_lock_front_buffer(gbm.surface);
|
||||||
|
#endif
|
||||||
|
assert(bo != NULL);
|
||||||
|
uint32_t handle = gbm_bo_get_handle(bo).u32;
|
||||||
|
uint32_t pitch = gbm_bo_get_stride(bo);
|
||||||
|
|
||||||
|
drmModeAddFB(render->fd_drm, VideoWindowWidth, VideoWindowHeight, render->bpp == 10 ? 30 : 24, 32, pitch, handle,
|
||||||
|
&fb);
|
||||||
|
// drmModeSetCrtc (render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
||||||
|
|
||||||
|
if (m_need_modeset) {
|
||||||
|
drmModeAtomicReqPtr ModeReq;
|
||||||
|
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
|
uint32_t modeID = 0;
|
||||||
|
|
||||||
|
if (drmModeCreatePropertyBlob(render->fd_drm, &render->mode, sizeof(render->mode), &modeID) != 0) {
|
||||||
|
fprintf(stderr, "Failed to create mode property.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(ModeReq = drmModeAtomicAlloc())) {
|
||||||
|
fprintf(stderr, "cannot allocate atomic request (%d): %m\n", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to disable the CRTC in order to submit the HDR data....
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
||||||
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "Colorspace",
|
||||||
|
old_color == AVCOL_PRI_BT2020 ? 9 : 2);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING",
|
||||||
|
old_color == AVCOL_PRI_BT2020 ? 2 : 1);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_RANGE", 0);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
|
render->crtc_id);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
|
|
||||||
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
|
fprintf(stderr, "cannot set atomic mode modeset 2 (%d): %m\n", errno);
|
||||||
|
|
||||||
|
if (drmModeDestroyPropertyBlob(render->fd_drm, modeID) != 0)
|
||||||
|
fprintf(stderr, "cannot destroy prperty blob (%d): %m\n", errno);
|
||||||
|
|
||||||
|
drmModeAtomicFree(ModeReq);
|
||||||
|
m_need_modeset = 0;
|
||||||
|
has_modeset = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
||||||
|
|
||||||
|
if (previous_bo) {
|
||||||
|
drmModeRmFB(render->fd_drm, previous_fb);
|
||||||
|
gbm_surface_release_buffer(gbm.surface, previous_bo);
|
||||||
|
}
|
||||||
|
previous_bo = bo;
|
||||||
|
previous_fb = fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drm_clean_up() {
|
||||||
|
// set the previous crtc
|
||||||
|
|
||||||
|
if (!render)
|
||||||
|
return;
|
||||||
|
Debug(3, "drm clean up\n");
|
||||||
|
|
||||||
|
|
||||||
|
drmModeSetCrtc(render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id, render->saved_crtc->x,
|
||||||
|
render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
|
||||||
|
drmModeFreeCrtc(render->saved_crtc);
|
||||||
|
|
||||||
|
if (previous_bo) {
|
||||||
|
drmModeRmFB(render->fd_drm, previous_fb);
|
||||||
|
gbm_surface_release_buffer(gbm.surface, previous_bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_modeset) {
|
||||||
|
drmModeAtomicReqPtr ModeReq;
|
||||||
|
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
|
uint32_t modeID = 0;
|
||||||
|
|
||||||
|
if (drmModeCreatePropertyBlob(render->fd_drm, &render->mode, sizeof(render->mode), &modeID) != 0) {
|
||||||
|
fprintf(stderr, "Failed to create mode property.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(ModeReq = drmModeAtomicAlloc())) {
|
||||||
|
fprintf(stderr, "cannot allocate atomic request (%d): %m\n", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to disable the CRTC in order to submit the HDR data....
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
||||||
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR,
|
||||||
|
"HDR_OUTPUT_METADATA", 0);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "Colorspace", 2);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING", 1);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_RANGE", 1);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
|
render->crtc_id);
|
||||||
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
|
|
||||||
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
|
if (drmModeDestroyPropertyBlob(render->fd_drm, modeID) != 0)
|
||||||
|
fprintf(stderr, "cannot destroy prperty blob (%d): %m\n", errno);
|
||||||
|
|
||||||
|
drmModeAtomicFree(ModeReq);
|
||||||
|
has_modeset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (render->hdr_blob_id)
|
||||||
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
|
render->hdr_blob_id = 0;
|
||||||
|
#if 0
|
||||||
|
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroySurface(eglDisplay, eglSurface);
|
||||||
|
EglCheck();
|
||||||
|
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||||
|
EglCheck();
|
||||||
|
eglDestroyContext(eglDisplay, eglContext);
|
||||||
|
EglCheck();
|
||||||
|
eglSharedContext = NULL;
|
||||||
|
eglContext = NULL;
|
||||||
|
eglTerminate(eglDisplay);
|
||||||
|
EglCheck();
|
||||||
|
eglDisplay = NULL;
|
||||||
|
#endif
|
||||||
|
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroySurface(eglDisplay, eglSurface);
|
||||||
|
EglCheck();
|
||||||
|
eglSurface = NULL;
|
||||||
|
gbm_surface_destroy(gbm.surface);
|
||||||
|
gbm_device_destroy(gbm.dev);
|
||||||
|
drmDropMaster(render->fd_drm);
|
||||||
|
close(render->fd_drm);
|
||||||
|
free(render);
|
||||||
|
render = NULL;
|
||||||
|
Debug(3, "nach drm clean up\n");
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
|
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -13,91 +14,91 @@
|
|||||||
#define _DRVAPI_ERROR_STRING_H_
|
#define _DRVAPI_ERROR_STRING_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#ifdef __cuda_cuda_h__ // check to see if CUDA_H is included above
|
|
||||||
|
|
||||||
// Error Code string definitions here
|
// Error Code string definitions here
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
char const *error_string;
|
char const *error_string;
|
||||||
unsigned int error_id;
|
unsigned int error_id;
|
||||||
} s_CudaErrorStr;
|
} s_CudaErrorStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error codes
|
* Error codes
|
||||||
*/
|
*/
|
||||||
s_CudaErrorStr sCudaDrvErrorString[] =
|
s_CudaErrorStr sCudaDrvErrorString[] = {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* The API call returned with no errors. In the case of query calls, this
|
* The API call returned with no errors. In the case of query calls, this
|
||||||
* can also mean that the operation being queried is complete (see
|
* can also mean that the operation being queried is complete (see
|
||||||
* ::cuEventQuery() and ::cuStreamQuery()).
|
* ::cuEventQuery() and ::cuStreamQuery()).
|
||||||
*/
|
*/
|
||||||
{ "CUDA_SUCCESS", 0 },
|
{"CUDA_SUCCESS", 0},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that one or more of the parameters passed to the API call
|
* This indicates that one or more of the parameters passed to the API call
|
||||||
* is not within an acceptable range of values.
|
* is not within an acceptable range of values.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_VALUE", 1 },
|
{"CUDA_ERROR_INVALID_VALUE", 1},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The API call failed because it was unable to allocate enough memory to
|
* The API call failed because it was unable to allocate enough memory to
|
||||||
* perform the requested operation.
|
* perform the requested operation.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_OUT_OF_MEMORY", 2 },
|
{"CUDA_ERROR_OUT_OF_MEMORY", 2},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the CUDA driver has not been initialized with
|
* This indicates that the CUDA driver has not been initialized with
|
||||||
* ::cuInit() or that initialization has failed.
|
* ::cuInit() or that initialization has failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_INITIALIZED", 3 },
|
{"CUDA_ERROR_NOT_INITIALIZED", 3},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the CUDA driver is in the process of shutting down.
|
* This indicates that the CUDA driver is in the process of shutting down.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_DEINITIALIZED", 4 },
|
{"CUDA_ERROR_DEINITIALIZED", 4},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiling APIs are called while application is running
|
* This indicates profiling APIs are called while application is running
|
||||||
* in visual profiler mode.
|
* in visual profiler mode.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PROFILER_DISABLED", 5 },
|
{"CUDA_ERROR_PROFILER_DISABLED", 5},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiling has not been initialized for this context.
|
* This indicates profiling has not been initialized for this context.
|
||||||
* Call cuProfilerInitialize() to resolve this.
|
* Call cuProfilerInitialize() to resolve this.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PROFILER_NOT_INITIALIZED", 6 },
|
{"CUDA_ERROR_PROFILER_NOT_INITIALIZED", 6},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiler has already been started and probably
|
* This indicates profiler has already been started and probably
|
||||||
* cuProfilerStart() is incorrectly called.
|
* cuProfilerStart() is incorrectly called.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PROFILER_ALREADY_STARTED", 7 },
|
{"CUDA_ERROR_PROFILER_ALREADY_STARTED", 7},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiler has already been stopped and probably
|
* This indicates profiler has already been stopped and probably
|
||||||
* cuProfilerStop() is incorrectly called.
|
* cuProfilerStop() is incorrectly called.
|
||||||
*/
|
|
||||||
{ "CUDA_ERROR_PROFILER_ALREADY_STOPPED", 8 },
|
|
||||||
/**
|
|
||||||
* This indicates that no CUDA-capable devices were detected by the installed
|
|
||||||
* CUDA driver.
|
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100 },
|
{"CUDA_ERROR_PROFILER_ALREADY_STOPPED", 8},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This indicates that no CUDA-capable devices were detected by the
|
||||||
|
* installed CUDA driver.
|
||||||
|
*/
|
||||||
|
{"CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the device ordinal supplied by the user does not
|
* This indicates that the device ordinal supplied by the user does not
|
||||||
* correspond to a valid CUDA device.
|
* correspond to a valid CUDA device.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_DEVICE (device specified is not a valid CUDA device)", 101 },
|
{"CUDA_ERROR_INVALID_DEVICE (device specified is not a valid CUDA device)", 101},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the device kernel image is invalid. This can also
|
* This indicates that the device kernel image is invalid. This can also
|
||||||
* indicate an invalid CUDA module.
|
* indicate an invalid CUDA module.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_IMAGE", 200 },
|
{"CUDA_ERROR_INVALID_IMAGE", 200},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This most frequently indicates that there is no context bound to the
|
* This most frequently indicates that there is no context bound to the
|
||||||
@ -107,7 +108,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* mixes different API versions (i.e. 3010 context with 3020 API calls).
|
* mixes different API versions (i.e. 3010 context with 3020 API calls).
|
||||||
* See ::cuCtxGetApiVersion() for more details.
|
* See ::cuCtxGetApiVersion() for more details.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_CONTEXT", 201 },
|
{"CUDA_ERROR_INVALID_CONTEXT", 201},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicated that the context being supplied as a parameter to the
|
* This indicated that the context being supplied as a parameter to the
|
||||||
@ -116,28 +117,28 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* This error return is deprecated as of CUDA 3.2. It is no longer an
|
* This error return is deprecated as of CUDA 3.2. It is no longer an
|
||||||
* error to attempt to push the active context via ::cuCtxPushCurrent().
|
* error to attempt to push the active context via ::cuCtxPushCurrent().
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_CONTEXT_ALREADY_CURRENT", 202 },
|
{"CUDA_ERROR_CONTEXT_ALREADY_CURRENT", 202},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a map or register operation has failed.
|
* This indicates that a map or register operation has failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_MAP_FAILED", 205 },
|
{"CUDA_ERROR_MAP_FAILED", 205},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an unmap or unregister operation has failed.
|
* This indicates that an unmap or unregister operation has failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_UNMAP_FAILED", 206 },
|
{"CUDA_ERROR_UNMAP_FAILED", 206},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the specified array is currently mapped and thus
|
* This indicates that the specified array is currently mapped and thus
|
||||||
* cannot be destroyed.
|
* cannot be destroyed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ARRAY_IS_MAPPED", 207 },
|
{"CUDA_ERROR_ARRAY_IS_MAPPED", 207},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the resource is already mapped.
|
* This indicates that the resource is already mapped.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ALREADY_MAPPED", 208 },
|
{"CUDA_ERROR_ALREADY_MAPPED", 208},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that there is no kernel image available that is suitable
|
* This indicates that there is no kernel image available that is suitable
|
||||||
@ -145,133 +146,130 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* options for a particular CUDA source file that do not include the
|
* options for a particular CUDA source file that do not include the
|
||||||
* corresponding device configuration.
|
* corresponding device configuration.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NO_BINARY_FOR_GPU", 209 },
|
{"CUDA_ERROR_NO_BINARY_FOR_GPU", 209},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a resource has already been acquired.
|
* This indicates that a resource has already been acquired.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ALREADY_ACQUIRED", 210 },
|
{"CUDA_ERROR_ALREADY_ACQUIRED", 210},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a resource is not mapped.
|
* This indicates that a resource is not mapped.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_MAPPED", 211 },
|
{"CUDA_ERROR_NOT_MAPPED", 211},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a mapped resource is not available for access as an
|
* This indicates that a mapped resource is not available for access as an
|
||||||
* array.
|
* array.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_MAPPED_AS_ARRAY", 212 },
|
{"CUDA_ERROR_NOT_MAPPED_AS_ARRAY", 212},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a mapped resource is not available for access as a
|
* This indicates that a mapped resource is not available for access as a
|
||||||
* pointer.
|
* pointer.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_MAPPED_AS_POINTER", 213 },
|
{"CUDA_ERROR_NOT_MAPPED_AS_POINTER", 213},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an uncorrectable ECC error was detected during
|
* This indicates that an uncorrectable ECC error was detected during
|
||||||
* execution.
|
* execution.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ECC_UNCORRECTABLE", 214 },
|
{"CUDA_ERROR_ECC_UNCORRECTABLE", 214},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the ::CUlimit passed to the API call is not
|
* This indicates that the ::CUlimit passed to the API call is not
|
||||||
* supported by the active device.
|
* supported by the active device.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_UNSUPPORTED_LIMIT", 215 },
|
{"CUDA_ERROR_UNSUPPORTED_LIMIT", 215},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the ::CUcontext passed to the API call can
|
* This indicates that the ::CUcontext passed to the API call can
|
||||||
* only be bound to a single CPU thread at a time but is already
|
* only be bound to a single CPU thread at a time but is already
|
||||||
* bound to a CPU thread.
|
* bound to a CPU thread.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_CONTEXT_ALREADY_IN_USE", 216 },
|
{"CUDA_ERROR_CONTEXT_ALREADY_IN_USE", 216},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that peer access is not supported across the given
|
* This indicates that peer access is not supported across the given
|
||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED", 217 },
|
{"CUDA_ERROR_PEER_ACCESS_UNSUPPORTED", 217},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a PTX JIT compilation failed.
|
* This indicates that a PTX JIT compilation failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_PTX", 218 },
|
{"CUDA_ERROR_INVALID_PTX", 218},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates an error with OpenGL or DirectX context.
|
* This indicates an error with OpenGL or DirectX context.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219 },
|
{"CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an uncorrectable NVLink error was detected during the
|
* This indicates that an uncorrectable NVLink error was detected during the
|
||||||
* execution.
|
* execution.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NVLINK_UNCORRECTABLE", 220 },
|
{"CUDA_ERROR_NVLINK_UNCORRECTABLE", 220},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the PTX JIT compiler library was not found.
|
* This indicates that the PTX JIT compiler library was not found.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_JIT_COMPILER_NOT_FOUND", 221 },
|
{"CUDA_ERROR_JIT_COMPILER_NOT_FOUND", 221},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the device kernel source is invalid.
|
* This indicates that the device kernel source is invalid.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_SOURCE", 300 },
|
{"CUDA_ERROR_INVALID_SOURCE", 300},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the file specified was not found.
|
* This indicates that the file specified was not found.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_FILE_NOT_FOUND", 301 },
|
{"CUDA_ERROR_FILE_NOT_FOUND", 301},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a link to a shared object failed to resolve.
|
* This indicates that a link to a shared object failed to resolve.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND", 302 },
|
{"CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND", 302},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that initialization of a shared object failed.
|
* This indicates that initialization of a shared object failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED", 303 },
|
{"CUDA_ERROR_SHARED_OBJECT_INIT_FAILED", 303},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an OS call failed.
|
* This indicates that an OS call failed.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_OPERATING_SYSTEM", 304 },
|
{"CUDA_ERROR_OPERATING_SYSTEM", 304},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a resource handle passed to the API call was not
|
* This indicates that a resource handle passed to the API call was not
|
||||||
* valid. Resource handles are opaque types like ::CUstream and ::CUevent.
|
* valid. Resource handles are opaque types like ::CUstream and ::CUevent.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_HANDLE", 400 },
|
{"CUDA_ERROR_INVALID_HANDLE", 400},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a named symbol was not found. Examples of symbols
|
* This indicates that a named symbol was not found. Examples of symbols
|
||||||
* are global/constant variable names, texture names }, and surface names.
|
* are global/constant variable names, texture names }, and surface names.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_FOUND", 500 },
|
{"CUDA_ERROR_NOT_FOUND", 500},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that asynchronous operations issued previously have not
|
* This indicates that asynchronous operations issued previously have not
|
||||||
* completed yet. This result is not actually an error, but must be indicated
|
* completed yet. This result is not actually an error, but must be
|
||||||
* differently than ::CUDA_SUCCESS (which indicates completion). Calls that
|
* indicated differently than ::CUDA_SUCCESS (which indicates completion).
|
||||||
* may return this value include ::cuEventQuery() and ::cuStreamQuery().
|
* Calls that may return this value include ::cuEventQuery() and
|
||||||
|
* ::cuStreamQuery().
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_READY", 600 },
|
{"CUDA_ERROR_NOT_READY", 600},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a
|
* While executing a kernel, the device encountered a
|
||||||
* load or store instruction on an invalid memory address.
|
* load or store instruction on an invalid memory address.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ILLEGAL_ADDRESS", 700 },
|
{"CUDA_ERROR_ILLEGAL_ADDRESS", 700},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that a launch did not occur because it did not have
|
* This indicates that a launch did not occur because it did not have
|
||||||
@ -282,7 +280,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* when a 32-bit int is expected) is equivalent to passing too many
|
* when a 32-bit int is expected) is equivalent to passing too many
|
||||||
* arguments and can also result in this error.
|
* arguments and can also result in this error.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES", 701 },
|
{"CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES", 701},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that the device kernel took too long to execute. This can
|
* This indicates that the device kernel took too long to execute. This can
|
||||||
@ -293,40 +291,40 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* this context are invalid and must be reconstructed if the program is to
|
* this context are invalid and must be reconstructed if the program is to
|
||||||
* continue using CUDA.
|
* continue using CUDA.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_LAUNCH_TIMEOUT", 702 },
|
{"CUDA_ERROR_LAUNCH_TIMEOUT", 702},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates a kernel launch that uses an incompatible texturing
|
* This error indicates a kernel launch that uses an incompatible texturing
|
||||||
* mode.
|
* mode.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING", 703 },
|
{"CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING", 703},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that a call to ::cuCtxEnablePeerAccess() is
|
* This error indicates that a call to ::cuCtxEnablePeerAccess() is
|
||||||
* trying to re-enable peer access to a context which has already
|
* trying to re-enable peer access to a context which has already
|
||||||
* had peer access to it enabled.
|
* had peer access to it enabled.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED", 704 },
|
{"CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED", 704},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that ::cuCtxDisablePeerAccess() is
|
* This error indicates that ::cuCtxDisablePeerAccess() is
|
||||||
* trying to disable peer access which has not been enabled yet
|
* trying to disable peer access which has not been enabled yet
|
||||||
* via ::cuCtxEnablePeerAccess().
|
* via ::cuCtxEnablePeerAccess().
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED", 705 },
|
{"CUDA_ERROR_PEER_ACCESS_NOT_ENABLED", 705},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the primary context for the specified device
|
* This error indicates that the primary context for the specified device
|
||||||
* has already been initialized.
|
* has already been initialized.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE", 708 },
|
{"CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE", 708},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the context current to the calling thread
|
* This error indicates that the context current to the calling thread
|
||||||
* has been destroyed using ::cuCtxDestroy }, or is a primary context which
|
* has been destroyed using ::cuCtxDestroy }, or is a primary context which
|
||||||
* has not yet been initialized.
|
* has not yet been initialized.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_CONTEXT_IS_DESTROYED", 709 },
|
{"CUDA_ERROR_CONTEXT_IS_DESTROYED", 709},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A device-side assert triggered during kernel execution. The context
|
* A device-side assert triggered during kernel execution. The context
|
||||||
@ -334,71 +332,71 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* memory allocations from this context are invalid and must be
|
* memory allocations from this context are invalid and must be
|
||||||
* reconstructed if the program is to continue using CUDA.
|
* reconstructed if the program is to continue using CUDA.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ASSERT", 710 },
|
{"CUDA_ERROR_ASSERT", 710},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the hardware resources required to enable
|
* This error indicates that the hardware resources required to enable
|
||||||
* peer access have been exhausted for one or more of the devices
|
* peer access have been exhausted for one or more of the devices
|
||||||
* passed to ::cuCtxEnablePeerAccess().
|
* passed to ::cuCtxEnablePeerAccess().
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_TOO_MANY_PEERS", 711 },
|
{"CUDA_ERROR_TOO_MANY_PEERS", 711},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the memory range passed to ::cuMemHostRegister()
|
* This error indicates that the memory range passed to
|
||||||
* has already been registered.
|
* ::cuMemHostRegister() has already been registered.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712 },
|
{"CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the pointer passed to ::cuMemHostUnregister()
|
* This error indicates that the pointer passed to ::cuMemHostUnregister()
|
||||||
* does not correspond to any currently registered memory region.
|
* does not correspond to any currently registered memory region.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED", 713 },
|
{"CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED", 713},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a stack error.
|
* While executing a kernel, the device encountered a stack error.
|
||||||
* This can be due to stack corruption or exceeding the stack size limit.
|
* This can be due to stack corruption or exceeding the stack size limit.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_HARDWARE_STACK_ERROR", 714 },
|
{"CUDA_ERROR_HARDWARE_STACK_ERROR", 714},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered an illegal instruction.
|
* While executing a kernel, the device encountered an illegal instruction.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_ILLEGAL_INSTRUCTION", 715 },
|
{"CUDA_ERROR_ILLEGAL_INSTRUCTION", 715},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a load or store instruction
|
* While executing a kernel, the device encountered a load or store
|
||||||
* on a memory address which is not aligned.
|
* instruction on a memory address which is not aligned. This leaves the
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* process in an inconsistent state and any further CUDA work will return
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* the same error. To continue using CUDA, the process must be terminated
|
||||||
* and relaunched.
|
* and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_MISALIGNED_ADDRESS", 716 },
|
{"CUDA_ERROR_MISALIGNED_ADDRESS", 716},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered an instruction
|
* While executing a kernel, the device encountered an instruction
|
||||||
* which can only operate on memory locations in certain address spaces
|
* which can only operate on memory locations in certain address spaces
|
||||||
* (global, shared, or local), but was supplied a memory address not
|
* (global, shared, or local), but was supplied a memory address not
|
||||||
* belonging to an allowed address space.
|
* belonging to an allowed address space.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_ADDRESS_SPACE", 717 },
|
{"CUDA_ERROR_INVALID_ADDRESS_SPACE", 717},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device program counter wrapped its address space.
|
* While executing a kernel, the device program counter wrapped its address
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* space. This leaves the process in an inconsistent state and any further
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* CUDA work will return the same error. To continue using CUDA, the process
|
||||||
* and relaunched.
|
* must be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_INVALID_PC", 718 },
|
{"CUDA_ERROR_INVALID_PC", 718},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exception occurred on the device while executing a kernel. Common
|
* An exception occurred on the device while executing a kernel. Common
|
||||||
@ -408,46 +406,42 @@ s_CudaErrorStr sCudaDrvErrorString[] =
|
|||||||
* memory allocations from this context are invalid and must be
|
* memory allocations from this context are invalid and must be
|
||||||
* reconstructed if the program is to continue using CUDA.
|
* reconstructed if the program is to continue using CUDA.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_LAUNCH_FAILED", 719 },
|
{"CUDA_ERROR_LAUNCH_FAILED", 719},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the number of blocks launched per grid for a kernel that was
|
* This error indicates that the number of blocks launched per grid for a
|
||||||
* launched via either ::cuLaunchCooperativeKernel or ::cuLaunchCooperativeKernelMultiDevice
|
* kernel that was launched via either ::cuLaunchCooperativeKernel or
|
||||||
* exceeds the maximum number of blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor
|
* ::cuLaunchCooperativeKernelMultiDevice exceeds the maximum number of
|
||||||
* or ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors
|
* blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor or
|
||||||
* as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
|
* ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number
|
||||||
|
* of multiprocessors as specified by the device attribute
|
||||||
|
* ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE", 720 },
|
{"CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE", 720},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the attempted operation is not permitted.
|
* This error indicates that the attempted operation is not permitted.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_PERMITTED", 800 },
|
{"CUDA_ERROR_NOT_PERMITTED", 800},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the attempted operation is not supported
|
* This error indicates that the attempted operation is not supported
|
||||||
* on the current system or device.
|
* on the current system or device.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_NOT_SUPPORTED", 801 },
|
{"CUDA_ERROR_NOT_SUPPORTED", 801},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an unknown internal error has occurred.
|
* This indicates that an unknown internal error has occurred.
|
||||||
*/
|
*/
|
||||||
{ "CUDA_ERROR_UNKNOWN", 999 },
|
{"CUDA_ERROR_UNKNOWN", 999},
|
||||||
{ NULL, -1 }
|
{NULL, -1}};
|
||||||
};
|
|
||||||
|
|
||||||
// This is just a linear search through the array, since the error_id's are not
|
// This is just a linear search through the array, since the error_id's are not
|
||||||
// always ocurring consecutively
|
// always ocurring consecutively
|
||||||
inline const char *getCudaDrvErrorString(CUresult error_id)
|
static inline const char *getCudaDrvErrorString(CUresult error_id) {
|
||||||
{
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
while (sCudaDrvErrorString[index].error_id != error_id &&
|
while (sCudaDrvErrorString[index].error_id != error_id && (int)sCudaDrvErrorString[index].error_id != -1) {
|
||||||
(int)sCudaDrvErrorString[index].error_id != -1)
|
|
||||||
{
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +451,4 @@ inline const char *getCudaDrvErrorString(CUresult error_id)
|
|||||||
return (const char *)"CUDA_ERROR not found!";
|
return (const char *)"CUDA_ERROR not found!";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __cuda_cuda_h__
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
606
hdr.c
Normal file
606
hdr.c
Normal file
@ -0,0 +1,606 @@
|
|||||||
|
#include <libavutil/mastering_display_metadata.h>
|
||||||
|
#ifndef _DRM_MODE_H
|
||||||
|
/**
|
||||||
|
* struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
|
||||||
|
*
|
||||||
|
* HDR Metadata Infoframe as per CTA 861.G spec. This is expected
|
||||||
|
* to match exactly with the spec.
|
||||||
|
*
|
||||||
|
* Userspace is expected to pass the metadata information as per
|
||||||
|
* the format described in this structure.
|
||||||
|
*/
|
||||||
|
struct hdr_metadata_infoframe {
|
||||||
|
/**
|
||||||
|
* @eotf: Electro-Optical Transfer Function (EOTF)
|
||||||
|
* used in the stream.
|
||||||
|
*/
|
||||||
|
__u8 eotf;
|
||||||
|
/**
|
||||||
|
* @metadata_type: Static_Metadata_Descriptor_ID.
|
||||||
|
*/
|
||||||
|
__u8 metadata_type;
|
||||||
|
/**
|
||||||
|
* @display_primaries: Color Primaries of the Data.
|
||||||
|
* These are coded as unsigned 16-bit values in units of
|
||||||
|
* 0.00002, where 0x0000 represents zero and 0xC350
|
||||||
|
* represents 1.0000.
|
||||||
|
* @display_primaries.x: X cordinate of color primary.
|
||||||
|
* @display_primaries.y: Y cordinate of color primary.
|
||||||
|
*/
|
||||||
|
struct {
|
||||||
|
__u16 x, y;
|
||||||
|
} display_primaries[3];
|
||||||
|
/**
|
||||||
|
* @white_point: White Point of Colorspace Data.
|
||||||
|
* These are coded as unsigned 16-bit values in units of
|
||||||
|
* 0.00002, where 0x0000 represents zero and 0xC350
|
||||||
|
* represents 1.0000.
|
||||||
|
* @white_point.x: X cordinate of whitepoint of color primary.
|
||||||
|
* @white_point.y: Y cordinate of whitepoint of color primary.
|
||||||
|
*/
|
||||||
|
struct {
|
||||||
|
__u16 x, y;
|
||||||
|
} white_point;
|
||||||
|
/**
|
||||||
|
* @max_display_mastering_luminance: Max Mastering Display Luminance.
|
||||||
|
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
|
||||||
|
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
|
||||||
|
*/
|
||||||
|
__u16 max_display_mastering_luminance;
|
||||||
|
/**
|
||||||
|
* @min_display_mastering_luminance: Min Mastering Display Luminance.
|
||||||
|
* This value is coded as an unsigned 16-bit value in units of
|
||||||
|
* 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
|
||||||
|
* represents 6.5535 cd/m2.
|
||||||
|
*/
|
||||||
|
__u16 min_display_mastering_luminance;
|
||||||
|
/**
|
||||||
|
* @max_cll: Max Content Light Level.
|
||||||
|
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
|
||||||
|
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
|
||||||
|
*/
|
||||||
|
__u16 max_cll;
|
||||||
|
/**
|
||||||
|
* @max_fall: Max Frame Average Light Level.
|
||||||
|
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
|
||||||
|
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
|
||||||
|
*/
|
||||||
|
__u16 max_fall;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct hdr_output_metadata - HDR output metadata
|
||||||
|
*
|
||||||
|
* Metadata Information to be passed from userspace
|
||||||
|
*/
|
||||||
|
struct hdr_output_metadata {
|
||||||
|
/**
|
||||||
|
* @metadata_type: Static_Metadata_Descriptor_ID.
|
||||||
|
*/
|
||||||
|
__u32 metadata_type;
|
||||||
|
/**
|
||||||
|
* @hdmi_metadata_type1: HDR Metadata Infoframe.
|
||||||
|
*/
|
||||||
|
union {
|
||||||
|
struct hdr_metadata_infoframe hdmi_metadata_type1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum hdr_metadata_eotf {
|
||||||
|
EOTF_TRADITIONAL_GAMMA_SDR,
|
||||||
|
EOTF_TRADITIONAL_GAMMA_HDR,
|
||||||
|
EOTF_ST2084,
|
||||||
|
EOTF_HLG,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum metadata_id {
|
||||||
|
METADATA_TYPE1,
|
||||||
|
};
|
||||||
|
|
||||||
|
void weston_hdr_metadata(void *data, uint16_t display_primary_r_x, uint16_t display_primary_r_y,
|
||||||
|
uint16_t display_primary_g_x, uint16_t display_primary_g_y, uint16_t display_primary_b_x,
|
||||||
|
uint16_t display_primary_b_y, uint16_t white_point_x, uint16_t white_point_y,
|
||||||
|
uint16_t min_luminance, uint16_t max_luminance, uint16_t max_cll, uint16_t max_fall,
|
||||||
|
enum hdr_metadata_eotf eotf) {
|
||||||
|
uint8_t *data8;
|
||||||
|
uint16_t *data16;
|
||||||
|
|
||||||
|
data8 = data;
|
||||||
|
|
||||||
|
*data8++ = eotf;
|
||||||
|
*data8++ = METADATA_TYPE1;
|
||||||
|
|
||||||
|
data16 = (void *)data8;
|
||||||
|
|
||||||
|
*data16++ = display_primary_r_x;
|
||||||
|
*data16++ = display_primary_r_y;
|
||||||
|
*data16++ = display_primary_g_x;
|
||||||
|
*data16++ = display_primary_g_y;
|
||||||
|
*data16++ = display_primary_b_x;
|
||||||
|
*data16++ = display_primary_b_y;
|
||||||
|
*data16++ = white_point_x;
|
||||||
|
*data16++ = white_point_y;
|
||||||
|
|
||||||
|
*data16++ = max_luminance;
|
||||||
|
*data16++ = min_luminance;
|
||||||
|
*data16++ = max_cll;
|
||||||
|
*data16++ = max_fall;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct weston_vector {
|
||||||
|
float f[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct weston_colorspace {
|
||||||
|
struct weston_vector r, g, b;
|
||||||
|
struct weston_vector whitepoint;
|
||||||
|
const char *name;
|
||||||
|
const char *whitepoint_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct weston_colorspace hdr10;
|
||||||
|
|
||||||
|
static const struct weston_colorspace bt470m = {
|
||||||
|
.r = {{
|
||||||
|
0.670f,
|
||||||
|
0.330f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.210f,
|
||||||
|
0.710f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.140f,
|
||||||
|
0.080f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3101f,
|
||||||
|
0.3162f,
|
||||||
|
}},
|
||||||
|
.name = "BT.470 M",
|
||||||
|
.whitepoint_name = "C",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace bt470bg = {
|
||||||
|
.r = {{
|
||||||
|
0.640f,
|
||||||
|
0.330f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.290f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "BT.470 B/G",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace smpte170m = {
|
||||||
|
.r = {{
|
||||||
|
0.630f,
|
||||||
|
0.340f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.310f,
|
||||||
|
0.595f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.155f,
|
||||||
|
0.070f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "SMPTE 170M",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace smpte240m = {
|
||||||
|
.r = {{
|
||||||
|
0.630f,
|
||||||
|
0.340f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.310f,
|
||||||
|
0.595f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.155f,
|
||||||
|
0.070f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "SMPTE 240M",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace bt709 = {
|
||||||
|
.r = {{
|
||||||
|
0.640f,
|
||||||
|
0.330f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.300f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "BT.709",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace bt2020 = {
|
||||||
|
.r = {{
|
||||||
|
0.708f,
|
||||||
|
0.292f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.170f,
|
||||||
|
0.797f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.131f,
|
||||||
|
0.046f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "BT.2020",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace srgb = {
|
||||||
|
.r = {{
|
||||||
|
0.640f,
|
||||||
|
0.330f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.300f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "sRGB",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace adobergb = {
|
||||||
|
.r = {{
|
||||||
|
0.640f,
|
||||||
|
0.330f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.210f,
|
||||||
|
0.710f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "AdobeRGB",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace dci_p3 = {
|
||||||
|
.r = {{
|
||||||
|
0.680f,
|
||||||
|
0.320f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.265f,
|
||||||
|
0.690f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
|
.name = "DCI-P3 D65",
|
||||||
|
.whitepoint_name = "D65",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace prophotorgb = {
|
||||||
|
.r = {{
|
||||||
|
0.7347f,
|
||||||
|
0.2653f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.1596f,
|
||||||
|
0.8404f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0366f,
|
||||||
|
0.0001f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{.3457, .3585}},
|
||||||
|
.name = "ProPhoto RGB",
|
||||||
|
.whitepoint_name = "D50",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace ciergb = {
|
||||||
|
.r = {{
|
||||||
|
0.7347f,
|
||||||
|
0.2653f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.2738f,
|
||||||
|
0.7174f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.1666f,
|
||||||
|
0.0089f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
1.0f / 3.0f,
|
||||||
|
1.0f / 3.0f,
|
||||||
|
}},
|
||||||
|
.name = "CIE RGB",
|
||||||
|
.whitepoint_name = "E",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace ciexyz = {
|
||||||
|
.r = {{
|
||||||
|
1.0f,
|
||||||
|
0.0f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.0f,
|
||||||
|
1.0f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0f,
|
||||||
|
0.0f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
1.0f / 3.0f,
|
||||||
|
1.0f / 3.0f,
|
||||||
|
}},
|
||||||
|
.name = "CIE XYZ",
|
||||||
|
.whitepoint_name = "E",
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct weston_colorspace ap0 = {
|
||||||
|
.r = {{
|
||||||
|
0.7347f,
|
||||||
|
0.2653f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.0000f,
|
||||||
|
1.0000f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0001f,
|
||||||
|
-0.0770f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
.32168f,
|
||||||
|
.33767f,
|
||||||
|
}},
|
||||||
|
.name = "ACES primaries #0",
|
||||||
|
.whitepoint_name = "D60",
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct weston_colorspace ap1 = {
|
||||||
|
.r = {{
|
||||||
|
0.713f,
|
||||||
|
0.393f,
|
||||||
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.165f,
|
||||||
|
0.830f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.128f,
|
||||||
|
0.044f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.32168f,
|
||||||
|
0.33767f,
|
||||||
|
}},
|
||||||
|
.name = "ACES primaries #1",
|
||||||
|
.whitepoint_name = "D60",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct weston_colorspace *const colorspaces[] = {
|
||||||
|
&bt470m, &bt470bg, &smpte170m, &smpte240m, &bt709, &bt2020, &srgb,
|
||||||
|
&adobergb, &dci_p3, &prophotorgb, &ciergb, &ciexyz, &ap0, &ap1,
|
||||||
|
};
|
||||||
|
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a)[0])
|
||||||
|
const struct weston_colorspace *weston_colorspace_lookup(const char *name) {
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(colorspaces); i++) {
|
||||||
|
const struct weston_colorspace *c = colorspaces[i];
|
||||||
|
|
||||||
|
if (!strcmp(c->name, name))
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cleanup = 0;
|
||||||
|
|
||||||
|
static uint16_t encode_xyy(float xyy) { return xyy * 50000; }
|
||||||
|
static AVMasteringDisplayMetadata md_save = {0};
|
||||||
|
static AVContentLightMetadata ld_save = {0};
|
||||||
|
static void set_hdr_metadata(int color, int trc, AVFrameSideData *sd1, AVFrameSideData *sd2) {
|
||||||
|
drmModeAtomicReqPtr ModeReq;
|
||||||
|
struct weston_colorspace *cs;
|
||||||
|
enum hdr_metadata_eotf eotf;
|
||||||
|
struct hdr_output_metadata data;
|
||||||
|
int ret, MaxCLL = 1500, MaxFALL = 400;
|
||||||
|
int max_lum = 4000, min_lum = 0050;
|
||||||
|
struct AVMasteringDisplayMetadata *md = NULL;
|
||||||
|
struct AVContentLightMetadata *ld = NULL;
|
||||||
|
|
||||||
|
// clean up FFMEPG stuff
|
||||||
|
if (trc == AVCOL_TRC_BT2020_10)
|
||||||
|
trc = AVCOL_TRC_ARIB_STD_B67;
|
||||||
|
|
||||||
|
if ((old_color == color && old_trc == trc && !sd1 && !sd2) || !render->hdr_metadata)
|
||||||
|
return; // nothing to do
|
||||||
|
|
||||||
|
if (sd1)
|
||||||
|
md = sd1->data;
|
||||||
|
|
||||||
|
if (sd2)
|
||||||
|
ld = sd2->data;
|
||||||
|
|
||||||
|
if (md && !memcmp(md, &md_save, sizeof(md_save)))
|
||||||
|
if (ld && !memcmp(ld, &ld_save, sizeof(ld_save))) {
|
||||||
|
return;
|
||||||
|
} else if (ld && !memcmp(ld, &ld_save, sizeof(ld_save))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ld)
|
||||||
|
memcpy(&ld_save, ld, sizeof(ld_save));
|
||||||
|
if (md)
|
||||||
|
memcpy(&md_save, md, sizeof(md_save));
|
||||||
|
|
||||||
|
Debug(3, "Update HDR to TRC %d color %d\n", trc, color);
|
||||||
|
|
||||||
|
old_color = color;
|
||||||
|
old_trc = trc;
|
||||||
|
|
||||||
|
if (VulkanTargetColorSpace != 3) { // no HDR TV
|
||||||
|
m_need_modeset = 1; // change in colorsettings
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (render->hdr_blob_id)
|
||||||
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
|
|
||||||
|
switch (trc) {
|
||||||
|
case AVCOL_TRC_BT709: // 1
|
||||||
|
case AVCOL_TRC_UNSPECIFIED: // 2
|
||||||
|
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
||||||
|
break;
|
||||||
|
case AVCOL_TRC_BT2020_10: // 14
|
||||||
|
case AVCOL_TRC_BT2020_12:
|
||||||
|
case AVCOL_TRC_ARIB_STD_B67: // 18 HLG
|
||||||
|
eotf = EOTF_HLG;
|
||||||
|
break;
|
||||||
|
case AVCOL_TRC_SMPTE2084: // 16
|
||||||
|
eotf = EOTF_ST2084;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (color) {
|
||||||
|
case AVCOL_PRI_BT709: // 1
|
||||||
|
case AVCOL_PRI_UNSPECIFIED: // 2
|
||||||
|
cs = weston_colorspace_lookup("BT.709");
|
||||||
|
break;
|
||||||
|
case AVCOL_PRI_BT2020: // 9
|
||||||
|
cs = weston_colorspace_lookup("BT.2020");
|
||||||
|
break;
|
||||||
|
case AVCOL_PRI_BT470BG: // 5
|
||||||
|
cs = weston_colorspace_lookup("BT.470 B/G"); // BT.601
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cs = weston_colorspace_lookup("BT.709");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (md) { // we got Metadata
|
||||||
|
if (md->has_primaries) {
|
||||||
|
Debug(3,
|
||||||
|
"Mastering Display Metadata,\n has_primaries:%d has_luminance:%d \n"
|
||||||
|
"r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) \n"
|
||||||
|
"min_luminance=%f, max_luminance=%f\n",
|
||||||
|
md->has_primaries, md->has_luminance, av_q2d(md->display_primaries[0][0]),
|
||||||
|
av_q2d(md->display_primaries[0][1]), av_q2d(md->display_primaries[1][0]),
|
||||||
|
av_q2d(md->display_primaries[1][1]), av_q2d(md->display_primaries[2][0]),
|
||||||
|
av_q2d(md->display_primaries[2][1]), av_q2d(md->white_point[0]), av_q2d(md->white_point[1]),
|
||||||
|
av_q2d(md->min_luminance), av_q2d(md->max_luminance));
|
||||||
|
|
||||||
|
cs = &hdr10;
|
||||||
|
cs->r.f[0] = (float)md->display_primaries[0][0].num / (float)md->display_primaries[0][0].den;
|
||||||
|
cs->r.f[1] = (float)md->display_primaries[0][1].num / (float)md->display_primaries[0][1].den;
|
||||||
|
cs->g.f[0] = (float)md->display_primaries[1][0].num / (float)md->display_primaries[1][0].den;
|
||||||
|
cs->g.f[1] = (float)md->display_primaries[1][1].num / (float)md->display_primaries[1][1].den;
|
||||||
|
cs->b.f[0] = (float)md->display_primaries[2][0].num / (float)md->display_primaries[2][0].den;
|
||||||
|
cs->b.f[1] = (float)md->display_primaries[2][1].num / (float)md->display_primaries[2][1].den;
|
||||||
|
cs->whitepoint.f[0] = (float)md->white_point[0].num / (float)md->white_point[0].den;
|
||||||
|
cs->whitepoint.f[1] = (float)md->white_point[1].num / (float)md->white_point[1].den;
|
||||||
|
}
|
||||||
|
if (md->has_luminance) {
|
||||||
|
max_lum = av_q2d(md->max_luminance);
|
||||||
|
min_lum = av_q2d(md->min_luminance) * 10000;
|
||||||
|
printf("max_lum %d min_lum %d\n", max_lum, min_lum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ld) {
|
||||||
|
Debug(3, "Has MaxCLL %d MaxFALL %d\n", ld->MaxCLL, ld->MaxFALL);
|
||||||
|
MaxCLL = ld->MaxCLL;
|
||||||
|
MaxFALL = ld->MaxFALL;
|
||||||
|
}
|
||||||
|
data.metadata_type = 7; // ????????????????????????
|
||||||
|
weston_hdr_metadata(&data.hdmi_metadata_type1, encode_xyy(cs->r.f[0]), encode_xyy(cs->r.f[1]),
|
||||||
|
encode_xyy(cs->g.f[0]), encode_xyy(cs->g.f[1]), encode_xyy(cs->b.f[0]), encode_xyy(cs->b.f[1]),
|
||||||
|
encode_xyy(cs->whitepoint.f[0]), encode_xyy(cs->whitepoint.f[1]),
|
||||||
|
max_lum, // max_display_mastering_luminance
|
||||||
|
min_lum, // min_display_mastering_luminance
|
||||||
|
MaxCLL, // Maximum Content Light Level (MaxCLL)
|
||||||
|
MaxFALL, // Maximum Frame-Average Light Level (MaxFALL)
|
||||||
|
eotf);
|
||||||
|
|
||||||
|
ret = drmModeCreatePropertyBlob(render->fd_drm, &data, sizeof(data), &render->hdr_blob_id);
|
||||||
|
if (ret) {
|
||||||
|
printf("DRM: HDR metadata: failed blob create \n");
|
||||||
|
render->hdr_blob_id = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = drmModeConnectorSetProperty(render->fd_drm, render->connector_id, render->hdr_metadata, render->hdr_blob_id);
|
||||||
|
if (ret) {
|
||||||
|
printf("DRM: HDR metadata: failed property set %d\n", ret);
|
||||||
|
|
||||||
|
if (render->hdr_blob_id)
|
||||||
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
|
render->hdr_blob_id = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_need_modeset = 1;
|
||||||
|
|
||||||
|
Debug(3, "DRM: HDR metadata: prop set\n");
|
||||||
|
}
|
74
iatomic.h
74
iatomic.h
@ -1,34 +1,32 @@
|
|||||||
///
|
///
|
||||||
/// @file iatomic.h @brief Misc function header file
|
/// @file iatomic.h @brief Misc function header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: 59e1684aaa6678ecdebb6ce0df6ce5b5f461dd6e $
|
/// $Id: 59e1684aaa6678ecdebb6ce0df6ce5b5f461dd6e $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup iatomic
|
/// @addtogroup iatomic
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
+ __GNUC_MINOR__ * 100 \
|
|
||||||
+ __GNUC_PATCHLEVEL__)
|
|
||||||
|
|
||||||
// gcc before 4.7 didn't support atomic builtins,
|
// gcc before 4.7 didn't support atomic builtins,
|
||||||
// use alsa atomic functions.
|
// use alsa atomic functions.
|
||||||
#if GCC_VERSION < 40700
|
#if GCC_VERSION < 40700
|
||||||
|
|
||||||
#include <alsa/iatomic.h>
|
#include <alsa/iatomic.h>
|
||||||
@ -36,61 +34,55 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Defines
|
// Defines
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Declares
|
// Declares
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///
|
///
|
||||||
/// atomic type, 24 bit useable,
|
/// atomic type, 24 bit useable,
|
||||||
///
|
///
|
||||||
typedef volatile int atomic_t;
|
typedef volatile int atomic_t;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Inlines
|
// Inlines
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set atomic value.
|
/// Set atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_set(ptr, val) \
|
#define atomic_set(ptr, val) __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Read atomic value.
|
/// Read atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_read(ptr) \
|
#define atomic_read(ptr) __atomic_load_n(ptr, __ATOMIC_SEQ_CST)
|
||||||
__atomic_load_n(ptr, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Increment atomic value.
|
/// Increment atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_inc(ptr) \
|
#define atomic_inc(ptr) __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
||||||
__atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Decrement atomic value.
|
/// Decrement atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_dec(ptr) \
|
#define atomic_dec(ptr) __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
||||||
__atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Add to atomic value.
|
/// Add to atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_add(val, ptr) \
|
#define atomic_add(val, ptr) __atomic_add_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_add_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Subtract from atomic value.
|
/// Subtract from atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_sub(val, ptr) \
|
#define atomic_sub(val, ptr) __atomic_sub_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_sub_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
105
misc.h
105
misc.h
@ -1,62 +1,61 @@
|
|||||||
///
|
///
|
||||||
/// @file misc.h @brief Misc function header file
|
/// @file misc.h @brief Misc function header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2012 by Lutz Sammer. All Rights Reserved.
|
/// Copyright (c) 2009 - 2012 by Lutz Sammer. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
/// Copied from uwm.
|
/// Copied from uwm.
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: f5ff4b300aa33eb721d658c0c9374c8499b67318 $
|
/// $Id: f5ff4b300aa33eb721d658c0c9374c8499b67318 $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup misc
|
/// @addtogroup misc
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <time.h> // clock_gettime
|
#include <syslog.h>
|
||||||
|
#include <time.h> // clock_gettime
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Defines
|
// Defines
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Declares
|
// Declares
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Variables
|
// Variables
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern int SysLogLevel; ///< how much information wanted
|
extern int SysLogLevel; ///< how much information wanted
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static inline void Syslog(const int, const char *format, ...)
|
static inline void Syslog(const int, const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
__attribute__ ((format(printf, 2, 3)));
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Inlines
|
// Inlines
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DebugLevel 4 /// private debug level
|
#define DebugLevel 4 /// private debug level
|
||||||
#else
|
#else
|
||||||
#define DebugLevel 0 /// private debug level
|
#define DebugLevel 0 /// private debug level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,44 +66,47 @@ static inline void Syslog(const int, const char *format, ...)
|
|||||||
** - 2 info
|
** - 2 info
|
||||||
** - 3 important debug and fixme's
|
** - 3 important debug and fixme's
|
||||||
*/
|
*/
|
||||||
static inline void Syslog(const int level, const char *format, ...)
|
static inline void Syslog(const int level, const char *format, ...) {
|
||||||
{
|
|
||||||
if (SysLogLevel > level || DebugLevel > level) {
|
if (SysLogLevel > level || DebugLevel > level) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsyslog(LOG_ERR, format, ap);
|
vsyslog(LOG_ERR, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show error.
|
** Show error.
|
||||||
*/
|
*/
|
||||||
#define Error(fmt...) Syslog(0, fmt)
|
#define Error(fmt...) Syslog(LOG_ERR, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show fatal error.
|
** Show fatal error.
|
||||||
*/
|
*/
|
||||||
#define Fatal(fmt...) do { Error(fmt); abort(); } while (0)
|
#define Fatal(fmt...) \
|
||||||
|
do { \
|
||||||
|
Error(fmt); \
|
||||||
|
abort(); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show warning.
|
** Show warning.
|
||||||
*/
|
*/
|
||||||
#define Warning(fmt...) Syslog(1, fmt)
|
#define Warning(fmt...) Syslog(LOG_WARNING, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show info.
|
** Show info.
|
||||||
*/
|
*/
|
||||||
#define Info(fmt...) Syslog(2, fmt)
|
#define Info(fmt...) Syslog(LOG_INFO, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show debug.
|
** Show debug.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define Debug(level, fmt...) Syslog(level, fmt)
|
#define Debug(level, fmt...) Syslog(level, fmt)
|
||||||
#else
|
#else
|
||||||
#define Debug(level, fmt...) /* disabled */
|
#define Debug(level, fmt...) /* disabled */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef AV_NOPTS_VALUE
|
#ifndef AV_NOPTS_VALUE
|
||||||
@ -116,18 +118,16 @@ static inline void Syslog(const int level, const char *format, ...)
|
|||||||
**
|
**
|
||||||
** @param ts dvb time stamp
|
** @param ts dvb time stamp
|
||||||
*/
|
*/
|
||||||
static inline const char *Timestamp2String(int64_t ts)
|
static inline const char *Timestamp2String(int64_t ts) {
|
||||||
{
|
|
||||||
static char buf[4][16];
|
static char buf[4][16];
|
||||||
static int idx;
|
static int idx;
|
||||||
|
|
||||||
if (ts == (int64_t) AV_NOPTS_VALUE) {
|
if (ts == (int64_t)AV_NOPTS_VALUE) {
|
||||||
return "--:--:--.---";
|
return "--:--:--.---";
|
||||||
}
|
}
|
||||||
idx = (idx + 1) % 3;
|
idx = (idx + 1) % 3;
|
||||||
snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d",
|
snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d", (int)(ts / (90 * 3600000)),
|
||||||
(int)(ts / (90 * 3600000)), (int)((ts / (90 * 60000)) % 60),
|
(int)((ts / (90 * 60000)) % 60), (int)((ts / (90 * 1000)) % 60), (int)((ts / 90) % 1000));
|
||||||
(int)((ts / (90 * 1000)) % 60), (int)((ts / 90) % 1000));
|
|
||||||
|
|
||||||
return buf[idx];
|
return buf[idx];
|
||||||
}
|
}
|
||||||
@ -137,8 +137,7 @@ static inline const char *Timestamp2String(int64_t ts)
|
|||||||
**
|
**
|
||||||
** @returns ticks in ms,
|
** @returns ticks in ms,
|
||||||
*/
|
*/
|
||||||
static inline uint32_t GetMsTicks(void)
|
static inline uint32_t GetMsTicks(void) {
|
||||||
{
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
struct timespec tspec;
|
struct timespec tspec;
|
||||||
|
|
||||||
@ -148,24 +147,24 @@ static inline uint32_t GetMsTicks(void)
|
|||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
|
|
||||||
if (gettimeofday(&tval, NULL) < 0) {
|
if (gettimeofday(&tval, NULL) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
|
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static inline uint64_t GetusTicks(void)
|
|
||||||
{
|
static inline uint64_t GetusTicks(void) {
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
struct timespec tspec;
|
struct timespec tspec;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &tspec);
|
clock_gettime(CLOCK_MONOTONIC, &tspec);
|
||||||
return (tspec.tv_sec * 1000000) + (tspec.tv_nsec) ;
|
return (uint64_t)(tspec.tv_sec * 1000000) + (tspec.tv_nsec);
|
||||||
#else
|
#else
|
||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
|
|
||||||
if (gettimeofday(&tval, NULL) < 0) {
|
if (gettimeofday(&tval, NULL) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
|
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
1031
openglosd.cpp
1031
openglosd.cpp
File diff suppressed because it is too large
Load Diff
361
openglosd.h
361
openglosd.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef __SOFTHDDEVICE_OPENGLOSD_H
|
#ifndef __SOFTHDDEVICE_OPENGLOSD_H
|
||||||
#define __SOFTHDDEVICE_OPENGLOSD_H
|
#define __SOFTHDDEVICE_OPENGLOSD_H
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/freeglut.h>
|
#include <GL/freeglut.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
@ -20,32 +21,27 @@
|
|||||||
#define FT_ERRORDEF( e, v, s ) { e, s },
|
#define FT_ERRORDEF( e, v, s ) { e, s },
|
||||||
#define FT_ERROR_START_LIST {
|
#define FT_ERROR_START_LIST {
|
||||||
#define FT_ERROR_END_LIST { 0, 0 } };
|
#define FT_ERROR_END_LIST { 0, 0 } };
|
||||||
const struct {
|
const struct
|
||||||
int code;
|
{
|
||||||
const char* message;
|
int code;
|
||||||
|
const char *message;
|
||||||
} FT_Errors[] =
|
} FT_Errors[] =
|
||||||
#include FT_ERRORS_H
|
#include FT_ERRORS_H
|
||||||
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include <vdr/plugin.h>
|
#include <vdr/plugin.h>
|
||||||
#include <vdr/osd.h>
|
#include <vdr/osd.h>
|
||||||
#include <vdr/thread.h>
|
#include <vdr/thread.h>
|
||||||
|
|
||||||
#include "softhddev.h"
|
#include "softhddev.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
extern "C" pthread_mutex_t OSDMutex;
|
extern "C" pthread_mutex_t OSDMutex;
|
||||||
|
|
||||||
@ -57,82 +53,80 @@ struct sOglImage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* Helpers
|
* Helpers
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
void ConvertColor(const GLint &colARGB, glm::vec4 &col);
|
void ConvertColor(const GLint &colARGB, glm::vec4 &col);
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cShader
|
* cShader
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
enum eShaderType {
|
enum eShaderType { stRect, stTexture, stText, stCount };
|
||||||
stRect,
|
|
||||||
stTexture,
|
|
||||||
stText,
|
|
||||||
stCount
|
|
||||||
};
|
|
||||||
|
|
||||||
class cShader {
|
class cShader {
|
||||||
private:
|
private:
|
||||||
eShaderType type;
|
eShaderType type;
|
||||||
GLuint id;
|
GLuint id;
|
||||||
bool Compile(const char *vertexCode, const char *fragmentCode);
|
bool Compile(const char *vertexCode, const char *fragmentCode);
|
||||||
bool CheckCompileErrors(GLuint object, bool program = false);
|
bool CheckCompileErrors(GLuint object, bool program = false);
|
||||||
public:
|
|
||||||
cShader(void) {};
|
public:
|
||||||
virtual ~cShader(void) {};
|
cShader(void){};
|
||||||
|
virtual ~cShader(void){};
|
||||||
bool Load(eShaderType type);
|
bool Load(eShaderType type);
|
||||||
void Use(void);
|
void Use(void);
|
||||||
void SetFloat (const GLchar *name, GLfloat value);
|
void SetFloat(const GLchar *name, GLfloat value);
|
||||||
void SetInteger (const GLchar *name, GLint value);
|
void SetInteger(const GLchar *name, GLint value);
|
||||||
void SetVector2f (const GLchar *name, GLfloat x, GLfloat y);
|
void SetVector2f(const GLchar *name, GLfloat x, GLfloat y);
|
||||||
void SetVector3f (const GLchar *name, GLfloat x, GLfloat y, GLfloat z);
|
void SetVector3f(const GLchar *name, GLfloat x, GLfloat y, GLfloat z);
|
||||||
void SetVector4f (const GLchar *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
void SetVector4f(const GLchar *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||||
void SetMatrix4 (const GLchar *name, const glm::mat4 &matrix);
|
void SetMatrix4(const GLchar *name, const glm::mat4 &matrix);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglGlyph
|
* cOglGlyph
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglGlyph : public cListObject {
|
class cOglGlyph : public cListObject {
|
||||||
private:
|
private:
|
||||||
struct tKerning {
|
struct tKerning {
|
||||||
public:
|
public:
|
||||||
tKerning(uint prevSym, GLfloat kerning = 0.0f) {
|
tKerning(FT_ULong prevSym, GLfloat kerning = 0.0f) {
|
||||||
this->prevSym = prevSym;
|
this->prevSym = prevSym;
|
||||||
this->kerning = kerning;
|
this->kerning = kerning;
|
||||||
}
|
}
|
||||||
uint prevSym;
|
FT_ULong prevSym;
|
||||||
GLfloat kerning;
|
GLfloat kerning;
|
||||||
};
|
};
|
||||||
uint charCode;
|
FT_ULong charCode;
|
||||||
int bearingLeft;
|
int bearingLeft;
|
||||||
int bearingTop;
|
int bearingTop;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int advanceX;
|
int advanceX;
|
||||||
|
|
||||||
cVector<tKerning> kerningCache;
|
cVector<tKerning> kerningCache;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
void LoadTexture(FT_BitmapGlyph ftGlyph);
|
void LoadTexture(FT_BitmapGlyph ftGlyph);
|
||||||
public:
|
|
||||||
cOglGlyph(uint charCode, FT_BitmapGlyph ftGlyph);
|
public:
|
||||||
|
cOglGlyph(FT_ULong charCode, FT_BitmapGlyph ftGlyph);
|
||||||
virtual ~cOglGlyph();
|
virtual ~cOglGlyph();
|
||||||
uint CharCode(void) { return charCode; }
|
FT_ULong CharCode(void) { return charCode; }
|
||||||
int AdvanceX(void) { return advanceX; }
|
int AdvanceX(void) { return advanceX; }
|
||||||
int BearingLeft(void) const { return bearingLeft; }
|
int BearingLeft(void) const { return bearingLeft; }
|
||||||
int BearingTop(void) const { return bearingTop; }
|
int BearingTop(void) const { return bearingTop; }
|
||||||
int Width(void) const { return width; }
|
int Width(void) const { return width; }
|
||||||
int Height(void) const { return height; }
|
int Height(void) const { return height; }
|
||||||
int GetKerningCache(uint prevSym);
|
int GetKerningCache(FT_ULong prevSym);
|
||||||
void SetKerningCache(uint prevSym, int kerning);
|
void SetKerningCache(FT_ULong prevSym, int kerning);
|
||||||
void BindTexture(void);
|
void BindTexture(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglFont
|
* cOglFont
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglFont : public cListObject {
|
class cOglFont : public cListObject {
|
||||||
private:
|
private:
|
||||||
static bool initiated;
|
static bool initiated;
|
||||||
cString name;
|
cString name;
|
||||||
int size;
|
int size;
|
||||||
@ -144,34 +138,36 @@ private:
|
|||||||
mutable cList<cOglGlyph> glyphCache;
|
mutable cList<cOglGlyph> glyphCache;
|
||||||
cOglFont(const char *fontName, int charHeight);
|
cOglFont(const char *fontName, int charHeight);
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
public:
|
|
||||||
|
public:
|
||||||
virtual ~cOglFont(void);
|
virtual ~cOglFont(void);
|
||||||
static cOglFont *Get(const char *name, int charHeight);
|
static cOglFont *Get(const char *name, int charHeight);
|
||||||
static void Cleanup(void);
|
static void Cleanup(void);
|
||||||
const char *Name(void) { return *name; };
|
const char *Name(void) { return *name; };
|
||||||
int Size(void) { return size; };
|
int Size(void) { return size; };
|
||||||
int Bottom(void) {return bottom; };
|
int Bottom(void) { return bottom; };
|
||||||
int Height(void) {return height; };
|
int Height(void) { return height; };
|
||||||
cOglGlyph* Glyph(uint charCode) const;
|
cOglGlyph *Glyph(FT_ULong charCode) const;
|
||||||
int Kerning(cOglGlyph *glyph, uint prevSym) const;
|
int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglFb
|
* cOglFb
|
||||||
* Framebuffer Object - OpenGL part of a Pixmap
|
* Framebuffer Object - OpenGL part of a Pixmap
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglFb {
|
class cOglFb {
|
||||||
protected:
|
protected:
|
||||||
bool initiated;
|
bool initiated;
|
||||||
// GLuint fb;
|
// GLuint fb;
|
||||||
// GLuint texture;
|
// GLuint texture;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint viewPortWidth, viewPortHeight;
|
GLint viewPortWidth, viewPortHeight;
|
||||||
bool scrollable;
|
bool scrollable;
|
||||||
public:
|
|
||||||
GLuint fb;
|
public:
|
||||||
GLuint texture;
|
GLuint fb;
|
||||||
|
GLuint texture;
|
||||||
|
|
||||||
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
|
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
|
||||||
virtual ~cOglFb(void);
|
virtual ~cOglFb(void);
|
||||||
bool Initiated(void) { return initiated; }
|
bool Initiated(void) { return initiated; }
|
||||||
@ -190,17 +186,20 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglOutputFb
|
* cOglOutputFb
|
||||||
* Output Framebuffer Object - holds Vdpau Output Surface which is our "output framebuffer"
|
* Output Framebuffer Object - holds Vdpau Output Surface which is our "output
|
||||||
****************************************************************************************/
|
*framebuffer"
|
||||||
|
****************************************************************************************/
|
||||||
class cOglOutputFb : public cOglFb {
|
class cOglOutputFb : public cOglFb {
|
||||||
protected:
|
protected:
|
||||||
bool initiated;
|
bool initiated;
|
||||||
private:
|
|
||||||
|
private:
|
||||||
GLvdpauSurfaceNV surface;
|
GLvdpauSurfaceNV surface;
|
||||||
public:
|
|
||||||
GLuint fb;
|
public:
|
||||||
GLuint texture;
|
GLuint fb;
|
||||||
|
GLuint texture;
|
||||||
cOglOutputFb(GLint width, GLint height);
|
cOglOutputFb(GLint width, GLint height);
|
||||||
virtual ~cOglOutputFb(void);
|
virtual ~cOglOutputFb(void);
|
||||||
virtual bool Init(void);
|
virtual bool Init(void);
|
||||||
@ -209,20 +208,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglVb
|
* cOglVb
|
||||||
* Vertex Buffer - OpenGl Vertices for the different drawing commands
|
* Vertex Buffer - OpenGl Vertices for the different drawing commands
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
enum eVertexBufferType {
|
enum eVertexBufferType { vbRect, vbEllipse, vbSlope, vbTexture, vbText, vbCount };
|
||||||
vbRect,
|
|
||||||
vbEllipse,
|
|
||||||
vbSlope,
|
|
||||||
vbTexture,
|
|
||||||
vbText,
|
|
||||||
vbCount
|
|
||||||
};
|
|
||||||
|
|
||||||
class cOglVb {
|
class cOglVb {
|
||||||
private:
|
private:
|
||||||
eVertexBufferType type;
|
eVertexBufferType type;
|
||||||
eShaderType shader;
|
eShaderType shader;
|
||||||
GLuint vao;
|
GLuint vao;
|
||||||
@ -231,7 +223,8 @@ private:
|
|||||||
int sizeVertex2;
|
int sizeVertex2;
|
||||||
int numVertices;
|
int numVertices;
|
||||||
GLuint drawMode;
|
GLuint drawMode;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglVb(int type);
|
cOglVb(int type);
|
||||||
virtual ~cOglVb(void);
|
virtual ~cOglVb(void);
|
||||||
bool Init(void);
|
bool Init(void);
|
||||||
@ -248,194 +241,213 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOpenGLCmd
|
* cOpenGLCmd
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglCmd {
|
class cOglCmd {
|
||||||
protected:
|
protected:
|
||||||
cOglFb *fb;
|
cOglFb *fb;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmd(cOglFb *fb) { this->fb = fb; };
|
cOglCmd(cOglFb *fb) { this->fb = fb; };
|
||||||
virtual ~cOglCmd(void) {};
|
virtual ~cOglCmd(void){};
|
||||||
virtual const char* Description(void) = 0;
|
virtual const char *Description(void) = 0;
|
||||||
virtual bool Execute(void) = 0;
|
virtual bool Execute(void) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdInitOutputFb : public cOglCmd {
|
class cOglCmdInitOutputFb : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
cOglOutputFb *oFb;
|
cOglOutputFb *oFb;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdInitOutputFb(cOglOutputFb *oFb);
|
cOglCmdInitOutputFb(cOglOutputFb *oFb);
|
||||||
virtual ~cOglCmdInitOutputFb(void) {};
|
virtual ~cOglCmdInitOutputFb(void){};
|
||||||
virtual const char* Description(void) { return "InitOutputFramebuffer"; }
|
virtual const char *Description(void) { return "InitOutputFramebuffer"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdInitFb : public cOglCmd {
|
class cOglCmdInitFb : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
cCondWait *wait;
|
cCondWait *wait;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL);
|
cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL);
|
||||||
virtual ~cOglCmdInitFb(void) {};
|
virtual ~cOglCmdInitFb(void){};
|
||||||
virtual const char* Description(void) { return "InitFramebuffer"; }
|
virtual const char *Description(void) { return "InitFramebuffer"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDeleteFb : public cOglCmd {
|
class cOglCmdDeleteFb : public cOglCmd {
|
||||||
public:
|
public:
|
||||||
cOglCmdDeleteFb(cOglFb *fb);
|
cOglCmdDeleteFb(cOglFb *fb);
|
||||||
virtual ~cOglCmdDeleteFb(void) {};
|
virtual ~cOglCmdDeleteFb(void){};
|
||||||
virtual const char* Description(void) { return "DeleteFramebuffer"; }
|
virtual const char *Description(void) { return "DeleteFramebuffer"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdRenderFbToBufferFb : public cOglCmd {
|
class cOglCmdRenderFbToBufferFb : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
cOglFb *buffer;
|
cOglFb *buffer;
|
||||||
GLfloat x, y;
|
GLfloat x, y;
|
||||||
GLfloat drawPortX, drawPortY;
|
GLfloat drawPortX, drawPortY;
|
||||||
GLint transparency;
|
GLint transparency;
|
||||||
public:
|
GLint alphablending;
|
||||||
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, GLint drawPortY);
|
|
||||||
virtual ~cOglCmdRenderFbToBufferFb(void) {};
|
public:
|
||||||
virtual const char* Description(void) { return "Render Framebuffer to Buffer"; }
|
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
|
||||||
|
GLint drawPortY, bool alphablending);
|
||||||
|
virtual ~cOglCmdRenderFbToBufferFb(void){};
|
||||||
|
virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdCopyBufferToOutputFb : public cOglCmd {
|
class cOglCmdCopyBufferToOutputFb : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
cOglOutputFb *oFb;
|
cOglOutputFb *oFb;
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y);
|
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y);
|
||||||
virtual ~cOglCmdCopyBufferToOutputFb(void) {};
|
virtual ~cOglCmdCopyBufferToOutputFb(void){};
|
||||||
virtual const char* Description(void) { return "Copy buffer to OutputFramebuffer"; }
|
virtual const char *Description(void) { return "Copy buffer to OutputFramebuffer"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdFill : public cOglCmd {
|
class cOglCmdFill : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
GLint color;
|
GLint color;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdFill(cOglFb *fb, GLint color);
|
cOglCmdFill(cOglFb *fb, GLint color);
|
||||||
virtual ~cOglCmdFill(void) {};
|
virtual ~cOglCmdFill(void){};
|
||||||
virtual const char* Description(void) { return "Fill"; }
|
virtual const char *Description(void) { return "Fill"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawRectangle : public cOglCmd {
|
class cOglCmdDrawRectangle : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint color;
|
GLint color;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color);
|
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color);
|
||||||
virtual ~cOglCmdDrawRectangle(void) {};
|
virtual ~cOglCmdDrawRectangle(void){};
|
||||||
virtual const char* Description(void) { return "DrawRectangle"; }
|
virtual const char *Description(void) { return "DrawRectangle"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawEllipse : public cOglCmd {
|
class cOglCmdDrawEllipse : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint color;
|
GLint color;
|
||||||
GLint quadrants;
|
GLint quadrants;
|
||||||
GLfloat *CreateVerticesFull(int &numVertices);
|
GLfloat *CreateVerticesFull(int &numVertices);
|
||||||
GLfloat *CreateVerticesQuadrant(int &numVertices);
|
GLfloat *CreateVerticesQuadrant(int &numVertices);
|
||||||
GLfloat *CreateVerticesHalf(int &numVertices);
|
GLfloat *CreateVerticesHalf(int &numVertices);
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
|
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
|
||||||
virtual ~cOglCmdDrawEllipse(void) {};
|
virtual ~cOglCmdDrawEllipse(void){};
|
||||||
virtual const char* Description(void) { return "DrawEllipse"; }
|
virtual const char *Description(void) { return "DrawEllipse"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawSlope : public cOglCmd {
|
class cOglCmdDrawSlope : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint color;
|
GLint color;
|
||||||
GLint type;
|
GLint type;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
|
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
|
||||||
virtual ~cOglCmdDrawSlope(void) {};
|
virtual ~cOglCmdDrawSlope(void){};
|
||||||
virtual const char* Description(void) { return "DrawSlope"; }
|
virtual const char *Description(void) { return "DrawSlope"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawText : public cOglCmd {
|
class cOglCmdDrawText : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint limitX;
|
GLint limitX;
|
||||||
GLint colorText;
|
GLint colorText;
|
||||||
cString fontName;
|
cString fontName;
|
||||||
int fontSize;
|
int fontSize;
|
||||||
unsigned int *symbols;
|
unsigned int *symbols;
|
||||||
public:
|
|
||||||
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText);
|
public:
|
||||||
|
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize,
|
||||||
|
tColor colorText);
|
||||||
virtual ~cOglCmdDrawText(void);
|
virtual ~cOglCmdDrawText(void);
|
||||||
virtual const char* Description(void) { return "DrawText"; }
|
virtual const char *Description(void) { return "DrawText"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawImage : public cOglCmd {
|
class cOglCmdDrawImage : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
tColor *argb;
|
tColor *argb;
|
||||||
GLint x, y, width, height;
|
GLint x, y, width, height;
|
||||||
bool overlay;
|
bool overlay;
|
||||||
GLfloat scaleX, scaleY;
|
GLfloat scaleX, scaleY;
|
||||||
public:
|
|
||||||
cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f);
|
public:
|
||||||
|
cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true,
|
||||||
|
double scaleX = 1.0f, double scaleY = 1.0f);
|
||||||
virtual ~cOglCmdDrawImage(void);
|
virtual ~cOglCmdDrawImage(void);
|
||||||
virtual const char* Description(void) { return "Draw Image"; }
|
virtual const char *Description(void) { return "Draw Image"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawTexture : public cOglCmd {
|
class cOglCmdDrawTexture : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
sOglImage *imageRef;
|
sOglImage *imageRef;
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
public:
|
GLfloat scaleX, scaleY;
|
||||||
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y);
|
|
||||||
virtual ~cOglCmdDrawTexture(void) {};
|
public:
|
||||||
virtual const char* Description(void) { return "Draw Texture"; }
|
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f);
|
||||||
|
virtual ~cOglCmdDrawTexture(void){};
|
||||||
|
virtual const char *Description(void) { return "Draw Texture"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdStoreImage : public cOglCmd {
|
class cOglCmdStoreImage : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
sOglImage *imageRef;
|
sOglImage *imageRef;
|
||||||
tColor *data;
|
tColor *data;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb);
|
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb);
|
||||||
virtual ~cOglCmdStoreImage(void);
|
virtual ~cOglCmdStoreImage(void);
|
||||||
virtual const char* Description(void) { return "Store Image"; }
|
virtual const char *Description(void) { return "Store Image"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDropImage : public cOglCmd {
|
class cOglCmdDropImage : public cOglCmd {
|
||||||
private:
|
private:
|
||||||
sOglImage *imageRef;
|
sOglImage *imageRef;
|
||||||
cCondWait *wait;
|
cCondWait *wait;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait);
|
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait);
|
||||||
virtual ~cOglCmdDropImage(void) {};
|
virtual ~cOglCmdDropImage(void){};
|
||||||
virtual const char* Description(void) { return "Drop Image"; }
|
virtual const char *Description(void) { return "Drop Image"; }
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* cOglThread
|
* cOglThread
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define OGL_MAX_OSDIMAGES 256
|
#define OGL_MAX_OSDIMAGES 256
|
||||||
#define OGL_CMDQUEUE_SIZE 100
|
#define OGL_CMDQUEUE_SIZE 100
|
||||||
|
|
||||||
class cOglThread : public cThread {
|
class cOglThread : public cThread {
|
||||||
private:
|
private:
|
||||||
cCondWait *startWait;
|
cCondWait *startWait;
|
||||||
cCondWait *wait;
|
cCondWait *wait;
|
||||||
bool stalled;
|
bool stalled;
|
||||||
std::queue<cOglCmd*> commands;
|
std::queue<cOglCmd *> commands;
|
||||||
GLint maxTextureSize;
|
GLint maxTextureSize;
|
||||||
sOglImage imageCache[OGL_MAX_OSDIMAGES];
|
sOglImage imageCache[OGL_MAX_OSDIMAGES];
|
||||||
long memCached;
|
long memCached;
|
||||||
@ -449,13 +461,15 @@ private:
|
|||||||
void Cleanup(void);
|
void Cleanup(void);
|
||||||
int GetFreeSlot(void);
|
int GetFreeSlot(void);
|
||||||
void ClearSlot(int slot);
|
void ClearSlot(int slot);
|
||||||
protected:
|
|
||||||
|
protected:
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
public:
|
|
||||||
|
public:
|
||||||
cOglThread(cCondWait *startWait, int maxCacheSize);
|
cOglThread(cCondWait *startWait, int maxCacheSize);
|
||||||
virtual ~cOglThread();
|
virtual ~cOglThread();
|
||||||
void Stop(void);
|
void Stop(void);
|
||||||
void DoCmd(cOglCmd* cmd);
|
void DoCmd(cOglCmd *cmd);
|
||||||
int StoreImage(const cImage &image);
|
int StoreImage(const cImage &image);
|
||||||
void DropImageData(int imageHandle);
|
void DropImageData(int imageHandle);
|
||||||
sOglImage *GetImageRef(int slot);
|
sOglImage *GetImageRef(int slot);
|
||||||
@ -463,15 +477,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglPixmap
|
* cOglPixmap
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglPixmap : public cPixmap {
|
class cOglPixmap : public cPixmap {
|
||||||
private:
|
private:
|
||||||
cOglFb *fb;
|
cOglFb *fb;
|
||||||
std::shared_ptr<cOglThread> oglThread;
|
std::shared_ptr<cOglThread> oglThread;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
public:
|
|
||||||
cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
public:
|
||||||
|
cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const cRect &ViewPort,
|
||||||
|
const cRect &DrawPort = cRect::Null);
|
||||||
virtual ~cOglPixmap(void);
|
virtual ~cOglPixmap(void);
|
||||||
cOglFb *Fb(void) { return fb; };
|
cOglFb *Fb(void) { return fb; };
|
||||||
int X(void) { return ViewPort().X(); };
|
int X(void) { return ViewPort().X(); };
|
||||||
@ -486,9 +502,13 @@ public:
|
|||||||
virtual void Fill(tColor Color);
|
virtual void Fill(tColor Color);
|
||||||
virtual void DrawImage(const cPoint &Point, const cImage &Image);
|
virtual void DrawImage(const cPoint &Point, const cImage &Image);
|
||||||
virtual void DrawImage(const cPoint &Point, int ImageHandle);
|
virtual void DrawImage(const cPoint &Point, int ImageHandle);
|
||||||
|
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
|
||||||
|
virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
|
||||||
virtual void DrawPixel(const cPoint &Point, tColor Color);
|
virtual void DrawPixel(const cPoint &Point, tColor Color);
|
||||||
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
|
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
|
||||||
virtual void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault);
|
bool Overlay = false);
|
||||||
|
virtual void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font,
|
||||||
|
int Width = 0, int Height = 0, int Alignment = taDefault);
|
||||||
virtual void DrawRectangle(const cRect &Rect, tColor Color);
|
virtual void DrawRectangle(const cRect &Rect, tColor Color);
|
||||||
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0);
|
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0);
|
||||||
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type);
|
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type);
|
||||||
@ -499,23 +519,26 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* cOglOsd
|
* cOglOsd
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
class cOglOsd : public cOsd {
|
class cOglOsd : public cOsd {
|
||||||
private:
|
private:
|
||||||
cOglFb *bFb;
|
cOglFb *bFb;
|
||||||
std::shared_ptr<cOglThread> oglThread;
|
std::shared_ptr<cOglThread> oglThread;
|
||||||
cVector<cOglPixmap *> oglPixmaps;
|
cVector<cOglPixmap *> oglPixmaps;
|
||||||
bool isSubtitleOsd;
|
bool isSubtitleOsd;
|
||||||
protected:
|
|
||||||
public:
|
protected:
|
||||||
|
public:
|
||||||
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
|
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
|
||||||
virtual ~cOglOsd();
|
virtual ~cOglOsd();
|
||||||
|
static void SetOsdPosition(int Left, int Top, int Width, int Height);
|
||||||
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
|
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
|
||||||
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
||||||
virtual void DestroyPixmap(cPixmap *Pixmap);
|
virtual void DestroyPixmap(cPixmap *Pixmap);
|
||||||
virtual void Flush(void);
|
virtual void Flush(void);
|
||||||
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias = false);
|
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY,
|
||||||
|
bool AntiAlias = false);
|
||||||
static cOglOutputFb *oFb;
|
static cOglOutputFb *oFb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
312
patches/HDR-for-LSPCON.patch
Normal file
312
patches/HDR-for-LSPCON.patch
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
|
||||||
|
index 8358152e403e..573ab6ea1a6e 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
|
||||||
|
@@ -1274,6 +1274,7 @@ struct intel_lspcon {
|
||||||
|
bool active;
|
||||||
|
enum drm_lspcon_mode mode;
|
||||||
|
enum lspcon_vendor vendor;
|
||||||
|
+ bool hdr_supported;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct intel_digital_port {
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
index f8f1308643a9..a1d0127b7f57 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
@@ -35,6 +35,8 @@
|
||||||
|
#define LSPCON_VENDOR_PARADE_OUI 0x001CF8
|
||||||
|
#define LSPCON_VENDOR_MCA_OUI 0x0060AD
|
||||||
|
|
||||||
|
+#define DPCD_MCA_LSPCON_HDR_STATUS 0x70003
|
||||||
|
+
|
||||||
|
/* AUX addresses to write MCA AVI IF */
|
||||||
|
#define LSPCON_MCA_AVI_IF_WRITE_OFFSET 0x5C0
|
||||||
|
#define LSPCON_MCA_AVI_IF_CTRL 0x5DF
|
||||||
|
@@ -104,6 +106,31 @@ static bool lspcon_detect_vendor(struct intel_lspcon *lspcon)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool lspcon_detect_hdr_capability(struct intel_lspcon *lspcon)
|
||||||
|
+{
|
||||||
|
+ struct intel_dp *dp = lspcon_to_intel_dp(lspcon);
|
||||||
|
+ u8 hdr_caps;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ /* Enable HDR for MCA based LSPCON devices */
|
||||||
|
+ if (lspcon->vendor == LSPCON_VENDOR_MCA)
|
||||||
|
+ ret = drm_dp_dpcd_read(&dp->aux, DPCD_MCA_LSPCON_HDR_STATUS,
|
||||||
|
+ &hdr_caps, 1);
|
||||||
|
+ else
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ DRM_DEBUG_KMS("hdr capability detection failed\n");
|
||||||
|
+ lspcon->hdr_supported = false;
|
||||||
|
+ return false;
|
||||||
|
+ } else if (hdr_caps & 0x1) {
|
||||||
|
+ DRM_DEBUG_KMS("lspcon capable of HDR\n");
|
||||||
|
+ lspcon->hdr_supported = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
|
||||||
|
{
|
||||||
|
enum drm_lspcon_mode current_mode;
|
||||||
|
@@ -581,6 +608,11 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!lspcon_detect_hdr_capability(lspcon)) {
|
||||||
|
+ DRM_ERROR("LSPCON hdr detection failed\n");
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
connector->ycbcr_420_allowed = true;
|
||||||
|
lspcon->active = true;
|
||||||
|
DRM_DEBUG_KMS("Success: LSPCON init\n");
|
||||||
|
--
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
|
||||||
|
index b54ccbb5aad5..051e30ad80e7 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
|
||||||
|
@@ -576,6 +576,16 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
|
||||||
|
return val & mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
|
||||||
|
+ const struct intel_crtc_state *crtc_state,
|
||||||
|
+ unsigned int type,
|
||||||
|
+ const void *frame, ssize_t len)
|
||||||
|
+{
|
||||||
|
+ DRM_DEBUG_KMS("Update HDR metadata for lspcon\n");
|
||||||
|
+ /* It uses the legacy hsw implementation for the same */
|
||||||
|
+ hsw_write_infoframe(encoder, crtc_state, type, frame, len);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static const u8 infoframe_type_to_idx[] = {
|
||||||
|
HDMI_PACKET_TYPE_GENERAL_CONTROL,
|
||||||
|
HDMI_PACKET_TYPE_GAMUT_METADATA,
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
index a1d0127b7f57..51ad5f02e700 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
@@ -460,27 +460,41 @@ void lspcon_write_infoframe(struct intel_encoder *encoder,
|
||||||
|
unsigned int type,
|
||||||
|
const void *frame, ssize_t len)
|
||||||
|
{
|
||||||
|
- bool ret;
|
||||||
|
+ bool ret = true;
|
||||||
|
struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
|
||||||
|
struct intel_lspcon *lspcon = enc_to_intel_lspcon(&encoder->base);
|
||||||
|
|
||||||
|
- /* LSPCON only needs AVI IF */
|
||||||
|
- if (type != HDMI_INFOFRAME_TYPE_AVI)
|
||||||
|
+ if (!(type == HDMI_INFOFRAME_TYPE_AVI ||
|
||||||
|
+ type == HDMI_PACKET_TYPE_GAMUT_METADATA))
|
||||||
|
return;
|
||||||
|
|
||||||
|
- if (lspcon->vendor == LSPCON_VENDOR_MCA)
|
||||||
|
- ret = _lspcon_write_avi_infoframe_mca(&intel_dp->aux,
|
||||||
|
- frame, len);
|
||||||
|
- else
|
||||||
|
- ret = _lspcon_write_avi_infoframe_parade(&intel_dp->aux,
|
||||||
|
- frame, len);
|
||||||
|
+ /*
|
||||||
|
+ * Supporting HDR on MCA LSPCON
|
||||||
|
+ * Todo: Add support for Parade later
|
||||||
|
+ */
|
||||||
|
+ if (type == HDMI_PACKET_TYPE_GAMUT_METADATA &&
|
||||||
|
+ lspcon->vendor != LSPCON_VENDOR_MCA)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (lspcon->vendor == LSPCON_VENDOR_MCA) {
|
||||||
|
+ if (type == HDMI_INFOFRAME_TYPE_AVI)
|
||||||
|
+ ret = _lspcon_write_avi_infoframe_mca(&intel_dp->aux,
|
||||||
|
+ frame, len);
|
||||||
|
+ else if (type == HDMI_PACKET_TYPE_GAMUT_METADATA)
|
||||||
|
+ lspcon_drm_write_infoframe(encoder, crtc_state,
|
||||||
|
+ HDMI_PACKET_TYPE_GAMUT_METADATA,
|
||||||
|
+ frame, VIDEO_DIP_DATA_SIZE);
|
||||||
|
+ } else {
|
||||||
|
+ ret = _lspcon_write_avi_infoframe_parade(&intel_dp->aux, frame,
|
||||||
|
+ len);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
- DRM_ERROR("Failed to write AVI infoframes\n");
|
||||||
|
+ DRM_ERROR("Failed to write infoframes\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- DRM_DEBUG_DRIVER("AVI infoframes updated successfully\n");
|
||||||
|
+ DRM_DEBUG_DRIVER("Infoframes updated successfully\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void lspcon_read_infoframe(struct intel_encoder *encoder,
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
index 37cfddf8a9c5..65878904f672 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
@@ -35,4 +35,8 @@ u32 lspcon_infoframes_enabled(struct intel_encoder *encoder,
|
||||||
|
void lspcon_ycbcr420_config(struct drm_connector *connector,
|
||||||
|
struct intel_crtc_state *crtc_state);
|
||||||
|
|
||||||
|
+void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
|
||||||
|
+ const struct intel_crtc_state *crtc_state,
|
||||||
|
+ unsigned int type,
|
||||||
|
+ const void *frame, ssize_t len);
|
||||||
|
#endif /* __INTEL_LSPCON_H__ */
|
||||||
|
--
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
index 51ad5f02e700..c32452360eeb 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
@@ -627,6 +627,11 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (lspcon->vendor == LSPCON_VENDOR_MCA && lspcon->hdr_supported)
|
||||||
|
+ drm_object_attach_property(&connector->base,
|
||||||
|
+ connector->dev->mode_config.hdr_output_metadata_property,
|
||||||
|
+ 0);
|
||||||
|
+
|
||||||
|
connector->ycbcr_420_allowed = true;
|
||||||
|
lspcon->active = true;
|
||||||
|
DRM_DEBUG_KMS("Success: LSPCON init\n");
|
||||||
|
--
|
||||||
|
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
|
||||||
|
index d0a937fb0c56..e78b3a1626fd 100644
|
||||||
|
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
|
||||||
|
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
|
||||||
|
@@ -416,6 +416,7 @@ __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
|
||||||
|
|
||||||
|
if (state->hdr_output_metadata)
|
||||||
|
drm_property_blob_get(state->hdr_output_metadata);
|
||||||
|
+ state->hdr_metadata_changed = false;
|
||||||
|
|
||||||
|
/* Don't copy over a writeback job, they are used only once */
|
||||||
|
state->writeback_job = NULL;
|
||||||
|
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
|
||||||
|
index 0d466d3b0809..5beabcd42d30 100644
|
||||||
|
--- a/drivers/gpu/drm/drm_atomic_uapi.c
|
||||||
|
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
|
||||||
|
@@ -734,6 +734,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
|
||||||
|
val,
|
||||||
|
sizeof(struct hdr_output_metadata), -1,
|
||||||
|
&replaced);
|
||||||
|
+ state->hdr_metadata_changed |= replaced;
|
||||||
|
return ret;
|
||||||
|
} else if (property == config->aspect_ratio_property) {
|
||||||
|
state->picture_aspect_ratio = val;
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||||
|
index 9ba794cb9b4f..dee3a593564c 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||||
|
@@ -3851,6 +3851,8 @@ static void intel_enable_ddi_dp(struct intel_encoder *encoder,
|
||||||
|
{
|
||||||
|
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||||
|
struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
|
||||||
|
+ struct intel_lspcon *lspcon =
|
||||||
|
+ enc_to_intel_lspcon(&encoder->base);
|
||||||
|
enum port port = encoder->port;
|
||||||
|
|
||||||
|
if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
|
||||||
|
@@ -3860,6 +3862,12 @@ static void intel_enable_ddi_dp(struct intel_encoder *encoder,
|
||||||
|
intel_psr_enable(intel_dp, crtc_state);
|
||||||
|
intel_dp_vsc_enable(intel_dp, crtc_state, conn_state);
|
||||||
|
intel_dp_hdr_metadata_enable(intel_dp, crtc_state, conn_state);
|
||||||
|
+
|
||||||
|
+ /* Set the infoframe for NON modeset cases as well */
|
||||||
|
+ if (lspcon->active && lspcon->hdr_supported &&
|
||||||
|
+ conn_state->hdr_metadata_changed)
|
||||||
|
+ intel_dp_setup_hdr_metadata_infoframe_sdp(intel_dp, crtc_state,
|
||||||
|
+ conn_state);
|
||||||
|
intel_edp_drrs_enable(intel_dp, crtc_state);
|
||||||
|
|
||||||
|
if (crtc_state->has_audio)
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
index 5eeafa45831a..cc616fd31d8b 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
@@ -4651,7 +4651,7 @@ intel_dp_setup_vsc_sdp(struct intel_dp *intel_dp,
|
||||||
|
crtc_state, DP_SDP_VSC, &vsc_sdp, sizeof(vsc_sdp));
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void
|
||||||
|
+void
|
||||||
|
intel_dp_setup_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
|
||||||
|
const struct intel_crtc_state *crtc_state,
|
||||||
|
const struct drm_connector_state *conn_state)
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
index 65878904f672..3404cff8c337 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
|
||||||
|
@@ -14,6 +14,7 @@ struct intel_crtc_state;
|
||||||
|
struct intel_digital_port;
|
||||||
|
struct intel_encoder;
|
||||||
|
struct intel_lspcon;
|
||||||
|
+struct intel_dp;
|
||||||
|
|
||||||
|
bool lspcon_init(struct intel_digital_port *intel_dig_port);
|
||||||
|
void lspcon_resume(struct intel_lspcon *lspcon);
|
||||||
|
@@ -39,4 +40,7 @@ void lspcon_drm_write_infoframe(struct intel_encoder *encoder,
|
||||||
|
const struct intel_crtc_state *crtc_state,
|
||||||
|
unsigned int type,
|
||||||
|
const void *frame, ssize_t len);
|
||||||
|
+void intel_dp_setup_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
|
||||||
|
+ const struct intel_crtc_state *crtc_state,
|
||||||
|
+ const struct drm_connector_state *conn_state);
|
||||||
|
#endif /* __INTEL_LSPCON_H__ */
|
||||||
|
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
|
||||||
|
index 5f8c3389d46f..1f0b4fcf0bd3 100644
|
||||||
|
--- a/include/drm/drm_connector.h
|
||||||
|
+++ b/include/drm/drm_connector.h
|
||||||
|
@@ -661,6 +661,7 @@ struct drm_connector_state {
|
||||||
|
* DRM blob property for HDR output metadata
|
||||||
|
*/
|
||||||
|
struct drm_property_blob *hdr_output_metadata;
|
||||||
|
+ u8 hdr_metadata_changed : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
--
|
||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
index c32452360eeb..8565bf73c4cd 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
|
||||||
|
@@ -505,6 +505,11 @@ void lspcon_read_infoframe(struct intel_encoder *encoder,
|
||||||
|
/* FIXME implement this */
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* HDMI HDR Colorspace Spec Definitions */
|
||||||
|
+#define NORMAL_COLORIMETRY_MASK 0x3
|
||||||
|
+#define EXTENDED_COLORIMETRY_MASK 0x7
|
||||||
|
+#define HDMI_COLORIMETRY_BT2020_YCC ((3 << 0) | (6 << 2) | (0 << 5))
|
||||||
|
+
|
||||||
|
void lspcon_set_infoframes(struct intel_encoder *encoder,
|
||||||
|
bool enable,
|
||||||
|
const struct intel_crtc_state *crtc_state,
|
||||||
|
@@ -549,6 +554,19 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
|
||||||
|
HDMI_QUANTIZATION_RANGE_LIMITED :
|
||||||
|
HDMI_QUANTIZATION_RANGE_FULL);
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * Set BT2020 colorspace if driving HDR data
|
||||||
|
+ * ToDo: Make this generic and expose all colorspaces for lspcon
|
||||||
|
+ */
|
||||||
|
+ if (lspcon->active && conn_state->hdr_metadata_changed) {
|
||||||
|
+ frame.avi.colorimetry =
|
||||||
|
+ HDMI_COLORIMETRY_BT2020_YCC &
|
||||||
|
+ NORMAL_COLORIMETRY_MASK;
|
||||||
|
+ frame.avi.extended_colorimetry =
|
||||||
|
+ (HDMI_COLORIMETRY_BT2020_YCC >> 2) &
|
||||||
|
+ EXTENDED_COLORIMETRY_MASK;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
ret = hdmi_infoframe_pack(&frame, buf, sizeof(buf));
|
||||||
|
if (ret < 0) {
|
||||||
|
DRM_ERROR("Failed to pack AVI IF\n");
|
||||||
|
--
|
38
patches/UHD-10Bit.patch
Normal file
38
patches/UHD-10Bit.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
index cc616fd31d8b..f2d1d7bd87d3 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
|
||||||
|
@@ -616,8 +616,10 @@ intel_dp_mode_valid(struct drm_connector *connector,
|
||||||
|
{
|
||||||
|
struct intel_dp *intel_dp = intel_attached_dp(connector);
|
||||||
|
struct intel_connector *intel_connector = to_intel_connector(connector);
|
||||||
|
+ struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
|
||||||
|
struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
|
||||||
|
struct drm_i915_private *dev_priv = to_i915(connector->dev);
|
||||||
|
+ struct intel_lspcon *lspcon = enc_to_intel_lspcon(&intel_encoder->base);
|
||||||
|
int target_clock = mode->clock;
|
||||||
|
int max_rate, mode_rate, max_lanes, max_link_clock;
|
||||||
|
int max_dotclk;
|
||||||
|
@@ -639,6 +641,21 @@ intel_dp_mode_valid(struct drm_connector *connector,
|
||||||
|
target_clock = fixed_mode->clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * Reducing Blanking to incorporate DP and HDMI timing/link bandwidth
|
||||||
|
+ * limitations for CEA modes (4k@60 at 10 bpp). DP can drive 17.28Gbs
|
||||||
|
+ * while 4k modes (VIC97 etc) at 10 bpp required 17.8 Gbps. This will
|
||||||
|
+ * cause mode to blank out. Reduced Htotal by shortening the back porch
|
||||||
|
+ * and front porch within permissible limits.
|
||||||
|
+ */
|
||||||
|
+ if (lspcon->active && lspcon->hdr_supported &&
|
||||||
|
+ mode->clock > 570000) {
|
||||||
|
+ mode->clock = 570000;
|
||||||
|
+ mode->htotal -= 180;
|
||||||
|
+ mode->hsync_start -= 72;
|
||||||
|
+ mode->hsync_end -= 72;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
max_link_clock = intel_dp_max_link_rate(intel_dp);
|
||||||
|
max_lanes = intel_dp_max_lane_count(intel_dp);
|
||||||
|
|
||||||
|
--
|
14
patches/vdr-plugin-skinnopacity-osd.diff.txt
Normal file
14
patches/vdr-plugin-skinnopacity-osd.diff.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- helpers.c.orig 2019-11-19 20:02:37.851039110 +0100
|
||||||
|
+++ helpers.c 2019-11-19 20:02:03.733164221 +0100
|
||||||
|
@@ -5,9 +5,9 @@
|
||||||
|
#include <vdr/skins.h>
|
||||||
|
|
||||||
|
cOsd *CreateOsd(int Left, int Top, int Width, int Height) {
|
||||||
|
- cOsd *osd = cOsdProvider::NewOsd(Left, Top);
|
||||||
|
+ cOsd *osd = cOsdProvider::NewOsd(cOsd::OsdLeft() + Left,cOsd::OsdTop() + Top);
|
||||||
|
if (osd) {
|
||||||
|
- tArea Area = { 0, 0, Width, Height, 32 };
|
||||||
|
+ tArea Area = { 0, 0, Width - 1, Height - 1, 32 };
|
||||||
|
if (osd->SetAreas(&Area, 1) == oeOk) {
|
||||||
|
return osd;
|
||||||
|
}
|
388
po/de_DE.po
388
po/de_DE.po
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VDR \n"
|
"Project-Id-Version: VDR \n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2018-08-18 15:05+0200\n"
|
"POT-Creation-Date: 2021-12-30 10:23+0100\n"
|
||||||
"PO-Revision-Date: blabla\n"
|
"PO-Revision-Date: blabla\n"
|
||||||
"Last-Translator: blabla\n"
|
"Last-Translator: blabla\n"
|
||||||
"Language-Team: blabla\n"
|
"Language-Team: blabla\n"
|
||||||
@ -140,91 +140,6 @@ msgstr ""
|
|||||||
msgid "snd_pcm_drop(): %s\n"
|
msgid "snd_pcm_drop(): %s\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_GETOSPACE): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: write error: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: error not all bytes written\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_HALT_OUTPUT): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: error poll %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: using %sdevice '%s'\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: can't open dsp device '%s': %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(MIXER_WRITE): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: can't open mixer device '%s': %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SOUND_MIXER_READ_DEVMASK): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: channel '%s' not supported\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: channel '%s' not found\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: should not happen\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_GETODELAY): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_SETFMT): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: device doesn't support 16 bit sample format.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_CHANNELS): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: device doesn't support %d channels.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_SPEED): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: device doesn't support %dHz sample rate.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_POLICY): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: delay %ums\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "audio: can't set channels %d sample-rate %dHz\n"
|
msgid "audio: can't set channels %d sample-rate %dHz\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -251,23 +166,28 @@ msgstr ""
|
|||||||
msgid "audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"
|
msgid "audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: buggy libav, use ffmpeg\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: can't allocate vodeo decoder\n"
|
msgid "codec: can't allocate vodeo decoder\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: missing close\n"
|
msgid "codec: missing close\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
msgid " No decoder found"
|
||||||
msgid "codec: codec ID %#06x not found\n"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't allocate video codec context\n"
|
msgid "codec: can't allocate video codec context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't set options to video codec!\n"
|
msgid "codec: can't set option deint to video codec!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "codec: can't set option surfces to video codec!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "codec: can't set option drop 2.field to video codec!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "codec: can't set option drop 2.field to video codec!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't open video codec!\n"
|
msgid "codec: can't open video codec!\n"
|
||||||
@ -276,12 +196,19 @@ msgstr ""
|
|||||||
msgid "codec: can't allocate video decoder frame buffer\n"
|
msgid "codec: can't allocate video decoder frame buffer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "video: Init of YADIF Filter failed\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't allocate audio decoder\n"
|
msgid "codec: can't allocate audio decoder\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't allocate audio decoder frame buffer\n"
|
msgid "codec: can't allocate audio decoder frame buffer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "codec: codec ID %#06x not found\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec: can't allocate audio codec context\n"
|
msgid "codec: can't allocate audio codec context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -291,42 +218,9 @@ msgstr ""
|
|||||||
msgid "codec/audio: decoded data smaller than encoded\n"
|
msgid "codec/audio: decoded data smaller than encoded\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec/audio: resample setup error\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: overwrite resample\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: AvResample setup error\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: latm\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: error audio data\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: error more than one frame data\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: can't setup resample\n"
|
msgid "codec/audio: can't setup resample\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec/audio: can't open resample\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: latm\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: bad audio frame\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: error more than one frame data\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec/audio: no frame\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "A software and GPU emulated UHD device"
|
msgid "A software and GPU emulated UHD device"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -360,6 +254,9 @@ msgstr "OSD Breite"
|
|||||||
msgid "Osd height"
|
msgid "Osd height"
|
||||||
msgstr "OSD Höhe"
|
msgstr "OSD Höhe"
|
||||||
|
|
||||||
|
msgid "GPU mem used for image caching (MB)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Suspend"
|
msgid "Suspend"
|
||||||
msgstr "Unterbrechen"
|
msgstr "Unterbrechen"
|
||||||
|
|
||||||
@ -384,8 +281,8 @@ msgstr "Video Hintergrundfrabe (RGB)"
|
|||||||
msgid "Video background color (Alpha)"
|
msgid "Video background color (Alpha)"
|
||||||
msgstr "Video Hintergrundfarbe (Alpha)"
|
msgstr "Video Hintergrundfarbe (Alpha)"
|
||||||
|
|
||||||
msgid "Use studio levels (vdpau only)"
|
msgid "Use studio levels"
|
||||||
msgstr "Benutze Studio Levels (nur vdpau)"
|
msgstr ""
|
||||||
|
|
||||||
msgid "60hz display mode"
|
msgid "60hz display mode"
|
||||||
msgstr "60Hz Anzeigemodus"
|
msgstr "60Hz Anzeigemodus"
|
||||||
@ -399,8 +296,11 @@ msgstr "Schwarz während Kanalwechsel"
|
|||||||
msgid "Clear decoder on channel switch"
|
msgid "Clear decoder on channel switch"
|
||||||
msgstr "Decoder bei Kanalwechsel leeren"
|
msgstr "Decoder bei Kanalwechsel leeren"
|
||||||
|
|
||||||
msgid "Brightness (-1000..1000) (vdpau)"
|
msgid "Scaler Test"
|
||||||
msgstr "Helligkeit (-1000..1000) (vdpau)"
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Brightness (-100..100)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "min"
|
msgid "min"
|
||||||
msgstr "min"
|
msgstr "min"
|
||||||
@ -408,14 +308,29 @@ msgstr "min"
|
|||||||
msgid "max"
|
msgid "max"
|
||||||
msgstr "max"
|
msgstr "max"
|
||||||
|
|
||||||
msgid "Contrast (0..10000) (vdpau)"
|
msgid "Contrast (0..100)"
|
||||||
msgstr "Kontrast (0..10000) (vdpau)"
|
msgstr ""
|
||||||
|
|
||||||
msgid "Saturation (0..10000) (vdpau)"
|
msgid "Saturation (0..100)"
|
||||||
msgstr "Sättigung (0..10000) (vdpau)"
|
msgstr ""
|
||||||
|
|
||||||
msgid "Hue (-3141..3141) (vdpau)"
|
msgid "Gamma (0..100)"
|
||||||
msgstr "Farbton (-3141..3141) (vdpau)"
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Hue (-314..314) "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Temperature 6500K + x * 100K"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Color Blindness"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Color Correction (-100..100) "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Monitor Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Scaling"
|
msgid "Scaling"
|
||||||
msgstr "Skalierung"
|
msgstr "Skalierung"
|
||||||
@ -450,18 +365,6 @@ msgstr "Schneide oben und unten ab (Pixel)"
|
|||||||
msgid "Cut left and right (pixel)"
|
msgid "Cut left and right (pixel)"
|
||||||
msgstr "Schneide links und rechts ab (Pixel)"
|
msgstr "Schneide links und rechts ab (Pixel)"
|
||||||
|
|
||||||
msgid "Auto-crop"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Autocrop interval (frames)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Autocrop delay (n * interval)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Autocrop tolerance (pixel)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Audio"
|
msgid "Audio"
|
||||||
msgstr "Audio"
|
msgstr "Audio"
|
||||||
|
|
||||||
@ -474,6 +377,15 @@ msgstr "Audio Driftkorrektur"
|
|||||||
msgid "Pass-through default"
|
msgid "Pass-through default"
|
||||||
msgstr "Pass-Through-Standard"
|
msgstr "Pass-Through-Standard"
|
||||||
|
|
||||||
|
msgid " PCM pass-through"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid " AC-3 pass-through"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid " E-AC-3 pass-through"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Enable (E-)AC-3 (decoder) downmix"
|
msgid "Enable (E-)AC-3 (decoder) downmix"
|
||||||
msgstr "Aktiviere (E-)AC-3 (decoder) downmix"
|
msgstr "Aktiviere (E-)AC-3 (decoder) downmix"
|
||||||
|
|
||||||
@ -577,15 +489,15 @@ msgstr ""
|
|||||||
msgid "Suspend SoftHdDevice"
|
msgid "Suspend SoftHdDevice"
|
||||||
msgstr "Unterbreche SoftHdDevice"
|
msgstr "Unterbreche SoftHdDevice"
|
||||||
|
|
||||||
|
msgid "Toggle LUT on/off"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "PIP toggle on/off: off"
|
msgid "PIP toggle on/off: off"
|
||||||
msgstr "PIP deaktivieren"
|
msgstr "PIP deaktivieren"
|
||||||
|
|
||||||
msgid "PIP toggle on/off: on"
|
msgid "PIP toggle on/off: on"
|
||||||
msgstr "PIP aktivieren"
|
msgstr "PIP aktivieren"
|
||||||
|
|
||||||
msgid "PIP zapmode (not working)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "PIP channel +"
|
msgid "PIP channel +"
|
||||||
msgstr "PIP Kanal +"
|
msgstr "PIP Kanal +"
|
||||||
|
|
||||||
@ -611,6 +523,10 @@ msgstr "PIP schließen"
|
|||||||
msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)"
|
msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)"
|
||||||
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
|
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid " Video %dx%d Color: %s Gamma: %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "pass-through disabled"
|
msgid "pass-through disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -627,12 +543,6 @@ msgstr ""
|
|||||||
msgid "surround downmix disabled"
|
msgid "surround downmix disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "auto-crop disabled and freezed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "auto-crop enabled"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "[softhddev]: hot key %d is not supported\n"
|
msgid "[softhddev]: hot key %d is not supported\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -690,10 +600,6 @@ msgstr ""
|
|||||||
msgid "[softhddev] out of memory\n"
|
msgid "[softhddev] out of memory\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video: packet buffer too small for %d\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video: no empty slot in packet ringbuffer\n"
|
msgid "video: no empty slot in packet ringbuffer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -714,10 +620,6 @@ msgstr ""
|
|||||||
msgid "[softhddev] invalid video packet %d/%d bytes\n"
|
msgid "[softhddev] invalid video packet %d/%d bytes\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "[softhddev] empty video packet %d bytes\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "softhddev: %s called without hw decoder\n"
|
msgid "softhddev: %s called without hw decoder\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -728,6 +630,10 @@ msgstr ""
|
|||||||
msgid "[softhddev] no codec known for still picture\n"
|
msgid "[softhddev] no codec known for still picture\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "Too much shaders definded\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Bad formated geometry please use: [=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]\n"
|
msgid "Bad formated geometry please use: [=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -766,34 +672,24 @@ msgstr ""
|
|||||||
msgid "[softhddev] ready%s\n"
|
msgid "[softhddev] ready%s\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/glx: can't make glx context current\n"
|
msgid "video: can't lock thread\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "video: can't unlock thread\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "video/egl: GlxSetupWindow can't make egl/glx context current\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/glx: no v-sync\n"
|
msgid "video/glx: no v-sync\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "glewinit failed\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/glx: no GLX support\n"
|
msgid "video/glx: no GLX support\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/glx: glx version %d.%d\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "did not get FBconfig"
|
msgid "did not get FBconfig"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/glx: can't get a RGB visual\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/glx: no valid visual found\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/glx: need atleast 8-bits per RGB\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/glx: can't create glx context\n"
|
msgid "video/glx: can't create glx context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -815,8 +711,7 @@ msgstr ""
|
|||||||
msgid "video/glx: SGI v-sync enabled\n"
|
msgid "video/glx: SGI v-sync enabled\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
msgid "video/egl: can't create egl context\n"
|
||||||
msgid "checkCudaErrors() Driver API error = %04d"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/cuvid: surface needed not set\n"
|
msgid "video/cuvid: surface needed not set\n"
|
||||||
@ -826,88 +721,69 @@ msgstr ""
|
|||||||
msgid "video/cuvid: release surface %#08x, which is not in use\n"
|
msgid "video/cuvid: release surface %#08x, which is not in use\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Wrong ES version \n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid " Could not bind API!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Can't get EGL Extentions\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not initialize EGL.\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not create EGL Context\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not create EGL surface!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not make context current!\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/cuvid: out of decoders\n"
|
msgid "video/cuvid: out of decoders\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/cuvid: out of memory\n"
|
msgid "video/cuvid: out of memory\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/cuvid: need 1 future, 1 current, 1 back and 1 work surface\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/cuvid: decoder not in decoder list.\n"
|
msgid "video/cuvid: decoder not in decoder list.\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/glx: glx error\n"
|
msgid "video/egl: egl init error\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "video/cuvid: SDL error %d: %d\n"
|
msgid "video/cuvid: SDL error %d\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/vdpau: no valid vdpau pixfmt found\n"
|
msgid "Unable to create placebo textures"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video/vdpau: no valid profile found\n"
|
msgid "video: no valid pixfmt found\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "CUVID Init failed\n"
|
msgid "video: no valid profile found\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "CUVID Not found\n"
|
msgid "NO Format valid"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Failed rendering frame!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "video/vdpau: can't get output surface parameters: %s\n"
|
msgid "video/cuvid: output buffer full, dropping frame (%d/%d)\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
msgid "Could not dynamically load CUDA\n"
|
||||||
msgid "video/vdpau: can't render output surface: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/vdpau: video surface size mismatch\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video/vdpau: out of memory\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: unsupported rgba format %d\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: can't get video surface bits native: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: can't get video surface parameters: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: unsupported chroma type %d\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: can't get video surface bits: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: output buffer full, dropping frame (%d/%d)\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/vdpau: pixel format %d not supported\n"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Kein Cuda device gefunden"
|
msgid "Kein Cuda device gefunden"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
msgid "Failed to submit swapchain buffer\n"
|
||||||
msgid "video/cuvid: can't block queue: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/cuvid: missed frame (%d/%d)\n"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
@ -921,16 +797,31 @@ msgstr ""
|
|||||||
msgid "video/event: No symbol for %d\n"
|
msgid "video/event: No symbol for %d\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: can't lock thread\n"
|
msgid "Cant get memory for PLACEBO struct"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: can't unlock thread\n"
|
msgid "Failed initializing libplacebo\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: can't queue cancel video display thread\n"
|
msgid "Failed to create placebo opengl \n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: can't cancel video display thread\n"
|
msgid "Failed to create XCB Surface\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Failed to create Vulkan Device"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Failed creating vulkan swapchain!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "libplacebo: failed initializing swapchain\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Failed initializing libplacebo renderer\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "video/egl: can't create thread egl context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
@ -944,11 +835,11 @@ msgid "softhddev: grab unsupported\n"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "video: Can't connect to X11 server on '%s'\n"
|
msgid "video: Can't initialize X11 thread support on '%s'\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "video: Can't initialize X11 thread support on '%s'\n"
|
msgid "video: Can't connect to X11 server on '%s'\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: Can't convert XLIB display to XCB connection\n"
|
msgid "video: Can't convert XLIB display to XCB connection\n"
|
||||||
@ -964,5 +855,20 @@ msgstr ""
|
|||||||
#~ msgid "A software and GPU emulated HD device"
|
#~ msgid "A software and GPU emulated HD device"
|
||||||
#~ msgstr "Ein Software und GPU emulieres HD-Gerät"
|
#~ msgstr "Ein Software und GPU emulieres HD-Gerät"
|
||||||
|
|
||||||
|
#~ msgid "Use studio levels (vdpau only)"
|
||||||
|
#~ msgstr "Benutze Studio Levels (nur vdpau)"
|
||||||
|
|
||||||
|
#~ msgid "Brightness (-1000..1000) (vdpau)"
|
||||||
|
#~ msgstr "Helligkeit (-1000..1000) (vdpau)"
|
||||||
|
|
||||||
|
#~ msgid "Contrast (0..10000) (vdpau)"
|
||||||
|
#~ msgstr "Kontrast (0..10000) (vdpau)"
|
||||||
|
|
||||||
|
#~ msgid "Saturation (0..10000) (vdpau)"
|
||||||
|
#~ msgstr "Sättigung (0..10000) (vdpau)"
|
||||||
|
|
||||||
|
#~ msgid "Hue (-3141..3141) (vdpau)"
|
||||||
|
#~ msgstr "Farbton (-3141..3141) (vdpau)"
|
||||||
|
|
||||||
#~ msgid "SoftHdDevice"
|
#~ msgid "SoftHdDevice"
|
||||||
#~ msgstr "SoftHdDevice"
|
#~ msgstr "SoftHdDevice"
|
||||||
|
198
ringbuffer.c
198
ringbuffer.c
@ -1,29 +1,29 @@
|
|||||||
///
|
///
|
||||||
/// @file ringbuffer.c @brief Ringbuffer module
|
/// @file ringbuffer.c @brief Ringbuffer module
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009, 2011, 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009, 2011, 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: c9497b197ce7e7a6ba397944edc7ccb161152efd $
|
/// $Id: c9497b197ce7e7a6ba397944edc7ccb161152efd $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @defgroup Ringbuffer The ring buffer module.
|
/// @defgroup Ringbuffer The ring buffer module.
|
||||||
///
|
///
|
||||||
/// Lock free ring buffer with only one writer and one reader.
|
/// Lock free ring buffer with only one writer and one reader.
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -33,18 +33,17 @@
|
|||||||
#include "iatomic.h"
|
#include "iatomic.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
||||||
/// ring buffer structure
|
/// ring buffer structure
|
||||||
struct _ring_buffer_
|
struct _ring_buffer_ {
|
||||||
{
|
char *Buffer; ///< ring buffer data
|
||||||
char *Buffer; ///< ring buffer data
|
const char *BufferEnd; ///< end of buffer
|
||||||
const char *BufferEnd; ///< end of buffer
|
size_t Size; ///< bytes in buffer (for faster calc)
|
||||||
size_t Size; ///< bytes in buffer (for faster calc)
|
|
||||||
|
|
||||||
const char *ReadPointer; ///< only used by reader
|
const char *ReadPointer; ///< only used by reader
|
||||||
char *WritePointer; ///< only used by writer
|
char *WritePointer; ///< only used by writer
|
||||||
|
|
||||||
/// The only thing modified by both
|
/// The only thing modified by both
|
||||||
atomic_t Filled; ///< how many of the buffer is used
|
atomic_t Filled; ///< how many of the buffer is used
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,8 +51,7 @@ struct _ring_buffer_
|
|||||||
**
|
**
|
||||||
** @param rb Ring buffer to reset read/write pointers.
|
** @param rb Ring buffer to reset read/write pointers.
|
||||||
*/
|
*/
|
||||||
void RingBufferReset(RingBuffer * rb)
|
void RingBufferReset(RingBuffer *rb) {
|
||||||
{
|
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
atomic_set(&rb->Filled, 0);
|
atomic_set(&rb->Filled, 0);
|
||||||
@ -67,16 +65,15 @@ void RingBufferReset(RingBuffer * rb)
|
|||||||
** @returns Allocated ring buffer, must be freed with
|
** @returns Allocated ring buffer, must be freed with
|
||||||
** RingBufferDel(), NULL for out of memory.
|
** RingBufferDel(), NULL for out of memory.
|
||||||
*/
|
*/
|
||||||
RingBuffer *RingBufferNew(size_t size)
|
RingBuffer *RingBufferNew(size_t size) {
|
||||||
{
|
|
||||||
RingBuffer *rb;
|
RingBuffer *rb;
|
||||||
|
|
||||||
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
|
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
|
||||||
return rb;
|
return rb;
|
||||||
}
|
}
|
||||||
if (!(rb->Buffer = malloc(size))) { // allocate buffer
|
if (!(rb->Buffer = malloc(size))) { // allocate buffer
|
||||||
free(rb);
|
free(rb);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->Size = size;
|
rb->Size = size;
|
||||||
@ -89,8 +86,7 @@ RingBuffer *RingBufferNew(size_t size)
|
|||||||
/**
|
/**
|
||||||
** Free an allocated ring buffer.
|
** Free an allocated ring buffer.
|
||||||
*/
|
*/
|
||||||
void RingBufferDel(RingBuffer * rb)
|
void RingBufferDel(RingBuffer *rb) {
|
||||||
{
|
|
||||||
free(rb->Buffer);
|
free(rb->Buffer);
|
||||||
free(rb);
|
free(rb);
|
||||||
}
|
}
|
||||||
@ -103,26 +99,25 @@ void RingBufferDel(RingBuffer * rb)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be advanced in ring buffer.
|
** @returns Number of bytes that could be advanced in ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
|
size_t RingBufferWriteAdvance(RingBuffer *rb, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = rb->Size - atomic_read(&rb->Filled);
|
n = rb->Size - atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough space
|
if (cnt > n) { // not enough space
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
rb->WritePointer += cnt;
|
rb->WritePointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
rb->WritePointer += n;
|
rb->WritePointer += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -142,30 +137,29 @@ size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
** @returns The number of bytes that could be placed in the ring
|
** @returns The number of bytes that could be placed in the ring
|
||||||
** buffer.
|
** buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
|
size_t RingBufferWrite(RingBuffer *rb, const void *buf, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = rb->Size - atomic_read(&rb->Filled);
|
n = rb->Size - atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough space
|
if (cnt > n) { // not enough space
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
memcpy(rb->WritePointer, buf, cnt);
|
memcpy(rb->WritePointer, buf, cnt);
|
||||||
rb->WritePointer += cnt;
|
rb->WritePointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
memcpy(rb->WritePointer, buf, n);
|
memcpy(rb->WritePointer, buf, n);
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
buf += n;
|
buf += n;
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
memcpy(rb->WritePointer, buf, n);
|
memcpy(rb->WritePointer, buf, n);
|
||||||
rb->WritePointer += n;
|
rb->WritePointer += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -184,8 +178,7 @@ size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
|
|||||||
** @returns The number of bytes that could be placed in the ring
|
** @returns The number of bytes that could be placed in the ring
|
||||||
** buffer at the write pointer.
|
** buffer at the write pointer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
|
size_t RingBufferGetWritePointer(RingBuffer *rb, void **wp) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
|
||||||
@ -198,8 +191,8 @@ size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
|
|||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n <= cnt) { // reached or cross the end
|
if (n <= cnt) { // reached or cross the end
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
@ -212,26 +205,25 @@ size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be advanced in ring buffer.
|
** @returns Number of bytes that could be advanced in ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
|
size_t RingBufferReadAdvance(RingBuffer *rb, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = atomic_read(&rb->Filled);
|
n = atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough filled
|
if (cnt > n) { // not enough filled
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
rb->ReadPointer += cnt;
|
rb->ReadPointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
rb->ReadPointer += n;
|
rb->ReadPointer += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -250,30 +242,29 @@ size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be read from ring buffer.
|
** @returns Number of bytes that could be read from ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
|
size_t RingBufferRead(RingBuffer *rb, void *buf, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = atomic_read(&rb->Filled);
|
n = atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough filled
|
if (cnt > n) { // not enough filled
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
memcpy(buf, rb->ReadPointer, cnt);
|
memcpy(buf, rb->ReadPointer, cnt);
|
||||||
rb->ReadPointer += cnt;
|
rb->ReadPointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
memcpy(buf, rb->ReadPointer, n);
|
memcpy(buf, rb->ReadPointer, n);
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
buf += n;
|
buf += n;
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
memcpy(buf, rb->ReadPointer, n);
|
memcpy(buf, rb->ReadPointer, n);
|
||||||
rb->ReadPointer += n;
|
rb->ReadPointer += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -292,8 +283,7 @@ size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
|
|||||||
** @returns The number of bytes that could be read from the ring
|
** @returns The number of bytes that could be read from the ring
|
||||||
** buffer at the read pointer.
|
** buffer at the read pointer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
|
size_t RingBufferGetReadPointer(RingBuffer *rb, const void **rp) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
|
||||||
@ -306,8 +296,8 @@ size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
|
|||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n <= cnt) { // reached or cross the end
|
if (n <= cnt) { // reached or cross the end
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
@ -319,10 +309,7 @@ size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes free in buffer.
|
** @returns Number of bytes free in buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferFreeBytes(RingBuffer * rb)
|
size_t RingBufferFreeBytes(RingBuffer *rb) { return rb->Size - atomic_read(&rb->Filled); }
|
||||||
{
|
|
||||||
return rb->Size - atomic_read(&rb->Filled);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Get used bytes in ring buffer.
|
** Get used bytes in ring buffer.
|
||||||
@ -331,7 +318,4 @@ size_t RingBufferFreeBytes(RingBuffer * rb)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes used in buffer.
|
** @returns Number of bytes used in buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferUsedBytes(RingBuffer * rb)
|
size_t RingBufferUsedBytes(RingBuffer *rb) { return atomic_read(&rb->Filled); }
|
||||||
{
|
|
||||||
return atomic_read(&rb->Filled);
|
|
||||||
}
|
|
||||||
|
50
ringbuffer.h
50
ringbuffer.h
@ -1,62 +1,62 @@
|
|||||||
///
|
///
|
||||||
/// @file ringbuffer.h @brief Ringbuffer module header file
|
/// @file ringbuffer.h @brief Ringbuffer module header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009, 2011 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009, 2011 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: 8a2b4c171f1024afb8b8a7a7add631b7ebe2d45e $
|
/// $Id: 8a2b4c171f1024afb8b8a7a7add631b7ebe2d45e $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup Ringbuffer
|
/// @addtogroup Ringbuffer
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// ring buffer typedef
|
/// ring buffer typedef
|
||||||
typedef struct _ring_buffer_ RingBuffer;
|
typedef struct _ring_buffer_ RingBuffer;
|
||||||
|
|
||||||
/// reset ring buffer pointers
|
/// reset ring buffer pointers
|
||||||
extern void RingBufferReset(RingBuffer *);
|
extern void RingBufferReset(RingBuffer *);
|
||||||
|
|
||||||
/// create new ring buffer
|
/// create new ring buffer
|
||||||
extern RingBuffer *RingBufferNew(size_t);
|
extern RingBuffer *RingBufferNew(size_t);
|
||||||
|
|
||||||
/// free ring buffer
|
/// free ring buffer
|
||||||
extern void RingBufferDel(RingBuffer *);
|
extern void RingBufferDel(RingBuffer *);
|
||||||
|
|
||||||
/// write into ring buffer
|
/// write into ring buffer
|
||||||
extern size_t RingBufferWrite(RingBuffer *, const void *, size_t);
|
extern size_t RingBufferWrite(RingBuffer *, const void *, size_t);
|
||||||
|
|
||||||
/// get write pointer of ring buffer
|
/// get write pointer of ring buffer
|
||||||
extern size_t RingBufferGetWritePointer(RingBuffer *, void **);
|
extern size_t RingBufferGetWritePointer(RingBuffer *, void **);
|
||||||
|
|
||||||
/// advance write pointer of ring buffer
|
/// advance write pointer of ring buffer
|
||||||
extern size_t RingBufferWriteAdvance(RingBuffer *, size_t);
|
extern size_t RingBufferWriteAdvance(RingBuffer *, size_t);
|
||||||
|
|
||||||
/// read from ring buffer
|
/// read from ring buffer
|
||||||
extern size_t RingBufferRead(RingBuffer *, void *, size_t);
|
extern size_t RingBufferRead(RingBuffer *, void *, size_t);
|
||||||
|
|
||||||
/// get read pointer of ring buffer
|
/// get read pointer of ring buffer
|
||||||
extern size_t RingBufferGetReadPointer(RingBuffer *, const void **);
|
extern size_t RingBufferGetReadPointer(RingBuffer *, const void **);
|
||||||
|
|
||||||
/// advance read pointer of ring buffer
|
/// advance read pointer of ring buffer
|
||||||
extern size_t RingBufferReadAdvance(RingBuffer *, size_t);
|
extern size_t RingBufferReadAdvance(RingBuffer *, size_t);
|
||||||
|
|
||||||
/// free bytes ring buffer
|
/// free bytes ring buffer
|
||||||
extern size_t RingBufferFreeBytes(RingBuffer *);
|
extern size_t RingBufferFreeBytes(RingBuffer *);
|
||||||
|
|
||||||
/// used bytes ring buffer
|
/// used bytes ring buffer
|
||||||
extern size_t RingBufferUsedBytes(RingBuffer *);
|
extern size_t RingBufferUsedBytes(RingBuffer *);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
819
shaders.h
819
shaders.h
@ -1,369 +1,450 @@
|
|||||||
|
// shader
|
||||||
// shader
|
#define SHADER_LENGTH 10000
|
||||||
|
|
||||||
char vertex[] = {"\
|
#ifdef CUVID
|
||||||
#version 330\n\
|
const char *gl_version = "#version 330";
|
||||||
in vec2 vertex_position;\n\
|
#else
|
||||||
in vec2 vertex_texcoord0;\n\
|
const char *gl_version = "#version 300 es ";
|
||||||
out vec2 texcoord0;\n\
|
#endif
|
||||||
in vec2 vertex_texcoord1;\n\
|
|
||||||
out vec2 texcoord1;\n\
|
/* Color conversion matrix: RGB = m * YUV + c
|
||||||
in vec2 vertex_texcoord2;\n\
|
* m is in row-major matrix, with m[row][col], e.g.:
|
||||||
out vec2 texcoord2;\n\
|
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
|
||||||
in vec2 vertex_texcoord3;\n\
|
* [ a21 a22 a23 ] { a21, a22, a23 },
|
||||||
out vec2 texcoord3;\n\
|
* [ a31 a32 a33 ] { a31, a32, a33 } };
|
||||||
in vec2 vertex_texcoord4;\n\
|
* This is accessed as e.g.: m[2-1][1-1] = a21
|
||||||
out vec2 texcoord4;\n\
|
* In particular, each row contains all the coefficients for one of R, G, B,
|
||||||
in vec2 vertex_texcoord5;\n\
|
* while each column contains all the coefficients for one of Y, U, V:
|
||||||
out vec2 texcoord5;\n\
|
* m[r,g,b][y,u,v] = ...
|
||||||
void main() {\n\
|
* The matrix could also be viewed as group of 3 vectors, e.g. the 1st column
|
||||||
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
|
* is the Y vector (1, 1, 1), the 2nd is the U vector, the 3rd the V vector.
|
||||||
texcoord0 = vertex_texcoord0;\n\
|
* The matrix might also be used for other conversions and colorspaces.
|
||||||
texcoord1 = vertex_texcoord1;\n\
|
*/
|
||||||
texcoord2 = vertex_texcoord2;\n\
|
struct mp_cmat {
|
||||||
texcoord3 = vertex_texcoord3;\n\
|
GLfloat m[3][3]; // colormatrix
|
||||||
texcoord4 = vertex_texcoord4;\n\
|
GLfloat c[3]; // colormatrix_c
|
||||||
texcoord5 = vertex_texcoord5;\n\
|
};
|
||||||
}\n"};
|
|
||||||
|
struct mp_mat {
|
||||||
|
GLfloat m[3][3];
|
||||||
char fragment[] = {"\
|
};
|
||||||
#version 330\n\
|
|
||||||
#define texture1D texture\n\
|
// YUV input limited range (16-235 for luma, 16-240 for chroma)
|
||||||
#define texture3D texture\n\
|
// ITU-R BT.601 (SD)
|
||||||
layout(location = 0) out vec4 out_color;\n\
|
struct mp_cmat yuv_bt601 = {
|
||||||
in vec2 texcoord0;\n\
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.391762, 2.017232}, {1.596027, -0.812968, 0.000000}},
|
||||||
in vec2 texcoord1;\n\
|
{-0.874202, 0.531668, -1.085631}};
|
||||||
in vec2 texcoord2;\n\
|
|
||||||
in vec2 texcoord3;\n\
|
// ITU-R BT.709 (HD)
|
||||||
in vec2 texcoord4;\n\
|
struct mp_cmat yuv_bt709 = {
|
||||||
in vec2 texcoord5;\n\
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.213249, 2.112402}, {1.792741, -0.532909, 0.000000}},
|
||||||
uniform mat3 colormatrix;\n\
|
{-0.972945, 0.301483, -1.133402}};
|
||||||
uniform vec3 colormatrix_c;\n\
|
|
||||||
uniform sampler2D texture0;\n\
|
// ITU-R BT.2020 non-constant luminance system
|
||||||
//uniform vec2 texture_size0;\n\
|
struct mp_cmat yuv_bt2020ncl = {
|
||||||
//uniform mat2 texture_rot0;\n\
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.187326, 2.141772}, {1.678674, -0.650424, 0.000000}},
|
||||||
//uniform vec2 pixel_size0;\n\
|
{-0.915688, 0.347459, -1.148145}};
|
||||||
uniform sampler2D texture1;\n\
|
|
||||||
//uniform vec2 texture_size1;\n\
|
// ITU-R BT.2020 constant luminance system
|
||||||
//uniform mat2 texture_rot1;\n\
|
struct mp_cmat yuv_bt2020cl = {
|
||||||
//uniform vec2 pixel_size1;\n\
|
{{0.0000, 1.164384, 0.000000}, {0.00000, 0.000000, 1.138393}, {1.138393, 0.000000, 0.000000}},
|
||||||
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
|
{-0.571429, -0.073059, -0.571429}};
|
||||||
void main() {\n\
|
|
||||||
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
|
float cms_matrix[3][3] = {
|
||||||
color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;\n\
|
{1.660497, -0.124547, -0.018154}, {-0.587657, 1.132895, -0.100597}, {-0.072840, -0.008348, 1.118751}};
|
||||||
color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;\n\
|
|
||||||
// color conversion\n\
|
// Common constants for SMPTE ST.2084 (PQ)
|
||||||
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
|
static const float PQ_M1 = 2610. / 4096 * 1. / 4, PQ_M2 = 2523. / 4096 * 128, PQ_C1 = 3424. / 4096,
|
||||||
color.a = 1.0;\n\
|
PQ_C2 = 2413. / 4096 * 32, PQ_C3 = 2392. / 4096 * 32;
|
||||||
// color mapping\n\
|
|
||||||
out_color = color;\n\
|
// Common constants for ARIB STD-B67 (HLG)
|
||||||
}\n"};
|
static const float HLG_A = 0.17883277, HLG_B = 0.28466892, HLG_C = 0.55991073;
|
||||||
|
|
||||||
char fragment_bt2100[] = {"\
|
struct gl_vao_entry {
|
||||||
#version 330\n\
|
// used for shader / glBindAttribLocation
|
||||||
#define texture1D texture\n\
|
const char *name;
|
||||||
#define texture3D texture\n\
|
// glVertexAttribPointer() arguments
|
||||||
layout(location = 0) out vec4 out_color;\n\
|
int num_elems; // size (number of elements)
|
||||||
in vec2 texcoord0;\n\
|
GLenum type;
|
||||||
in vec2 texcoord1;\n\
|
bool normalized;
|
||||||
in vec2 texcoord2;\n\
|
int offset;
|
||||||
in vec2 texcoord3;\n\
|
};
|
||||||
in vec2 texcoord4;\n\
|
|
||||||
in vec2 texcoord5;\n\
|
struct vertex_pt {
|
||||||
uniform mat3 colormatrix;\n\
|
float x, y;
|
||||||
uniform vec3 colormatrix_c;\n\
|
};
|
||||||
uniform mat3 cms_matrix;\n\
|
|
||||||
uniform sampler2D texture0;\n\
|
struct vertex_pi {
|
||||||
//uniform vec2 texture_size0;\n\
|
GLint x, y;
|
||||||
//uniform mat2 texture_rot0;\n\
|
};
|
||||||
//uniform vec2 pixel_size0;\n\
|
|
||||||
uniform sampler2D texture1;\n\
|
#define TEXUNIT_VIDEO_NUM 6
|
||||||
//uniform vec2 texture_size1;\n\
|
|
||||||
//uniform mat2 texture_rot1;\n\
|
struct vertex {
|
||||||
//uniform vec2 pixel_size1;\n\
|
struct vertex_pt position;
|
||||||
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
|
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
||||||
void main() {\n\
|
};
|
||||||
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
|
|
||||||
color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;\n\
|
static const struct gl_vao_entry vertex_vao[] = {
|
||||||
color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n\
|
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
|
||||||
// color conversion\n\
|
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
|
||||||
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
|
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
|
||||||
color.a = 1.0;\n\
|
{0}};
|
||||||
// color mapping\n\
|
|
||||||
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
|
#define GLSL(...) pl_shader_append(__VA_ARGS__)
|
||||||
color.rgb = pow(color.rgb, vec3(2.4));\n\
|
#define GLSLV(...) pl_shader_append_v(__VA_ARGS__)
|
||||||
color.rgb = cms_matrix * color.rgb;\n\
|
|
||||||
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
|
char sh[SHADER_LENGTH];
|
||||||
color.rgb = pow(color.rgb, vec3(1.0/2.4));\n\
|
char shv[SHADER_LENGTH];
|
||||||
out_color = color;\n\
|
|
||||||
}\n"};
|
void GL_init() { sh[0] = 0; }
|
||||||
|
|
||||||
/* Color conversion matrix: RGB = m * YUV + c
|
void GLV_init() { shv[0] = 0; }
|
||||||
* m is in row-major matrix, with m[row][col], e.g.:
|
|
||||||
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
|
void pl_shader_append(const char *fmt, ...) {
|
||||||
* [ a21 a22 a23 ] { a21, a22, a23 },
|
char temp[1000];
|
||||||
* [ a31 a32 a33 ] { a31, a32, a33 } };
|
va_list ap;
|
||||||
* This is accessed as e.g.: m[2-1][1-1] = a21
|
|
||||||
* In particular, each row contains all the coefficients for one of R, G, B,
|
va_start(ap, fmt);
|
||||||
* while each column contains all the coefficients for one of Y, U, V:
|
vsprintf(temp, fmt, ap);
|
||||||
* m[r,g,b][y,u,v] = ...
|
va_end(ap);
|
||||||
* The matrix could also be viewed as group of 3 vectors, e.g. the 1st column
|
|
||||||
* is the Y vector (1, 1, 1), the 2nd is the U vector, the 3rd the V vector.
|
if (strlen(sh) + strlen(temp) > SHADER_LENGTH)
|
||||||
* The matrix might also be used for other conversions and colorspaces.
|
Fatal(_("Shaderlenght fault\n"));
|
||||||
*/
|
strcat(sh, temp);
|
||||||
struct mp_cmat {
|
}
|
||||||
float m[3][3]; // colormatrix
|
|
||||||
float c[3]; //colormatrix_c
|
void pl_shader_append_v(const char *fmt, ...) {
|
||||||
};
|
char temp[1000];
|
||||||
|
va_list ap;
|
||||||
struct mp_mat {
|
|
||||||
float m[3][3];
|
va_start(ap, fmt);
|
||||||
};
|
vsprintf(temp, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
// YUV input limited range (16-235 for luma, 16-240 for chroma)
|
|
||||||
// ITU-R BT.601 (SD)
|
if (strlen(shv) + strlen(temp) > SHADER_LENGTH)
|
||||||
struct mp_cmat yuv_bt601 = {\
|
Fatal(_("Shaderlenght fault\n"));
|
||||||
{{ 1.164384, 1.164384, 1.164384 },\
|
strcat(shv, temp);
|
||||||
{ 0.00000, -0.391762, 2.017232 },\
|
}
|
||||||
{ 1.596027, -0.812968 , 0.000000 }},\
|
#ifndef PLACEBO
|
||||||
{-0.874202, 0.531668, -1.085631 } };
|
static void compile_attach_shader(GLuint program, GLenum type, const char *source) {
|
||||||
|
GLuint shader;
|
||||||
// ITU-R BT.709 (HD)
|
GLint status = 1234, log_length;
|
||||||
struct mp_cmat yuv_bt709 = {\
|
char log[4000];
|
||||||
{{ 1.164384, 1.164384, 1.164384 },\
|
GLsizei len;
|
||||||
{ 0.00000, -0.213249, 2.112402 },\
|
|
||||||
{ 1.792741, -0.532909 , 0.000000 }},\
|
shader = glCreateShader(type);
|
||||||
{-0.972945, 0.301483, -1.133402 } };
|
glShaderSource(shader, 1, (const GLchar **)&source, NULL); // &buffer, NULL);
|
||||||
|
glCompileShader(shader);
|
||||||
// ITU-R BT.2020 non-constant luminance system
|
status = 0;
|
||||||
struct mp_cmat yuv_bt2020ncl = {\
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||||
{{ 1.164384, 1.164384, 1.164384 },\
|
log_length = 0;
|
||||||
{ 0.00000, -0.187326, 2.141772 },\
|
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
{ 1.678674, -0.650424 , 0.000000 }},\
|
glGetShaderInfoLog(shader, 4000, &len, log);
|
||||||
{-0.915688, 0.347459, -1.148145 } };
|
GlxCheck();
|
||||||
|
Debug(3, "compile Status %d loglen %d >%s<\n", status, log_length, log);
|
||||||
// ITU-R BT.2020 constant luminance system
|
|
||||||
struct mp_cmat yuv_bt2020cl = {\
|
glAttachShader(program, shader);
|
||||||
{{ 0.0000, 1.164384, 0.000000 },\
|
glDeleteShader(shader);
|
||||||
{ 0.00000, 0.000000, 1.138393 },\
|
}
|
||||||
{ 1.138393, 0.000000 , 0.000000 }},\
|
|
||||||
{-0.571429, -0.073059, -0.571429 } };
|
static void link_shader(GLuint program) {
|
||||||
|
GLint status, log_length;
|
||||||
float cms_matrix[3][3] = \
|
|
||||||
{{ 1.660497, -0.124547, -0.018154},\
|
glLinkProgram(program);
|
||||||
{-0.587657, 1.132895, -0.100597},\
|
status = 0;
|
||||||
{-0.072840, -0.008348, 1.118751}};
|
glGetProgramiv(program, GL_LINK_STATUS, &status);
|
||||||
|
log_length = 0;
|
||||||
struct gl_vao_entry {
|
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
// used for shader / glBindAttribLocation
|
Debug(3, "Link Status %d loglen %d\n", status, log_length);
|
||||||
const char *name;
|
}
|
||||||
// glVertexAttribPointer() arguments
|
|
||||||
int num_elems; // size (number of elements)
|
|
||||||
GLenum type;
|
static GLuint sc_generate_osd(GLuint gl_prog) {
|
||||||
bool normalized;
|
|
||||||
int offset;
|
Debug(3, "vor create osd\n");
|
||||||
};
|
gl_prog = glCreateProgram();
|
||||||
|
|
||||||
struct vertex_pt {
|
GL_init();
|
||||||
float x, y;
|
GLSL("%s\n", gl_version);
|
||||||
};
|
GLSL("in vec2 vertex_position;\n");
|
||||||
|
GLSL("in vec2 vertex_texcoord0;\n");
|
||||||
struct vertex_pi {
|
GLSL("out vec2 texcoord0;\n");
|
||||||
GLint x, y;
|
GLSL("void main() {\n");
|
||||||
};
|
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
||||||
|
GLSL("texcoord0 = vertex_texcoord0;\n");
|
||||||
#define TEXUNIT_VIDEO_NUM 6
|
GLSL("}\n");
|
||||||
|
|
||||||
|
Debug(3, "vor compile vertex osd\n");
|
||||||
struct vertex {
|
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh); // vertex_osd);
|
||||||
struct vertex_pt position;
|
GL_init();
|
||||||
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
GLSL("%s\n", gl_version);
|
||||||
};
|
GLSL("#define texture1D texture\n");
|
||||||
|
GLSL("precision mediump float; \n");
|
||||||
static const struct gl_vao_entry vertex_vao[] = {
|
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||||
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
|
GLSL("in vec2 texcoord0;\n");
|
||||||
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
|
GLSL("uniform sampler2D texture0;\n");
|
||||||
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
|
GLSL("void main() {\n");
|
||||||
{"texcoord2", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[2])},
|
GLSL("vec4 color; \n");
|
||||||
{"texcoord3", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[3])},
|
GLSL("color = vec4(texture(texture0, texcoord0));\n");
|
||||||
{"texcoord4", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[4])},
|
#ifdef GAMMA
|
||||||
{"texcoord5", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[5])},
|
GLSL("// delinearize gamma \n");
|
||||||
{0}
|
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // delinearize gamma
|
||||||
};
|
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
|
#endif
|
||||||
|
GLSL("out_color = color;\n");
|
||||||
static void compile_attach_shader(GLuint program,
|
GLSL("}\n");
|
||||||
GLenum type, const char *source)
|
Debug(3, "vor compile fragment osd \n");
|
||||||
{
|
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh); // fragment_osd);
|
||||||
GLuint shader;
|
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
||||||
GLint status, log_length;
|
glBindAttribLocation(gl_prog, 1, "vertex_texcoord0");
|
||||||
|
|
||||||
shader = glCreateShader(type);
|
link_shader(gl_prog);
|
||||||
glShaderSource(shader, 1, &source, NULL);
|
|
||||||
glCompileShader(shader);
|
return gl_prog;
|
||||||
status = 0;
|
}
|
||||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
|
||||||
log_length = 0;
|
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
||||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
|
|
||||||
Debug(3,"compile Status %d loglen %d\n",status,log_length);
|
char vname[80];
|
||||||
|
int n;
|
||||||
GlxCheck();
|
GLint cmsLoc;
|
||||||
glAttachShader(program, shader);
|
float *m, *c, *cms;
|
||||||
glDeleteShader(shader);
|
//char *frag;
|
||||||
}
|
|
||||||
|
GL_init();
|
||||||
static void link_shader(GLuint program)
|
GLSL("%s\n", gl_version);
|
||||||
{
|
GLSL("in vec2 vertex_position; \n");
|
||||||
GLint status,log_length;
|
GLSL("in vec2 vertex_texcoord0; \n");
|
||||||
|
GLSL("out vec2 texcoord0; \n");
|
||||||
glLinkProgram(program);
|
GLSL("in vec2 vertex_texcoord1; \n");
|
||||||
status = 0;
|
GLSL("out vec2 texcoord1; \n");
|
||||||
glGetProgramiv(program, GL_LINK_STATUS, &status);
|
if (Planes == 3) {
|
||||||
log_length = 0;
|
GLSL("in vec2 vertex_texcoord2; \n");
|
||||||
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
|
GLSL("out vec2 texcoord2; \n");
|
||||||
Debug(3,"Link Status %d loglen %d\n",status,log_length);
|
}
|
||||||
|
GLSL("void main() { \n");
|
||||||
|
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
||||||
}
|
GLSL("texcoord0 = vertex_texcoord0; \n");
|
||||||
|
GLSL("texcoord1 = vertex_texcoord1; \n");
|
||||||
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
if (Planes == 3) {
|
||||||
|
GLSL("texcoord2 = vertex_texcoord1; \n"); // texcoord1 ist hier richtig
|
||||||
char vname[80];
|
}
|
||||||
int n;
|
GLSL("} \n");
|
||||||
GLint cmsLoc;
|
|
||||||
float *m,*c,*cms;
|
Debug(3, "vor create\n");
|
||||||
char *frag;
|
gl_prog = glCreateProgram();
|
||||||
|
Debug(3, "vor compile vertex\n");
|
||||||
switch (colorspace) {
|
// printf("%s",sh);
|
||||||
case AVCOL_SPC_RGB:
|
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh);
|
||||||
m = &yuv_bt601.m[0][0];
|
|
||||||
c = &yuv_bt601.c[0];
|
switch (colorspace) {
|
||||||
frag = fragment;
|
case AVCOL_SPC_RGB:
|
||||||
Debug(3,"BT601 Colorspace used\n");
|
case AVCOL_SPC_BT470BG:
|
||||||
break;
|
m = &yuv_bt601.m[0][0];
|
||||||
case AVCOL_SPC_BT709:
|
c = &yuv_bt601.c[0];
|
||||||
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
|
Debug(3, "BT601 Colorspace used\n");
|
||||||
m = &yuv_bt709.m[0][0];
|
break;
|
||||||
c = &yuv_bt709.c[0];
|
case AVCOL_SPC_BT709:
|
||||||
frag = fragment;
|
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
|
||||||
Debug(3,"BT709 Colorspace used\n");
|
m = &yuv_bt709.m[0][0];
|
||||||
break;
|
c = &yuv_bt709.c[0];
|
||||||
case AVCOL_SPC_BT2020_NCL:
|
Debug(3, "BT709 Colorspace used\n");
|
||||||
m = &yuv_bt2020ncl.m[0][0];
|
break;
|
||||||
c = &yuv_bt2020ncl.c[0];
|
case AVCOL_SPC_BT2020_NCL:
|
||||||
cms = &cms_matrix[0][0];
|
m = &yuv_bt2020ncl.m[0][0];
|
||||||
frag = fragment_bt2100;
|
c = &yuv_bt2020ncl.c[0];
|
||||||
Debug(3,"BT2020NCL Colorspace used\n");
|
cms = &cms_matrix[0][0];
|
||||||
break;
|
Debug(3, "BT2020NCL Colorspace used\n");
|
||||||
default: // fallback
|
break;
|
||||||
m = &yuv_bt709.m[0][0];
|
default: // fallback
|
||||||
c = &yuv_bt709.c[0];
|
m = &yuv_bt709.m[0][0];
|
||||||
frag = fragment;
|
c = &yuv_bt709.c[0];
|
||||||
Debug(3,"default BT709 Colorspace used %d\n",colorspace);
|
Debug(3, "default BT709 Colorspace used %d\n", colorspace);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug(3,"vor create\n");
|
GL_init();
|
||||||
gl_prog = glCreateProgram();
|
|
||||||
Debug(3,"vor compile vertex\n");
|
GLSL("%s\n", gl_version);
|
||||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, vertex);
|
GLSL("precision mediump float; \n");
|
||||||
Debug(3,"vor compile fragment\n");
|
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||||
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, frag);
|
GLSL("in vec2 texcoord0; \n");
|
||||||
glBindAttribLocation(gl_prog,0,"vertex_position");
|
GLSL("in vec2 texcoord1; \n");
|
||||||
|
if (Planes == 3)
|
||||||
for (n=0;n<6;n++) {
|
GLSL("in vec2 texcoord2; \n");
|
||||||
sprintf(vname,"vertex_texcoord%1d",n);
|
GLSL("uniform mat3 colormatrix; \n");
|
||||||
glBindAttribLocation(gl_prog,n+1,vname);
|
GLSL("uniform vec3 colormatrix_c; \n");
|
||||||
}
|
if (colorspace == AVCOL_SPC_BT2020_NCL)
|
||||||
|
GLSL("uniform mat3 cms_matrix;\n");
|
||||||
link_shader(gl_prog);
|
GLSL("uniform sampler2D texture0; \n");
|
||||||
|
GLSL("uniform sampler2D texture1; \n");
|
||||||
gl_colormatrix = glGetUniformLocation(gl_prog,"colormatrix");
|
if (Planes == 3)
|
||||||
Debug(3,"get uniform colormatrix %d \n",gl_colormatrix);
|
GLSL("uniform sampler2D texture2; \n");
|
||||||
if (gl_colormatrix != -1)
|
GLSL("void main() { \n");
|
||||||
glProgramUniformMatrix3fv(gl_prog,gl_colormatrix,1,0,m);
|
GLSL("vec4 color; \n");
|
||||||
GlxCheck();
|
|
||||||
//glProgramUniform3fv(gl_prog,gl_colormatrix,3,&yuv_bt709.m[0][0]);
|
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
||||||
gl_colormatrix_c = glGetUniformLocation(gl_prog,"colormatrix_c");
|
GLSL("color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||||
Debug(3,"get uniform colormatrix_c %d %f\n",gl_colormatrix_c,*c);
|
if (Planes == 3) {
|
||||||
if (gl_colormatrix_c != -1)
|
GLSL("color.g = 1.003906 * vec4(texture(texture1, texcoord1)).r; \n");
|
||||||
glProgramUniform3fv(gl_prog,gl_colormatrix_c,1,c);
|
GLSL("color.b = 1.003906 * vec4(texture(texture2, texcoord2)).r; \n");
|
||||||
GlxCheck();
|
} else {
|
||||||
|
GLSL("color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n");
|
||||||
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
}
|
||||||
cmsLoc = glGetUniformLocation(gl_prog,"cms_matrix");
|
GLSL("// color conversion\n");
|
||||||
if (cmsLoc != -1)
|
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; "
|
||||||
glProgramUniformMatrix3fv(gl_prog,cmsLoc,1,0,cms);
|
"\n");
|
||||||
GlxCheck();
|
GLSL("color.a = 1.0; \n");
|
||||||
}
|
|
||||||
|
GLSL("// pl_shader_linearize \n");
|
||||||
return gl_prog;
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
}
|
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
||||||
|
// GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
static void render_pass_quad(int flip, float xcrop, float ycrop)
|
// GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb -
|
||||||
{
|
// vec3(%f)) * vec3(1.0/%f)) + vec3(%f) ,
|
||||||
struct vertex va[4];
|
// bvec3(lessThan(vec3(0.5), color.rgb)));\n",HLG_C, HLG_A, HLG_B);
|
||||||
int n;
|
GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - "
|
||||||
const struct gl_vao_entry *e;
|
"vec3(0.55991073)) * vec3(1.0/0.17883277)) + vec3(0.28466892), "
|
||||||
// uhhhh what a hack
|
"bvec3(lessThan(vec3(0.5), color.rgb)));\n");
|
||||||
if (!flip ) {
|
GLSL("color.rgb *= vec3(1.0/3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
||||||
va[0].position.x = (float) -1.0;
|
GLSL("// color mapping \n");
|
||||||
va[0].position.y = (float) 1.0;
|
GLSL("color.rgb = cms_matrix * color.rgb; \n");
|
||||||
va[1].position.x = (float) -1.0;
|
#ifndef GAMMA
|
||||||
va[1].position.y = (float) -1.0;
|
GLSL("// pl_shader_delinearize \n");
|
||||||
va[2].position.x = (float) 1.0;
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
va[2].position.y = (float) 1.0;
|
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
||||||
va[3].position.x = (float) 1.0;
|
// GLSL("color.rgb = pow(color.rgb, vec3(1.0/2.4)); \n");
|
||||||
va[3].position.y = (float) -1.0;
|
GLSL("color.rgb *= vec3(3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
||||||
} else {
|
GLSL("color.rgb = mix(vec3(0.5) * sqrt(color.rgb), vec3(0.17883277) * "
|
||||||
va[0].position.x = (float) -1.0;
|
"log(color.rgb - vec3(0.28466892)) + vec3(0.55991073), "
|
||||||
va[0].position.y = (float) -1.0;
|
"bvec3(lessThan(vec3(1.0), color.rgb))); \n");
|
||||||
va[1].position.x = (float) -1.0;
|
|
||||||
va[1].position.y = (float) 1.0;
|
#endif
|
||||||
va[2].position.x = (float) 1.0;
|
GLSL("out_color = color; \n");
|
||||||
va[2].position.y = (float) -1.0;
|
GLSL("} \n");
|
||||||
va[3].position.x = (float) 1.0;
|
} else {
|
||||||
va[3].position.y = (float) 1.0;
|
|
||||||
}
|
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||||
|
if (Planes == 3) {
|
||||||
va[0].texcoord[0].x = (float) 0.0 + xcrop;
|
GLSL("color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;\n");
|
||||||
va[0].texcoord[0].y = (float) 0.0 + ycrop; // abgeschnitten von links oben
|
GLSL("color.b = 1.000000 * vec4(texture(texture2, texcoord2)).r;\n");
|
||||||
va[0].texcoord[1].x = (float) 0.0 + xcrop;
|
} else {
|
||||||
va[0].texcoord[1].y = (float) 0.0 + ycrop; // abgeschnitten von links oben
|
GLSL("color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg; \n");
|
||||||
va[1].texcoord[0].x = (float) 0.0 + xcrop;
|
}
|
||||||
va[1].texcoord[0].y = (float) 1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
GLSL("// color conversion \n");
|
||||||
va[1].texcoord[1].x = (float) 0.0 + xcrop;
|
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||||
va[1].texcoord[1].y = (float) 1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
GLSL("color.a = 1.0; \n");
|
||||||
va[2].texcoord[0].x = (float) 1.0 - xcrop;
|
|
||||||
va[2].texcoord[0].y = (float) 0.0 + ycrop; // abgeschnitten von rechts oben
|
GLSL("// linearize gamma \n");
|
||||||
va[2].texcoord[1].x = (float) 1.0 - xcrop;
|
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
|
||||||
va[2].texcoord[1].y = (float) 0.0 + ycrop; // abgeschnitten von rechts oben
|
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
va[3].texcoord[0].x = (float) 1.0 - xcrop;
|
#ifndef GAMMA
|
||||||
va[3].texcoord[0].y = (float) 1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
GLSL("// delinearize gamma to sRGB \n");
|
||||||
va[3].texcoord[1].x = (float) 1.0 - xcrop;
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
va[3].texcoord[1].y = (float) 1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
GLSL("color.rgb = mix(color.rgb * vec3(12.92), vec3(1.055) * "
|
||||||
|
"pow(color.rgb, vec3(1.0/2.4)) - vec3(0.055), "
|
||||||
|
"bvec3(lessThanEqual(vec3(0.0031308), color.rgb))); \n");
|
||||||
|
#endif
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
GLSL("// color mapping \n");
|
||||||
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
GLSL("out_color = color; \n");
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
GLSL("} \n");
|
||||||
|
}
|
||||||
// enable attribs
|
// printf(">%s<",sh);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
Debug(3, "vor compile fragment\n");
|
||||||
for ( n = 0; vertex_vao[n].name; n++) {
|
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh);
|
||||||
e = &vertex_vao[n];
|
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
||||||
glEnableVertexAttribArray(n);
|
|
||||||
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized,
|
for (n = 0; n < 6; n++) {
|
||||||
sizeof(struct vertex), (void *)(intptr_t)e->offset);
|
sprintf(vname, "vertex_texcoord%1d", n);
|
||||||
}
|
glBindAttribLocation(gl_prog, n + 1, vname);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
}
|
||||||
|
|
||||||
// draw quad
|
link_shader(gl_prog);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
||||||
for ( n = 0; vertex_vao[n].name; n++)
|
gl_colormatrix = glGetUniformLocation(gl_prog, "colormatrix");
|
||||||
glDisableVertexAttribArray(n);
|
Debug(3, "get uniform colormatrix %d \n", gl_colormatrix);
|
||||||
}
|
if (gl_colormatrix != -1)
|
||||||
|
glProgramUniformMatrix3fv(gl_prog, gl_colormatrix, 1, 0, m);
|
||||||
|
GlxCheck();
|
||||||
|
Debug(3, "nach set colormatrix\n");
|
||||||
|
|
||||||
|
gl_colormatrix_c = glGetUniformLocation(gl_prog, "colormatrix_c");
|
||||||
|
Debug(3, "get uniform colormatrix_c %d %f\n", gl_colormatrix_c, *c);
|
||||||
|
if (gl_colormatrix_c != -1)
|
||||||
|
glProgramUniform3fv(gl_prog, gl_colormatrix_c, 1, c);
|
||||||
|
GlxCheck();
|
||||||
|
|
||||||
|
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
||||||
|
cmsLoc = glGetUniformLocation(gl_prog, "cms_matrix");
|
||||||
|
if (cmsLoc != -1)
|
||||||
|
glProgramUniformMatrix3fv(gl_prog, cmsLoc, 1, 0, cms);
|
||||||
|
GlxCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
return gl_prog;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_pass_quad(int flip, float xcrop, float ycrop) {
|
||||||
|
struct vertex va[4];
|
||||||
|
int n;
|
||||||
|
const struct gl_vao_entry *e;
|
||||||
|
|
||||||
|
// uhhhh what a hack
|
||||||
|
if (!flip) {
|
||||||
|
va[0].position.x = (float)-1.0;
|
||||||
|
va[0].position.y = (float)1.0;
|
||||||
|
va[1].position.x = (float)-1.0;
|
||||||
|
va[1].position.y = (float)-1.0;
|
||||||
|
va[2].position.x = (float)1.0;
|
||||||
|
va[2].position.y = (float)1.0;
|
||||||
|
va[3].position.x = (float)1.0;
|
||||||
|
va[3].position.y = (float)-1.0;
|
||||||
|
} else {
|
||||||
|
va[0].position.x = (float)-1.0;
|
||||||
|
va[0].position.y = (float)-1.0;
|
||||||
|
va[1].position.x = (float)-1.0;
|
||||||
|
va[1].position.y = (float)1.0;
|
||||||
|
va[2].position.x = (float)1.0;
|
||||||
|
va[2].position.y = (float)-1.0;
|
||||||
|
va[3].position.x = (float)1.0;
|
||||||
|
va[3].position.y = (float)1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
va[0].texcoord[0].x = (float)0.0 + xcrop;
|
||||||
|
va[0].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
||||||
|
va[0].texcoord[1].x = (float)0.0 + xcrop;
|
||||||
|
va[0].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
||||||
|
va[1].texcoord[0].x = (float)0.0 + xcrop;
|
||||||
|
va[1].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
||||||
|
va[1].texcoord[1].x = (float)0.0 + xcrop;
|
||||||
|
va[1].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
||||||
|
va[2].texcoord[0].x = (float)1.0 - xcrop;
|
||||||
|
va[2].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
||||||
|
va[2].texcoord[1].x = (float)1.0 - xcrop;
|
||||||
|
va[2].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
||||||
|
va[3].texcoord[0].x = (float)1.0 - xcrop;
|
||||||
|
va[3].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
||||||
|
va[3].texcoord[1].x = (float)1.0 - xcrop;
|
||||||
|
va[3].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
// enable attribs
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
||||||
|
for (n = 0; vertex_vao[n].name; n++) {
|
||||||
|
e = &vertex_vao[n];
|
||||||
|
glEnableVertexAttribArray(n);
|
||||||
|
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized, sizeof(struct vertex),
|
||||||
|
(void *)(intptr_t)e->offset);
|
||||||
|
}
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
// draw quad
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
for (n = 0; vertex_vao[n].name; n++)
|
||||||
|
glDisableVertexAttribArray(n);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
92
shaders.txt
92
shaders.txt
@ -1,92 +0,0 @@
|
|||||||
Pro 7 1080i
|
|
||||||
|
|
||||||
[vo/opengl] [ 1] color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;
|
|
||||||
[vo/opengl] [ 2] color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;
|
|
||||||
[vo/opengl] [ 3] // color conversion
|
|
||||||
[vo/opengl] [ 4] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
|
|
||||||
[vo/opengl] [ 5] color.a = 1.0;
|
|
||||||
[vo/opengl] [ 6] // color mapping
|
|
||||||
|
|
||||||
UHD 10 Bit
|
|
||||||
[vo/opengl] [ 1] color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;
|
|
||||||
[vo/opengl] [ 2] color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;
|
|
||||||
[vo/opengl] [ 3] // color conversion
|
|
||||||
[vo/opengl] [ 4] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
|
|
||||||
[vo/opengl] [ 5] color.a = 1.0;
|
|
||||||
[vo/opengl] [ 6] // color mapping
|
|
||||||
|
|
||||||
|
|
||||||
HEVC 8 Bit
|
|
||||||
[vo/opengl] [ 1] color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;
|
|
||||||
[vo/opengl] [ 2] color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;
|
|
||||||
[vo/opengl] [ 3] // color conversion
|
|
||||||
[vo/opengl] [ 4] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
|
|
||||||
[vo/opengl] [ 5] color.a = 1.0;
|
|
||||||
[vo/opengl] [ 6] // color mapping
|
|
||||||
|
|
||||||
ZDF 720p
|
|
||||||
[vo/opengl] [ 1] color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;
|
|
||||||
[vo/opengl] [ 2] color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;
|
|
||||||
[vo/opengl] [ 3] // color conversion
|
|
||||||
[vo/opengl] [ 4] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
|
|
||||||
[vo/opengl] [ 5] color.a = 1.0;
|
|
||||||
[vo/opengl] [ 6] // color mapping
|
|
||||||
|
|
||||||
VERTEX
|
|
||||||
#version 330
|
|
||||||
in vec2 vertex_position;
|
|
||||||
in vec2 vertex_texcoord0;
|
|
||||||
out vec2 texcoord0;
|
|
||||||
in vec2 vertex_texcoord1;
|
|
||||||
out vec2 texcoord1;
|
|
||||||
in vec2 vertex_texcoord2;
|
|
||||||
out vec2 texcoord2;
|
|
||||||
in vec2 vertex_texcoord3;
|
|
||||||
out vec2 texcoord3;
|
|
||||||
in vec2 vertex_texcoord4;
|
|
||||||
out vec2 texcoord4;
|
|
||||||
in vec2 vertex_texcoord5;
|
|
||||||
out vec2 texcoord5;
|
|
||||||
void main() {
|
|
||||||
gl_Position = vec4(vertex_position, 1.0, 1.0);
|
|
||||||
texcoord0 = vertex_texcoord0;
|
|
||||||
texcoord1 = vertex_texcoord1;
|
|
||||||
texcoord2 = vertex_texcoord2;
|
|
||||||
texcoord3 = vertex_texcoord3;
|
|
||||||
texcoord4 = vertex_texcoord4;
|
|
||||||
texcoord5 = vertex_texcoord5;
|
|
||||||
}
|
|
||||||
|
|
||||||
FRAGMENT
|
|
||||||
#version 330
|
|
||||||
#define texture1D texture
|
|
||||||
#define texture3D texture
|
|
||||||
out vec4 out_color;
|
|
||||||
in vec2 texcoord0;
|
|
||||||
in vec2 texcoord1;
|
|
||||||
in vec2 texcoord2;
|
|
||||||
in vec2 texcoord3;
|
|
||||||
in vec2 texcoord4;
|
|
||||||
in vec2 texcoord5;
|
|
||||||
uniform mat3 colormatrix;
|
|
||||||
uniform vec3 colormatrix_c;
|
|
||||||
uniform sampler2D texture0;
|
|
||||||
uniform vec2 texture_size0;
|
|
||||||
uniform mat2 texture_rot0;
|
|
||||||
uniform vec2 pixel_size0;
|
|
||||||
uniform sampler2D texture1;
|
|
||||||
uniform vec2 texture_size1;
|
|
||||||
uniform mat2 texture_rot1;
|
|
||||||
uniform vec2 pixel_size1;
|
|
||||||
#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))
|
|
||||||
void main() {
|
|
||||||
vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
|
|
||||||
color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;
|
|
||||||
color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;
|
|
||||||
// color conversion
|
|
||||||
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
|
|
||||||
color.a = 1.0;
|
|
||||||
// color mapping
|
|
||||||
out_color = color;
|
|
||||||
}
|
|
||||||
|
|
222
shaders/KrigBilateral.glsl
Normal file
222
shaders/KrigBilateral.glsl
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
// KrigBilateral by Shiandow
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 3.0 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library.
|
||||||
|
|
||||||
|
//!HOOK CHROMA
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!BIND LUMA
|
||||||
|
//!SAVE LOWRES_Y
|
||||||
|
//!WIDTH LUMA.w
|
||||||
|
//!WHEN CHROMA.w LUMA.w <
|
||||||
|
//!DESC KrigBilateral Downscaling Y pass 1
|
||||||
|
|
||||||
|
#define offset vec2(0,0)
|
||||||
|
|
||||||
|
#define axis 1
|
||||||
|
|
||||||
|
#define Kernel(x) dot(vec3(0.42659, -0.49656, 0.076849), cos(vec3(0, 1, 2) * acos(-1.) * (x + 1.)))
|
||||||
|
|
||||||
|
vec4 hook() {
|
||||||
|
// Calculate bounds
|
||||||
|
float low = ceil((LUMA_pos - CHROMA_pt) * LUMA_size - offset - 0.5)[axis];
|
||||||
|
float high = floor((LUMA_pos + CHROMA_pt) * LUMA_size - offset - 0.5)[axis];
|
||||||
|
|
||||||
|
float W = 0.0;
|
||||||
|
vec4 avg = vec4(0);
|
||||||
|
vec2 pos = LUMA_pos;
|
||||||
|
|
||||||
|
for (float k = low; k <= high; k++) {
|
||||||
|
pos[axis] = LUMA_pt[axis] * (k - offset[axis] + 0.5);
|
||||||
|
float rel = (pos[axis] - LUMA_pos[axis])*CHROMA_size[axis];
|
||||||
|
float w = Kernel(rel);
|
||||||
|
|
||||||
|
vec4 y = textureGrad(LUMA_raw, pos, vec2(0.0), vec2(0.0)).xxxx * LUMA_mul;
|
||||||
|
y.y *= y.y;
|
||||||
|
avg += w * y;
|
||||||
|
W += w;
|
||||||
|
}
|
||||||
|
avg /= W;
|
||||||
|
avg.y = abs(avg.y - pow(avg.x, 2.0));
|
||||||
|
return avg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//!HOOK CHROMA
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!BIND LOWRES_Y
|
||||||
|
//!SAVE LOWRES_Y
|
||||||
|
//!WHEN CHROMA.w LUMA.w <
|
||||||
|
//!DESC KrigBilateral Downscaling Y pass 2
|
||||||
|
|
||||||
|
#define offset vec2(0,0)
|
||||||
|
|
||||||
|
#define axis 0
|
||||||
|
|
||||||
|
#define Kernel(x) dot(vec3(0.42659, -0.49656, 0.076849), cos(vec3(0, 1, 2) * acos(-1.) * (x + 1.)))
|
||||||
|
|
||||||
|
vec4 hook() {
|
||||||
|
// Calculate bounds
|
||||||
|
float low = ceil((LOWRES_Y_pos - CHROMA_pt) * LOWRES_Y_size - offset - 0.5)[axis];
|
||||||
|
float high = floor((LOWRES_Y_pos + CHROMA_pt) * LOWRES_Y_size - offset - 0.5)[axis];
|
||||||
|
|
||||||
|
float W = 0.0;
|
||||||
|
vec4 avg = vec4(0);
|
||||||
|
vec2 pos = LOWRES_Y_pos;
|
||||||
|
|
||||||
|
for (float k = low; k <= high; k++) {
|
||||||
|
pos[axis] = LOWRES_Y_pt[axis] * (k - offset[axis] + 0.5);
|
||||||
|
float rel = (pos[axis] - LOWRES_Y_pos[axis])*CHROMA_size[axis];
|
||||||
|
float w = Kernel(rel);
|
||||||
|
|
||||||
|
vec4 y = textureGrad(LOWRES_Y_raw, pos, vec2(0.0), vec2(0.0)).xxxx * LOWRES_Y_mul;
|
||||||
|
y.y *= y.y;
|
||||||
|
avg += w * y;
|
||||||
|
W += w;
|
||||||
|
}
|
||||||
|
avg /= W;
|
||||||
|
avg.y = abs(avg.y - pow(avg.x, 2.0)) + LOWRES_Y_texOff(0).y;
|
||||||
|
return avg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//!HOOK CHROMA
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!BIND LUMA
|
||||||
|
//!BIND LOWRES_Y
|
||||||
|
//!WIDTH LUMA.w
|
||||||
|
//!HEIGHT LUMA.h
|
||||||
|
//!WHEN CHROMA.w LUMA.w <
|
||||||
|
//!OFFSET ALIGN
|
||||||
|
//!DESC KrigBilateral Upscaling UV
|
||||||
|
|
||||||
|
// -- Convenience --
|
||||||
|
#define sqr(x) dot(x,x)
|
||||||
|
#define bitnoise 1.0/(2.0*255.0)
|
||||||
|
#define noise 0.05//5.0*bitnoise
|
||||||
|
#define chromaOffset vec2(0.0, 0.0)
|
||||||
|
|
||||||
|
// -- Window Size --
|
||||||
|
#define taps 3
|
||||||
|
#define even (float(taps) - 2.0 * floor(float(taps) / 2.0) == 0.0)
|
||||||
|
#define minX int(1.0-ceil(float(taps)/2.0))
|
||||||
|
#define maxX int(floor(float(taps)/2.0))
|
||||||
|
|
||||||
|
#define Kernel(x) (cos(acos(-1.0)*(x)/float(taps))) // Hann kernel
|
||||||
|
|
||||||
|
// -- Input processing --
|
||||||
|
#define GetY(coord) LOWRES_Y_tex(LOWRES_Y_pt*(pos+coord+vec2(0.5))).xy
|
||||||
|
#define GetUV(coord) CHROMA_tex(CHROMA_pt*(pos+coord+vec2(0.5))).xy
|
||||||
|
|
||||||
|
#define N (taps*taps - 1)
|
||||||
|
|
||||||
|
#define M(i,j) Mx[min(i,j)*N + max(i,j) - min(i,j)*(min(i,j)+1)/2]
|
||||||
|
|
||||||
|
#define C(i,j) (inversesqrt(1.0 + (X[i].y + X[j].y)/localVar) * exp(-0.5*(sqr(X[i].x - X[j].x)/(localVar + X[i].y + X[j].y) + sqr((coords[i] - coords[j])/radius))) + (X[i].x - y) * (X[j].x - y) / localVar)
|
||||||
|
#define c(i) (inversesqrt(1.0 + X[i].y/localVar) * exp(-0.5*(sqr(X[i].x - y)/(localVar + X[i].y) + sqr((coords[i] - offset)/radius))))
|
||||||
|
|
||||||
|
vec4 hook() {
|
||||||
|
vec2 pos = CHROMA_pos * HOOKED_size - chromaOffset - vec2(0.5);
|
||||||
|
vec2 offset = pos - (even ? floor(pos) : round(pos));
|
||||||
|
pos -= offset;
|
||||||
|
|
||||||
|
vec2 coords[N+1];
|
||||||
|
vec4 X[N+1];
|
||||||
|
float y = LUMA_texOff(0).x;
|
||||||
|
vec4 total = vec4(0);
|
||||||
|
|
||||||
|
coords[0] = vec2(-1,-1); coords[1] = vec2(-1, 0); coords[2] = vec2(-1, 1);
|
||||||
|
coords[3] = vec2( 0,-1); coords[4] = vec2( 0, 1); coords[5] = vec2( 1,-1);
|
||||||
|
coords[6] = vec2( 1, 0); coords[7] = vec2( 1, 1); coords[8] = vec2( 0, 0);
|
||||||
|
|
||||||
|
for (int i=0; i<N+1; i++) {
|
||||||
|
X[i] = vec4(GetY(coords[i]), GetUV(coords[i]));
|
||||||
|
vec2 w = clamp(1.5 - abs(coords[i] - offset), 0.0, 1.0);
|
||||||
|
total += w.x*w.y*vec4(X[i].x, pow(X[i].x, 2.0), X[i].y, 1.0);
|
||||||
|
}
|
||||||
|
total.xyz /= total.w;
|
||||||
|
float localVar = sqr(noise) + abs(total.y - pow(total.x, 2.0)) + total.z;
|
||||||
|
float radius = 1.0;
|
||||||
|
|
||||||
|
float Mx[N*(N+1)/2];
|
||||||
|
float b[N];
|
||||||
|
vec4 interp = X[N];
|
||||||
|
|
||||||
|
b[0] = c(0) - c(N) - C(0,N) + C(N,N); M(0, 0) = C(0,0) - C(0,N) - C(0,N) + C(N,N); M(0, 1) = C(0,1) - C(1,N) - C(0,N) + C(N,N); M(0, 2) = C(0,2) - C(2,N) - C(0,N) + C(N,N); M(0, 3) = C(0,3) - C(3,N) - C(0,N) + C(N,N); M(0, 4) = C(0,4) - C(4,N) - C(0,N) + C(N,N); M(0, 5) = C(0,5) - C(5,N) - C(0,N) + C(N,N); M(0, 6) = C(0,6) - C(6,N) - C(0,N) + C(N,N); M(0, 7) = C(0,7) - C(7,N) - C(0,N) + C(N,N);
|
||||||
|
b[1] = c(1) - c(N) - C(1,N) + C(N,N); M(1, 1) = C(1,1) - C(1,N) - C(1,N) + C(N,N); M(1, 2) = C(1,2) - C(2,N) - C(1,N) + C(N,N); M(1, 3) = C(1,3) - C(3,N) - C(1,N) + C(N,N); M(1, 4) = C(1,4) - C(4,N) - C(1,N) + C(N,N); M(1, 5) = C(1,5) - C(5,N) - C(1,N) + C(N,N); M(1, 6) = C(1,6) - C(6,N) - C(1,N) + C(N,N); M(1, 7) = C(1,7) - C(7,N) - C(1,N) + C(N,N);
|
||||||
|
b[2] = c(2) - c(N) - C(2,N) + C(N,N); M(2, 2) = C(2,2) - C(2,N) - C(2,N) + C(N,N); M(2, 3) = C(2,3) - C(3,N) - C(2,N) + C(N,N); M(2, 4) = C(2,4) - C(4,N) - C(2,N) + C(N,N); M(2, 5) = C(2,5) - C(5,N) - C(2,N) + C(N,N); M(2, 6) = C(2,6) - C(6,N) - C(2,N) + C(N,N); M(2, 7) = C(2,7) - C(7,N) - C(2,N) + C(N,N);
|
||||||
|
b[3] = c(3) - c(N) - C(3,N) + C(N,N); M(3, 3) = C(3,3) - C(3,N) - C(3,N) + C(N,N); M(3, 4) = C(3,4) - C(4,N) - C(3,N) + C(N,N); M(3, 5) = C(3,5) - C(5,N) - C(3,N) + C(N,N); M(3, 6) = C(3,6) - C(6,N) - C(3,N) + C(N,N); M(3, 7) = C(3,7) - C(7,N) - C(3,N) + C(N,N);
|
||||||
|
b[4] = c(4) - c(N) - C(4,N) + C(N,N); M(4, 4) = C(4,4) - C(4,N) - C(4,N) + C(N,N); M(4, 5) = C(4,5) - C(5,N) - C(4,N) + C(N,N); M(4, 6) = C(4,6) - C(6,N) - C(4,N) + C(N,N); M(4, 7) = C(4,7) - C(7,N) - C(4,N) + C(N,N);
|
||||||
|
b[5] = c(5) - c(N) - C(5,N) + C(N,N); M(5, 5) = C(5,5) - C(5,N) - C(5,N) + C(N,N); M(5, 6) = C(5,6) - C(6,N) - C(5,N) + C(N,N); M(5, 7) = C(5,7) - C(7,N) - C(5,N) + C(N,N);
|
||||||
|
b[6] = c(6) - c(N) - C(6,N) + C(N,N); M(6, 6) = C(6,6) - C(6,N) - C(6,N) + C(N,N); M(6, 7) = C(6,7) - C(7,N) - C(6,N) + C(N,N);
|
||||||
|
b[7] = c(7) - c(N) - C(7,N) + C(N,N); M(7, 7) = C(7,7) - C(7,N) - C(7,N) + C(N,N);
|
||||||
|
|
||||||
|
b[1] -= b[0] * M(1, 0) / M(0, 0); M(1, 1) -= M(0, 1) * M(1, 0) / M(0, 0); M(1, 2) -= M(0, 2) * M(1, 0) / M(0, 0); M(1, 3) -= M(0, 3) * M(1, 0) / M(0, 0); M(1, 4) -= M(0, 4) * M(1, 0) / M(0, 0); M(1, 5) -= M(0, 5) * M(1, 0) / M(0, 0); M(1, 6) -= M(0, 6) * M(1, 0) / M(0, 0); M(1, 7) -= M(0, 7) * M(1, 0) / M(0, 0);
|
||||||
|
b[2] -= b[0] * M(2, 0) / M(0, 0); M(2, 2) -= M(0, 2) * M(2, 0) / M(0, 0); M(2, 3) -= M(0, 3) * M(2, 0) / M(0, 0); M(2, 4) -= M(0, 4) * M(2, 0) / M(0, 0); M(2, 5) -= M(0, 5) * M(2, 0) / M(0, 0); M(2, 6) -= M(0, 6) * M(2, 0) / M(0, 0); M(2, 7) -= M(0, 7) * M(2, 0) / M(0, 0);
|
||||||
|
b[3] -= b[0] * M(3, 0) / M(0, 0); M(3, 3) -= M(0, 3) * M(3, 0) / M(0, 0); M(3, 4) -= M(0, 4) * M(3, 0) / M(0, 0); M(3, 5) -= M(0, 5) * M(3, 0) / M(0, 0); M(3, 6) -= M(0, 6) * M(3, 0) / M(0, 0); M(3, 7) -= M(0, 7) * M(3, 0) / M(0, 0);
|
||||||
|
b[4] -= b[0] * M(4, 0) / M(0, 0); M(4, 4) -= M(0, 4) * M(4, 0) / M(0, 0); M(4, 5) -= M(0, 5) * M(4, 0) / M(0, 0); M(4, 6) -= M(0, 6) * M(4, 0) / M(0, 0); M(4, 7) -= M(0, 7) * M(4, 0) / M(0, 0);
|
||||||
|
b[5] -= b[0] * M(5, 0) / M(0, 0); M(5, 5) -= M(0, 5) * M(5, 0) / M(0, 0); M(5, 6) -= M(0, 6) * M(5, 0) / M(0, 0); M(5, 7) -= M(0, 7) * M(5, 0) / M(0, 0);
|
||||||
|
b[6] -= b[0] * M(6, 0) / M(0, 0); M(6, 6) -= M(0, 6) * M(6, 0) / M(0, 0); M(6, 7) -= M(0, 7) * M(6, 0) / M(0, 0);
|
||||||
|
b[7] -= b[0] * M(7, 0) / M(0, 0); M(7, 7) -= M(0, 7) * M(7, 0) / M(0, 0);
|
||||||
|
|
||||||
|
b[2] -= b[1] * M(2, 1) / M(1, 1); M(2, 2) -= M(1, 2) * M(2, 1) / M(1, 1); M(2, 3) -= M(1, 3) * M(2, 1) / M(1, 1); M(2, 4) -= M(1, 4) * M(2, 1) / M(1, 1); M(2, 5) -= M(1, 5) * M(2, 1) / M(1, 1); M(2, 6) -= M(1, 6) * M(2, 1) / M(1, 1); M(2, 7) -= M(1, 7) * M(2, 1) / M(1, 1);
|
||||||
|
b[3] -= b[1] * M(3, 1) / M(1, 1); M(3, 3) -= M(1, 3) * M(3, 1) / M(1, 1); M(3, 4) -= M(1, 4) * M(3, 1) / M(1, 1); M(3, 5) -= M(1, 5) * M(3, 1) / M(1, 1); M(3, 6) -= M(1, 6) * M(3, 1) / M(1, 1); M(3, 7) -= M(1, 7) * M(3, 1) / M(1, 1);
|
||||||
|
b[4] -= b[1] * M(4, 1) / M(1, 1); M(4, 4) -= M(1, 4) * M(4, 1) / M(1, 1); M(4, 5) -= M(1, 5) * M(4, 1) / M(1, 1); M(4, 6) -= M(1, 6) * M(4, 1) / M(1, 1); M(4, 7) -= M(1, 7) * M(4, 1) / M(1, 1);
|
||||||
|
b[5] -= b[1] * M(5, 1) / M(1, 1); M(5, 5) -= M(1, 5) * M(5, 1) / M(1, 1); M(5, 6) -= M(1, 6) * M(5, 1) / M(1, 1); M(5, 7) -= M(1, 7) * M(5, 1) / M(1, 1);
|
||||||
|
b[6] -= b[1] * M(6, 1) / M(1, 1); M(6, 6) -= M(1, 6) * M(6, 1) / M(1, 1); M(6, 7) -= M(1, 7) * M(6, 1) / M(1, 1);
|
||||||
|
b[7] -= b[1] * M(7, 1) / M(1, 1); M(7, 7) -= M(1, 7) * M(7, 1) / M(1, 1);
|
||||||
|
|
||||||
|
b[3] -= b[2] * M(3, 2) / M(2, 2); M(3, 3) -= M(2, 3) * M(3, 2) / M(2, 2); M(3, 4) -= M(2, 4) * M(3, 2) / M(2, 2); M(3, 5) -= M(2, 5) * M(3, 2) / M(2, 2); M(3, 6) -= M(2, 6) * M(3, 2) / M(2, 2); M(3, 7) -= M(2, 7) * M(3, 2) / M(2, 2);
|
||||||
|
b[4] -= b[2] * M(4, 2) / M(2, 2); M(4, 4) -= M(2, 4) * M(4, 2) / M(2, 2); M(4, 5) -= M(2, 5) * M(4, 2) / M(2, 2); M(4, 6) -= M(2, 6) * M(4, 2) / M(2, 2); M(4, 7) -= M(2, 7) * M(4, 2) / M(2, 2);
|
||||||
|
b[5] -= b[2] * M(5, 2) / M(2, 2); M(5, 5) -= M(2, 5) * M(5, 2) / M(2, 2); M(5, 6) -= M(2, 6) * M(5, 2) / M(2, 2); M(5, 7) -= M(2, 7) * M(5, 2) / M(2, 2);
|
||||||
|
b[6] -= b[2] * M(6, 2) / M(2, 2); M(6, 6) -= M(2, 6) * M(6, 2) / M(2, 2); M(6, 7) -= M(2, 7) * M(6, 2) / M(2, 2);
|
||||||
|
b[7] -= b[2] * M(7, 2) / M(2, 2); M(7, 7) -= M(2, 7) * M(7, 2) / M(2, 2);
|
||||||
|
|
||||||
|
b[4] -= b[3] * M(4, 3) / M(3, 3); M(4, 4) -= M(3, 4) * M(4, 3) / M(3, 3); M(4, 5) -= M(3, 5) * M(4, 3) / M(3, 3); M(4, 6) -= M(3, 6) * M(4, 3) / M(3, 3); M(4, 7) -= M(3, 7) * M(4, 3) / M(3, 3);
|
||||||
|
b[5] -= b[3] * M(5, 3) / M(3, 3); M(5, 5) -= M(3, 5) * M(5, 3) / M(3, 3); M(5, 6) -= M(3, 6) * M(5, 3) / M(3, 3); M(5, 7) -= M(3, 7) * M(5, 3) / M(3, 3);
|
||||||
|
b[6] -= b[3] * M(6, 3) / M(3, 3); M(6, 6) -= M(3, 6) * M(6, 3) / M(3, 3); M(6, 7) -= M(3, 7) * M(6, 3) / M(3, 3);
|
||||||
|
b[7] -= b[3] * M(7, 3) / M(3, 3); M(7, 7) -= M(3, 7) * M(7, 3) / M(3, 3);
|
||||||
|
|
||||||
|
b[5] -= b[4] * M(5, 4) / M(4, 4); M(5, 5) -= M(4, 5) * M(5, 4) / M(4, 4); M(5, 6) -= M(4, 6) * M(5, 4) / M(4, 4); M(5, 7) -= M(4, 7) * M(5, 4) / M(4, 4);
|
||||||
|
b[6] -= b[4] * M(6, 4) / M(4, 4); M(6, 6) -= M(4, 6) * M(6, 4) / M(4, 4); M(6, 7) -= M(4, 7) * M(6, 4) / M(4, 4);
|
||||||
|
b[7] -= b[4] * M(7, 4) / M(4, 4); M(7, 7) -= M(4, 7) * M(7, 4) / M(4, 4);
|
||||||
|
|
||||||
|
b[6] -= b[5] * M(6, 5) / M(5, 5); M(6, 6) -= M(5, 6) * M(6, 5) / M(5, 5); M(6, 7) -= M(5, 7) * M(6, 5) / M(5, 5);
|
||||||
|
b[7] -= b[5] * M(7, 5) / M(5, 5); M(7, 7) -= M(5, 7) * M(7, 5) / M(5, 5);
|
||||||
|
|
||||||
|
b[7] -= b[6] * M(7, 6) / M(6, 6); M(7, 7) -= M(6, 7) * M(7, 6) / M(6, 6);
|
||||||
|
|
||||||
|
b[N-1-0] /= M(N-1-0, N-1-0);
|
||||||
|
interp += b[N-1-0] * (X[N-1-0] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-1] -= M(N-1-1, 7) * b[7]; b[N-1-1] /= M(N-1-1, N-1-1);
|
||||||
|
interp += b[N-1-1] * (X[N-1-1] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-2] -= M(N-1-2, 6) * b[6]; b[N-1-2] -= M(N-1-2, 7) * b[7]; b[N-1-2] /= M(N-1-2, N-1-2);
|
||||||
|
interp += b[N-1-2] * (X[N-1-2] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-3] -= M(N-1-3, 5) * b[5]; b[N-1-3] -= M(N-1-3, 6) * b[6]; b[N-1-3] -= M(N-1-3, 7) * b[7]; b[N-1-3] /= M(N-1-3, N-1-3);
|
||||||
|
interp += b[N-1-3] * (X[N-1-3] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-4] -= M(N-1-4, 4) * b[4]; b[N-1-4] -= M(N-1-4, 5) * b[5]; b[N-1-4] -= M(N-1-4, 6) * b[6]; b[N-1-4] -= M(N-1-4, 7) * b[7]; b[N-1-4] /= M(N-1-4, N-1-4);
|
||||||
|
interp += b[N-1-4] * (X[N-1-4] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-5] -= M(N-1-5, 3) * b[3]; b[N-1-5] -= M(N-1-5, 4) * b[4]; b[N-1-5] -= M(N-1-5, 5) * b[5]; b[N-1-5] -= M(N-1-5, 6) * b[6]; b[N-1-5] -= M(N-1-5, 7) * b[7]; b[N-1-5] /= M(N-1-5, N-1-5);
|
||||||
|
interp += b[N-1-5] * (X[N-1-5] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-6] -= M(N-1-6, 2) * b[2]; b[N-1-6] -= M(N-1-6, 3) * b[3]; b[N-1-6] -= M(N-1-6, 4) * b[4]; b[N-1-6] -= M(N-1-6, 5) * b[5]; b[N-1-6] -= M(N-1-6, 6) * b[6]; b[N-1-6] -= M(N-1-6, 7) * b[7]; b[N-1-6] /= M(N-1-6, N-1-6);
|
||||||
|
interp += b[N-1-6] * (X[N-1-6] - X[N]);
|
||||||
|
|
||||||
|
b[N-1-7] -= M(N-1-7, 1) * b[1]; b[N-1-7] -= M(N-1-7, 2) * b[2]; b[N-1-7] -= M(N-1-7, 3) * b[3]; b[N-1-7] -= M(N-1-7, 4) * b[4]; b[N-1-7] -= M(N-1-7, 5) * b[5]; b[N-1-7] -= M(N-1-7, 6) * b[6]; b[N-1-7] -= M(N-1-7, 7) * b[7]; b[N-1-7] /= M(N-1-7, N-1-7);
|
||||||
|
interp += b[N-1-7] * (X[N-1-7] - X[N]);
|
||||||
|
|
||||||
|
return interp.zwxx;
|
||||||
|
}
|
206
shaders/LumaSharpenHook.glsl
Normal file
206
shaders/LumaSharpenHook.glsl
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
// vim: set ft=glsl:
|
||||||
|
|
||||||
|
/*
|
||||||
|
LumaSharpenHook 0.3
|
||||||
|
|
||||||
|
original hlsl by Christian Cann Schuldt Jensen ~ CeeJay.dk
|
||||||
|
port to glsl by Anon
|
||||||
|
|
||||||
|
It blurs the original pixel with the surrounding pixels and then subtracts this blur to sharpen the image.
|
||||||
|
It does this in luma to avoid color artifacts and allows limiting the maximum sharpning to avoid or lessen halo artifacts.
|
||||||
|
|
||||||
|
This is similar to using Unsharp Mask in Photoshop.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// -- Hooks --
|
||||||
|
//!HOOK LUMA
|
||||||
|
//!BIND HOOKED
|
||||||
|
|
||||||
|
|
||||||
|
// -- Sharpening --
|
||||||
|
#define sharp_strength 0.30 //[0.10 to 3.00] Strength of the sharpening
|
||||||
|
|
||||||
|
#define sharp_clamp 0.035 //[0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
|
||||||
|
|
||||||
|
// -- Advanced sharpening settings --
|
||||||
|
#define pattern 2 //[1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
|
||||||
|
//[8|9] Experimental slower patterns. 8 = 9 tap 9 fetch gaussian, 9 = 9 tap 9 fetch high pass.
|
||||||
|
|
||||||
|
#define offset_bias 1.0 //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
|
||||||
|
|
||||||
|
vec4 hook(){
|
||||||
|
vec4 colorInput = LUMA_tex(LUMA_pos);
|
||||||
|
|
||||||
|
|
||||||
|
//We are on luma plane: xyzw = [luma_val, 0.0, 0.0, 1.0]
|
||||||
|
float ori = colorInput.x;
|
||||||
|
|
||||||
|
// -- Combining the strength and luma multipliers --
|
||||||
|
float sharp_strength_luma = sharp_strength; //I'll be combining even more multipliers with it later on
|
||||||
|
|
||||||
|
float px = 1.0;
|
||||||
|
float py = 1.0;
|
||||||
|
|
||||||
|
// Sampling patterns
|
||||||
|
|
||||||
|
// [ NW, , NE ] Each texture lookup (except ori)
|
||||||
|
// [ ,ori, ] samples 4 pixels
|
||||||
|
// [ SW, , SE ]
|
||||||
|
|
||||||
|
// -- Pattern 1 -- A (fast) 7 tap gaussian using only 2+1 texture fetches.
|
||||||
|
#if pattern == 1
|
||||||
|
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ 1/9, 2/9, ] [ 1 , 2 , ]
|
||||||
|
// [ 2/9, 8/9, 2/9] = [ 2 , 8 , 2 ]
|
||||||
|
// [ , 2/9, 1/9] [ , 2 , 1 ]
|
||||||
|
|
||||||
|
px = (px / 3.0) * offset_bias;
|
||||||
|
py = (py / 3.0) * offset_bias;
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(px,py)).x; // North West
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South East
|
||||||
|
|
||||||
|
//blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
//blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
|
|
||||||
|
blur_ori *= 0.5; //Divide by the number of texture fetches
|
||||||
|
|
||||||
|
sharp_strength_luma *= 1.5; // Adjust strength to aproximate the strength of pattern 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Pattern 2 -- A 9 tap gaussian using 4+1 texture fetches.
|
||||||
|
#if pattern == 2
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
||||||
|
// [ .50, 1, .50] = [ 2 , 4 , 2 ]
|
||||||
|
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
||||||
|
|
||||||
|
px = px * 0.5 * offset_bias;
|
||||||
|
py = py * 0.5 * offset_bias;
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
|
|
||||||
|
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Pattern 3 -- An experimental 17 tap gaussian using 4+1 texture fetches.
|
||||||
|
#if pattern == 3
|
||||||
|
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ , 4 , 6 , , ]
|
||||||
|
// [ ,16 ,24 ,16 , 4 ]
|
||||||
|
// [ 6 ,24 , ,24 , 6 ]
|
||||||
|
// [ 4 ,16 ,24 ,16 , ]
|
||||||
|
// [ , , 6 , 4 , ]
|
||||||
|
|
||||||
|
px = px * offset_bias;
|
||||||
|
py = py * offset_bias;
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(0.4*px,-1.2*py)).x; // South South East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-1.2*px,-0.4*py)).x; // West South West
|
||||||
|
blur_ori += LUMA_texOff(vec2(1.2*px,0.4*py)).x; // East North East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-0.4*px,1.2*py)).x; // North North West
|
||||||
|
|
||||||
|
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
||||||
|
|
||||||
|
sharp_strength_luma *= 0.51;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Pattern 4 -- A 9 tap high pass (pyramid filter) using 4+1 texture fetches.
|
||||||
|
#if pattern == 4
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
||||||
|
// [ .50, , .50] = [ 1 , , 1 ]
|
||||||
|
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(0.5 * px,-py * offset_bias)).x; // South South East
|
||||||
|
blur_ori += LUMA_texOff(vec2(offset_bias * -px,0.5 * -py)).x; // West South West
|
||||||
|
blur_ori += LUMA_texOff(vec2(offset_bias * px,0.5 * py)).x; // East North East
|
||||||
|
blur_ori += LUMA_texOff(vec2(0.5 * -px,py * offset_bias)).x; // North North West
|
||||||
|
|
||||||
|
//blur_ori += (2.0 * ori); // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
|
blur_ori *= 0.25; //Divide by the number of texture fetches
|
||||||
|
|
||||||
|
sharp_strength_luma *= 0.666; // Adjust strength to aproximate the strength of pattern 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Pattern 8 -- A (slower) 9 tap gaussian using 9 texture fetches.
|
||||||
|
#if pattern == 8
|
||||||
|
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ 1 , 2 , 1 ]
|
||||||
|
// [ 2 , 4 , 2 ]
|
||||||
|
// [ 1 , 2 , 1 ]
|
||||||
|
|
||||||
|
px = px * offset_bias;
|
||||||
|
py = py * offset_bias;
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
|
||||||
|
float blur_ori2 = LUMA_texOff(vec2(0.0,py)).x; // North
|
||||||
|
blur_ori2 += LUMA_texOff(vec2(0.0,-py)).x; // South
|
||||||
|
blur_ori2 += LUMA_texOff(vec2(-px,0.0)).x; // West
|
||||||
|
blur_ori2 += LUMA_texOff(vec2(px,0.0)).x; // East
|
||||||
|
blur_ori2 *= 2.0;
|
||||||
|
|
||||||
|
blur_ori += blur_ori2;
|
||||||
|
blur_ori += (ori * 4.0); // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
|
// dot()s with gaussian strengths here?
|
||||||
|
|
||||||
|
blur_ori /= 16.0; //Divide by the number of texture fetches
|
||||||
|
|
||||||
|
sharp_strength_luma *= 0.75; // Adjust strength to aproximate the strength of pattern 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Pattern 9 -- A (slower) 9 tap high pass using 9 texture fetches.
|
||||||
|
#if pattern == 9
|
||||||
|
|
||||||
|
// -- Gaussian filter --
|
||||||
|
// [ 1 , 1 , 1 ]
|
||||||
|
// [ 1 , 1 , 1 ]
|
||||||
|
// [ 1 , 1 , 1 ]
|
||||||
|
|
||||||
|
px = px * offset_bias;
|
||||||
|
py = py * offset_bias;
|
||||||
|
|
||||||
|
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
|
||||||
|
blur_ori += ori; // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
|
blur_ori += LUMA_texOff(vec2(0.0,py)).x; // North
|
||||||
|
blur_ori += LUMA_texOff(vec2(0.0,-py)).x; // South
|
||||||
|
blur_ori += LUMA_texOff(vec2(-px,0.0)).x; // West
|
||||||
|
blur_ori += LUMA_texOff(vec2(px,0.0)).x; // East
|
||||||
|
|
||||||
|
blur_ori /= 9.0; //Divide by the number of texture fetches
|
||||||
|
|
||||||
|
sharp_strength_luma *= (8.0/9.0); // Adjust strength to aproximate the strength of pattern 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -- Calculate the sharpening --
|
||||||
|
float sharp = ori - blur_ori; //Subtracting the blurred image from the original image
|
||||||
|
|
||||||
|
// -- Adjust strength of the sharpening and clamp it--
|
||||||
|
float sharp_strength_luma_clamp = sharp_strength_luma / (2.0 * sharp_clamp); //Roll part of the clamp into the dot
|
||||||
|
|
||||||
|
float sharp_luma = clamp((sharp * sharp_strength_luma_clamp + 0.5), 0.0,1.0 ); //Calculate the luma, adjust the strength, scale up and clamp
|
||||||
|
sharp_luma = (sharp_clamp * 2.0) * sharp_luma - sharp_clamp; //scale down
|
||||||
|
|
||||||
|
|
||||||
|
// -- Combining the values to get the final sharpened pixel --
|
||||||
|
|
||||||
|
colorInput.x = colorInput.x + sharp_luma; // Add the sharpening to the input color.
|
||||||
|
return clamp(colorInput, 0.0,1.0);
|
||||||
|
}
|
246
shaders/adaptive-sharpen.glsl
Normal file
246
shaders/adaptive-sharpen.glsl
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
// Copyright (c) 2015-2018, bacondither
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions
|
||||||
|
// are met:
|
||||||
|
// 1. Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer
|
||||||
|
// in this position and unchanged.
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Adaptive sharpen - version 2018-04-14 - (requires ps >= 3.0)
|
||||||
|
// Tuned for use post resize
|
||||||
|
|
||||||
|
//!HOOK SCALED
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!SAVE ASSD
|
||||||
|
//!COMPONENTS 2
|
||||||
|
//!DESC adaptive-sharpen
|
||||||
|
|
||||||
|
//--------------------------------------- Settings ------------------------------------------------
|
||||||
|
|
||||||
|
#define curve_height 1.6 // Main control of sharpening strength [>0]
|
||||||
|
// 0.3 <-> 2.0 is a reasonable range of values
|
||||||
|
|
||||||
|
// Defined values under this row are "optimal" DO NOT CHANGE IF YOU DO NOT KNOW WHAT YOU ARE DOING!
|
||||||
|
|
||||||
|
#define curveslope 0.5 // Sharpening curve slope, high edge values
|
||||||
|
|
||||||
|
#define L_overshoot 0.003 // Max light overshoot before compression [>0.001]
|
||||||
|
#define L_compr_low 0.167 // Light compression, default (0.169=~9x)
|
||||||
|
#define L_compr_high 0.334 // Light compression, surrounded by edges (0.337=~4x)
|
||||||
|
|
||||||
|
#define D_overshoot 0.009 // Max dark overshoot before compression [>0.001]
|
||||||
|
#define D_compr_low 0.250 // Dark compression, default (0.253=~6x)
|
||||||
|
#define D_compr_high 0.500 // Dark compression, surrounded by edges (0.504=~2.5x)
|
||||||
|
|
||||||
|
#define scale_lim 0.1 // Abs max change before compression (0.1=+-10%)
|
||||||
|
#define scale_cs 0.056 // Compression slope above scale_lim
|
||||||
|
|
||||||
|
#define pm_p sat(1.0/curve_height) // Power mean p-value [>0-1.0]
|
||||||
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Soft limit
|
||||||
|
#define soft_lim(v,s) ( (exp(2.0*min(abs(v), s*24.0)/s) - 1.0)/(exp(2.0*min(abs(v), s*24.0)/s) + 1.0)*s )
|
||||||
|
|
||||||
|
// Weighted power mean
|
||||||
|
#define wpmean(a,b,c) ( pow((c*pow(abs(a), pm_p) + (1.0-c)*pow(b, pm_p)), (1.0/pm_p)) )
|
||||||
|
|
||||||
|
// Get destination pixel values
|
||||||
|
#define get(x,y) ( HOOKED_texOff(vec2(x, y)).rgb )
|
||||||
|
#define sat(x) ( clamp(x, 0.0, 1.0) )
|
||||||
|
|
||||||
|
// Colour to luma, fast approx gamma, avg of rec. 709 & 601 luma coeffs
|
||||||
|
#define CtL(RGB) ( sqrt(dot(vec3(0.2558, 0.6511, 0.0931), pow(sat(RGB), vec3(2.0)))) )
|
||||||
|
|
||||||
|
// Center pixel diff
|
||||||
|
#define mdiff(a,b,c,d,e,f,g) ( abs(luma[g]-luma[a]) + abs(luma[g]-luma[b]) \
|
||||||
|
+ abs(luma[g]-luma[c]) + abs(luma[g]-luma[d]) \
|
||||||
|
+ 0.5*(abs(luma[g]-luma[e]) + abs(luma[g]-luma[f])) )
|
||||||
|
|
||||||
|
#define b_diff(pix) ( abs(blur-c[pix]) )
|
||||||
|
|
||||||
|
vec4 hook() {
|
||||||
|
|
||||||
|
vec4 o = HOOKED_tex(HOOKED_pos);
|
||||||
|
|
||||||
|
// Get points, saturate colour data in c[0]
|
||||||
|
// [ c22 ]
|
||||||
|
// [ c24, c9, c23 ]
|
||||||
|
// [ c21, c1, c2, c3, c18 ]
|
||||||
|
// [ c19, c10, c4, c0, c5, c11, c16 ]
|
||||||
|
// [ c20, c6, c7, c8, c17 ]
|
||||||
|
// [ c15, c12, c14 ]
|
||||||
|
// [ c13 ]
|
||||||
|
vec3 c[25] = vec3[](sat(o.rgb), get(-1,-1), get( 0,-1), get( 1,-1), get(-1, 0),
|
||||||
|
get( 1, 0), get(-1, 1), get( 0, 1), get( 1, 1), get( 0,-2),
|
||||||
|
get(-2, 0), get( 2, 0), get( 0, 2), get( 0, 3), get( 1, 2),
|
||||||
|
get(-1, 2), get( 3, 0), get( 2, 1), get( 2,-1), get(-3, 0),
|
||||||
|
get(-2, 1), get(-2,-1), get( 0,-3), get( 1,-2), get(-1,-2));
|
||||||
|
|
||||||
|
// Blur, gauss 3x3
|
||||||
|
vec3 blur = (2.0 * (c[2]+c[4]+c[5]+c[7]) + (c[1]+c[3]+c[6]+c[8]) + 4.0 * c[0]) / 16.0;
|
||||||
|
|
||||||
|
// Contrast compression, center = 0.5, scaled to 1/3
|
||||||
|
float c_comp = sat(0.266666681f + 0.9*exp2(dot(blur, vec3(-7.4/3.0))));
|
||||||
|
|
||||||
|
// Edge detection
|
||||||
|
// Relative matrix weights
|
||||||
|
// [ 1 ]
|
||||||
|
// [ 4, 5, 4 ]
|
||||||
|
// [ 1, 5, 6, 5, 1 ]
|
||||||
|
// [ 4, 5, 4 ]
|
||||||
|
// [ 1 ]
|
||||||
|
float edge = length( 1.38*b_diff(0)
|
||||||
|
+ 1.15*(b_diff(2) + b_diff(4) + b_diff(5) + b_diff(7))
|
||||||
|
+ 0.92*(b_diff(1) + b_diff(3) + b_diff(6) + b_diff(8))
|
||||||
|
+ 0.23*(b_diff(9) + b_diff(10) + b_diff(11) + b_diff(12)) ) * c_comp;
|
||||||
|
|
||||||
|
// RGB to luma
|
||||||
|
float c0_Y = CtL(c[0]);
|
||||||
|
|
||||||
|
float luma[25] = float[](c0_Y, CtL(c[1]), CtL(c[2]), CtL(c[3]), CtL(c[4]), CtL(c[5]), CtL(c[6]),
|
||||||
|
CtL(c[7]), CtL(c[8]), CtL(c[9]), CtL(c[10]), CtL(c[11]), CtL(c[12]),
|
||||||
|
CtL(c[13]), CtL(c[14]), CtL(c[15]), CtL(c[16]), CtL(c[17]), CtL(c[18]),
|
||||||
|
CtL(c[19]), CtL(c[20]), CtL(c[21]), CtL(c[22]), CtL(c[23]), CtL(c[24]));
|
||||||
|
|
||||||
|
// Precalculated default squared kernel weights
|
||||||
|
const vec3 w1 = vec3(0.5, 1.0, 1.41421356237); // 0.25, 1.0, 2.0
|
||||||
|
const vec3 w2 = vec3(0.86602540378, 1.0, 0.54772255751); // 0.75, 1.0, 0.3
|
||||||
|
|
||||||
|
// Transition to a concave kernel if the center edge val is above thr
|
||||||
|
vec3 dW = pow(mix( w1, w2, smoothstep( 0.3, 0.8, edge)), vec3(2.0));
|
||||||
|
|
||||||
|
float mdiff_c0 = 0.02 + 3.0*( abs(luma[0]-luma[2]) + abs(luma[0]-luma[4])
|
||||||
|
+ abs(luma[0]-luma[5]) + abs(luma[0]-luma[7])
|
||||||
|
+ 0.25*(abs(luma[0]-luma[1]) + abs(luma[0]-luma[3])
|
||||||
|
+abs(luma[0]-luma[6]) + abs(luma[0]-luma[8])) );
|
||||||
|
|
||||||
|
// Use lower weights for pixels in a more active area relative to center pixel area
|
||||||
|
// This results in narrower and less visible overshoots around sharp edges
|
||||||
|
float weights[12] = float[](( min((mdiff_c0/mdiff(24, 21, 2, 4, 9, 10, 1)), dW.y) ),
|
||||||
|
( dW.x ),
|
||||||
|
( min((mdiff_c0/mdiff(23, 18, 5, 2, 9, 11, 3)), dW.y) ),
|
||||||
|
( dW.x ),
|
||||||
|
( dW.x ),
|
||||||
|
( min((mdiff_c0/mdiff(4, 20, 15, 7, 10, 12, 6)), dW.y) ),
|
||||||
|
( dW.x ),
|
||||||
|
( min((mdiff_c0/mdiff(5, 7, 17, 14, 12, 11, 8)), dW.y) ),
|
||||||
|
( min((mdiff_c0/mdiff(2, 24, 23, 22, 1, 3, 9)), dW.z) ),
|
||||||
|
( min((mdiff_c0/mdiff(20, 19, 21, 4, 1, 6, 10)), dW.z) ),
|
||||||
|
( min((mdiff_c0/mdiff(17, 5, 18, 16, 3, 8, 11)), dW.z) ),
|
||||||
|
( min((mdiff_c0/mdiff(13, 15, 7, 14, 6, 8, 12)), dW.z) ));
|
||||||
|
|
||||||
|
weights[0] = (max(max((weights[8] + weights[9])/4.0, weights[0]), 0.25) + weights[0])/2.0;
|
||||||
|
weights[2] = (max(max((weights[8] + weights[10])/4.0, weights[2]), 0.25) + weights[2])/2.0;
|
||||||
|
weights[5] = (max(max((weights[9] + weights[11])/4.0, weights[5]), 0.25) + weights[5])/2.0;
|
||||||
|
weights[7] = (max(max((weights[10] + weights[11])/4.0, weights[7]), 0.25) + weights[7])/2.0;
|
||||||
|
|
||||||
|
// Calculate the negative part of the laplace kernel
|
||||||
|
float weightsum = 0.0;
|
||||||
|
float neg_laplace = 0.0;
|
||||||
|
|
||||||
|
for (int pix = 0; pix < 12; ++pix)
|
||||||
|
{
|
||||||
|
neg_laplace += luma[pix+1]*weights[pix];
|
||||||
|
weightsum += weights[pix];
|
||||||
|
}
|
||||||
|
|
||||||
|
neg_laplace = neg_laplace / weightsum;
|
||||||
|
|
||||||
|
// Compute sharpening magnitude function
|
||||||
|
float sharpen_val = (curve_height/(curve_height*curveslope*pow((edge), 3.5) + 0.625));
|
||||||
|
|
||||||
|
// Calculate sharpening diff and scale
|
||||||
|
float sharpdiff = (c0_Y - neg_laplace)*(sharpen_val + 0.01);
|
||||||
|
|
||||||
|
// Calculate local near min & max, partial sort
|
||||||
|
float temp;
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < 24; i1 += 2)
|
||||||
|
{
|
||||||
|
temp = luma[i1];
|
||||||
|
luma[i1] = min(luma[i1], luma[i1+1]);
|
||||||
|
luma[i1+1] = max(temp, luma[i1+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i2 = 24; i2 > 0; i2 -= 2)
|
||||||
|
{
|
||||||
|
temp = luma[0];
|
||||||
|
luma[0] = min(luma[0], luma[i2]);
|
||||||
|
luma[i2] = max(temp, luma[i2]);
|
||||||
|
|
||||||
|
temp = luma[24];
|
||||||
|
luma[24] = max(luma[24], luma[i2-1]);
|
||||||
|
luma[i2-1] = min(temp, luma[i2-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i1 = 1; i1 < 24-1; i1 += 2)
|
||||||
|
{
|
||||||
|
temp = luma[i1];
|
||||||
|
luma[i1] = min(luma[i1], luma[i1+1]);
|
||||||
|
luma[i1+1] = max(temp, luma[i1+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i2 = 24-1; i2 > 1; i2 -= 2)
|
||||||
|
{
|
||||||
|
temp = luma[1];
|
||||||
|
luma[1] = min(luma[1], luma[i2]);
|
||||||
|
luma[i2] = max(temp, luma[i2]);
|
||||||
|
|
||||||
|
temp = luma[24-1];
|
||||||
|
luma[24-1] = max(luma[24-1], luma[i2-1]);
|
||||||
|
luma[i2-1] = min(temp, luma[i2-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
float nmax = (max(luma[23], c0_Y)*3.0 + luma[24])/4.0;
|
||||||
|
float nmin = (min(luma[1], c0_Y)*3.0 + luma[0])/4.0;
|
||||||
|
|
||||||
|
// Calculate tanh scale factors
|
||||||
|
float min_dist = min(abs(nmax - c0_Y), abs(c0_Y - nmin));
|
||||||
|
float pos_scale = min_dist + min(L_overshoot, 1.0001 - min_dist - c0_Y);
|
||||||
|
float neg_scale = min_dist + min(D_overshoot, 0.0001 + c0_Y - min_dist);
|
||||||
|
|
||||||
|
pos_scale = min(pos_scale, scale_lim*(1.0 - scale_cs) + pos_scale*scale_cs);
|
||||||
|
neg_scale = min(neg_scale, scale_lim*(1.0 - scale_cs) + neg_scale*scale_cs);
|
||||||
|
|
||||||
|
// Soft limited anti-ringing with tanh, wpmean to control compression slope
|
||||||
|
sharpdiff = wpmean(max(sharpdiff, 0.0), soft_lim( max(sharpdiff, 0.0), pos_scale ), L_compr_low )
|
||||||
|
- wpmean(min(sharpdiff, 0.0), soft_lim( min(sharpdiff, 0.0), neg_scale ), D_compr_low );
|
||||||
|
|
||||||
|
return vec4(sharpdiff, c0_Y, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//!HOOK SCALED
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!BIND ASSD
|
||||||
|
//!DESC adaptive-sharpen equalization
|
||||||
|
|
||||||
|
#define video_level_out false // True to preserve BTB & WTW (minor summation error)
|
||||||
|
// Normally it should be set to false
|
||||||
|
#define SD(x,y) ASSD_texOff(vec2(x,y)).r
|
||||||
|
|
||||||
|
vec4 hook() {
|
||||||
|
vec4 o = HOOKED_texOff(0);
|
||||||
|
float sharpdiff = SD( 0, 0) - 0.6 * 0.25 * (SD(-0.5,-0.5) + SD( 0.5,-0.5) + SD(-0.5, 0.5) + SD( 0.5, 0.5));
|
||||||
|
float c0_Y = ASSD_texOff(vec2(0)).g;
|
||||||
|
float sharpdiff_lim = clamp(c0_Y + sharpdiff, 0.0, 1.0) - c0_Y;
|
||||||
|
float satmul = (c0_Y + max(sharpdiff_lim*0.9, sharpdiff_lim)*1.03 + 0.03)/(c0_Y + 0.03);
|
||||||
|
vec3 res = c0_Y + (sharpdiff_lim*3 + sharpdiff)/4 + (clamp(o.rgb, 0.0, 1.0) - c0_Y)*satmul;
|
||||||
|
o.rgb = video_level_out == true ? res + o.rgb - clamp(o.rgb, 0.0, 1.0) : res;
|
||||||
|
return o;
|
||||||
|
}
|
41
shaders/filmgrain.glsl
Normal file
41
shaders/filmgrain.glsl
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
//!HOOK LUMA
|
||||||
|
//!BIND HOOKED
|
||||||
|
//!DESC gaussian film grain
|
||||||
|
|
||||||
|
#normal value is 0.05 changed for demo purposes
|
||||||
|
#define INTENSITY 0.55
|
||||||
|
|
||||||
|
float permute(float x)
|
||||||
|
{
|
||||||
|
x = (34.0 * x + 1.0) * x;
|
||||||
|
return fract(x * 1.0/289.0) * 289.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float rand(inout float state)
|
||||||
|
{
|
||||||
|
state = permute(state);
|
||||||
|
return fract(state * 1.0/41.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 hook()
|
||||||
|
{
|
||||||
|
vec3 m = vec3(HOOKED_pos, random) + vec3(1.0);
|
||||||
|
float state = permute(permute(m.x) + m.y) + m.z;
|
||||||
|
|
||||||
|
const float a0 = 0.151015505647689;
|
||||||
|
const float a1 = -0.5303572634357367;
|
||||||
|
const float a2 = 1.365020122861334;
|
||||||
|
const float b0 = 0.132089632343748;
|
||||||
|
const float b1 = -0.7607324991323768;
|
||||||
|
|
||||||
|
float p = 0.95 * rand(state) + 0.025;
|
||||||
|
float q = p - 0.5;
|
||||||
|
float r = q * q;
|
||||||
|
|
||||||
|
float grain = q * (a2 + (a1 * r + a0) / (r*r + b1*r + b0));
|
||||||
|
grain *= 0.255121822830526; // normalize to [-1,1)
|
||||||
|
|
||||||
|
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||||
|
color.rgb += vec3(INTENSITY * grain);
|
||||||
|
return color;
|
||||||
|
}
|
4328
softhdcuvid.cpp
4328
softhdcuvid.cpp
File diff suppressed because it is too large
Load Diff
3915
softhddev.c
3915
softhddev.c
File diff suppressed because it is too large
Load Diff
181
softhddev.h
181
softhddev.h
@ -1,117 +1,114 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddev.h @brief software HD device plugin header file.
|
/// @file softhddev.h @brief software HD device plugin header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2011 - 2015 by Johns. All Rights Reserved.
|
/// Copyright (c) 2011 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: efb2e251dd7082138ec21609478d2402be8208cf $
|
/// $Id: efb2e251dd7082138ec21609478d2402be8208cf $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/// C callback feed key press
|
/// C callback feed key press
|
||||||
extern void FeedKeyPress(const char *, const char *, int, int,
|
extern void FeedKeyPress(const char *, const char *, int, int, const char *);
|
||||||
const char *);
|
|
||||||
|
|
||||||
/// C plugin get osd size and ascpect
|
/// C plugin get osd size and ascpect
|
||||||
extern void GetOsdSize(int *, int *, double *);
|
extern void GetOsdSize(int *, int *, double *);
|
||||||
|
|
||||||
/// C plugin close osd
|
/// C plugin close osd
|
||||||
extern void OsdClose(void);
|
extern void OsdClose(void);
|
||||||
/// C plugin draw osd pixmap
|
/// C plugin draw osd pixmap
|
||||||
extern void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int,
|
extern void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
|
||||||
int);
|
|
||||||
|
|
||||||
/// C plugin play audio packet
|
/// C plugin play audio packet
|
||||||
extern int PlayAudio(const uint8_t *, int, uint8_t);
|
extern int PlayAudio(const uint8_t *, int, uint8_t);
|
||||||
/// C plugin play TS audio packet
|
/// C plugin play TS audio packet
|
||||||
extern int PlayTsAudio(const uint8_t *, int);
|
extern int PlayTsAudio(const uint8_t *, int);
|
||||||
/// C plugin set audio volume
|
/// C plugin set audio volume
|
||||||
extern void SetVolumeDevice(int);
|
extern void SetVolumeDevice(int);
|
||||||
/// C plugin reset channel id (restarts audio)
|
/// C plugin reset channel id (restarts audio)
|
||||||
extern void ResetChannelId(void);
|
extern void ResetChannelId(void);
|
||||||
|
|
||||||
/// C plugin play video packet
|
/// C plugin play video packet
|
||||||
extern int PlayVideo(const uint8_t *, int);
|
extern int PlayVideo(const uint8_t *, int);
|
||||||
/// C plugin play TS video packet
|
/// C plugin play TS video packet
|
||||||
extern void PlayTsVideo(const uint8_t *, int);
|
extern void PlayTsVideo(const uint8_t *, int);
|
||||||
/// C plugin grab an image
|
/// C plugin grab an image
|
||||||
extern uint8_t *GrabImage(int *, int, int, int, int);
|
extern uint8_t *GrabImage(int *, int, int, int, int);
|
||||||
|
|
||||||
/// C plugin set play mode
|
/// C plugin set play mode
|
||||||
extern int SetPlayMode(int);
|
extern int SetPlayMode(int);
|
||||||
/// C plugin get current system time counter
|
/// C plugin get current system time counter
|
||||||
extern int64_t GetSTC(void);
|
extern int64_t GetSTC(void);
|
||||||
/// C plugin get video stream size and aspect
|
/// C plugin get video stream size and aspect
|
||||||
extern void GetVideoSize(int *, int *, double *);
|
extern void GetVideoSize(int *, int *, double *);
|
||||||
/// C plugin set trick speed
|
/// C plugin set trick speed
|
||||||
extern void TrickSpeed(int);
|
extern void TrickSpeed(int);
|
||||||
/// C plugin clears all video and audio data from the device
|
/// C plugin clears all video and audio data from the device
|
||||||
extern void Clear(void);
|
extern void Clear(void);
|
||||||
/// C plugin sets the device into play mode
|
/// C plugin sets the device into play mode
|
||||||
extern void Play(void);
|
extern void Play(void);
|
||||||
/// C plugin sets the device into "freeze frame" mode
|
/// C plugin sets the device into "freeze frame" mode
|
||||||
extern void Freeze(void);
|
extern void Freeze(void);
|
||||||
/// C plugin mute audio
|
/// C plugin mute audio
|
||||||
extern void Mute(void);
|
extern void Mute(void);
|
||||||
/// C plugin display I-frame as a still picture.
|
/// C plugin display I-frame as a still picture.
|
||||||
extern void StillPicture(const uint8_t *, int);
|
extern void StillPicture(const uint8_t *, int);
|
||||||
/// C plugin poll if ready
|
/// C plugin poll if ready
|
||||||
extern int Poll(int);
|
extern int Poll(int);
|
||||||
/// C plugin flush output buffers
|
/// C plugin flush output buffers
|
||||||
extern int Flush(int);
|
extern int Flush(int);
|
||||||
|
|
||||||
/// C plugin command line help
|
/// C plugin command line help
|
||||||
extern const char *CommandLineHelp(void);
|
extern const char *CommandLineHelp(void);
|
||||||
/// C plugin process the command line arguments
|
/// C plugin process the command line arguments
|
||||||
extern int ProcessArgs(int, char *const[]);
|
extern int ProcessArgs(int, char *const[]);
|
||||||
|
|
||||||
/// C plugin exit + cleanup
|
/// C plugin exit + cleanup
|
||||||
extern void SoftHdDeviceExit(void);
|
extern void SoftHdDeviceExit(void);
|
||||||
/// C plugin start code
|
/// C plugin start code
|
||||||
extern int Start(void);
|
extern int Start(void);
|
||||||
/// C plugin stop code
|
/// C plugin stop code
|
||||||
extern void Stop(void);
|
extern void Stop(void);
|
||||||
/// C plugin house keeping
|
/// C plugin house keeping
|
||||||
extern void Housekeeping(void);
|
extern void Housekeeping(void);
|
||||||
/// C plugin main thread hook
|
/// C plugin main thread hook
|
||||||
extern void MainThreadHook(void);
|
extern void MainThreadHook(void);
|
||||||
|
|
||||||
/// Suspend plugin
|
/// Suspend plugin
|
||||||
extern void Suspend(int, int, int);
|
extern void Suspend(int, int, int);
|
||||||
/// Resume plugin
|
/// Resume plugin
|
||||||
extern void Resume(void);
|
extern void Resume(void);
|
||||||
|
|
||||||
/// Get decoder statistics
|
/// Get decoder statistics
|
||||||
extern void GetStats(int *, int *, int *, int *, float *);
|
extern void GetStats(int *, int *, int *, int *, float *, int *, int *, int *, int *);
|
||||||
/// C plugin scale video
|
/// C plugin scale video
|
||||||
extern void ScaleVideo(int, int, int, int);
|
extern void ScaleVideo(int, int, int, int);
|
||||||
|
|
||||||
/// Set Pip position
|
/// Set Pip position
|
||||||
extern void PipSetPosition(int, int, int, int, int, int, int, int);
|
extern void PipSetPosition(int, int, int, int, int, int, int, int);
|
||||||
/// Pip start
|
/// Pip start
|
||||||
extern void PipStart(int, int, int, int, int, int, int, int);
|
extern void PipStart(int, int, int, int, int, int, int, int);
|
||||||
/// Pip stop
|
/// Pip stop
|
||||||
extern void PipStop(void);
|
extern void PipStop(void);
|
||||||
/// Pip play video packet
|
/// Pip play video packet
|
||||||
extern int PipPlayVideo(const uint8_t *, int);
|
extern int PipPlayVideo(const uint8_t *, int);
|
||||||
|
|
||||||
extern const char *X11DisplayName; ///< x11 display name
|
extern const char *X11DisplayName; ///< x11 display name
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddevice.h @brief software HD device plugin header file.
|
/// @file softhddevice.h @brief software HD device plugin header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2011, 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2011, 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: 3bc44809950ec019529638cad9223a85d4ab5576 $
|
/// $Id: 3bc44809950ec019529638cad9223a85d4ab5576 $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,36 +1,34 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddev_service.h @brief software HD device service header file.
|
/// @file softhddev_service.h @brief software HD device service header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2012 by durchflieger. All Rights Reserved.
|
/// Copyright (c) 2012 by durchflieger. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: c7c2d5e8b724515d7c767668aab717b27f4e4068 $
|
/// $Id: c7c2d5e8b724515d7c767668aab717b27f4e4068 $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
|
#define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
|
||||||
#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
|
#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
|
||||||
#define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
|
#define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
|
||||||
|
|
||||||
enum
|
enum { GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
|
||||||
{ GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int structSize;
|
int structSize;
|
||||||
|
|
||||||
// request data
|
// request data
|
||||||
@ -45,13 +43,11 @@ typedef struct
|
|||||||
void *img;
|
void *img;
|
||||||
} SoftHDDevice_AtmoGrabService_v1_0_t;
|
} SoftHDDevice_AtmoGrabService_v1_0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int Mode;
|
int Mode;
|
||||||
} SoftHDDevice_Osd3DModeService_v1_0_t;
|
} SoftHDDevice_Osd3DModeService_v1_0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
// request/reply data
|
// request/reply data
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
|
219
video.h
219
video.h
@ -1,23 +1,23 @@
|
|||||||
///
|
///
|
||||||
/// @file video.h @brief Video module header file
|
/// @file video.h @brief Video module header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
/// License: AGPLv3
|
/// License: AGPLv3
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
/// it under the terms of the GNU Affero General Public License as
|
/// it under the terms of the GNU Affero General Public License as
|
||||||
/// published by the Free Software Foundation, either version 3 of the
|
/// published by the Free Software Foundation, either version 3 of the
|
||||||
/// License.
|
/// License.
|
||||||
///
|
///
|
||||||
/// This program is distributed in the hope that it will be useful,
|
/// This program is distributed in the hope that it will be useful,
|
||||||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
/// GNU Affero General Public License for more details.
|
/// GNU Affero General Public License for more details.
|
||||||
///
|
///
|
||||||
/// $Id: 83cd827a8744e8c80c8adba6cb87653b0ad58c45 $
|
/// $Id: 83cd827a8744e8c80c8adba6cb87653b0ad58c45 $
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// @addtogroup Video
|
/// @addtogroup Video
|
||||||
@ -27,236 +27,247 @@
|
|||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Typedefs
|
// Typedefs
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Video hardware decoder typedef
|
/// Video hardware decoder typedef
|
||||||
typedef struct _video_hw_decoder_ VideoHwDecoder;
|
typedef struct _video_hw_decoder_ VideoHwDecoder;
|
||||||
|
|
||||||
/// Video output stream typedef
|
/// Video output stream typedef
|
||||||
typedef struct __video_stream__ VideoStream;
|
typedef struct __video_stream__ VideoStream;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
|
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
|
||||||
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
|
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
|
||||||
extern int VideoAudioDelay; ///< audio/video delay
|
extern int VideoAudioDelay; ///< audio/video delay
|
||||||
extern char ConfigStartX11Server; ///< flag start the x11 server
|
extern char ConfigStartX11Server; ///< flag start the x11 server
|
||||||
|
extern char MyConfigDir[];
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Allocate new video hardware decoder.
|
/// Allocate new video hardware decoder.
|
||||||
extern VideoHwDecoder *VideoNewHwDecoder(VideoStream *);
|
extern VideoHwDecoder *VideoNewHwDecoder(VideoStream *);
|
||||||
|
|
||||||
/// Deallocate video hardware decoder.
|
/// Deallocate video hardware decoder.
|
||||||
extern void VideoDelHwDecoder(VideoHwDecoder *);
|
extern void VideoDelHwDecoder(VideoHwDecoder *);
|
||||||
|
|
||||||
#ifdef LIBAVCODEC_VERSION
|
/// Get and allocate a video hardware surface.
|
||||||
/// Get and allocate a video hardware surface.
|
|
||||||
extern unsigned VideoGetSurface(VideoHwDecoder *, const AVCodecContext *);
|
extern unsigned VideoGetSurface(VideoHwDecoder *, const AVCodecContext *);
|
||||||
|
|
||||||
/// Release a video hardware surface
|
/// Release a video hardware surface
|
||||||
extern void VideoReleaseSurface(VideoHwDecoder *, unsigned);
|
extern void VideoReleaseSurface(VideoHwDecoder *, unsigned);
|
||||||
|
|
||||||
/// Callback to negotiate the PixelFormat.
|
/// Callback to negotiate the PixelFormat.
|
||||||
extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *,
|
extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *, const enum AVPixelFormat *);
|
||||||
const enum AVPixelFormat *);
|
|
||||||
|
|
||||||
/// Render a ffmpeg frame.
|
/// Render a ffmpeg frame.
|
||||||
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *,
|
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *, const AVFrame *);
|
||||||
const AVFrame *);
|
|
||||||
|
|
||||||
/// Get hwaccel context for ffmpeg.
|
/// Get hwaccel context for ffmpeg.
|
||||||
extern void *VideoGetHwAccelContext(VideoHwDecoder *);
|
extern void *VideoGetHwAccelContext(VideoHwDecoder *);
|
||||||
|
|
||||||
#ifdef AVCODEC_VDPAU_H
|
#ifdef AVCODEC_VDPAU_H
|
||||||
/// Draw vdpau render state.
|
/// Draw vdpau render state.
|
||||||
extern void VideoDrawRenderState(VideoHwDecoder *,
|
extern void VideoDrawRenderState(VideoHwDecoder *, struct vdpau_render_state *);
|
||||||
struct vdpau_render_state *);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_OPENGLOSD
|
#ifdef USE_OPENGLOSD
|
||||||
/// Set callback funktion to notify VDR about VideoEvents
|
/// Set callback funktion to notify VDR about VideoEvents
|
||||||
extern void VideoSetVideoEventCallback(void (*)(void));
|
extern void VideoSetVideoEventCallback(void (*)(void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Poll video events.
|
/// Poll video events.
|
||||||
extern void VideoPollEvent(void);
|
extern void VideoPollEvent(void);
|
||||||
|
|
||||||
/// Wakeup display handler.
|
/// Wakeup display handler.
|
||||||
extern void VideoDisplayWakeup(void);
|
extern void VideoDisplayWakeup(void);
|
||||||
|
|
||||||
/// Set video device.
|
/// Set video device.
|
||||||
extern void VideoSetDevice(const char *);
|
extern void VideoSetDevice(const char *);
|
||||||
|
|
||||||
/// Get video driver name.
|
/// Get video driver name.
|
||||||
extern const char *VideoGetDriverName(void);
|
extern const char *VideoGetDriverName(void);
|
||||||
|
|
||||||
/// Set video geometry.
|
/// Set video geometry.
|
||||||
extern int VideoSetGeometry(const char *);
|
extern int VideoSetGeometry(const char *);
|
||||||
|
|
||||||
/// Set 60Hz display mode.
|
/// Set 60Hz display mode.
|
||||||
extern void VideoSet60HzMode(int);
|
extern void VideoSet60HzMode(int);
|
||||||
|
|
||||||
/// Set soft start audio/video sync.
|
/// Set soft start audio/video sync.
|
||||||
extern void VideoSetSoftStartSync(int);
|
extern void VideoSetSoftStartSync(int);
|
||||||
|
|
||||||
/// Set show black picture during channel switch.
|
/// Set show black picture during channel switch.
|
||||||
extern void VideoSetBlackPicture(int);
|
extern void VideoSetBlackPicture(int);
|
||||||
|
|
||||||
/// Set brightness adjustment.
|
/// Set brightness adjustment.
|
||||||
extern void VideoSetBrightness(int);
|
extern void VideoSetBrightness(int);
|
||||||
|
|
||||||
/// Set contrast adjustment.
|
/// Set contrast adjustment.
|
||||||
extern void VideoSetContrast(int);
|
extern void VideoSetContrast(int);
|
||||||
|
|
||||||
/// Set saturation adjustment.
|
/// Set saturation adjustment.
|
||||||
extern void VideoSetSaturation(int);
|
extern void VideoSetSaturation(int);
|
||||||
|
|
||||||
/// Set Gamm.
|
/// Set Gamma.
|
||||||
extern void VideoSetGamma(int);
|
extern void VideoSetGamma(int);
|
||||||
|
|
||||||
/// Set ColorSpace.
|
/// Set Color Temp.
|
||||||
|
extern void VideoSetTemperature(int);
|
||||||
|
|
||||||
|
/// Set ColorSpace.
|
||||||
extern void VideoSetTargetColor(int);
|
extern void VideoSetTargetColor(int);
|
||||||
|
|
||||||
/// Set hue adjustment.
|
/// Set hue adjustment.
|
||||||
extern void VideoSetHue(int);
|
extern void VideoSetHue(int);
|
||||||
|
|
||||||
/// Set Color Blindness.
|
/// Set Color Blindness.
|
||||||
extern void VideoSetColorBlindness(int);
|
extern void VideoSetColorBlindness(int);
|
||||||
|
|
||||||
/// Set Color Blindness Faktor
|
/// Set Color Blindness Faktor
|
||||||
extern void VideoSetColorBlindnessFaktor(int);
|
extern void VideoSetColorBlindnessFaktor(int);
|
||||||
|
|
||||||
/// Set video output position.
|
/// Set video output position.
|
||||||
extern void VideoSetOutputPosition(VideoHwDecoder *, int, int, int, int);
|
extern void VideoSetOutputPosition(VideoHwDecoder *, int, int, int, int);
|
||||||
|
|
||||||
/// Set video mode.
|
/// Set video mode.
|
||||||
extern void VideoSetVideoMode(int, int, int, int);
|
extern void VideoSetVideoMode(int, int, int, int);
|
||||||
|
|
||||||
/// Set 4:3 display format.
|
/// Set 4:3 display format.
|
||||||
extern void VideoSet4to3DisplayFormat(int);
|
extern void VideoSet4to3DisplayFormat(int);
|
||||||
|
|
||||||
/// Set other display format.
|
/// Set other display format.
|
||||||
extern void VideoSetOtherDisplayFormat(int);
|
extern void VideoSetOtherDisplayFormat(int);
|
||||||
|
|
||||||
/// Set video fullscreen mode.
|
/// Set video fullscreen mode.
|
||||||
extern void VideoSetFullscreen(int);
|
extern void VideoSetFullscreen(int);
|
||||||
|
|
||||||
/// Set deinterlace.
|
/// Set deinterlace.
|
||||||
extern void VideoSetDeinterlace(int[]);
|
extern void VideoSetDeinterlace(int[]);
|
||||||
|
|
||||||
/// Set skip chroma deinterlace.
|
/// Set skip chroma deinterlace.
|
||||||
extern void VideoSetSkipChromaDeinterlace(int[]);
|
extern void VideoSetSkipChromaDeinterlace(int[]);
|
||||||
|
|
||||||
/// Set inverse telecine.
|
/// Set inverse telecine.
|
||||||
extern void VideoSetInverseTelecine(int[]);
|
extern void VideoSetInverseTelecine(int[]);
|
||||||
|
|
||||||
/// Set scaling.
|
/// Set scaling.
|
||||||
extern void VideoSetScaling(int[]);
|
extern void VideoSetScaling(int[]);
|
||||||
|
|
||||||
/// Set scaler test.
|
/// Set scaler test.
|
||||||
extern void VideoSetScalerTest(int);
|
extern void VideoSetScalerTest(int);
|
||||||
|
|
||||||
/// Set denoise.
|
/// Set denoise.
|
||||||
extern void VideoSetDenoise(int[]);
|
extern void VideoSetDenoise(int[]);
|
||||||
|
|
||||||
/// Set sharpen.
|
/// Set sharpen.
|
||||||
extern void VideoSetSharpen(int[]);
|
extern void VideoSetSharpen(int[]);
|
||||||
|
|
||||||
/// Set cut top and bottom.
|
/// Set cut top and bottom.
|
||||||
extern void VideoSetCutTopBottom(int[]);
|
extern void VideoSetCutTopBottom(int[]);
|
||||||
|
|
||||||
/// Set cut left and right.
|
/// Set cut left and right.
|
||||||
extern void VideoSetCutLeftRight(int[]);
|
extern void VideoSetCutLeftRight(int[]);
|
||||||
|
|
||||||
/// Set studio levels.
|
/// Set studio levels.
|
||||||
extern void VideoSetStudioLevels(int);
|
extern void VideoSetStudioLevels(int);
|
||||||
|
|
||||||
/// Set background.
|
/// Set background.
|
||||||
extern void VideoSetBackground(uint32_t);
|
extern void VideoSetBackground(uint32_t);
|
||||||
|
|
||||||
/// Set audio delay.
|
/// Set audio delay.
|
||||||
extern void VideoSetAudioDelay(int);
|
extern void VideoSetAudioDelay(int);
|
||||||
|
|
||||||
/// Set auto-crop parameters.
|
/// Clear OSD.
|
||||||
extern void VideoSetAutoCrop(int, int, int);
|
|
||||||
|
|
||||||
/// Clear OSD.
|
|
||||||
extern void VideoOsdClear(void);
|
extern void VideoOsdClear(void);
|
||||||
|
|
||||||
/// Draw an OSD ARGB image.
|
/// Draw an OSD ARGB image.
|
||||||
extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int,
|
extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
|
||||||
int);
|
|
||||||
|
|
||||||
/// Get OSD size.
|
/// Get OSD size.
|
||||||
extern void VideoGetOsdSize(int *, int *);
|
extern void VideoGetOsdSize(int *, int *);
|
||||||
|
|
||||||
/// Set OSD size.
|
/// Set OSD size.
|
||||||
extern void VideoSetOsdSize(int, int);
|
extern void VideoSetOsdSize(int, int);
|
||||||
|
|
||||||
/// Set Osd 3D Mode
|
/// Set Osd 3D Mode
|
||||||
extern void VideoSetOsd3DMode(int);
|
extern void VideoSetOsd3DMode(int);
|
||||||
|
|
||||||
/// Set video clock.
|
/// Set video clock.
|
||||||
extern void VideoSetClock(VideoHwDecoder *, int64_t);
|
extern void VideoSetClock(VideoHwDecoder *, int64_t);
|
||||||
|
|
||||||
/// Get video clock.
|
/// Get video clock.
|
||||||
extern int64_t VideoGetClock(const VideoHwDecoder *);
|
extern int64_t VideoGetClock(const VideoHwDecoder *);
|
||||||
|
|
||||||
/// Set closing flag.
|
/// Set closing flag.
|
||||||
extern void VideoSetClosing(VideoHwDecoder *);
|
extern void VideoSetClosing(VideoHwDecoder *);
|
||||||
|
|
||||||
/// Reset start of frame counter
|
/// Reset start of frame counter
|
||||||
extern void VideoResetStart(VideoHwDecoder *);
|
extern void VideoResetStart(VideoHwDecoder *);
|
||||||
|
|
||||||
/// Set trick play speed.
|
/// Set trick play speed.
|
||||||
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
|
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
|
||||||
|
|
||||||
/// Grab screen.
|
/// Grab screen.
|
||||||
extern uint8_t *VideoGrab(int *, int *, int *, int);
|
extern uint8_t *VideoGrab(int *, int *, int *, int);
|
||||||
|
|
||||||
/// Grab screen raw.
|
/// Grab screen raw.
|
||||||
extern uint8_t *VideoGrabService(int *, int *, int *);
|
extern uint8_t *VideoGrabService(int *, int *, int *);
|
||||||
|
|
||||||
/// Get decoder statistics.
|
/// Get decoder statistics.
|
||||||
extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *);
|
extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *);
|
||||||
|
|
||||||
/// Get video stream size
|
/// Get video stream size
|
||||||
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);
|
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);
|
||||||
|
|
||||||
extern void VideoOsdInit(void); ///< Setup osd.
|
extern void VideoOsdInit(void); ///< Setup osd.
|
||||||
extern void VideoOsdExit(void); ///< Cleanup osd.
|
extern void VideoOsdExit(void); ///< Cleanup osd.
|
||||||
|
|
||||||
extern void VideoInit(const char *); ///< Setup video module.
|
extern void VideoInit(const char *); ///< Setup video module.
|
||||||
extern void VideoExit(void); ///< Cleanup and exit video module.
|
extern void VideoExit(void); ///< Cleanup and exit video module.
|
||||||
|
|
||||||
/// Poll video input buffers.
|
/// Poll video input buffers.
|
||||||
extern int VideoPollInput(VideoStream *);
|
extern int VideoPollInput(VideoStream *);
|
||||||
|
|
||||||
/// Decode video input buffers.
|
/// Decode video input buffers.
|
||||||
extern int VideoDecodeInput(VideoStream *);
|
extern int VideoDecodeInput(VideoStream *, int);
|
||||||
|
|
||||||
/// Get number of input buffers.
|
/// Get number of input buffers.
|
||||||
extern int VideoGetBuffers(const VideoStream *);
|
extern int VideoGetBuffers(const VideoStream *);
|
||||||
|
|
||||||
/// Set DPMS at Blackscreen switch
|
/// Set DPMS at Blackscreen switch
|
||||||
extern void SetDPMSatBlackScreen(int);
|
extern void SetDPMSatBlackScreen(int);
|
||||||
|
|
||||||
/// Raise the frontend window
|
/// Raise the frontend window
|
||||||
extern int VideoRaiseWindow(void);
|
extern int VideoRaiseWindow(void);
|
||||||
|
|
||||||
|
/// Set Shaders
|
||||||
|
extern int VideoSetShader(char *);
|
||||||
|
|
||||||
|
extern void VideoSetRefresh(char *);
|
||||||
|
|
||||||
|
extern void VideoSetConnector(char *);
|
||||||
|
|
||||||
#ifdef USE_OPENGLOSD
|
#ifdef USE_OPENGLOSD
|
||||||
extern void ActivateOsd(GLuint,int,int,int,int);
|
extern void ActivateOsd(GLuint, int, int, int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GAMMA
|
||||||
|
extern void Init_Gamma();
|
||||||
|
extern void Exit_Gamma();
|
||||||
|
extern void Set_Gamma(float, int);
|
||||||
|
extern void Get_Gamma();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
long int gettid()
|
long int gettid()
|
||||||
{
|
{
|
||||||
return (long int)syscall(224);
|
return (long int)syscall(224);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user