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
ifeq ($(LIBPLACEBO),1)
LIBS += -lplacebo
LIBS += -lplacebo -lglut
endif
LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid

View File

@ -758,7 +758,7 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
buffer->Bind();
if (!fb->BindTexture())
return false;
VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
VertexBuffers[vbTexture]->DrawArrays();
VertexBuffers[vbTexture]->Unbind();
@ -774,17 +774,36 @@ cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputF
this->y = y;
}
#ifdef PLACEBO
//extern "C" {
extern unsigned char *posd;
//}
#endif
bool cOglCmdCopyBufferToOutputFb::Execute(void) {
int i;
pthread_mutex_lock(&OSDMutex);
fb->BindRead();
oFb->BindWrite();
glClear(GL_COLOR_BUFFER_BIT);
fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
oFb->Unbind();
#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);
#endif
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
oFb->Unbind();
pthread_mutex_unlock(&OSDMutex);
ActivateOsd(oFb->texture,x, y ,fb->Width(), fb->Height());
return true;
}
@ -1566,10 +1585,11 @@ extern "C" int GlxInitopengl();
bool cOglThread::InitOpenGL(void) {
#if 0
#ifdef PLACEBO
const char *displayName = X11DisplayName;
if (!displayName) {
displayName = getenv("DISPLAY");
@ -1577,6 +1597,7 @@ bool cOglThread::InitOpenGL(void) {
displayName = ":0.0";
}
}
dsyslog("[softhddev]OpenGL using display %s", displayName);
int argc = 3;
@ -1600,11 +1621,11 @@ bool cOglThread::InitOpenGL(void) {
esyslog("[softhddev]glewInit failed, aborting\n");
return false;
}
#endif
#else
if (!GlxInitopengl())
return false;
#endif
VertexBuffers[vbText]->EnableBlending();
glDisable(GL_DEPTH_TEST);
return true;
@ -1666,7 +1687,9 @@ void cOglThread::Cleanup(void) {
DeleteShaders();
// glVDPAUFiniNV();
cOglFont::Cleanup();
// glutExit();
#ifdef PLACEBO
glutExit();
#endif
pthread_mutex_unlock(&OSDMutex);
}
@ -1909,7 +1932,11 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
// osdHeight = 1080;
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
if (!oFb) {
oFb = new cOglOutputFb(osdWidth, osdHeight);
@ -1921,6 +1948,11 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
cOglOsd::~cOglOsd() {
OsdClose();
SetActive(false);
#ifdef PLACEBO
if (posd)
free(posd);
posd = 0;
#endif
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
}

View File

@ -171,6 +171,7 @@ protected:
public:
GLuint fb;
GLuint texture;
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
virtual ~cOglFb(void);
bool Initiated(void) { return initiated; }

View File

@ -46,9 +46,12 @@ extern "C"
#include <stdint.h>
#include <libavcodec/avcodec.h>
#ifndef USE_OPENGLOSD
#include "audio.h"
#include "video.h"
#include "codec.h"
#include "audio.h"
#include "video.h"
#include "codec.h"
#endif
#if PLACEBO
#include <libplacebo/filters.h>
#endif
}
@ -89,6 +92,7 @@ static const char *const Resolution[RESOLUTIONS] = {
"576i", "720p", "1080i_fake", "1080i", "UHD"
};
static char ConfigMakePrimary; ///< config primary wanted
static char ConfigHideMainMenuEntry; ///< config hide main menu entry
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
static int ConfigVideoBrightness; ///< config video brightness
static int ConfigVideoContrast = 1000; ///< config video contrast
static int ConfigVideoSaturation = 1000; ///< config video saturation
static int ConfigVideoContrast = 100; ///< config video contrast
static int ConfigVideoSaturation = 100; ///< config video saturation
static int ConfigVideoHue; ///< config video hue
/// config deinterlace
@ -985,9 +989,11 @@ void cMenuSetupSoft::Create(void)
static const char *const deinterlace_short[] = {
"B", "W", "T", "T+S", "S+B", "S+S",
};
#ifndef PLACEBO
static const char *const scaling[] = {
"Normal", "Fast", "HQ", "Anamorphic"
};
#endif
static const char *const scaling_short[] = {
"N", "F", "HQ", "A"
};
@ -1000,6 +1006,19 @@ void cMenuSetupSoft::Create(void)
int current;
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
Clear(); // clear the menu
@ -1062,15 +1081,15 @@ void cMenuSetupSoft::Create(void)
&BlackPicture, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"),
&ClearOnSwitch, trVDR("no"), trVDR("yes")));
#if 0
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
&Brightness, -1000, 1000, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast,
0, 10000, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Saturation (0..10000) (vdpau)"),
&Saturation, 0, 10000, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141,
3141, tr("min"), tr("max")));
#if PLACEBO
Add(new cMenuEditIntItem(tr("Brightness (-100..100)"),
&Brightness, -100, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Contrast (0..100)"), &Contrast,
0, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Saturation (0..100)"),
&Saturation, 0, 100, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Hue (-314..314) "), &Hue, -314,
314, tr("min"), tr("max")));
#endif
for (i = 0; i < RESOLUTIONS; ++i) {
cString msg;
@ -1080,9 +1099,10 @@ void cMenuSetupSoft::Create(void)
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
if (ResolutionShown[i]) {
#if PLACEBO
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], scalers, scaling));
#endif
#if 0
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
scaling));
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
6, deinterlace));
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),
@ -1269,16 +1289,16 @@ cMenuSetupSoft::cMenuSetupSoft(void)
Hue = ConfigVideoHue;
for (i = 0; i < RESOLUTIONS; ++i) {
ResolutionShown[i] = 0;
Scaling[i] = ConfigVideoScaling[i];
Deinterlace[i] = ConfigVideoDeinterlace[i];
SkipChromaDeinterlace[i] = ConfigVideoSkipChromaDeinterlace[i];
InverseTelecine[i] = ConfigVideoInverseTelecine[i];
Denoise[i] = ConfigVideoDenoise[i];
Sharpen[i] = ConfigVideoSharpen[i];
ResolutionShown[i] = 0;
Scaling[i] = ConfigVideoScaling[i];
Deinterlace[i] = ConfigVideoDeinterlace[i];
SkipChromaDeinterlace[i] = ConfigVideoSkipChromaDeinterlace[i];
InverseTelecine[i] = ConfigVideoInverseTelecine[i];
Denoise[i] = ConfigVideoDenoise[i];
Sharpen[i] = ConfigVideoSharpen[i];
CutTopBottom[i] = ConfigVideoCutTopBottom[i];
CutLeftRight[i] = ConfigVideoCutLeftRight[i];
CutTopBottom[i] = ConfigVideoCutTopBottom[i];
CutLeftRight[i] = ConfigVideoCutLeftRight[i];
}
//
// auto-crop

813
video.c

File diff suppressed because it is too large Load Diff