diff --git a/README.md b/README.md index 3c10961..69f2b3e 100644 --- a/README.md +++ b/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: 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 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: 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 This is for INTEL cards and uses Vaapi as decoder. It uses xcb for output and needs a X Server to run. - + 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. Install: @@ -98,27 +98,27 @@ Install: 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: - 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. + 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. 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 - 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 + + 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 + Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test is activ. - + 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. - - If you are colorblind you could try to remedy this with the Colorblind Settings. Realy only needed + 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 in rare cases. - + All other settings can be in their default state. - - + + Setup: environment ------ @@ -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 - - - diff --git a/common.h b/common.h index 3b87e77..ceb935e 100644 --- a/common.h +++ b/common.h @@ -1,3 +1,4 @@ + /* * This file is part of mpv. * diff --git a/config.h b/config.h index 3029b17..5d300dd 100644 --- a/config.h +++ b/config.h @@ -1,3 +1,4 @@ + /* * This file is part of libplacebo. * diff --git a/drm.c b/drm.c index 4ed1881..cb5c833 100644 --- a/drm.c +++ b/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; diff --git a/drvapi_error_string.h b/drvapi_error_string.h index 652d2db..ccf42fb 100644 --- a/drvapi_error_string.h +++ b/drvapi_error_string.h @@ -1,3 +1,4 @@ + /* * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. * diff --git a/po/de_DE.po b/po/de_DE.po index 8d388ca..6556250 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR \n" "Report-Msgid-Bugs-To: \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 "" diff --git a/softhdcuvid.cpp b/softhdcuvid.cpp index 10217b8..80743f7 100644 --- a/softhdcuvid.cpp +++ b/softhdcuvid.cpp @@ -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[] = { @@ -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 diff --git a/video.c b/video.c index 032cbdc..2dae7a0 100644 --- a/video.c +++ b/video.c @@ -253,7 +253,7 @@ typedef enum _video_zoom_modes_ VideoNormal, ///< normal VideoStretch, ///< stretch to all edges VideoCenterCutOut, ///< center and cut out - VideoAnamorphic, ///< anamorphic scaled (unsupported) + VideoNone, ///< no scaling } VideoZoomModes; /// @@ -679,44 +679,35 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in AVRational display_aspect_ratio; AVRational tmp_ratio; + // input not initialized yet, return immediately if (!input_aspect_ratio.num || !input_aspect_ratio.den) { - input_aspect_ratio.num = 1; - input_aspect_ratio.den = 1; - Debug(3, "video: aspect defaults to %d:%d\n", input_aspect_ratio.num, input_aspect_ratio.den); - - } - - 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; + output_width = video_width; + output_height = video_height; + return; } #ifdef USE_DRM get_drm_aspect(&display_aspect_ratio.num, &display_aspect_ratio.den); #else - Debug(3, "mmHeight %d mm Width %d VideoHeight %d VideoWidth %d\n", VideoScreen->height_in_millimeters, - VideoScreen->width_in_millimeters, VideoScreen->height_in_pixels, VideoScreen->width_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; + display_aspect_ratio.num = VideoScreen->width_in_pixels; + display_aspect_ratio.den = VideoScreen->height_in_pixels; #endif - display_aspect_ratio = av_mul_q(input_aspect_ratio, display_aspect_ratio); - Debug(3, "video: aspect %d:%d Resolution %d\n", display_aspect_ratio.num, display_aspect_ratio.den, resolution); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den, + 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_y = VideoCutTopBottom[resolution]; *crop_width = input_width - VideoCutLeftRight[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.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)) { switch (Video4to3ZoomMode) { case VideoNormal: @@ -725,9 +716,8 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in goto stretch; case VideoCenterCutOut: goto center_cut_out; - case VideoAnamorphic: - // FIXME: rest should be done by hardware - goto stretch; + case VideoNone: + goto video_none; } } switch (VideoOtherZoomMode) { @@ -737,28 +727,24 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in goto stretch; case VideoCenterCutOut: goto center_cut_out; - case VideoAnamorphic: - // FIXME: rest should be done by hardware - goto stretch; + case VideoNone: + goto video_none; } normal: *output_x = video_x; *output_y = video_y; - *output_width = - (video_height * display_aspect_ratio.num + display_aspect_ratio.den - 1) / display_aspect_ratio.den; - *output_height = - (video_width * display_aspect_ratio.den + display_aspect_ratio.num - 1) / display_aspect_ratio.num; + *output_height = video_height; + *output_width = (*crop_width * *output_height * input_aspect_ratio.num) / (input_aspect_ratio.den * *crop_height); if (*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; - } else if (*output_height > video_height) { - *output_height = video_height; + } else if (*output_width < video_width) { *output_x += (video_width - *output_width) / 2; } - - 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); + CuvidMessage(2, "video: normal aspect output %dx%d%+d%+d\n", *output_width, *output_height, *output_x, *output_y); return; stretch: @@ -766,49 +752,34 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in *output_y = video_y; *output_width = video_width; *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; center_cut_out: *output_x = video_x; *output_y = video_y; *output_height = video_height; - *output_width = video_width; - - *crop_width = (video_height * display_aspect_ratio.num + display_aspect_ratio.den - 1) / display_aspect_ratio.den; - *crop_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num - 1) / display_aspect_ratio.num; - - // look which side must be cut - if (*crop_width > video_width) { - int tmp; - - *crop_height = input_height - VideoCutTopBottom[resolution] * 2; - - // 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; + *output_width = (*crop_width * *output_height * input_aspect_ratio.num) / (input_aspect_ratio.den * *crop_height); + if (*output_width > video_width) { + // fix height cropping + *crop_width = (int)((*crop_width * video_width) / (*output_width * 2.0) + 0.5) * 2; + *crop_x = (input_width - *crop_width) / 2; + *output_width = video_width; + } else if (*output_width < video_width) { + // fix width cropping + *crop_height = (int)((*crop_height * *output_width) / (video_width * 2.0) + 0.5) * 2; + *crop_y = (input_height - *crop_height) / 2; + *output_width = video_width; } - 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; } @@ -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"); } - // 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 */ while ((ret = av_buffersink_get_frame(decoder->buffersink_ctx, filt_frame)) >= 0) { filt_frame->pts /= 2; 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); 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; #ifdef VAAPI - const char *filters_descr = "deinterlace_vaapi=rate=field:auto=1"; // + const char *filters_descr = "deinterlace_vaapi=rate=field:auto=1"; #endif #ifdef YADIF 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 *, const AVCodecContext *, const AVFrame *))CuvidSyncRenderFrame, .GetHwAccelContext = (void *(*const)(VideoHwDecoder *))CuvidGetHwAccelContext, - .SetClock =(void(*const)(VideoHwDecoder *, int64_t))CuvidSetClock, - .GetClock =(int64_t(*const)(const VideoHwDecoder *))CuvidGetClock, - .SetClosing =(void(*const)(const VideoHwDecoder *))CuvidSetClosing, - .ResetStart =(void(*const)(const VideoHwDecoder *))CuvidResetStart, - .SetTrickSpeed =(void(*const)(const VideoHwDecoder *, int))CuvidSetTrickSpeed, + .SetClock = (void(*const)(VideoHwDecoder *, int64_t))CuvidSetClock, + .GetClock = (int64_t(*const)(const VideoHwDecoder *))CuvidGetClock, + .SetClosing = (void(*const)(const VideoHwDecoder *))CuvidSetClosing, + .ResetStart = (void(*const)(const VideoHwDecoder *))CuvidResetStart, + .SetTrickSpeed = (void(*const)(const VideoHwDecoder *, int))CuvidSetTrickSpeed, .GrabOutput = CuvidGrabOutputSurface, - .GetStats =(void(*const)(VideoHwDecoder *, int *, int *, int *, + .GetStats = (void(*const)(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *))CuvidGetStats, .SetBackground = CuvidSetBackground, .SetVideoMode = CuvidSetVideoMode, @@ -4836,13 +4807,13 @@ static const VideoModule NoopModule = { const AVCodecContext *, const AVFrame *))NoopSyncRenderFrame, .GetHwAccelContext = (void *(*const)(VideoHwDecoder *)) DummyGetHwAccelContext, - .SetClock =(void(*const)(VideoHwDecoder *, int64_t))NoopSetClock, - .GetClock =(int64_t(*const)(const VideoHwDecoder *))NoopGetClock, - .SetClosing =(void(*const)(const VideoHwDecoder *))NoopSetClosing, - .ResetStart =(void(*const)(const VideoHwDecoder *))NoopResetStart, + .SetClock = (void(*const)(VideoHwDecoder *, int64_t))NoopSetClock, + .GetClock = (int64_t(*const)(const VideoHwDecoder *))NoopGetClock, + .SetClosing = (void(*const)(const VideoHwDecoder *))NoopSetClosing, + .ResetStart = (void(*const)(const VideoHwDecoder *))NoopResetStart, .SetTrickSpeed = (void(*const)(const VideoHwDecoder *, int))NoopSetTrickSpeed, .GrabOutput = NoopGrabOutputSurface, - .GetStats =(void(*const)(VideoHwDecoder *, int *, int *, int *, + .GetStats = (void(*const)(VideoHwDecoder *, int *, int *, int *, int *, float *, int *, int *, int *, int *))NoopGetStats, #endif .SetBackground = NoopSetBackground, @@ -6515,15 +6486,15 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax]) VideoDeinterlace[1] = 1; //mode[1]; // 720p VideoDeinterlace[2] = mode[2]; // fake 1080 VideoDeinterlace[3] = mode[3]; // 1080 - VideoDeinterlace[4] = 1, //mode[4]; 2160p + VideoDeinterlace[4] = 1; //mode[4]; 2160p #else VideoDeinterlace[0] = 1; // 576i VideoDeinterlace[1] = 0; //mode[1]; // 720p VideoDeinterlace[2] = 1; // fake 1080 VideoDeinterlace[3] = 1; // 1080 - VideoDeinterlace[4] = 0, //mode[4]; 2160p + VideoDeinterlace[4] = 0; //mode[4]; 2160p #endif - VideoSurfaceModesChanged = 1; + VideoSurfaceModesChanged = 1; } ///