mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Reworked the aspect function. Now we calculate the display aspect from the pixel width and
pixel height (and not from the physical size, which was the root cause for rounding errors). Cropping calculation is reworking, now the rounding is correct. I introduce a new aspect mode "original" which displays the output with the original size (but after correction the pixel aspect ratio). Tested with vaapi(X11) and vaapi(DRM) with and without libplacebo.
This commit is contained in:
parent
36c208967e
commit
23651104f2
45
README.md
45
README.md
@ -50,7 +50,7 @@ Only via DisplayPort you can get 10 Bit output to a compatible screen. This is a
|
|||||||
|
|
||||||
Current Status with VAAPI:
|
Current Status with VAAPI:
|
||||||
I tested it with Intel VAAPI. If you have problmes with the shaders then copy the drirc file in your home directory as .drirc
|
I tested it with Intel VAAPI. If you have problmes with the shaders then copy the drirc file in your home directory as .drirc
|
||||||
AMD VAAPI is broken by AMD and will not work currently.
|
AMD VAAPI is broken by AMD and will not work currently.
|
||||||
|
|
||||||
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
|
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
|
||||||
The Makefile expects the CUDA SDK in /usr/local/cuda. Currently it is tested with CUDA 10
|
The Makefile expects the CUDA SDK in /usr/local/cuda. Currently it is tested with CUDA 10
|
||||||
@ -73,13 +73,13 @@ Quickstart:
|
|||||||
You have to adapt the Makefile. There are 3 possible Version that you can build:
|
You have to adapt the Makefile. There are 3 possible Version that you can build:
|
||||||
|
|
||||||
softhdcuvid
|
softhdcuvid
|
||||||
This is for NVIDA cards and uses cuvid as decoder. It uses xcb for output and needs a X Server to run.
|
This is for NVIDA cards and uses cuvid as decoder. It uses xcb for output and needs a X Server to run.
|
||||||
|
|
||||||
softhdvaapi
|
softhdvaapi
|
||||||
This is for INTEL cards and uses Vaapi as decoder. It uses xcb for output and needs a X Server to run.
|
This is for INTEL cards and uses Vaapi as decoder. It uses xcb for output and needs a X Server to run.
|
||||||
|
|
||||||
softhddrm
|
softhddrm
|
||||||
This is for INTEL cards and also uses Vaapi as decoder. It uses the DRM API for output and
|
This is for INTEL cards and also uses Vaapi as decoder. It uses the DRM API for output and
|
||||||
runs without X Server. There are several commandline options to select the resolution and refresh rate.
|
runs without X Server. There are several commandline options to select the resolution and refresh rate.
|
||||||
|
|
||||||
Install:
|
Install:
|
||||||
@ -98,27 +98,27 @@ Install:
|
|||||||
|
|
||||||
Beginners Guide for libplacebo:
|
Beginners Guide for libplacebo:
|
||||||
-------------------------------
|
-------------------------------
|
||||||
When using libplacebo you will find several config options.
|
When using libplacebo you will find several config options.
|
||||||
|
|
||||||
First of all you need to set the right scaler for each resolution:
|
First of all you need to set the right scaler for each resolution:
|
||||||
Best you beginn with setting all to "bilinear". If that works ok for you, you can try to change them
|
Best you beginn with setting all to "bilinear". If that works ok for you, you can try to change them
|
||||||
for more advanced scaler. I use ewa_robidouxsharp on my GTX1050, but your mileage may vary.
|
for more advanced scaler. I use ewa_robidouxsharp on my GTX1050, but your mileage may vary.
|
||||||
Unfortunatly on INTEL not all scalers may work or crash.
|
Unfortunatly on INTEL not all scalers may work or crash.
|
||||||
|
|
||||||
You can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will
|
You can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will
|
||||||
see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the
|
see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the
|
||||||
Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test
|
Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test
|
||||||
is activ.
|
is activ.
|
||||||
|
|
||||||
Then you should set the Monitor Colorspace to "sRGB". This guarantees you the best colors on your screen.
|
Then you should set the Monitor Colorspace to "sRGB". This guarantees you the best colors on your screen.
|
||||||
At the moment all calculations internaly are done in RGB space and all cards output also RGB.
|
At the moment all calculations internaly are done in RGB space and all cards output also RGB.
|
||||||
|
|
||||||
If you are colorblind you could try to remedy this with the Colorblind Settings. Realy only needed
|
If you are colorblind you could try to remedy this with the Colorblind Settings. Realy only needed
|
||||||
in rare cases.
|
in rare cases.
|
||||||
|
|
||||||
All other settings can be in their default state.
|
All other settings can be in their default state.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Setup: environment
|
Setup: environment
|
||||||
------
|
------
|
||||||
@ -283,11 +283,13 @@ Setup: /etc/vdr/setup.conf
|
|||||||
0 pan and scan
|
0 pan and scan
|
||||||
1 letter box
|
1 letter box
|
||||||
2 center cut-out
|
2 center cut-out
|
||||||
|
3 original
|
||||||
|
|
||||||
softhddevice.VideoOtherDisplayFormat = 1
|
softhddevice.VideoOtherDisplayFormat = 1
|
||||||
0 pan and scan
|
0 pan and scan
|
||||||
1 pillar box
|
1 pillar box
|
||||||
2 center cut-out
|
2 center cut-out
|
||||||
|
3 original
|
||||||
|
|
||||||
softhddevice.pip.X = 79
|
softhddevice.pip.X = 79
|
||||||
softhddevice.pip.Y = 78
|
softhddevice.pip.Y = 78
|
||||||
@ -378,6 +380,3 @@ Running:
|
|||||||
Known Bugs:
|
Known Bugs:
|
||||||
-----------
|
-----------
|
||||||
SD Streams not working very well on vaapi
|
SD Streams not working very well on vaapi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
common.h
1
common.h
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of mpv.
|
* This file is part of mpv.
|
||||||
*
|
*
|
||||||
|
1
config.h
1
config.h
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of libplacebo.
|
* This file is part of libplacebo.
|
||||||
*
|
*
|
||||||
|
5
drm.c
5
drm.c
@ -475,9 +475,8 @@ void VideoInitDrm()
|
|||||||
|
|
||||||
void get_drm_aspect(int *num,int *den)
|
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;
|
||||||
*num = VideoWindowWidth * render->mmHeight;
|
*den = VideoWindowHeight;
|
||||||
*den = VideoWindowHeight * render->mmWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gbm_bo *bo = NULL, *next_bo=NULL;
|
struct gbm_bo *bo = NULL, *next_bo=NULL;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
|
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
|
40
po/de_DE.po
40
po/de_DE.po
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VDR \n"
|
"Project-Id-Version: VDR \n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\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"
|
"PO-Revision-Date: blabla\n"
|
||||||
"Last-Translator: blabla\n"
|
"Last-Translator: blabla\n"
|
||||||
"Language-Team: blabla\n"
|
"Language-Team: blabla\n"
|
||||||
@ -263,9 +263,6 @@ msgstr ""
|
|||||||
msgid "codec: can't allocate video codec context\n"
|
msgid "codec: can't allocate video codec context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "VAAPI Refcounts invalid\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: can't set option deint to video codec!\n"
|
msgid "codec: can't set option deint to video codec!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -306,24 +303,6 @@ msgstr ""
|
|||||||
msgid "codec/audio: decoded data smaller than encoded\n"
|
msgid "codec/audio: decoded data smaller than encoded\n"
|
||||||
msgstr ""
|
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"
|
msgid "codec/audio: can't setup resample\n"
|
||||||
msgstr ""
|
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)"
|
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid " Frame Process time %2.2fms"
|
msgid " Video %dx%d Color: %s Gamma: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "pass-through disabled"
|
msgid "pass-through disabled"
|
||||||
@ -807,10 +786,6 @@ msgstr ""
|
|||||||
msgid "video/glx: no GLX support\n"
|
msgid "video/glx: no GLX support\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "video/glx: glx version %d.%d\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "did not get FBconfig"
|
msgid "did not get FBconfig"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -898,11 +873,10 @@ msgid "Failed rendering frame!\n"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, 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 ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
msgid "Could not dynamically load CUDA\n"
|
||||||
msgid "video/vdpau: pixel format %d not supported\n"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Kein Cuda device gefunden"
|
msgid "Kein Cuda device gefunden"
|
||||||
@ -943,12 +917,6 @@ msgstr ""
|
|||||||
msgid "video/egl: can't create thread egl context\n"
|
msgid "video/egl: can't create thread egl context\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: can't queue cancel video display thread\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "video: can't cancel video display thread\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "video: repeated pict %d found, but not handled\n"
|
msgid "video: repeated pict %d found, but not handled\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1096,10 +1096,10 @@ void cMenuSetupSoft::Create(void)
|
|||||||
"auto", "1920x1080", "1280x720", "custom",
|
"auto", "1920x1080", "1280x720", "custom",
|
||||||
};
|
};
|
||||||
static const char *const video_display_formats_4_3[] = {
|
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[] = {
|
static const char *const video_display_formats_16_9[] = {
|
||||||
"pan&scan", "pillarbox", "center cut-out",
|
"pan&scan", "pillarbox", "center cut-out", "original"
|
||||||
};
|
};
|
||||||
#ifdef YADIF
|
#ifdef YADIF
|
||||||
static const char *const deinterlace[] = {
|
static const char *const deinterlace[] = {
|
||||||
@ -1182,9 +1182,9 @@ void cMenuSetupSoft::Create(void)
|
|||||||
Add(new cMenuEditBoolItem(tr("Enable Screensaver(DPMS) at black screen"), &EnableDPMSatBlackScreen,
|
Add(new cMenuEditBoolItem(tr("Enable Screensaver(DPMS) at black screen"), &EnableDPMSatBlackScreen,
|
||||||
trVDR("no"), trVDR("yes")));
|
trVDR("no"), trVDR("yes")));
|
||||||
#endif
|
#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));
|
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));
|
video_display_formats_16_9));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
157
video.c
157
video.c
@ -253,7 +253,7 @@ typedef enum _video_zoom_modes_
|
|||||||
VideoNormal, ///< normal
|
VideoNormal, ///< normal
|
||||||
VideoStretch, ///< stretch to all edges
|
VideoStretch, ///< stretch to all edges
|
||||||
VideoCenterCutOut, ///< center and cut out
|
VideoCenterCutOut, ///< center and cut out
|
||||||
VideoAnamorphic, ///< anamorphic scaled (unsupported)
|
VideoNone, ///< no scaling
|
||||||
} VideoZoomModes;
|
} VideoZoomModes;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -679,44 +679,35 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in
|
|||||||
AVRational display_aspect_ratio;
|
AVRational display_aspect_ratio;
|
||||||
AVRational tmp_ratio;
|
AVRational tmp_ratio;
|
||||||
|
|
||||||
|
// input not initialized yet, return immediately
|
||||||
if (!input_aspect_ratio.num || !input_aspect_ratio.den) {
|
if (!input_aspect_ratio.num || !input_aspect_ratio.den) {
|
||||||
input_aspect_ratio.num = 1;
|
output_width = video_width;
|
||||||
input_aspect_ratio.den = 1;
|
output_height = video_height;
|
||||||
Debug(3, "video: aspect defaults to %d:%d\n", input_aspect_ratio.num, input_aspect_ratio.den);
|
return;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
av_reduce(&input_aspect_ratio.num, &input_aspect_ratio.den, input_width * input_aspect_ratio.num,
|
|
||||||
input_height * input_aspect_ratio.den, 1024 * 1024);
|
|
||||||
|
|
||||||
// InputWidth/Height can be zero = uninitialized
|
|
||||||
if (!input_aspect_ratio.num || !input_aspect_ratio.den) {
|
|
||||||
input_aspect_ratio.num = 1;
|
|
||||||
input_aspect_ratio.den = 1;
|
|
||||||
}
|
}
|
||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
get_drm_aspect(&display_aspect_ratio.num, &display_aspect_ratio.den);
|
get_drm_aspect(&display_aspect_ratio.num, &display_aspect_ratio.den);
|
||||||
#else
|
#else
|
||||||
Debug(3, "mmHeight %d mm Width %d VideoHeight %d VideoWidth %d\n", VideoScreen->height_in_millimeters,
|
display_aspect_ratio.num = VideoScreen->width_in_pixels;
|
||||||
VideoScreen->width_in_millimeters, VideoScreen->height_in_pixels, VideoScreen->width_in_pixels);
|
display_aspect_ratio.den = VideoScreen->height_in_pixels;
|
||||||
display_aspect_ratio.num = VideoScreen->width_in_pixels * VideoScreen->height_in_millimeters;
|
|
||||||
display_aspect_ratio.den = VideoScreen->height_in_pixels * VideoScreen->width_in_millimeters;
|
|
||||||
#endif
|
#endif
|
||||||
display_aspect_ratio = av_mul_q(input_aspect_ratio, display_aspect_ratio);
|
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, 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);
|
1024 * 1024);
|
||||||
|
|
||||||
|
Debug(3, "video: input %dx%d (%d:%d)\n", input_width, input_height, input_aspect_ratio.num,
|
||||||
|
input_aspect_ratio.den);
|
||||||
|
Debug(3, "video: display aspect %d:%d Resolution %d\n", display_aspect_ratio.num, display_aspect_ratio.den,
|
||||||
|
resolution);
|
||||||
|
Debug(3, "video: video %+d%+d %dx%d\n", video_x, video_y, video_width, video_height);
|
||||||
|
|
||||||
*crop_x = VideoCutLeftRight[resolution];
|
*crop_x = VideoCutLeftRight[resolution];
|
||||||
*crop_y = VideoCutTopBottom[resolution];
|
*crop_y = VideoCutTopBottom[resolution];
|
||||||
*crop_width = input_width - VideoCutLeftRight[resolution] * 2;
|
*crop_width = input_width - VideoCutLeftRight[resolution] * 2;
|
||||||
*crop_height = input_height - VideoCutTopBottom[resolution] * 2;
|
*crop_height = input_height - VideoCutTopBottom[resolution] * 2;
|
||||||
|
CuvidMessage(2, "video: crop to %+d%+d %dx%d\n", *crop_x, *crop_y, *crop_width, *crop_height);
|
||||||
|
|
||||||
// FIXME: store different positions for the ratios
|
|
||||||
tmp_ratio.num = 4;
|
tmp_ratio.num = 4;
|
||||||
tmp_ratio.den = 3;
|
tmp_ratio.den = 3;
|
||||||
#ifdef DEBUG
|
|
||||||
Debug(4, "ratio: %d:%d %d:%d\n", input_aspect_ratio.num, input_aspect_ratio.den, display_aspect_ratio.num,
|
|
||||||
display_aspect_ratio.den);
|
|
||||||
#endif
|
|
||||||
if (!av_cmp_q(input_aspect_ratio, tmp_ratio)) {
|
if (!av_cmp_q(input_aspect_ratio, tmp_ratio)) {
|
||||||
switch (Video4to3ZoomMode) {
|
switch (Video4to3ZoomMode) {
|
||||||
case VideoNormal:
|
case VideoNormal:
|
||||||
@ -725,9 +716,8 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in
|
|||||||
goto stretch;
|
goto stretch;
|
||||||
case VideoCenterCutOut:
|
case VideoCenterCutOut:
|
||||||
goto center_cut_out;
|
goto center_cut_out;
|
||||||
case VideoAnamorphic:
|
case VideoNone:
|
||||||
// FIXME: rest should be done by hardware
|
goto video_none;
|
||||||
goto stretch;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (VideoOtherZoomMode) {
|
switch (VideoOtherZoomMode) {
|
||||||
@ -737,28 +727,24 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in
|
|||||||
goto stretch;
|
goto stretch;
|
||||||
case VideoCenterCutOut:
|
case VideoCenterCutOut:
|
||||||
goto center_cut_out;
|
goto center_cut_out;
|
||||||
case VideoAnamorphic:
|
case VideoNone:
|
||||||
// FIXME: rest should be done by hardware
|
goto video_none;
|
||||||
goto stretch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
normal:
|
normal:
|
||||||
*output_x = video_x;
|
*output_x = video_x;
|
||||||
*output_y = video_y;
|
*output_y = video_y;
|
||||||
*output_width =
|
*output_height = video_height;
|
||||||
(video_height * display_aspect_ratio.num + display_aspect_ratio.den - 1) / display_aspect_ratio.den;
|
*output_width = (*crop_width * *output_height * input_aspect_ratio.num) / (input_aspect_ratio.den * *crop_height);
|
||||||
*output_height =
|
|
||||||
(video_width * display_aspect_ratio.den + display_aspect_ratio.num - 1) / display_aspect_ratio.num;
|
|
||||||
if (*output_width > video_width) {
|
if (*output_width > video_width) {
|
||||||
*output_width = video_width;
|
*output_width = video_width;
|
||||||
|
*output_height =
|
||||||
|
(*crop_height * *output_width * input_aspect_ratio.den) / (input_aspect_ratio.num * *crop_width);
|
||||||
*output_y += (video_height - *output_height) / 2;
|
*output_y += (video_height - *output_height) / 2;
|
||||||
} else if (*output_height > video_height) {
|
} else if (*output_width < video_width) {
|
||||||
*output_height = video_height;
|
|
||||||
*output_x += (video_width - *output_width) / 2;
|
*output_x += (video_width - *output_width) / 2;
|
||||||
}
|
}
|
||||||
|
CuvidMessage(2, "video: normal aspect output %dx%d%+d%+d\n", *output_width, *output_height, *output_x, *output_y);
|
||||||
CuvidMessage(2, "video: normal aspect output %dx%d%+d%+d Video %dx%d\n", *output_width, *output_height, *output_x,
|
|
||||||
*output_y, video_width, video_height);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stretch:
|
stretch:
|
||||||
@ -766,49 +752,34 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in
|
|||||||
*output_y = video_y;
|
*output_y = video_y;
|
||||||
*output_width = video_width;
|
*output_width = video_width;
|
||||||
*output_height = video_height;
|
*output_height = video_height;
|
||||||
Debug(3, "video: stretch output %dx%d%+d%+d\n", *output_width, *output_height, *output_x, *output_y);
|
CuvidMessage(2, "video: stretch output %dx%d%+d%+d\n", *output_width, *output_height, *output_x, *output_y);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
center_cut_out:
|
center_cut_out:
|
||||||
*output_x = video_x;
|
*output_x = video_x;
|
||||||
*output_y = video_y;
|
*output_y = video_y;
|
||||||
*output_height = video_height;
|
*output_height = video_height;
|
||||||
*output_width = video_width;
|
*output_width = (*crop_width * *output_height * input_aspect_ratio.num) / (input_aspect_ratio.den * *crop_height);
|
||||||
|
if (*output_width > video_width) {
|
||||||
*crop_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den - 1) / display_aspect_ratio.den;
|
// fix height cropping
|
||||||
*crop_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num - 1) / display_aspect_ratio.num;
|
*crop_width = (int)((*crop_width * video_width) / (*output_width * 2.0) + 0.5) * 2;
|
||||||
|
*crop_x = (input_width - *crop_width) / 2;
|
||||||
// look which side must be cut
|
*output_width = video_width;
|
||||||
if (*crop_width > video_width) {
|
} else if (*output_width < video_width) {
|
||||||
int tmp;
|
// fix width cropping
|
||||||
|
*crop_height = (int)((*crop_height * *output_width) / (video_width * 2.0) + 0.5) * 2;
|
||||||
*crop_height = input_height - VideoCutTopBottom[resolution] * 2;
|
*crop_y = (input_height - *crop_height) / 2;
|
||||||
|
*output_width = video_width;
|
||||||
// adjust scaling
|
|
||||||
tmp = ((*crop_width - video_width) * input_width) / (2 * video_width);
|
|
||||||
// FIXME: round failure?
|
|
||||||
if (tmp > *crop_x) {
|
|
||||||
*crop_x = tmp;
|
|
||||||
}
|
|
||||||
*crop_width = input_width - *crop_x * 2;
|
|
||||||
} else if (*crop_height > video_height) {
|
|
||||||
int tmp;
|
|
||||||
|
|
||||||
*crop_width = input_width - VideoCutLeftRight[resolution] * 2;
|
|
||||||
|
|
||||||
// adjust scaling
|
|
||||||
tmp = ((*crop_height - video_height) * input_height)
|
|
||||||
/ (2 * video_height);
|
|
||||||
// FIXME: round failure?
|
|
||||||
if (tmp > *crop_y) {
|
|
||||||
*crop_y = tmp;
|
|
||||||
}
|
|
||||||
*crop_height = input_height - *crop_y * 2;
|
|
||||||
} else {
|
|
||||||
*crop_width = input_width - VideoCutLeftRight[resolution] * 2;
|
|
||||||
*crop_height = input_height - VideoCutTopBottom[resolution] * 2;
|
|
||||||
}
|
}
|
||||||
Debug(3, "video: aspect crop %dx%d%+d%+d\n", *crop_width, *crop_height, *crop_x, *crop_y);
|
CuvidMessage(2, "video: aspect crop %dx%d%+d%+d\n", *crop_width, *crop_height, *crop_x, *crop_y);
|
||||||
|
return;
|
||||||
|
|
||||||
|
video_none:
|
||||||
|
*output_height = *crop_height;
|
||||||
|
*output_width = (*crop_width * input_aspect_ratio.num) / input_aspect_ratio.den; // normalize pixel aspect ratio
|
||||||
|
*output_x = video_x + (video_width - *output_width) / 2;
|
||||||
|
*output_y = video_y + (video_height - *output_height) / 2;
|
||||||
|
CuvidMessage(2, "video: original aspect output %dx%d%+d%+d\n", *output_width, *output_height, *output_x, *output_y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2629,12 +2600,12 @@ int push_filters(AVCodecContext * dec_ctx, CuvidDecoder * decoder, AVFrame * fra
|
|||||||
av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
|
av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("Interlaced %d tff %d\n",frame->interlaced_frame,frame->top_field_first);
|
// printf("Interlaced %d tff %d\n",frame->interlaced_frame,frame->top_field_first);
|
||||||
/* pull filtered frames from the filtergraph */
|
/* pull filtered frames from the filtergraph */
|
||||||
while ((ret = av_buffersink_get_frame(decoder->buffersink_ctx, filt_frame)) >= 0) {
|
while ((ret = av_buffersink_get_frame(decoder->buffersink_ctx, filt_frame)) >= 0) {
|
||||||
filt_frame->pts /= 2;
|
filt_frame->pts /= 2;
|
||||||
decoder->Interlaced = 0;
|
decoder->Interlaced = 0;
|
||||||
// printf("vaapideint video:new %#012" PRIx64 " old %#012" PRIx64 "\n",filt_frame->pts,frame->pts);
|
// printf("vaapideint video:new %#012" PRIx64 " old %#012" PRIx64 "\n",filt_frame->pts,frame->pts);
|
||||||
CuvidSyncRenderFrame(decoder, dec_ctx, filt_frame);
|
CuvidSyncRenderFrame(decoder, dec_ctx, filt_frame);
|
||||||
filt_frame = av_frame_alloc(); // get new frame
|
filt_frame = av_frame_alloc(); // get new frame
|
||||||
|
|
||||||
@ -2649,7 +2620,7 @@ int init_filters(AVCodecContext * dec_ctx, CuvidDecoder * decoder, AVFrame * fra
|
|||||||
enum AVPixelFormat format = PIXEL_FORMAT;
|
enum AVPixelFormat format = PIXEL_FORMAT;
|
||||||
|
|
||||||
#ifdef VAAPI
|
#ifdef VAAPI
|
||||||
const char *filters_descr = "deinterlace_vaapi=rate=field:auto=1"; //
|
const char *filters_descr = "deinterlace_vaapi=rate=field:auto=1";
|
||||||
#endif
|
#endif
|
||||||
#ifdef YADIF
|
#ifdef YADIF
|
||||||
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
||||||
@ -4668,13 +4639,13 @@ static const VideoModule CuvidModule = {
|
|||||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||||
const AVCodecContext *, const AVFrame *))CuvidSyncRenderFrame,
|
const AVCodecContext *, const AVFrame *))CuvidSyncRenderFrame,
|
||||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))CuvidGetHwAccelContext,
|
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))CuvidGetHwAccelContext,
|
||||||
.SetClock =(void(*const)(VideoHwDecoder *, int64_t))CuvidSetClock,
|
.SetClock = (void(*const)(VideoHwDecoder *, int64_t))CuvidSetClock,
|
||||||
.GetClock =(int64_t(*const)(const VideoHwDecoder *))CuvidGetClock,
|
.GetClock = (int64_t(*const)(const VideoHwDecoder *))CuvidGetClock,
|
||||||
.SetClosing =(void(*const)(const VideoHwDecoder *))CuvidSetClosing,
|
.SetClosing = (void(*const)(const VideoHwDecoder *))CuvidSetClosing,
|
||||||
.ResetStart =(void(*const)(const VideoHwDecoder *))CuvidResetStart,
|
.ResetStart = (void(*const)(const VideoHwDecoder *))CuvidResetStart,
|
||||||
.SetTrickSpeed =(void(*const)(const VideoHwDecoder *, int))CuvidSetTrickSpeed,
|
.SetTrickSpeed = (void(*const)(const VideoHwDecoder *, int))CuvidSetTrickSpeed,
|
||||||
.GrabOutput = CuvidGrabOutputSurface,
|
.GrabOutput = CuvidGrabOutputSurface,
|
||||||
.GetStats =(void(*const)(VideoHwDecoder *, int *, int *, int *,
|
.GetStats = (void(*const)(VideoHwDecoder *, int *, int *, int *,
|
||||||
int *, float *, int *, int *, int *, int *))CuvidGetStats,
|
int *, float *, int *, int *, int *, int *))CuvidGetStats,
|
||||||
.SetBackground = CuvidSetBackground,
|
.SetBackground = CuvidSetBackground,
|
||||||
.SetVideoMode = CuvidSetVideoMode,
|
.SetVideoMode = CuvidSetVideoMode,
|
||||||
@ -4836,13 +4807,13 @@ static const VideoModule NoopModule = {
|
|||||||
const AVCodecContext *, const AVFrame *))NoopSyncRenderFrame,
|
const AVCodecContext *, const AVFrame *))NoopSyncRenderFrame,
|
||||||
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
.GetHwAccelContext = (void *(*const)(VideoHwDecoder *))
|
||||||
DummyGetHwAccelContext,
|
DummyGetHwAccelContext,
|
||||||
.SetClock =(void(*const)(VideoHwDecoder *, int64_t))NoopSetClock,
|
.SetClock = (void(*const)(VideoHwDecoder *, int64_t))NoopSetClock,
|
||||||
.GetClock =(int64_t(*const)(const VideoHwDecoder *))NoopGetClock,
|
.GetClock = (int64_t(*const)(const VideoHwDecoder *))NoopGetClock,
|
||||||
.SetClosing =(void(*const)(const VideoHwDecoder *))NoopSetClosing,
|
.SetClosing = (void(*const)(const VideoHwDecoder *))NoopSetClosing,
|
||||||
.ResetStart =(void(*const)(const VideoHwDecoder *))NoopResetStart,
|
.ResetStart = (void(*const)(const VideoHwDecoder *))NoopResetStart,
|
||||||
.SetTrickSpeed = (void(*const)(const VideoHwDecoder *, int))NoopSetTrickSpeed,
|
.SetTrickSpeed = (void(*const)(const VideoHwDecoder *, int))NoopSetTrickSpeed,
|
||||||
.GrabOutput = NoopGrabOutputSurface,
|
.GrabOutput = NoopGrabOutputSurface,
|
||||||
.GetStats =(void(*const)(VideoHwDecoder *, int *, int *, int *,
|
.GetStats = (void(*const)(VideoHwDecoder *, int *, int *, int *,
|
||||||
int *, float *, int *, int *, int *, int *))NoopGetStats,
|
int *, float *, int *, int *, int *, int *))NoopGetStats,
|
||||||
#endif
|
#endif
|
||||||
.SetBackground = NoopSetBackground,
|
.SetBackground = NoopSetBackground,
|
||||||
@ -6515,15 +6486,15 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax])
|
|||||||
VideoDeinterlace[1] = 1; //mode[1]; // 720p
|
VideoDeinterlace[1] = 1; //mode[1]; // 720p
|
||||||
VideoDeinterlace[2] = mode[2]; // fake 1080
|
VideoDeinterlace[2] = mode[2]; // fake 1080
|
||||||
VideoDeinterlace[3] = mode[3]; // 1080
|
VideoDeinterlace[3] = mode[3]; // 1080
|
||||||
VideoDeinterlace[4] = 1, //mode[4]; 2160p
|
VideoDeinterlace[4] = 1; //mode[4]; 2160p
|
||||||
#else
|
#else
|
||||||
VideoDeinterlace[0] = 1; // 576i
|
VideoDeinterlace[0] = 1; // 576i
|
||||||
VideoDeinterlace[1] = 0; //mode[1]; // 720p
|
VideoDeinterlace[1] = 0; //mode[1]; // 720p
|
||||||
VideoDeinterlace[2] = 1; // fake 1080
|
VideoDeinterlace[2] = 1; // fake 1080
|
||||||
VideoDeinterlace[3] = 1; // 1080
|
VideoDeinterlace[3] = 1; // 1080
|
||||||
VideoDeinterlace[4] = 0, //mode[4]; 2160p
|
VideoDeinterlace[4] = 0; //mode[4]; 2160p
|
||||||
#endif
|
#endif
|
||||||
VideoSurfaceModesChanged = 1;
|
VideoSurfaceModesChanged = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user