Kodi Community Forum
How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs (/showthread.php?tid=116996)



RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - FernetMenta - 2013-06-13

During the time pullup correction calculates fps we don't drop in decoder because this would mess up timestamps. Means the video is late from the beginning and drops after fps is calculated. The initial lateness is most likely caused by faulty calculated delay of audio (one reason why we write a new audio engine).

Disabling vsync in xbmc does not disable vsync at the driver level on NVidia systems. vsync at the driver level is always enabled for NVidia.

Do you see any "Discontinuity" massages in the log when running with vsync on?


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-13

(2013-06-13, 11:58)FernetMenta Wrote: During the time pullup correction calculates fps we don't drop in decoder because this would mess up timestamps. Means the video is late from the beginning and drops after fps is calculated. The initial lateness is most likely caused by faulty calculated delay of audio (one reason why we write a new audio engine).

Do you see any "Discontinuity" massages in the log when running with vsync on?

There is usually DEBUG: CDVDPlayerAudio:: Duplicating 1 packet(s) of 23.22 ms duration or CDVDPlayerAudio:: Skipping 1 packet(s) of 23.22 ms duration around when this happen.
I sent you logs of several files to pm.
I think this behaviour didn't happen before the 50hz fix, but something similar started happening with recent mainline nightly builds, but those builds usually drops even more frames than xvba-testing when this occurs at the beginning of playback. (not sure exactly when it started happening in mainline, but build from the end of april I had definitely didn't drop any frames)



(2013-06-13, 11:58)FernetMenta Wrote: Disabling vsync in xbmc does not disable vsync at the driver level on NVidia systems. vsync at the driver level is always enabled for NVidia.

So vsync off in xbmc is really best option for 23.976 smooth playback? Tearing when playback is not expected, but is expected in xbmc gui? What's the difference between playback/xbmc gui rendering in terms of tearing behaviour with vsync off?

Also I'm being curious why is there such a difference in smoothness of playback when you have vsync on in xbmc, is that because of "conflict" between driver level vsync and xbmc vsnyc setting? I would compare both to something like: 24 fps rendering vs 96 fps rendering)


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - FernetMenta - 2013-06-14

Quote:So vsync off in xbmc is really best option for 23.976 smooth playback?

Not correct. Elaborate on "smooth". Do you observe dropped or skipped frames when running with vsync on?

Quote:Tearing when playback is not expected, but is expected in xbmc gui?

If xorg.conf is not messed up, you can't get tearing, neither in the gui nor during playback.

Quote:What's the difference between playback/xbmc gui rendering in terms of tearing behaviour with vsync off?

As already said, on NVidia systems vsync is always on. Disabling it in xbmc shouldn't make any difference. If the is a difference, something is going wrong. What exactly do you observe?


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-14

(2013-06-14, 08:53)FernetMenta Wrote:
Quote:So vsync off in xbmc is really best option for 23.976 smooth playback?

Not correct. Elaborate on "smooth". Do you observe dropped or skipped frames when running with vsync on?

