madshi bug tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000462madVRbugpublic2016-12-26 16:502018-01-14 12:41
Assigned Tomadshi 
PlatformOSWindowsOS Version10.0.14393 x64
Summary0000462: FinalStep rendering time spikes massively on specific video scenes when a 3DLUT is enabled
DescriptionI am experiencing a very strange problem when using madVR on my new Razer Blade 2016 laptop (Intel HD Graphics 530). Basically, madVR rendering times skyrocket during certain video scenes. This is completely reproducible - if I play the same video segment again, the issue is guaranteed to reoccur. In addition, this only happens when a 3DLUT is enabled.

This happens only on specific scenes in a variety of videos encoded in a variety of ways (none of them "exotic" - this is very standard low-bitrate stuff). I was not able to discern a specific pattern among these problematic scenes.
Steps To Reproduce1. Enable the 3DLUT provided in "additional information", below.
2. Play the short video sample provided in "additional information", below.
3. Use CTRL+J and watch render times while the sample is playing. ShowRenderSteps will provide more detail.
4. While the problematic scene is playing, the "FinalStep" rendering time will skyrocket from around ~7ms to ~25ms. If expensive madVR options are used at the same time, frames will be dropped as the system is unable to keep up.
5. After the problematic scene has passed, performance goes back to normal.
Additional InformationThe fact that this only happens on specific scenes might make this sound like a decoder performance issue, but I'm pretty sure it's not - these files are low bitrate (the sample is from a Youtube video), are very simple to decode, and switching decoders (e.g. between software and DXVA2) does not make any difference.

Disabling the 3DLUT makes the issue go away entirely. No other madVR settings seem to make any difference (windowed/exclusive, overlay, D3D11, use separate device for presentation, queue size, flush settings, trade quality for performance, etc.).

The following file: [^] contains the following:
- A 23-second video sample that reproduces the issue of my system. It is cut (remux'd) from the original video which itself is downloaded from [^] I cut the sample in such a way that the problematic scene is exactly in the middle of the video - specifically, at 00:11. The problematic scene lasts for about 2 seconds.
- The 3DLUT that triggers the issue, generated with ArgyllCMS.
- A madVR debug log that covers one playback session of the aforementioned 23-second sample from beginning to end on my system, with a 3Dlut enabled, reproducing the issue.

I also used GPUView to record a full trace while the sample is playing. The trace can reveal additional information when opened in GPUView or the Windows Performance Analyser. However, for privacy reasons, I will only provide the trace file on direct request from madshi.
TagsNo tags attached.
madVR Version0.91.4
Media Player (with version info)MPC-HC 1.7.10
Splitter (with version info)LAV Splitter (MPC-HC built-in)
Decoder (with version info)LAV Video (MPC-HC built-in)
Deinterlacingnone (progressive)
DXVA2 Scaling Activeno
Aero / Desktop CompositionOn
Problem occurs with modeall modes
GPU ManufacturerIntel
GPU ModelHD Graphics 530 (Core i7 6700HQ)
GPU Driver Version21.20.16.4542
Attached Files

- Relationships

-  Notes
madshi (administrator)
2016-12-27 11:57

This has been reported mainly by NVidia users and seems to be less of a problem with AMD users. I think the issue is likely caused by the GPU texture cache failing because the 3DLUT texture is very big, and some rarely used colors might not be in the cache.

One thing you could try is clipping out of gamut colors with a custom pixel shader. E.g. just do a custom MPC-HC shader with "return saturate(tex2D(...))". I've no idea if that will help, but it should at least cut off a part of the 3DLUT area.
e-t172 (reporter)
2016-12-27 13:28

Thanks for the suggestion. I've tried the following shader:

sampler s0 : register(s0);
float4 main(float2 tex : TEXCOORD0) : COLOR
    return saturate(tex2D(s0, tex));

It doesn't seem to make much of a difference. (I've verified the shader is actually running because it appears in the list of rendering steps.)
madshi (administrator)
2016-12-27 13:38

Well, it was just a try. I suppose the only other option would be to create/use smaller sized 3dluts... :-(
e-t172 (reporter)
2016-12-27 13:56

Yep. I think you're right when you say it has to do with the colours of the scene: if I apply the "greyscale" shader that comes with MPC-HC, the problem disappears. Also the "problematic scene" in the sample happens to have lots of highly saturated colours. Here's a screenshot of the scene: [^]

Maybe one way to work around the issue could be to split the 3Dlut texture into several smaller textures? (Just a suggestion - I have no idea how GPU programming works)
madshi (administrator)
2016-12-27 14:05

No, that wouldn't help. The only solution I can see is either better GPU drivers, more GPU texture cache, or a smaller 3dlut (e.g. 65^3 instead of 255^3).
huhn (reporter)
2016-12-31 07:44

i can confirm the problem with that file even on AMD which is way faster than nvidia in my personal experience.

i personally only notice this problem at UHD at 1080p i can't really reproduce this issue what so ever. why is the resolution playing such a big rule for this issue? i don't understand this part.

no chance with openCL or stuff like that?
madshi (administrator)
2016-12-31 10:30

I don't think OpenCL would make things better. *Maybe* D3D11, but I highly doubt it. I think it's a texture cache issue and the API set probably won't affect that.

The 3dlut is applied at the very last rendering step, so it's not the resolution of the video which should make a difference, but the output resolution, I would expect.
huhn (reporter)
2017-01-02 02:25

the problem is more about the insane increase in GPU usage at UHD.

if i take a file with the problem i notice nothing at FHD but at UHD the render time easily triple or even more with such a scene.
or with numbers.

FHD final step 0000001:0000002-4 ms
UHD final step 10-250ms

UHD needs 4 x ms of FHD which makes sense but with the problem it is easily 64 times...
e-t172 (reporter)
2017-01-02 09:56

In my report I mentioned FinalStep rendering times of ~25ms during the problematic scene instead of ~7ms otherwise. That's with a 1080p video playing at 1080p on a 1080p display. I think the reason why it's especially noticeable on my system is because of the slow GPU (Intel HD Graphics 530), which exacerbates the problem.
madshi (administrator)
2018-01-14 12:41

I'll add to my to do list to maybe consider supporting smaller 3dlut sizes, but it's not a simple change, so I'm not sure if it's going to happen, or how soon.

- Issue History
Date Modified Username Field Change
2016-12-26 16:50 e-t172 New Issue
2016-12-27 11:57 madshi Note Added: 0001545
2016-12-27 13:28 e-t172 Note Added: 0001546
2016-12-27 13:38 madshi Note Added: 0001547
2016-12-27 13:56 e-t172 Note Added: 0001548
2016-12-27 14:05 madshi Note Added: 0001549
2016-12-31 07:44 huhn Note Added: 0001561
2016-12-31 10:30 madshi Note Added: 0001562
2017-01-02 02:25 huhn Note Added: 0001563
2017-01-02 09:56 e-t172 Note Added: 0001564
2018-01-14 12:41 madshi Note Added: 0002022
2018-01-14 12:41 madshi Status new => closed
2018-01-14 12:41 madshi Assigned To => madshi
2018-01-14 12:41 madshi Resolution open => suspended

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker