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;
|
||||
};
|
||||
|
||||
struct vertex_pi {
|
||||
GLint x, y;
|
||||
};
|
||||
|
||||
#define TEXUNIT_VIDEO_NUM 6
|
||||
|
||||
|
||||
struct vertex {
|
||||
struct vertex_pt position;
|
||||
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,
|
||||
GLenum type, const char *source)
|
||||
{
|
||||
@ -292,7 +297,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
||||
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];
|
||||
int n;
|
||||
@ -317,22 +322,24 @@ static void render_pass_quad(int flip)
|
||||
va[3].position.x = (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);
|
||||
|
@ -995,7 +995,7 @@ void cMenuSetupSoft::Create(void)
|
||||
"None", "PCM", "AC-3", "PCM + AC-3"
|
||||
};
|
||||
static const char *const resolution[RESOLUTIONS] = {
|
||||
"576i", "720p", "fake 1080i", "1080i" ,"UHD"
|
||||
"576", "720", "fake 1080", "1080" ,"UHD"
|
||||
};
|
||||
int current;
|
||||
int i;
|
||||
@ -1045,6 +1045,7 @@ void cMenuSetupSoft::Create(void)
|
||||
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"),
|
||||
&VideoOtherDisplayFormat, 3, video_display_formats_16_9));
|
||||
|
||||
#if 0
|
||||
// FIXME: switch config gray/color configuration
|
||||
Add(new cMenuEditIntItem(tr("Video background color (RGB)"),
|
||||
(int *)&Background, 0, 0x00FFFFFF));
|
||||
@ -1052,6 +1053,7 @@ void cMenuSetupSoft::Create(void)
|
||||
(int *)&BackgroundAlpha, 0, 0xFF));
|
||||
Add(new cMenuEditBoolItem(tr("Use studio levels (vdpau only)"),
|
||||
&StudioLevels, trVDR("no"), trVDR("yes")));
|
||||
#endif
|
||||
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
|
||||
trVDR("no"), trVDR("yes")));
|
||||
Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync,
|
||||
@ -1060,7 +1062,7 @@ 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,
|
||||
@ -1069,39 +1071,37 @@ void cMenuSetupSoft::Create(void)
|
||||
&Saturation, 0, 10000, tr("min"), tr("max")));
|
||||
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141,
|
||||
3141, tr("min"), tr("max")));
|
||||
|
||||
#endif
|
||||
for (i = 0; i < RESOLUTIONS; ++i) {
|
||||
cString msg;
|
||||
|
||||
// short hidden informations
|
||||
msg =
|
||||
cString::sprintf("%s,%s%s%s%s,...", scaling_short[Scaling[i]],
|
||||
deinterlace_short[Deinterlace[i]],
|
||||
SkipChromaDeinterlace[i] ? ",skip" : "",
|
||||
InverseTelecine[i] ? ",ITC" : "", Denoise[i] ? ",DN" : "");
|
||||
msg = cString::sprintf("show");
|
||||
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
|
||||
|
||||
if (ResolutionShown[i]) {
|
||||
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
|
||||
scaling));
|
||||
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
|
||||
6, deinterlace));
|
||||
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),
|
||||
&SkipChromaDeinterlace[i], trVDR("no"), trVDR("yes")));
|
||||
Add(new cMenuEditBoolItem(tr("Inverse Telecine (vdpau)"),
|
||||
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
||||
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"),
|
||||
&Denoise[i], 0, 1000, tr("off"), tr("max")));
|
||||
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
||||
&Sharpen[i], -1000, 1000, tr("blur max"),
|
||||
tr("sharpen max")));
|
||||
|
||||
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
|
||||
&CutTopBottom[i], 0, 250));
|
||||
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
|
||||
&CutLeftRight[i], 0, 250));
|
||||
#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)"),
|
||||
&SkipChromaDeinterlace[i], trVDR("no"), trVDR("yes")));
|
||||
Add(new cMenuEditBoolItem(tr("Inverse Telecine (vdpau)"),
|
||||
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
||||
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"),
|
||||
&Denoise[i], 0, 1000, tr("off"), tr("max")));
|
||||
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
||||
&Sharpen[i], -1000, 1000, tr("blur max"),
|
||||
tr("sharpen max")));
|
||||
#endif
|
||||
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
|
||||
&CutTopBottom[i], 0, 250));
|
||||
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
|
||||
&CutLeftRight[i], 0, 250));
|
||||
}
|
||||
}
|
||||
#ifdef USE_AUTOCROP
|
||||
//
|
||||
// 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 delay (n * interval)"), &AutoCropDelay, 0, 200));
|
||||
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"), &AutoCropTolerance, 0, 32));
|
||||
#endif
|
||||
}
|
||||
//
|
||||
// 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;
|
||||
|
||||
display_aspect_ratio = av_mul_q(input_aspect_ratio, display_aspect_ratio);
|
||||
Debug(3, "video: aspect %d:%d\n", display_aspect_ratio.num,
|
||||
display_aspect_ratio.den);
|
||||
Debug(3, "video: aspect %d:%d Resolution %d\n", display_aspect_ratio.num, display_aspect_ratio.den, resolution);
|
||||
|
||||
*crop_x = VideoCutLeftRight[resolution];
|
||||
*crop_y = VideoCutTopBottom[resolution];
|
||||
@ -1354,7 +1353,7 @@ static VideoResolutions VideoResolutionGroup(int width, int height,
|
||||
if (height <= 720) {
|
||||
return VideoResolution720p;
|
||||
}
|
||||
if (height <= 1080) {
|
||||
if (height < 1080) {
|
||||
return VideoResolutionFake1080i;
|
||||
}
|
||||
if (width < 1920) {
|
||||
@ -2361,7 +2360,7 @@ int get_RGB(CuvidDecoder *decoder) {
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
||||
|
||||
render_pass_quad(1);
|
||||
render_pass_quad(1,0.0,0.0);
|
||||
glUseProgram(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
@ -2614,8 +2613,7 @@ static void CuvidAutoCrop(CuvidDecoder * decoder)
|
||||
decoder->InputAspect.num, decoder->InputAspect.den, crop14, crop16,
|
||||
decoder->AutoCrop->Y1, decoder->InputHeight - decoder->AutoCrop->Y2);
|
||||
|
||||
Debug(3, "video: crop aspect %d -> %d\n", decoder->AutoCrop->State,
|
||||
next_state);
|
||||
Debug(3, "video: crop aspect %d -> %d\n", decoder->AutoCrop->State, next_state);
|
||||
|
||||
switch (decoder->AutoCrop->State) {
|
||||
case 16:
|
||||
@ -2894,6 +2892,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
|
||||
int w = decoder->InputWidth;
|
||||
int h = decoder->InputHeight;
|
||||
int y;
|
||||
float xcropf, ycropf;
|
||||
GLint texLoc;
|
||||
|
||||
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.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.y0 = decoder->OutputY;
|
||||
dst_video_rect.x1 = decoder->OutputX + decoder->OutputWidth;
|
||||
@ -2949,7 +2951,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D,decoder->gl_textures[current*2+1]);
|
||||
|
||||
render_pass_quad(0);
|
||||
render_pass_quad(0, xcropf, ycropf);
|
||||
|
||||
glUseProgram(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
Loading…
Reference in New Issue
Block a user