Smooth in terms of motion perception (like when you compare game running at 30 fps vs 60 fps) with vsync off motion looks like higher framerate than vsync on (but doesn't look like artificial MFC interpolation of nowadays TVs which try to improve smoothness of low framerate sources)

(2013-06-14, 08:53)FernetMenta Wrote:
Quote:Tearing when playback is not expected, but is expected in xbmc gui?

If xorg.conf is not messed up, you can't get tearing, neither in the gui nor during playback.

As already said, on NVidia systems vsync is always on. Disabling it in xbmc shouldn't make any difference. If the is a difference, something is going wrong. What exactly do you observe?

Here's my xorg.conf, playback is without tearing, navigation in xbmc gui sometimes produces really subtle tearing when switching between different section screens or when different fanarts fade in/out. I don't really mind that kind of tearing, it's not an obtrusive one.

Code:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 319.23  (buildmeister@swio-display-x86-rhel47-14)  Thu May 16 20:06:47 PDT 2013


Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "HDMI-0"
    VendorName     "TV"
    ModelName      "TV"
    HorizSync       15.0 - 81.0
    VertRefresh     23.0 - 76.0
    ModeLine       "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
    ModeLine       "1920x1080_59.94" 148.350 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
    ModeLine       "1920x1080_23.976" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
    ModeLine       "1920x1080_24.00" 74.250 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "HDMI-0"
    DefaultDepth    24
    Option         "NoLogo" "true"
    Option         "DynamicTwinView" "false"
    Option         "ExactModeTimingsDVI" "True"
    Option         "FlatPanelProperties" "Scaling = Native"
    Option         "HWCursor" "false"
    Option         "NoFlip" "false"
    Option         "ModeValidation" "NoEdidModes, NoXServerModes, NoVesaModes, NoPredefinedModes, NoVertRefreshCheck, NoHorizSyncCheck"
    Option         "ConnectedMonitor" "DFP-1"
    Option         "TripleBuffer" "true"
    Option         "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1"
    SubSection     "Display"
        Depth       24
        Modes      "1920x1080_50"
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Disable"
EndSection



RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - FernetMenta - 2013-06-14

Looks like I was wrong. vsync can be disabled by the setting in xbmc. Maybe the behavior has changed since those lines have been written (not by me)

Code:
#ifdef TARGET_POSIX
  // for nvidia cards - vsync currently ALWAYS enabled.
  // the reason is that after screen has been setup changing this env var will make no difference.
  setenv("__GL_SYNC_TO_VBLANK", "1", 0);
  setenv("__GL_YIELD", "USLEEP", 0);
#endif

If you disable vsync, you see fps in the menu rising to 100, right?

During video playback we only render at video fps. If video gets late, it can catch up without vsync, because it can render at higher speed.

I always run with vsync on and don't see any improvement when switching it off. As long as you don't observe drops/skips when running with vsync, I have no explanation why this should not as smooth as running without.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - laric - 2013-06-14

I resently switched from the xbmc-xvba over to xbmc-xvba-testing and I am experiencing total freeze when I turn off the display and come back some time later and start the display. (Usually I am away several hours).

How should I go about troubleshooting that? Would a debug log be of any use as I have to press reset to get out of it. (or ssh from an external machine).


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - fritsch - 2013-06-14

Quote:Option "TripleBuffer" "true"

Remove this, it harms in a "swapBuffer" World, where front and back buffers are used to measure number of glSwaps.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-14

(2013-06-14, 13:06)fritsch Wrote:
Quote:Option "TripleBuffer" "true"

Remove this, it harms in a "swapBuffer" World, where front and back buffers are used to measure number of glSwaps.
Surprisingly removing that line lined up the difference between vsync off/vsync on. Now both are equally smooth (like vsync on before) , so I actually like TripleBuffer . Didn't help with dropped frame at the beginning though.

(2013-06-14, 11:18)FernetMenta Wrote: Looks like I was wrong. vsync can be disabled by the setting in xbmc. Maybe the behavior has changed since those lines have been written (not by me)

Code:
#ifdef TARGET_POSIX
  // for nvidia cards - vsync currently ALWAYS enabled.
  // the reason is that after screen has been setup changing this env var will make no difference.
  setenv("__GL_SYNC_TO_VBLANK", "1", 0);
  setenv("__GL_YIELD", "USLEEP", 0);
#endif

If you disable vsync, you see fps in the menu rising to 100, right?

During video playback we only render at video fps. If video gets late, it can catch up without vsync, because it can render at higher speed.

I always run with vsync on and don't see any improvement when switching it off. As long as you don't observe drops/skips when running with vsync, I have no explanation why this should not as smooth as running without.

Yes, fps in menu is ~100 fps.
I also notice same kind of smoothness difference with vsync on when using different video scalers. Like lower quality ones feels smoother than higher quality ones (NN/Bilinear/Bicubic/Lanczos2 > Spline36,Lanczos3 optimized > Spline36,Lanczos3), but there is no difference in dropped/skipped/missed when comparing them.

In XVBA there is new Auto setting, how does that exactly work?


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - fritsch - 2013-06-14

Auto is used together with two settings:

e.g.
everything < 720 -> use high quality scaling
everything >= 720 use bilinear

But there is a new setting fernetmenta provided, which means "Scaling per cent". So you can set a percentage value from which one starting, the high quality scaling will be used.

this way you can fix to Lanczos 3 Optimized and it automatically uses bilinear / nearest neighbour, when you for example "scale" 1080p to 1080p or only scale 10%.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-14

Thanks a lot.

Scaling per cent above... is that for video width, video height or total video pixels (width x height)?


Is there any reason to prefer Bilinear/Nearest Neighbour with 1080p on 1920x1080 display over higher quality scalers with high end GPU? Won't I degrade quality of the picture?
I ask because two or three years ago I thought there is no scaling needed when you display 1920x1080 material... on 1920x1080 display, but there was quite visual quality difference when I used original VDPAU HQ scaler over other normal shader scalers, since that I use highest quality scalers possible (Lanczos3 usually) even for 1080p, but to be honest I've never compared the quality in detail between any of the currently available scalers with 1080p material.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - FernetMenta - 2013-06-14

If percentage of width AND height is below the chosen setting, hq scaling is avoided.

HQ scaling means double path rendering. We render first to a FBO of video size and do YUV to RGB conversion. In the second path scaling is done.
Doing decoding, temporal/spacial deinterlacing, and double path rendering for 1080 material is too much for e.g. gt610.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - fritsch - 2013-06-14

And! perhaps to add: not needed at all for content that already is 1080p - or near to it.


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-16

Thank you both, but I'm still little bit confused how it works, can you please give me som real world usage examples?
Do I divide display resolution width by video resolution width and display resolution height by video height then take the higher value and compare it to scaling setting?

display 1920x1080
video: 1280x720 - Is that considered as 50% upscale? 1920/1280 = 1080/720
video 1280x544 - Is that considered as 99% upscale? 1080/544 > 1920/1280

If I don't have Video Scaling method specifically set to Auto, Enable HQ Scalers for scaling above isn't used at all and scaler specified in Video scaling method is used all the time, right?
Or HQ scaler is independent of Video scaling method set, and is just a way how to improve scaling with the selected scaling method?

If I have set Enable HQ Scalers for scaling above 0% (default) does it mean it use HQ scaling is used all the time or only when following applies (from your answer):

Quote:everything < 720 -> use high quality scaling
everything >= 720 use bilinear

Last question, Auto Video Scaling method... what scaler is used for high quality scaling? Highest available in menu (Lanczos3 optimized by default or Lanczos3 when I have <enablehighqualityhwscalers>1</enablehighqualityhwscalers> in advancedsettings.xml ?

Thanks Ez.

(2013-06-14, 15:43)fritsch Wrote: Auto is used together with two settings:

e.g.
everything < 720 -> use high quality scaling
everything >= 720 use bilinear

But there is a new setting fernetmenta provided, which means "Scaling per cent". So you can set a percentage value from which one starting, the high quality scaling will be used.

this way you can fix to Lanczos 3 Optimized and it automatically uses bilinear / nearest neighbour, when you for example "scale" 1080p to 1080p or only scale 10%.



RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - FernetMenta - 2013-06-16

Quote:display 1920x1080
video: 1280x720 - Is that considered as 50% upscale? 1920/1280 = 1080/720
video 1280x544 - Is that considered as 99% upscale? 1080/544 > 1920/1280

scaling is (destination-source)/source * 100
video 1280x720: width is scaled by (1920-1280)/1280 * 100 = 50%, height by 50%
video 1280x544: it depends on the aspect ratio, destination is not necessarily you display dimensions, if you keep the aspect ratio in this case, height is only scaled by 50% as well

If you allow hq scalers only for e.g. above 20%, either scaling for width OR height must satisfy this condition. If the condition is not met, hq scalers won't be taken, regardless of setting AUTO. The default of 0% disables this feature.

Quote:Last question, Auto Video Scaling method... what scaler is used for high quality scaling?

Lanczos3 optimized


RE: How to Install XBMC PVR Xvba for AMD/Nvidia/Intel GPUs - ezechiel1917 - 2013-06-16

Now I get it, thanks a lot.

EDIT: In other words as long as you have powerful hw, you don't have to care about this setting (leaving it at 0%) as it won't improve PQ when you already use Lanczos3 optimized+, but it's very useful to people with slower hw, adding an ability to use faster scalers for more demanding (higher resolutions) videos to keep up with their hw's decoding capabilities.