mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Merge pull request #45 from dnehring7/master
Reindent all sources to common coding. Reworked aspect function.
This commit is contained in:
commit
309ad1c90e
4
Makefile
4
Makefile
@ -385,9 +385,7 @@ HDRS= $(wildcard *.h)
|
||||
|
||||
indent:
|
||||
for i in $(SRCS) $(HDRS); do \
|
||||
indent $$i; \
|
||||
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
|
||||
mv $$i.up $$i; \
|
||||
VERSION_CONTROL=none indent $$i; \
|
||||
done
|
||||
|
||||
video_test: video.c Makefile
|
||||
|
@ -283,11 +283,13 @@ Setup: /etc/vdr/setup.conf
|
||||
0 pan and scan
|
||||
1 letter box
|
||||
2 center cut-out
|
||||
3 original
|
||||
|
||||
softhddevice.VideoOtherDisplayFormat = 1
|
||||
0 pan and scan
|
||||
1 pillar box
|
||||
2 center cut-out
|
||||
3 original
|
||||
|
||||
softhddevice.pip.X = 79
|
||||
softhddevice.pip.Y = 78
|
||||
@ -378,6 +380,3 @@ Running:
|
||||
Known Bugs:
|
||||
-----------
|
||||
SD Streams not working very well on vaapi
|
||||
|
||||
|
||||
|
||||
|
13
audio.c
13
audio.c
@ -146,7 +146,6 @@ static volatile char AudioRunning; ///< thread running / stopped
|
||||
static volatile char AudioPaused; ///< audio paused
|
||||
static volatile char AudioVideoIsReady; ///< video ready start early
|
||||
static int AudioSkip; ///< skip audio to sync to video
|
||||
int AudioDelay; /// delay audio to sync to video
|
||||
|
||||
static const int AudioBytesProSample = 2; ///< number of bytes per sample
|
||||
|
||||
@ -2024,7 +2023,8 @@ static void *AudioPlayHandlerThread(void *dummy)
|
||||
|
||||
Debug(3, "audio: ----> %dms %d start\n", (AudioUsedBytes() * 1000)
|
||||
/ (!AudioRing[AudioRingWrite].HwSampleRate + !AudioRing[AudioRingWrite].HwChannels +
|
||||
AudioRing[AudioRingWrite].HwSampleRate * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample),AudioUsedBytes());
|
||||
AudioRing[AudioRingWrite].HwSampleRate * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample),
|
||||
AudioUsedBytes());
|
||||
|
||||
do {
|
||||
int filled;
|
||||
@ -2291,7 +2291,7 @@ void AudioEnqueue(const void *samples, int count)
|
||||
// no lock needed, can wakeup next time
|
||||
AudioRunning = 1;
|
||||
pthread_cond_signal(&AudioStartCond);
|
||||
Debug(3, "Start on AudioEnque Threshold %d n %d\n",AudioStartThreshold,n);
|
||||
Debug(3, "Start on AudioEnque Threshold %d n %d\n", AudioStartThreshold, n);
|
||||
}
|
||||
}
|
||||
// Update audio clock (stupid gcc developers thinks INT64_C is unsigned)
|
||||
@ -2337,11 +2337,12 @@ void AudioVideoReady(int64_t pts)
|
||||
|
||||
if (!AudioRunning) {
|
||||
int skip;
|
||||
|
||||
// buffer ~15 video frames
|
||||
// FIXME: HDTV can use smaller video buffer
|
||||
skip = pts - 0 * 20 * 90 - AudioBufferTime * 90 - audio_pts + VideoAudioDelay;
|
||||
#ifdef DEBUG
|
||||
// fprintf(stderr, "a/v-diff %dms a/v-delay %dms skip %dms Audiobuffer %d\n", (int)(pts - audio_pts) / 90, VideoAudioDelay / 90, skip / 90,AudioBufferTime);
|
||||
// fprintf(stderr, "a/v-diff %dms a/v-delay %dms skip %dms Audiobuffer %d\n", (int)(pts - audio_pts) / 90, VideoAudioDelay / 90, skip / 90,AudioBufferTime);
|
||||
#endif
|
||||
// guard against old PTS
|
||||
if (skip > 0 && skip < 4000 * 90) {
|
||||
@ -2479,7 +2480,7 @@ int64_t AudioGetDelay(void)
|
||||
pts += ((int64_t) RingBufferUsedBytes(AudioRing[AudioRingRead].RingBuffer)
|
||||
* 90 * 1000) / (AudioRing[AudioRingRead].HwSampleRate * AudioRing[AudioRingRead].HwChannels *
|
||||
AudioBytesProSample);
|
||||
Debug(4,"audio: hw+sw delay %zd %" PRId64 "ms\n", RingBufferUsedBytes(AudioRing[AudioRingRead].RingBuffer),
|
||||
Debug(4, "audio: hw+sw delay %zd %" PRId64 "ms\n", RingBufferUsedBytes(AudioRing[AudioRingRead].RingBuffer),
|
||||
pts / 90);
|
||||
|
||||
return pts;
|
||||
@ -2496,7 +2497,7 @@ void AudioSetClock(int64_t pts)
|
||||
Debug(4, "audio: set clock %s -> %s pts\n", Timestamp2String(AudioRing[AudioRingWrite].PTS),
|
||||
Timestamp2String(pts));
|
||||
}
|
||||
// printf("Audiosetclock pts %#012" PRIx64 " %d\n",pts,RingBufferUsedBytes(AudioRing[AudioRingWrite].RingBuffer));
|
||||
// printf("Audiosetclock pts %#012" PRIx64 " %d\n",pts,RingBufferUsedBytes(AudioRing[AudioRingWrite].RingBuffer));
|
||||
AudioRing[AudioRingWrite].PTS = pts;
|
||||
}
|
||||
|
||||
|
34
codec.c
34
codec.c
@ -96,6 +96,7 @@ static pthread_mutex_t CodecLockMutex;
|
||||
/// Flag prefer fast channel switch
|
||||
char CodecUsePossibleDefectFrames;
|
||||
AVBufferRef *hw_device_ctx;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Video
|
||||
//----------------------------------------------------------------------------
|
||||
@ -255,16 +256,16 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
||||
#endif
|
||||
#ifdef RASPI
|
||||
switch (codec_id) {
|
||||
case AV_CODEC_ID_MPEG2VIDEO:
|
||||
name = "mpeg2_v4l2m2m";
|
||||
break;
|
||||
case AV_CODEC_ID_H264:
|
||||
name = "h264_v4l2m2m";
|
||||
case AV_CODEC_ID_MPEG2VIDEO:
|
||||
name = "mpeg2_v4l2m2m";
|
||||
break;
|
||||
case AV_CODEC_ID_H264:
|
||||
name = "h264_v4l2m2m";
|
||||
// name = "h264_mmal";
|
||||
break;
|
||||
case AV_CODEC_ID_HEVC:
|
||||
name = "hevc_v4l2m2m";
|
||||
break;
|
||||
break;
|
||||
case AV_CODEC_ID_HEVC:
|
||||
name = "hevc_v4l2m2m";
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (name && (video_codec = avcodec_find_decoder_by_name(name))) {
|
||||
@ -288,8 +289,8 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
||||
}
|
||||
decoder->VideoCtx->hw_device_ctx = av_buffer_ref(HwDeviceContext);
|
||||
#else
|
||||
decoder->VideoCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME; /* request a DRM frame
|
||||
// decoder->VideoCtx->pix_fmt = AV_PIX_FMT_MMAL; /* request a DRM frame */
|
||||
decoder->VideoCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME; /* request a DRM frame */
|
||||
// decoder->VideoCtx->pix_fmt = AV_PIX_FMT_MMAL; /* request a DRM frame */
|
||||
#endif
|
||||
|
||||
// FIXME: for software decoder use all cpus, otherwise 1
|
||||
@ -310,7 +311,7 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
|
||||
if (video_codec->capabilities & (AV_CODEC_CAP_AUTO_THREADS)) {
|
||||
Debug(3, "codec: auto threads enabled");
|
||||
// decoder->VideoCtx->thread_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (video_codec->capabilities & AV_CODEC_CAP_TRUNCATED) {
|
||||
Debug(3, "codec: supports truncated packets");
|
||||
@ -596,9 +597,9 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
} else {
|
||||
got_frame = 0;
|
||||
}
|
||||
// printf("got %s packet from decoder\n",got_frame?"1":"no");
|
||||
// printf("got %s packet from decoder\n",got_frame?"1":"no");
|
||||
if (got_frame) { // frame completed
|
||||
// printf("video frame pts %#012" PRIx64 " %dms\n",frame->pts,(int)(apts - frame->pts) / 90);
|
||||
// printf("video frame pts %#012" PRIx64 " %dms\n",frame->pts,(int)(apts - frame->pts) / 90);
|
||||
#ifdef YADIF
|
||||
if (decoder->filter) {
|
||||
if (decoder->filter == 1) {
|
||||
@ -647,7 +648,7 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
void CodecVideoFlushBuffers(VideoDecoder * decoder)
|
||||
{
|
||||
if (decoder->VideoCtx) {
|
||||
avcodec_flush_buffers(decoder->VideoCtx);
|
||||
avcodec_flush_buffers(decoder->VideoCtx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1111,8 +1112,6 @@ static int CodecAudioPassthroughHelper(AudioDecoder * audio_decoder, const AVPac
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(USE_SWRESAMPLE) || defined(USE_AVRESAMPLE)
|
||||
|
||||
/**
|
||||
@ -1346,6 +1345,7 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||
if (audio_decoder->Resample) {
|
||||
uint8_t outbuf[8192 * 2 * 8];
|
||||
uint8_t *out[1];
|
||||
|
||||
out[0] = outbuf;
|
||||
ret =
|
||||
swr_convert(audio_decoder->Resample, out, sizeof(outbuf) / (2 * audio_decoder->HwChannels),
|
||||
|
5
drm.c
5
drm.c
@ -475,9 +475,8 @@ void VideoInitDrm()
|
||||
|
||||
void get_drm_aspect(int *num,int *den)
|
||||
{
|
||||
Debug(3,"mmHeight %d mmWidth %d VideoHeight %d VideoWidth %d\n",render->mmHeight,render->mmWidth,VideoWindowHeight,VideoWindowWidth);
|
||||
*num = VideoWindowWidth * render->mmHeight;
|
||||
*den = VideoWindowHeight * render->mmWidth;
|
||||
*num = VideoWindowWidth;
|
||||
*den = VideoWindowHeight;
|
||||
}
|
||||
|
||||
struct gbm_bo *bo = NULL, *next_bo=NULL;
|
||||
|
1
hdr.c
1
hdr.c
@ -490,4 +490,3 @@ static void set_hdr_metadata(int color,int trc, AVFrameSideData *sd1, AVFrameSid
|
||||
Debug(3,"DRM: HDR metadata: prop set\n");
|
||||
|
||||
}
|
||||
|
||||
|
991
openglosd.cpp
991
openglosd.cpp
File diff suppressed because it is too large
Load Diff
40
po/de_DE.po
40
po/de_DE.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: VDR \n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2019-10-26 18:41+0200\n"
|
||||
"POT-Creation-Date: 2020-04-13 16:26+0200\n"
|
||||
"PO-Revision-Date: blabla\n"
|
||||
"Last-Translator: blabla\n"
|
||||
"Language-Team: blabla\n"
|
||||
@ -263,9 +263,6 @@ msgstr ""
|
||||
msgid "codec: can't allocate video codec context\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "VAAPI Refcounts invalid\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "codec: can't set option deint to video codec!\n"
|
||||
msgstr ""
|
||||
|
||||
@ -306,24 +303,6 @@ msgstr ""
|
||||
msgid "codec/audio: decoded data smaller than encoded\n"
|
||||
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"
|
||||
msgstr ""
|
||||
|
||||
@ -642,7 +621,7 @@ msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)"
|
||||
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
|
||||
|
||||
#, c-format
|
||||
msgid " Frame Process time %2.2fms"
|
||||
msgid " Video %dx%d Color: %s Gamma: %s"
|
||||
msgstr ""
|
||||
|
||||
msgid "pass-through disabled"
|
||||
@ -807,10 +786,6 @@ msgstr ""
|
||||
msgid "video/glx: no GLX support\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video/glx: glx version %d.%d\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "did not get FBconfig"
|
||||
msgstr ""
|
||||
|
||||
@ -898,11 +873,10 @@ msgid "Failed rendering frame!\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video/vdpau: output buffer full, dropping frame (%d/%d)\n"
|
||||
msgid "video/cuvid: output buffer full, dropping frame (%d/%d)\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video/vdpau: pixel format %d not supported\n"
|
||||
msgid "Could not dynamically load CUDA\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kein Cuda device gefunden"
|
||||
@ -943,12 +917,6 @@ msgstr ""
|
||||
msgid "video/egl: can't create thread egl context\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "video: can't queue cancel video display thread\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "video: can't cancel video display thread\n"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "video: repeated pict %d found, but not handled\n"
|
||||
msgstr ""
|
||||
|
285
shaders.h
285
shaders.h
@ -11,7 +11,6 @@ const char *gl_version = "#version 300 es ";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Color conversion matrix: RGB = m * YUV + c
|
||||
* m is in row-major matrix, with m[row][col], e.g.:
|
||||
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
|
||||
@ -71,16 +70,11 @@ float cms_matrix[3][3] = { {1.660497, -0.124547, -0.018154},
|
||||
};
|
||||
|
||||
// Common constants for SMPTE ST.2084 (PQ)
|
||||
static const float PQ_M1 = 2610./4096 * 1./4,
|
||||
PQ_M2 = 2523./4096 * 128,
|
||||
PQ_C1 = 3424./4096,
|
||||
PQ_C2 = 2413./4096 * 32,
|
||||
PQ_C3 = 2392./4096 * 32;
|
||||
static const float PQ_M1 = 2610. / 4096 * 1. / 4, PQ_M2 = 2523. / 4096 * 128, PQ_C1 = 3424. / 4096, PQ_C2 =
|
||||
2413. / 4096 * 32, PQ_C3 = 2392. / 4096 * 32;
|
||||
|
||||
// Common constants for ARIB STD-B67 (HLG)
|
||||
static const float HLG_A = 0.17883277,
|
||||
HLG_B = 0.28466892,
|
||||
HLG_C = 0.55991073;
|
||||
static const float HLG_A = 0.17883277, HLG_B = 0.28466892, HLG_C = 0.55991073;
|
||||
|
||||
struct gl_vao_entry
|
||||
{
|
||||
@ -124,48 +118,55 @@ static const struct gl_vao_entry vertex_vao[] = {
|
||||
char sh[SHADER_LENGTH];
|
||||
char shv[SHADER_LENGTH];
|
||||
|
||||
GL_init() {
|
||||
sh[0] = 0;
|
||||
GL_init()
|
||||
{
|
||||
sh[0] = 0;
|
||||
}
|
||||
GLV_init() {
|
||||
shv[0] = 0;
|
||||
|
||||
GLV_init()
|
||||
{
|
||||
shv[0] = 0;
|
||||
}
|
||||
pl_shader_append(const char *fmt, ...) {
|
||||
char temp[1000];
|
||||
va_list ap;
|
||||
|
||||
pl_shader_append(const char *fmt, ...)
|
||||
{
|
||||
char temp[1000];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(temp,fmt,ap);
|
||||
va_end(ap);
|
||||
vsprintf(temp, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (strlen(sh) + strlen(temp) > SHADER_LENGTH)
|
||||
Fatal(_("Shaderlenght fault\n"));
|
||||
strcat(sh,temp);
|
||||
if (strlen(sh) + strlen(temp) > SHADER_LENGTH)
|
||||
Fatal(_("Shaderlenght fault\n"));
|
||||
strcat(sh, temp);
|
||||
|
||||
}
|
||||
|
||||
pl_shader_append_v(const char *fmt, ...) {
|
||||
char temp[1000];
|
||||
va_list ap;
|
||||
pl_shader_append_v(const char *fmt, ...)
|
||||
{
|
||||
char temp[1000];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(temp,fmt,ap);
|
||||
va_end(ap);
|
||||
vsprintf(temp, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (strlen(shv) + strlen(temp) > SHADER_LENGTH)
|
||||
Fatal(_("Shaderlenght fault\n"));
|
||||
strcat(shv,temp);
|
||||
if (strlen(shv) + strlen(temp) > SHADER_LENGTH)
|
||||
Fatal(_("Shaderlenght fault\n"));
|
||||
strcat(shv, temp);
|
||||
|
||||
}
|
||||
|
||||
static void compile_attach_shader(GLuint program, GLenum type, const char *source)
|
||||
{
|
||||
GLuint shader;
|
||||
GLint status=1234, log_length;
|
||||
GLint status = 1234, log_length;
|
||||
char log[4000];
|
||||
GLsizei len;
|
||||
|
||||
shader = glCreateShader(type);
|
||||
glShaderSource(shader, 1, (const GLchar **)&source, NULL); // &buffer, NULL);
|
||||
glShaderSource(shader, 1, (const GLchar **)&source, NULL); // &buffer, NULL);
|
||||
glCompileShader(shader);
|
||||
status = 0;
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
@ -198,35 +199,35 @@ static GLuint sc_generate_osd(GLuint gl_prog)
|
||||
Debug(3, "vor create osd\n");
|
||||
gl_prog = glCreateProgram();
|
||||
|
||||
GL_init();
|
||||
GLSL("%s\n",gl_version);
|
||||
GLSL("in vec2 vertex_position;\n");
|
||||
GLSL("in vec2 vertex_texcoord0;\n");
|
||||
GLSL("out vec2 texcoord0;\n");
|
||||
GLSL("void main() {\n");
|
||||
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
||||
GLSL("texcoord0 = vertex_texcoord0;\n");
|
||||
GLSL("}\n");
|
||||
GL_init();
|
||||
GLSL("%s\n", gl_version);
|
||||
GLSL("in vec2 vertex_position;\n");
|
||||
GLSL("in vec2 vertex_texcoord0;\n");
|
||||
GLSL("out vec2 texcoord0;\n");
|
||||
GLSL("void main() {\n");
|
||||
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
||||
GLSL("texcoord0 = vertex_texcoord0;\n");
|
||||
GLSL("}\n");
|
||||
|
||||
Debug(3, "vor compile vertex osd\n");
|
||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh); // vertex_osd);
|
||||
GL_init();
|
||||
GLSL("%s\n",gl_version);
|
||||
GLSL("#define texture1D texture\n");
|
||||
GLSL("precision mediump float; \n");
|
||||
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||
GLSL("in vec2 texcoord0;\n");
|
||||
GLSL("uniform sampler2D texture0;\n");
|
||||
GLSL("void main() {\n");
|
||||
GLSL("vec4 color; \n");
|
||||
GLSL("color = vec4(texture(texture0, texcoord0));\n");
|
||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh); // vertex_osd);
|
||||
GL_init();
|
||||
GLSL("%s\n", gl_version);
|
||||
GLSL("#define texture1D texture\n");
|
||||
GLSL("precision mediump float; \n");
|
||||
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||
GLSL("in vec2 texcoord0;\n");
|
||||
GLSL("uniform sampler2D texture0;\n");
|
||||
GLSL("void main() {\n");
|
||||
GLSL("vec4 color; \n");
|
||||
GLSL("color = vec4(texture(texture0, texcoord0));\n");
|
||||
#ifdef GAMMA
|
||||
GLSL("// delinearize gamma \n");
|
||||
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // delinearize gamma
|
||||
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||
GLSL("// delinearize gamma \n");
|
||||
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");
|
||||
GLSL("}\n");
|
||||
GLSL("out_color = color;\n");
|
||||
GLSL("}\n");
|
||||
Debug(3, "vor compile fragment osd \n");
|
||||
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh); //fragment_osd);
|
||||
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
||||
@ -246,32 +247,31 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
||||
float *m, *c, *cms;
|
||||
char *frag;
|
||||
|
||||
GL_init();
|
||||
GLSL("%s\n",gl_version);
|
||||
GLSL("in vec2 vertex_position; \n");
|
||||
GLSL("in vec2 vertex_texcoord0; \n");
|
||||
GLSL("out vec2 texcoord0; \n");
|
||||
GLSL("in vec2 vertex_texcoord1; \n");
|
||||
GLSL("out vec2 texcoord1; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("in vec2 vertex_texcoord2; \n");
|
||||
GLSL("out vec2 texcoord2; \n");
|
||||
}
|
||||
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");
|
||||
if (Planes == 3) {
|
||||
GLSL("texcoord2 = vertex_texcoord1; \n"); // texcoord1 ist hier richtig
|
||||
}
|
||||
GLSL("} \n");
|
||||
GL_init();
|
||||
GLSL("%s\n", gl_version);
|
||||
GLSL("in vec2 vertex_position; \n");
|
||||
GLSL("in vec2 vertex_texcoord0; \n");
|
||||
GLSL("out vec2 texcoord0; \n");
|
||||
GLSL("in vec2 vertex_texcoord1; \n");
|
||||
GLSL("out vec2 texcoord1; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("in vec2 vertex_texcoord2; \n");
|
||||
GLSL("out vec2 texcoord2; \n");
|
||||
}
|
||||
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");
|
||||
if (Planes == 3) {
|
||||
GLSL("texcoord2 = vertex_texcoord1; \n"); // texcoord1 ist hier richtig
|
||||
}
|
||||
GLSL("} \n");
|
||||
|
||||
Debug(3, "vor create\n");
|
||||
gl_prog = glCreateProgram();
|
||||
Debug(3, "vor compile vertex\n");
|
||||
// printf("%s",sh);
|
||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh );
|
||||
|
||||
// printf("%s",sh);
|
||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh);
|
||||
|
||||
switch (colorspace) {
|
||||
case AVCOL_SPC_RGB:
|
||||
@ -298,82 +298,81 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
||||
break;
|
||||
}
|
||||
|
||||
GL_init();
|
||||
GL_init();
|
||||
|
||||
GLSL("%s\n",gl_version);
|
||||
GLSL("precision mediump float; \n");
|
||||
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||
GLSL("in vec2 texcoord0; \n");
|
||||
GLSL("in vec2 texcoord1; \n");
|
||||
if (Planes == 3)
|
||||
GLSL("in vec2 texcoord2; \n");
|
||||
GLSL("uniform mat3 colormatrix; \n");
|
||||
GLSL("uniform vec3 colormatrix_c; \n");
|
||||
if (colorspace == AVCOL_SPC_BT2020_NCL)
|
||||
GLSL("uniform mat3 cms_matrix;\n");
|
||||
GLSL("uniform sampler2D texture0; \n");
|
||||
GLSL("uniform sampler2D texture1; \n");
|
||||
if (Planes == 3)
|
||||
GLSL("uniform sampler2D texture2; \n");
|
||||
GLSL("void main() { \n");
|
||||
GLSL("vec4 color; \n");
|
||||
GLSL("%s\n", gl_version);
|
||||
GLSL("precision mediump float; \n");
|
||||
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||
GLSL("in vec2 texcoord0; \n");
|
||||
GLSL("in vec2 texcoord1; \n");
|
||||
if (Planes == 3)
|
||||
GLSL("in vec2 texcoord2; \n");
|
||||
GLSL("uniform mat3 colormatrix; \n");
|
||||
GLSL("uniform vec3 colormatrix_c; \n");
|
||||
if (colorspace == AVCOL_SPC_BT2020_NCL)
|
||||
GLSL("uniform mat3 cms_matrix;\n");
|
||||
GLSL("uniform sampler2D texture0; \n");
|
||||
GLSL("uniform sampler2D texture1; \n");
|
||||
if (Planes == 3)
|
||||
GLSL("uniform sampler2D texture2; \n");
|
||||
GLSL("void main() { \n");
|
||||
GLSL("vec4 color; \n");
|
||||
|
||||
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
||||
GLSL("color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("color.g = 1.003906 * vec4(texture(texture1, texcoord1)).r; \n");
|
||||
GLSL("color.b = 1.003906 * vec4(texture(texture2, texcoord2)).r; \n");
|
||||
} else {
|
||||
GLSL("color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n");
|
||||
}
|
||||
GLSL("// color conversion\n");
|
||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||
GLSL("color.a = 1.0; \n");
|
||||
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
||||
GLSL("color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("color.g = 1.003906 * vec4(texture(texture1, texcoord1)).r; \n");
|
||||
GLSL("color.b = 1.003906 * vec4(texture(texture2, texcoord2)).r; \n");
|
||||
} else {
|
||||
GLSL("color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n");
|
||||
}
|
||||
GLSL("// color conversion\n");
|
||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||
GLSL("color.a = 1.0; \n");
|
||||
|
||||
GLSL("// pl_shader_linearize \n");
|
||||
GLSL("// pl_shader_linearize \n");
|
||||
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");
|
||||
// GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(%f)) * vec3(1.0/%f)) + vec3(%f),bvec3(lessThan(vec3(0.5), color.rgb)));\n",HLG_C, HLG_A, HLG_B);
|
||||
GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(0.55991073)) * vec3(1.0/0.17883277)) + vec3(0.28466892), bvec3(lessThan(vec3(0.5), color.rgb)));\n");
|
||||
GLSL("// color mapping \n");
|
||||
GLSL("color.rgb = cms_matrix * color.rgb; \n");
|
||||
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
||||
// GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||
// GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(%f)) * vec3(1.0/%f)) + vec3(%f),bvec3(lessThan(vec3(0.5), color.rgb)));\n",HLG_C, HLG_A, HLG_B);
|
||||
GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(0.55991073)) * vec3(1.0/0.17883277)) + vec3(0.28466892), bvec3(lessThan(vec3(0.5), color.rgb)));\n");
|
||||
GLSL("// color mapping \n");
|
||||
GLSL("color.rgb = cms_matrix * color.rgb; \n");
|
||||
#ifndef GAMMA
|
||||
GLSL("// pl_shader_delinearize \n");
|
||||
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(1.0/2.4)); \n");
|
||||
GLSL("color.rgb = mix(vec3(0.5) * sqrt(color.rgb), vec3(0.17883277) * log(color.rgb - vec3(0.28466892)) + vec3(0.55991073), bvec3(lessThan(vec3(1.0), color.rgb))); \n");
|
||||
GLSL("// pl_shader_delinearize \n");
|
||||
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(1.0/2.4)); \n");
|
||||
GLSL("color.rgb = mix(vec3(0.5) * sqrt(color.rgb), vec3(0.17883277) * log(color.rgb - vec3(0.28466892)) + vec3(0.55991073), bvec3(lessThan(vec3(1.0), color.rgb))); \n");
|
||||
|
||||
#endif
|
||||
GLSL("out_color = color; \n");
|
||||
GLSL("} \n");
|
||||
}
|
||||
else {
|
||||
GLSL("out_color = color; \n");
|
||||
GLSL("} \n");
|
||||
} else {
|
||||
|
||||
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;\n");
|
||||
GLSL("color.b = 1.000000 * vec4(texture(texture2, texcoord2)).r;\n");
|
||||
} else {
|
||||
GLSL("color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg; \n");
|
||||
}
|
||||
GLSL("// color conversion \n");
|
||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||
GLSL("color.a = 1.0; \n");
|
||||
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||
if (Planes == 3) {
|
||||
GLSL("color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;\n");
|
||||
GLSL("color.b = 1.000000 * vec4(texture(texture2, texcoord2)).r;\n");
|
||||
} else {
|
||||
GLSL("color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg; \n");
|
||||
}
|
||||
GLSL("// color conversion \n");
|
||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||
GLSL("color.a = 1.0; \n");
|
||||
|
||||
GLSL("// linearize gamma \n");
|
||||
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
|
||||
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||
GLSL("// linearize gamma \n");
|
||||
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
|
||||
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||
#ifndef GAMMA
|
||||
GLSL("// delinearize gamma to sRGB \n");
|
||||
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||
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");
|
||||
GLSL("// delinearize gamma to sRGB \n");
|
||||
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||
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
|
||||
GLSL("// color mapping \n");
|
||||
GLSL("out_color = color; \n");
|
||||
GLSL("} \n");
|
||||
}
|
||||
GLSL("// color mapping \n");
|
||||
GLSL("out_color = color; \n");
|
||||
GLSL("} \n");
|
||||
}
|
||||
//printf(">%s<",sh);
|
||||
Debug(3, "vor compile fragment\n");
|
||||
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh);
|
||||
|
@ -1096,10 +1096,10 @@ void cMenuSetupSoft::Create(void)
|
||||
"auto", "1920x1080", "1280x720", "custom",
|
||||
};
|
||||
static const char *const video_display_formats_4_3[] = {
|
||||
"pan&scan", "letterbox", "center cut-out",
|
||||
"pan&scan", "letterbox", "center cut-out", "original"
|
||||
};
|
||||
static const char *const video_display_formats_16_9[] = {
|
||||
"pan&scan", "pillarbox", "center cut-out",
|
||||
"pan&scan", "pillarbox", "center cut-out", "original"
|
||||
};
|
||||
#ifdef YADIF
|
||||
static const char *const deinterlace[] = {
|
||||
@ -1133,7 +1133,7 @@ void cMenuSetupSoft::Create(void)
|
||||
static char *scalingtest[100];
|
||||
|
||||
if (scalers == 0) {
|
||||
scalingtest[0] = (char *) "Off";
|
||||
scalingtest[0] = (char *)"Off";
|
||||
for (scalers = 0; pl_named_filters[scalers].filter != NULL; scalers++) {
|
||||
scaling[scalers] = (char *)pl_named_filters[scalers].name;
|
||||
scalingtest[scalers + 1] = (char *)pl_named_filters[scalers].name;
|
||||
@ -1182,9 +1182,9 @@ void cMenuSetupSoft::Create(void)
|
||||
Add(new cMenuEditBoolItem(tr("Enable Screensaver(DPMS) at black screen"), &EnableDPMSatBlackScreen,
|
||||
trVDR("no"), trVDR("yes")));
|
||||
#endif
|
||||
Add(new cMenuEditStraItem(trVDR("4:3 video display format"), &Video4to3DisplayFormat, 3,
|
||||
Add(new cMenuEditStraItem(trVDR("4:3 video display format"), &Video4to3DisplayFormat, 4,
|
||||
video_display_formats_4_3));
|
||||
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"), &VideoOtherDisplayFormat, 3,
|
||||
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"), &VideoOtherDisplayFormat, 4,
|
||||
video_display_formats_16_9));
|
||||
|
||||
#if 0
|
||||
@ -2153,10 +2153,10 @@ void cSoftHdMenu::Create(void)
|
||||
int dropped;
|
||||
int counter;
|
||||
float frametime;
|
||||
int width,height;
|
||||
int color;
|
||||
int eotf;
|
||||
char *colorstr, *eotfstr;
|
||||
int width, height;
|
||||
int color;
|
||||
int eotf;
|
||||
char *colorstr, *eotfstr;
|
||||
|
||||
current = Current(); // get current menu item index
|
||||
Clear(); // clear the menu
|
||||
@ -2191,8 +2191,8 @@ void cSoftHdMenu::Create(void)
|
||||
#endif
|
||||
Add(new cOsdItem(NULL, osUnknown, false));
|
||||
Add(new cOsdItem(NULL, osUnknown, false));
|
||||
GetStats(&missed, &duped, &dropped, &counter, &frametime, &width, &height, &color,&eotf);
|
||||
switch (color) {
|
||||
GetStats(&missed, &duped, &dropped, &counter, &frametime, &width, &height, &color, &eotf);
|
||||
switch (color) {
|
||||
case AVCOL_SPC_RGB:
|
||||
colorstr = strdup("BT 601");
|
||||
eotfstr = strdup("BT 1886");
|
||||
@ -2213,8 +2213,9 @@ void cSoftHdMenu::Create(void)
|
||||
}
|
||||
Add(new cOsdItem(cString::sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"), missed, duped, dropped,
|
||||
counter), osUnknown, false));
|
||||
Add(new cOsdItem(cString::sprintf(tr(" Video %dx%d Color: %s Gamma: %s"), width, height, colorstr, eotfstr), osUnknown, false));
|
||||
// Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false));
|
||||
Add(new cOsdItem(cString::sprintf(tr(" Video %dx%d Color: %s Gamma: %s"), width, height, colorstr, eotfstr),
|
||||
osUnknown, false));
|
||||
// Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false));
|
||||
SetCurrent(Get(current)); // restore selected menu entry
|
||||
Display(); // display build menu
|
||||
}
|
||||
|
27
softhddev.c
27
softhddev.c
@ -645,7 +645,7 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size, int is_st
|
||||
q = pesdx->Buffer + pesdx->Skip;
|
||||
n = pesdx->Index - pesdx->Skip;
|
||||
while (n >= 5) {
|
||||
int r=0;
|
||||
int r = 0;
|
||||
unsigned codec_id = AV_CODEC_ID_NONE;
|
||||
|
||||
// 4 bytes 0xFFExxxxx Mpeg audio
|
||||
@ -2871,11 +2871,10 @@ const char *CommandLineHelp(void)
|
||||
" -p device\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n"
|
||||
" -c channel\taudio mixer channel name (fe. PCM)\n" " -d display\tdisplay of x11 server (fe. :0.0)\n"
|
||||
" -f\t\tstart with fullscreen window (only with window manager)\n"
|
||||
" -g geometry\tx11 window geometry wxh+x+y\n"
|
||||
" -r Refresh\tRefreshrate for DRM (default is 50 Hz)\n"
|
||||
" -C Connector\tConnector for DRM (default is current Connector)\n"
|
||||
" -v device\tvideo driver device (cuvid)\n"
|
||||
" -s\t\tstart in suspended mode\n" " -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
|
||||
" -g geometry\tx11 window geometry wxh+x+y\n" " -r Refresh\tRefreshrate for DRM (default is 50 Hz)\n"
|
||||
" -C Connector\tConnector for DRM (default is current Connector)\n"
|
||||
" -v device\tvideo driver device (cuvid)\n" " -s\t\tstart in suspended mode\n"
|
||||
" -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
|
||||
" -X args\tX11 server arguments (f.e. -nocursor)\n" " -w workaround\tenable/disable workarounds\n"
|
||||
"\tno-hw-decoder\t\tdisable hw decoder, use software decoder only\n"
|
||||
"\tno-mpeg-hw-decoder\tdisable hw decoder for mpeg only\n"
|
||||
@ -2917,7 +2916,7 @@ int ProcessArgs(int argc, char *const argv[])
|
||||
case 'C': // Connector for DRM
|
||||
VideoSetConnector(optarg);
|
||||
continue;
|
||||
case 'r': // Connector for DRM
|
||||
case 'r': // Connector for DRM
|
||||
VideoSetRefresh(optarg);
|
||||
continue;
|
||||
case 'p': // pass-through audio device
|
||||
@ -3369,19 +3368,21 @@ void Resume(void)
|
||||
** @param[out] dropped dropped frames
|
||||
** @param[out] count number of decoded frames
|
||||
*/
|
||||
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int *eotf)
|
||||
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height,
|
||||
int *color, int *eotf)
|
||||
{
|
||||
*missed = 0;
|
||||
*duped = 0;
|
||||
*dropped = 0;
|
||||
*counter = 0;
|
||||
*frametime = 0.0f;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*color = NULL;
|
||||
*eotf = NULL;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*color = NULL;
|
||||
*eotf = NULL;
|
||||
if (MyVideoStream->HwDecoder) {
|
||||
VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime, width, height, color, eotf);
|
||||
VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime, width, height, color,
|
||||
eotf);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user