1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

finalised PLACEBO support

This commit is contained in:
jojo61 2018-11-17 14:58:25 +01:00
parent 882f63b0b4
commit c97fd4e007
5 changed files with 578 additions and 362 deletions

View File

@ -196,7 +196,7 @@ LIBS += -L/usr/lib64/opengl/nvidia/lib
LIBS += -L/usr/local/cuda/lib64 LIBS += -L/usr/local/cuda/lib64
ifeq ($(LIBPLACEBO),1) ifeq ($(LIBPLACEBO),1)
LIBS += -lplacebo LIBS += -lplacebo -lglut
endif endif
LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid

View File

@ -774,16 +774,35 @@ cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputF
this->y = y; this->y = y;
} }
#ifdef PLACEBO
//extern "C" {
extern unsigned char *posd;
//}
#endif
bool cOglCmdCopyBufferToOutputFb::Execute(void) { bool cOglCmdCopyBufferToOutputFb::Execute(void) {
int i;
pthread_mutex_lock(&OSDMutex); pthread_mutex_lock(&OSDMutex);
fb->BindRead(); fb->BindRead();
oFb->BindWrite(); oFb->BindWrite();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
#ifdef PLACEBO
// if (posd)
// free(posd);
// posd = MALLOC(unsigned char, (y+fb->Height()) * (x+fb->Width()) * 4);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if (posd)
glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_BGRA,GL_UNSIGNED_BYTE,posd);
#else
fb->Blit(x, y + fb->Height(), x + fb->Width(), y); fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
#endif
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
oFb->Unbind(); oFb->Unbind();
pthread_mutex_unlock(&OSDMutex); pthread_mutex_unlock(&OSDMutex);
ActivateOsd(oFb->texture,x, y ,fb->Width(), fb->Height());
return true; return true;
} }
@ -1566,10 +1585,11 @@ extern "C" int GlxInitopengl();
bool cOglThread::InitOpenGL(void) { bool cOglThread::InitOpenGL(void) {
#if 0 #ifdef PLACEBO
const char *displayName = X11DisplayName; const char *displayName = X11DisplayName;
if (!displayName) { if (!displayName) {
displayName = getenv("DISPLAY"); displayName = getenv("DISPLAY");
@ -1577,6 +1597,7 @@ bool cOglThread::InitOpenGL(void) {
displayName = ":0.0"; displayName = ":0.0";
} }
} }
dsyslog("[softhddev]OpenGL using display %s", displayName); dsyslog("[softhddev]OpenGL using display %s", displayName);
int argc = 3; int argc = 3;
@ -1600,11 +1621,11 @@ bool cOglThread::InitOpenGL(void) {
esyslog("[softhddev]glewInit failed, aborting\n"); esyslog("[softhddev]glewInit failed, aborting\n");
return false; return false;
} }
#endif #else
if (!GlxInitopengl()) if (!GlxInitopengl())
return false; return false;
#endif
VertexBuffers[vbText]->EnableBlending(); VertexBuffers[vbText]->EnableBlending();
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
return true; return true;
@ -1666,7 +1687,9 @@ void cOglThread::Cleanup(void) {
DeleteShaders(); DeleteShaders();
// glVDPAUFiniNV(); // glVDPAUFiniNV();
cOglFont::Cleanup(); cOglFont::Cleanup();
// glutExit(); #ifdef PLACEBO
glutExit();
#endif
pthread_mutex_unlock(&OSDMutex); pthread_mutex_unlock(&OSDMutex);
} }
@ -1909,7 +1932,11 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
// osdHeight = 1080; // osdHeight = 1080;
dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight); dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight);
#ifdef PLACEBO
if (posd)
free(posd);
posd = MALLOC(unsigned char, osdWidth * osdHeight * 4);
#endif
//create output framebuffer //create output framebuffer
if (!oFb) { if (!oFb) {
oFb = new cOglOutputFb(osdWidth, osdHeight); oFb = new cOglOutputFb(osdWidth, osdHeight);
@ -1921,6 +1948,11 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
cOglOsd::~cOglOsd() { cOglOsd::~cOglOsd() {
OsdClose(); OsdClose();
SetActive(false); SetActive(false);
#ifdef PLACEBO
if (posd)
free(posd);
posd = 0;
#endif
oglThread->DoCmd(new cOglCmdDeleteFb(bFb)); oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
} }

View File

@ -171,6 +171,7 @@ protected:
public: public:
GLuint fb; GLuint fb;
GLuint texture; 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; }

View File

@ -46,9 +46,12 @@ extern "C"
#include <stdint.h> #include <stdint.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#ifndef USE_OPENGLOSD #ifndef USE_OPENGLOSD
#include "audio.h" #include "audio.h"
#include "video.h" #include "video.h"
#include "codec.h" #include "codec.h"
#endif
#if PLACEBO
#include <libplacebo/filters.h>
#endif #endif
} }
@ -89,6 +92,7 @@ static const char *const Resolution[RESOLUTIONS] = {
"576i", "720p", "1080i_fake", "1080i", "UHD" "576i", "720p", "1080i_fake", "1080i", "UHD"
}; };
static char ConfigMakePrimary; ///< config primary wanted static char ConfigMakePrimary; ///< config primary wanted
static char ConfigHideMainMenuEntry; ///< config hide main menu entry static char ConfigHideMainMenuEntry; ///< config hide main menu entry
static char ConfigDetachFromMainMenu; ///< detach from main menu entry instead of suspend static char ConfigDetachFromMainMenu; ///< detach from main menu entry instead of suspend
@ -107,8 +111,8 @@ static char ConfigVideoBlackPicture; ///< config enable black picture mode
char ConfigVideoClearOnSwitch; ///< config enable Clear on channel switch char ConfigVideoClearOnSwitch; ///< config enable Clear on channel switch
static int ConfigVideoBrightness; ///< config video brightness static int ConfigVideoBrightness; ///< config video brightness
static int ConfigVideoContrast = 1000; ///< config video contrast static int ConfigVideoContrast = 100; ///< config video contrast
static int ConfigVideoSaturation = 1000; ///< config video saturation static int ConfigVideoSaturation = 100; ///< config video saturation
static int ConfigVideoHue; ///< config video hue static int ConfigVideoHue; ///< config video hue
/// config deinterlace /// config deinterlace
@ -985,9 +989,11 @@ void cMenuSetupSoft::Create(void)
static const char *const deinterlace_short[] = { static const char *const deinterlace_short[] = {
"B", "W", "T", "T+S", "S+B", "S+S", "B", "W", "T", "T+S", "S+B", "S+S",
}; };
#ifndef PLACEBO
static const char *const scaling[] = { static const char *const scaling[] = {
"Normal", "Fast", "HQ", "Anamorphic" "Normal", "Fast", "HQ", "Anamorphic"
}; };
#endif
static const char *const scaling_short[] = { static const char *const scaling_short[] = {
"N", "F", "HQ", "A" "N", "F", "HQ", "A"
}; };
@ -1000,6 +1006,19 @@ void cMenuSetupSoft::Create(void)
int current; int current;
int i; int i;
#ifdef PLACEBO
static int scalers=0;
static char *scaling[100];
if (scalers == 0) {
for (scalers = 0;pl_named_filters[scalers].filter != NULL ; scalers++) {
scaling[scalers] = (char*)pl_named_filters[scalers].name;
printf("Scaler %s\n",pl_named_filters[scalers].name);
}
scalers -= 2;
}
#endif
current = Current(); // get current menu item index current = Current(); // get current menu item index
Clear(); // clear the menu Clear(); // clear the menu
@ -1062,15 +1081,15 @@ void cMenuSetupSoft::Create(void)
&BlackPicture, trVDR("no"), trVDR("yes"))); &BlackPicture, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"), Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"),
&ClearOnSwitch, trVDR("no"), trVDR("yes"))); &ClearOnSwitch, trVDR("no"), trVDR("yes")));
#if 0 #if PLACEBO
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"), Add(new cMenuEditIntItem(tr("Brightness (-100..100)"),
&Brightness, -1000, 1000, tr("min"), tr("max"))); &Brightness, -100, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast, Add(new cMenuEditIntItem(tr("Contrast (0..100)"), &Contrast,
0, 10000, tr("min"), tr("max"))); 0, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Saturation (0..10000) (vdpau)"), Add(new cMenuEditIntItem(tr("Saturation (0..100)"),
&Saturation, 0, 10000, tr("min"), tr("max"))); &Saturation, 0, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141, Add(new cMenuEditIntItem(tr("Hue (-314..314) "), &Hue, -314,
3141, tr("min"), tr("max"))); 314, tr("min"), tr("max")));
#endif #endif
for (i = 0; i < RESOLUTIONS; ++i) { for (i = 0; i < RESOLUTIONS; ++i) {
cString msg; cString msg;
@ -1080,9 +1099,10 @@ void cMenuSetupSoft::Create(void)
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg)); Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
if (ResolutionShown[i]) { if (ResolutionShown[i]) {
#if PLACEBO
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], scalers, scaling));
#endif
#if 0 #if 0
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
scaling));
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i], Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
6, deinterlace)); 6, deinterlace));
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"), Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),

767
video.c

File diff suppressed because it is too large Load Diff