Page 1 of 2
Direct3D output is blurring video
Posted: 10 Jan 2008 23:25
by eltouco
Hi all,
I've noticed that when using Direct3D as video output in VLC preferences, the video is a bit blurry (the edges of the image are blur) even when the video is displayed at its native size.
When using DirectX as output, the display look fine (sharp edges)
is it a bug or a feature ?
since I've read that Direct3D will be the default mode with Vista, I'm wondering if this rendering is also the same with Vista (for information, I'm using Windows XP directX 9.0c with an ATI x850XT graphics cards)
Thanks for your contributions
Touco
Re: Direct3D output is blurring video
Posted: 10 Jan 2008 23:28
by Jean-Baptiste Kempf
It is a bug.
Re: Direct3D output is blurring video
Posted: 12 Jan 2008 15:08
by eltouco
It is a bug.
Hi thanks for your answer,
is the correction of this bug inthe scope of VLC next release ? ( 0.9 ?)
Touco
Re: Direct3D output is blurring video
Posted: 12 Jan 2008 18:25
by Jean-Baptiste Kempf
Not that I know... Help will be appreciated.
Re: Direct3D output is blurring video
Posted: 12 Jan 2008 19:44
by VLC_help
Can you get screen capture that shows this issue?
Re: Direct3D output is blurring video
Posted: 13 Jan 2008 14:33
by eltouco
Can you get screen capture that shows this issue?
Hi
sorry for the delay, but I had to find that will not cause problem of copyright and will not too moving scene (since VLC can not seek at the frame precision it is difficult to have the same ouput image with directx and direct3D)
Here you are, all the capture where made using ALT-Print, no resize where made with vlc
An image with directX ouput, all the edge of the letters are sharp
the same image with direct3d ouput, the edge are blur
another one with directx ouput, it is less difficult to see the difference, since the edge are not really sharp
the same with direct3d
anothe one, with directx ouput, the image details are sharp
the same with direct3d ouput, it is then blurry
also, here is an article I found about the Video Mixing Rendere (I guess that is the engine fore rendering video with Direct3D)
http://www.virtualdub.org/blog/pivot/entry.php?id=92, search for blur
here is an extract
...What can cause a blur is forcing full-scene antialiasing (FSAA) on in the driver. Supersampling causes multiple texture samples to be taken per pixel and blended together, which blurs the result. Even though multisampling writes the exact same color value into every subpixel, it too can blur the video because a blur post-pass is done over the result. If you have FSAA forced on, try turning it back to Application Controlled and see if that helps.
...
I can develop myself, and would like to help, but I know nothing about directx programming
Hope it will help
Touco
Re: Direct3D output is blurring video
Posted: 13 Jan 2008 17:57
by Jean-Baptiste Kempf
This is a very interesting post. damienf should look at it. What about opening a bug request on that one ?
Re: Direct3D output is blurring video
Posted: 13 Jan 2008 18:59
by eltouco
This is a very interesting post. damienf should look at it. What about opening a bug request on that one ?
I've just opened a ticket and assigned it to damienf
here is the ticket
ticket 1434
Re: Direct3D output is blurring video
Posted: 15 Jan 2008 14:36
by VLC_help
And you are sure you haven't enabled AA from your display adapters control panel?
Re: Direct3D output is blurring video
Posted: 15 Jan 2008 21:17
by eltouco
And you are sure you haven't enabled AA from your display adapters control panel?
I have an ATI cards, (precisely ATI X850XT 256 MO) only the drivers are installed, not the Catalyst control panel that I have uninstalled, considering that it is not useful for me.
I could install it, see if the setting you mention existes and is somehow "by default", then disable it and make new tests.
I'll keep you update, but anyway, even if it is the case, to my point of view VLC should take over a default setting for the display it needs to render, therefore a correction would also be needed in that case.
Can someone else reproduced this bug ?
Re: Direct3D output is blurring video
Posted: 16 Jan 2008 16:53
by VLC_help
ATItool and other GPU overclocking software also have this possibility to change AA, AF etc.
![Image](http://www.raiska.com/vlc/gdi.png)
video with GDI output.
![Image](http://www.raiska.com/vlc/d3d.png)
video with D3D output.
![Image](http://www.raiska.com/vlc/d3d_6xaa.png)
video with D3D output and 6x AA (using ATI x1100)
in my case it doesn't matter.
Re: Direct3D output is blurring video
Posted: 16 Jan 2008 20:44
by eltouco
Hi,
Thanks for your contribution.
it may be a silly question, but to make sure, between each change in the setting (directx->direct3d) did you quit and relauch VLC ?
i will make new tests by changing setting in Catalyst control center (I have to install .NET before...
![Evil or Very Mad :evil:](./images/smilies/icon_evil.gif)
) but to my point of views, VLC should overcome this settings, moreover if there is no resize I don't understand why a kind of anti-aliasing filter is applied ??
to precise my configuration, I have windows XP service pack 2, directx 9.0c and an ATI card x850XT, latest drivers and no catalyst control center, what is your configuration ?
Touco
Re: Direct3D output is blurring video
Posted: 16 Jan 2008 20:57
by Jean-Baptiste Kempf
This is a good question... Can we disable AA from the application for all vendors ?
Re: Direct3D output is blurring video
Posted: 16 Jan 2008 21:24
by eltouco
This is a good question... Can we disable AA from the application for all vendors ?
I made a new test.
this time with Catalyst Control Center (the last one 8.1 that has just been updated today)
here are the setting I found under the control center
under 3D
Anti-aliasing, smoothvision HD:Anti-Aliasing : "use application setting" is set
Adaptive Anti-Aliasing : Enable Adaptive Anti-Aliasing is unset
Smoothvision HD : Anisotropic Filtering : : "use application setting" is set
So, every setting related to antialisaing are either unset or left to the application.
I still have the same problem with Direct3D
[edit] I made a new test, this time by setting anti aliasing to any value in contol center (x2 or x4 or x6), then the problem does not occur ! but when i set it to "application managed" the problem occurs again[/edit]
I had a look at direct3d.c in module/video_output, I made some search about the direct3d function used, I found nothing "obvious" that could explain the problem, but my knowledge of DirectX programming is close to zero, someone more experimented should take a look a it. the only thing I've noticed (and I don't think it has something to do with the problem, is that the vertex processing used is software and not hardware, there is no test to check the graphic card capabilities)
Touco
Re: Direct3D output is blurring video
Posted: 17 Jan 2008 19:36
by VLC_help
I tested again with my Vista computer and you are right. Direct3D output is mushy. This computer has Nvidia 7900 GT so I guessing the problem is in VLC and not in drivers because in this case AA settings didn't change output.
![Image](http://www.raiska.com/vlc/vista_d3d.png)
Vista Direct3D
![Image](http://www.raiska.com/vlc/vista_dx.png)
Vista DirectX
EDIT:
I also tested with nightly builds. Same thing with them.
I also checked source
http://www.koders.com/c/fid90D03349FF99 ... 27EF9.aspx from there. By comparing those screenshots it seems Direct3D output does some scaling and moving, because video ain't same position which would explain a lot. Also instead of IDirect3DDevice9_SetSamplerState(p_d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
you could use
IDirect3DDevice9_SetSamplerState(p_d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC);
or
IDirect3DDevice9_SetSamplerState(p_d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_PYRAMIDALQUAD);
or
IDirect3DDevice9_SetSamplerState(p_d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_GAUSSIANQUAD);
when video hardware supports those. (maybe same for D3DSAMP_MINFILTER)
Re: Direct3D output is blurring video
Posted: 19 Jan 2008 14:48
by eltouco
Hi,
thanks for testing this further and for having a look at the source code.
I'm glad to see that there is in fact a correction to make and it seems you found the solution.
But who is able to analyse the directX code and make the correction to it ? I've opened a ticket but it seems that no one is working on it.
Touco
Re: Direct3D output is blurring video
Posted: 19 Jan 2008 18:43
by VLC_help
My suggestions don't fix the issues (D3DSAMP_MAGFILTER). They only make scaled picture look better =) And it seems that funman has something to do with that file. I looked code little more. Suggestion for D3DCREATE_HARDWARE_VERTEXPROCESSING instead of D3DCREATE_SOFTWARE_VERTEXPROCESSING might reduce CPU load but again it has to be verified that GPU supports that.
If I understand code correctly only things that have an effect to output are
f_width = (float)(p_vout->output.i_width);
f_height = (float)(p_vout->output.i_height);
or at least I couldn't find projection matrix or anything like that from code (I am haven't really coded with D3D, only OpenGL but I guess principles are very similar).
With little trial and error I found the issue (or at least I think so). With Direct3D output pixels of bottom row and right column are removed and after that image is scaled to video resolution.
Issue might be off by one error in texture creation or something similar. It would be easy to find out what causes that error but i don't have time or compile environment for debugging.
![Image](http://www.raiska.com/vlc/error_sample.png)
I made black image and added white lines which are those pixels that will vanish. Then I used Virtualdub to convert that image to video. Which you can
download. With Direct3D output you can't see anything white.
Re: Direct3D output is blurring video
Posted: 19 Jan 2008 23:18
by eltouco
I've dowloaded your video and tried it over different player.
with VLC (directx output) no white lines
with Media Player Classic, I see white lines on right and bottom
with Windows Media player I see white lines
It would be interessting that someone explains the point of using direct3D to output video.
by reading the code I see the use of vertex and texture, why is it useful for 2D images ? (I don't mean it is not useful, I'm just asking)
in VLC documentation, I coudn't find something about the difference between direct3D ouput and DirectX output, if the choice is proposed to the user, no info is given to make a decision to choose one or another.
Explanation are welcome !
Touco
Re: Direct3D output is blurring video
Posted: 20 Jan 2008 06:17
by Jean-Baptiste Kempf
Vista and Aero are the explanation
Re: Direct3D output is blurring video
Posted: 21 Jan 2008 17:32
by VLC_help
With textures you can offload some work from CPU and let GPU do some stuff like scaling and colorspace conversions. Also with Direct3D enabling font support, scaling, transformations, flips, shader effects etc are much easier to do and much less prone to errors.
Re: Direct3D output is blurring video
Posted: 21 Jan 2008 21:30
by eltouco
Vista and Aero are the explanation
Sorry, it may be a "newbie" question (I don't have Vista and i didn't find info about it), but you mean DirectX output is not compatible with Vista ?
Re: Direct3D output is blurring video
Posted: 21 Jan 2008 22:00
by Jean-Baptiste Kempf
Vista and Aero are the explanation
Sorry, it may be a "newbie" question (I don't have Vista and i didn't find info about it), but you mean DirectX output is not compatible with Vista ?
You are right... DirectX is not compatible with Aero.
Overlay and hardware acceleration too are removed from Vista...
If you want to complain
http://www.microsoft.com
Re: Direct3D output is blurring video
Posted: 21 Jan 2008 22:09
by eltouco
Vista and Aero are the explanation
Sorry, it may be a "newbie" question (I don't have Vista and i didn't find info about it), but you mean DirectX output is not compatible with Vista ?
You are right... DirectX is not compatible with Aero.
Overlay and hardware acceleration too are removed from Vista...
If you want to complain
http://www.microsoft.com
As long as I have an alternative with a direct3D output with sharp image that's fine to me
I hope the correction of this bug will be found, because if I move to Vista (maybe Vista 64 bits with VLC 64 bits ?) I don't want to change my habits to a new video player
Touco
Re: Direct3D output is blurring video
Posted: 23 Mar 2008 23:27
by VLC_help
Okay, I added small patch that makes this issue little better.
![Image](http://www.raiska.com/vlc/vista_d3d.png)
Old
![Image](http://www.raiska.com/vlc/uusi.png)
New
Re: Direct3D output is blurring video
Posted: 03 May 2008 01:00
by eltouco
Okay, I added small patch that makes this issue little better.
In which version this patch can be found ?
I read on the vug tracker that this issue is supposed to be solved in VLC 0.9
Thanks
Touco