mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
enabled copping
This commit is contained in:
parent
b1f79c423a
commit
130c3e90a0
43
shaders.h
43
shaders.h
@ -169,7 +169,13 @@ struct vertex_pt {
|
|||||||
float x, y;
|
float x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct vertex_pi {
|
||||||
|
GLint x, y;
|
||||||
|
};
|
||||||
|
|
||||||
#define TEXUNIT_VIDEO_NUM 6
|
#define TEXUNIT_VIDEO_NUM 6
|
||||||
|
|
||||||
|
|
||||||
struct vertex {
|
struct vertex {
|
||||||
struct vertex_pt position;
|
struct vertex_pt position;
|
||||||
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
||||||
@ -187,7 +193,6 @@ static const struct gl_vao_entry vertex_vao[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void compile_attach_shader(GLuint program,
|
static void compile_attach_shader(GLuint program,
|
||||||
GLenum type, const char *source)
|
GLenum type, const char *source)
|
||||||
{
|
{
|
||||||
@ -292,7 +297,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
|||||||
return gl_prog;
|
return gl_prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_pass_quad(int flip)
|
static void render_pass_quad(int flip, float xcrop, float ycrop)
|
||||||
{
|
{
|
||||||
struct vertex va[4];
|
struct vertex va[4];
|
||||||
int n;
|
int n;
|
||||||
@ -317,24 +322,26 @@ static void render_pass_quad(int flip)
|
|||||||
va[3].position.x = (float) 1.0;
|
va[3].position.x = (float) 1.0;
|
||||||
va[3].position.y = (float) 1.0;
|
va[3].position.y = (float) 1.0;
|
||||||
}
|
}
|
||||||
va[0].texcoord[0].x = (float) 0.0;
|
|
||||||
va[0].texcoord[0].y = (float) 0.0;
|
|
||||||
va[0].texcoord[1].x = (float) 0.0;
|
|
||||||
va[0].texcoord[1].y = (float) 0.0;
|
|
||||||
va[1].texcoord[0].x = (float) 0.0;
|
|
||||||
va[1].texcoord[0].y = (float) 1.0;
|
|
||||||
va[1].texcoord[1].x = (float) 0.0;
|
|
||||||
va[1].texcoord[1].y = (float) 1.0;
|
|
||||||
va[2].texcoord[0].x = (float) 1.0;
|
|
||||||
va[2].texcoord[0].y = (float) 0.0;
|
|
||||||
va[2].texcoord[1].x = (float) 1.0;
|
|
||||||
va[2].texcoord[1].y = (float) 0.0;
|
|
||||||
va[3].texcoord[0].x = (float) 1.0;
|
|
||||||
va[3].texcoord[0].y = (float) 1.0;
|
|
||||||
va[3].texcoord[1].x = (float) 1.0;
|
|
||||||
va[3].texcoord[1].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);
|
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
@ -995,7 +995,7 @@ void cMenuSetupSoft::Create(void)
|
|||||||
"None", "PCM", "AC-3", "PCM + AC-3"
|
"None", "PCM", "AC-3", "PCM + AC-3"
|
||||||
};
|
};
|
||||||
static const char *const resolution[RESOLUTIONS] = {
|
static const char *const resolution[RESOLUTIONS] = {
|
||||||
"576i", "720p", "fake 1080i", "1080i" ,"UHD"
|
"576", "720", "fake 1080", "1080" ,"UHD"
|
||||||
};
|
};
|
||||||
int current;
|
int current;
|
||||||
int i;
|
int i;
|
||||||
@ -1045,6 +1045,7 @@ void cMenuSetupSoft::Create(void)
|
|||||||
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"),
|
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"),
|
||||||
&VideoOtherDisplayFormat, 3, video_display_formats_16_9));
|
&VideoOtherDisplayFormat, 3, video_display_formats_16_9));
|
||||||
|
|
||||||
|
#if 0
|
||||||
// FIXME: switch config gray/color configuration
|
// FIXME: switch config gray/color configuration
|
||||||
Add(new cMenuEditIntItem(tr("Video background color (RGB)"),
|
Add(new cMenuEditIntItem(tr("Video background color (RGB)"),
|
||||||
(int *)&Background, 0, 0x00FFFFFF));
|
(int *)&Background, 0, 0x00FFFFFF));
|
||||||
@ -1052,6 +1053,7 @@ void cMenuSetupSoft::Create(void)
|
|||||||
(int *)&BackgroundAlpha, 0, 0xFF));
|
(int *)&BackgroundAlpha, 0, 0xFF));
|
||||||
Add(new cMenuEditBoolItem(tr("Use studio levels (vdpau only)"),
|
Add(new cMenuEditBoolItem(tr("Use studio levels (vdpau only)"),
|
||||||
&StudioLevels, trVDR("no"), trVDR("yes")));
|
&StudioLevels, trVDR("no"), trVDR("yes")));
|
||||||
|
#endif
|
||||||
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
|
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
|
||||||
trVDR("no"), trVDR("yes")));
|
trVDR("no"), trVDR("yes")));
|
||||||
Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync,
|
Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync,
|
||||||
@ -1060,7 +1062,7 @@ 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
|
||||||
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
|
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
|
||||||
&Brightness, -1000, 1000, tr("min"), tr("max")));
|
&Brightness, -1000, 1000, tr("min"), tr("max")));
|
||||||
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast,
|
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast,
|
||||||
@ -1069,39 +1071,37 @@ void cMenuSetupSoft::Create(void)
|
|||||||
&Saturation, 0, 10000, tr("min"), tr("max")));
|
&Saturation, 0, 10000, tr("min"), tr("max")));
|
||||||
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141,
|
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141,
|
||||||
3141, tr("min"), tr("max")));
|
3141, tr("min"), tr("max")));
|
||||||
|
#endif
|
||||||
for (i = 0; i < RESOLUTIONS; ++i) {
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
||||||
cString msg;
|
cString msg;
|
||||||
|
|
||||||
// short hidden informations
|
// short hidden informations
|
||||||
msg =
|
msg = cString::sprintf("show");
|
||||||
cString::sprintf("%s,%s%s%s%s,...", scaling_short[Scaling[i]],
|
|
||||||
deinterlace_short[Deinterlace[i]],
|
|
||||||
SkipChromaDeinterlace[i] ? ",skip" : "",
|
|
||||||
InverseTelecine[i] ? ",ITC" : "", Denoise[i] ? ",DN" : "");
|
|
||||||
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
|
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
|
||||||
|
|
||||||
if (ResolutionShown[i]) {
|
if (ResolutionShown[i]) {
|
||||||
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
|
#if 0
|
||||||
scaling));
|
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
|
||||||
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
|
scaling));
|
||||||
6, deinterlace));
|
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
|
||||||
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),
|
6, deinterlace));
|
||||||
&SkipChromaDeinterlace[i], trVDR("no"), trVDR("yes")));
|
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),
|
||||||
Add(new cMenuEditBoolItem(tr("Inverse Telecine (vdpau)"),
|
&SkipChromaDeinterlace[i], trVDR("no"), trVDR("yes")));
|
||||||
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
Add(new cMenuEditBoolItem(tr("Inverse Telecine (vdpau)"),
|
||||||
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"),
|
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
||||||
&Denoise[i], 0, 1000, tr("off"), tr("max")));
|
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"),
|
||||||
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
&Denoise[i], 0, 1000, tr("off"), tr("max")));
|
||||||
&Sharpen[i], -1000, 1000, tr("blur max"),
|
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
||||||
tr("sharpen max")));
|
&Sharpen[i], -1000, 1000, tr("blur max"),
|
||||||
|
tr("sharpen max")));
|
||||||
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
|
#endif
|
||||||
&CutTopBottom[i], 0, 250));
|
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
|
||||||
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
|
&CutTopBottom[i], 0, 250));
|
||||||
&CutLeftRight[i], 0, 250));
|
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
|
||||||
|
&CutLeftRight[i], 0, 250));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USE_AUTOCROP
|
||||||
//
|
//
|
||||||
// auto-crop
|
// auto-crop
|
||||||
//
|
//
|
||||||
@ -1109,6 +1109,7 @@ void cMenuSetupSoft::Create(void)
|
|||||||
Add(new cMenuEditIntItem(tr("Autocrop interval (frames)"), &AutoCropInterval, 0, 200, tr("off")));
|
Add(new cMenuEditIntItem(tr("Autocrop interval (frames)"), &AutoCropInterval, 0, 200, tr("off")));
|
||||||
Add(new cMenuEditIntItem(tr("Autocrop delay (n * interval)"), &AutoCropDelay, 0, 200));
|
Add(new cMenuEditIntItem(tr("Autocrop delay (n * interval)"), &AutoCropDelay, 0, 200));
|
||||||
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"), &AutoCropTolerance, 0, 32));
|
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"), &AutoCropTolerance, 0, 32));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// audio
|
// audio
|
||||||
|
16
video.c
16
video.c
@ -590,8 +590,7 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
|
|||||||
VideoScreen->height_in_pixels * VideoScreen->width_in_millimeters;
|
VideoScreen->height_in_pixels * VideoScreen->width_in_millimeters;
|
||||||
|
|
||||||
display_aspect_ratio = av_mul_q(input_aspect_ratio, display_aspect_ratio);
|
display_aspect_ratio = av_mul_q(input_aspect_ratio, display_aspect_ratio);
|
||||||
Debug(3, "video: aspect %d:%d\n", display_aspect_ratio.num,
|
Debug(3, "video: aspect %d:%d Resolution %d\n", display_aspect_ratio.num, display_aspect_ratio.den, resolution);
|
||||||
display_aspect_ratio.den);
|
|
||||||
|
|
||||||
*crop_x = VideoCutLeftRight[resolution];
|
*crop_x = VideoCutLeftRight[resolution];
|
||||||
*crop_y = VideoCutTopBottom[resolution];
|
*crop_y = VideoCutTopBottom[resolution];
|
||||||
@ -1354,7 +1353,7 @@ static VideoResolutions VideoResolutionGroup(int width, int height,
|
|||||||
if (height <= 720) {
|
if (height <= 720) {
|
||||||
return VideoResolution720p;
|
return VideoResolution720p;
|
||||||
}
|
}
|
||||||
if (height <= 1080) {
|
if (height < 1080) {
|
||||||
return VideoResolutionFake1080i;
|
return VideoResolutionFake1080i;
|
||||||
}
|
}
|
||||||
if (width < 1920) {
|
if (width < 1920) {
|
||||||
@ -2361,7 +2360,7 @@ int get_RGB(CuvidDecoder *decoder) {
|
|||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
||||||
|
|
||||||
render_pass_quad(1);
|
render_pass_quad(1,0.0,0.0);
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
@ -2614,8 +2613,7 @@ static void CuvidAutoCrop(CuvidDecoder * decoder)
|
|||||||
decoder->InputAspect.num, decoder->InputAspect.den, crop14, crop16,
|
decoder->InputAspect.num, decoder->InputAspect.den, crop14, crop16,
|
||||||
decoder->AutoCrop->Y1, decoder->InputHeight - decoder->AutoCrop->Y2);
|
decoder->AutoCrop->Y1, decoder->InputHeight - decoder->AutoCrop->Y2);
|
||||||
|
|
||||||
Debug(3, "video: crop aspect %d -> %d\n", decoder->AutoCrop->State,
|
Debug(3, "video: crop aspect %d -> %d\n", decoder->AutoCrop->State, next_state);
|
||||||
next_state);
|
|
||||||
|
|
||||||
switch (decoder->AutoCrop->State) {
|
switch (decoder->AutoCrop->State) {
|
||||||
case 16:
|
case 16:
|
||||||
@ -2894,6 +2892,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
|
|||||||
int w = decoder->InputWidth;
|
int w = decoder->InputWidth;
|
||||||
int h = decoder->InputHeight;
|
int h = decoder->InputHeight;
|
||||||
int y;
|
int y;
|
||||||
|
float xcropf, ycropf;
|
||||||
GLint texLoc;
|
GLint texLoc;
|
||||||
|
|
||||||
size_t nSize = 0;
|
size_t nSize = 0;
|
||||||
@ -2921,6 +2920,9 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
|
|||||||
video_src_rect.x1 = decoder->CropX + decoder->CropWidth;
|
video_src_rect.x1 = decoder->CropX + decoder->CropWidth;
|
||||||
video_src_rect.y1 = decoder->CropY + decoder->CropHeight;
|
video_src_rect.y1 = decoder->CropY + decoder->CropHeight;
|
||||||
|
|
||||||
|
xcropf = (float) decoder->CropX / (float) decoder->InputWidth;
|
||||||
|
ycropf = (float) decoder->CropY / (float) decoder->InputHeight;
|
||||||
|
|
||||||
dst_video_rect.x0 = decoder->OutputX; // video output (scale)
|
dst_video_rect.x0 = decoder->OutputX; // video output (scale)
|
||||||
dst_video_rect.y0 = decoder->OutputY;
|
dst_video_rect.y0 = decoder->OutputY;
|
||||||
dst_video_rect.x1 = decoder->OutputX + decoder->OutputWidth;
|
dst_video_rect.x1 = decoder->OutputX + decoder->OutputWidth;
|
||||||
@ -2949,7 +2951,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
|
|||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D,decoder->gl_textures[current*2+1]);
|
glBindTexture(GL_TEXTURE_2D,decoder->gl_textures[current*2+1]);
|
||||||
|
|
||||||
render_pass_quad(0);
|
render_pass_quad(0, xcropf, ycropf);
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
Loading…
Reference in New Issue
Block a user