Log in

View Full Version : h/w deinterlace then upscale/enhance in ffdshow


riadmelb
20th February 2009, 03:31
Hi, as the title says, is it possible? I'm asking this because I have many SD interlaced videos that I want to upscale/enhance before feeding to 1080p display.

I heard doing it vice-versa is not recommended and causes problems.

Thank you for listening,
Riado

LoRd_MuldeR
20th February 2009, 04:04
Correct: Resizing (scaling) an interlaced video will destroy the video. So if you want to apply such filters, you must deinterlace first!

Anyway, you can't use "hardware" deinterlacing -and- apply ffdshow filters afterwards:
Using hardware deinterlacing means nothing but: Keep the video as-is (interlaced), mark it as being "interlaced" and send it to the video renderer.
Then let the video renderer take care of the interlacing, which usually means that the GPU ("hardware") will perform the deinterlacing.

Of course ffdshow cannot apply any filters to the deinterlaced video, when using this method!
That's because when using "hardware" deinterlacing then ffdshow needs to pass the video to the renderer before the deinterlacing takes place!
If any interlacing-incompatible filters need to be applied, then ffdshow needs to deinterlace the video itself, in software.

riadmelb
20th February 2009, 05:48
Thank you lord, very clean explanation!

I will try this method: s/w deinterlace first, then enhance and upscale to 720p (instead of 1080p so I don't overload the cpu).

Esurnir
21st February 2009, 17:50
Thank you lord, very clean explanation!

I will try this method: s/w deinterlace first, then enhance and upscale to 720p (instead of 1080p so I don't overload the cpu).

I don't think you'll overload the cpu either way.

cpu load depends on the source resolution, resizing don't really impact -too- much

DigitalDeviant
24th February 2009, 17:46
Wouldn't it be possible with Nvidia cards to use a CUDA based MPEG-2 decoder and then use ffdshow's raw video processing after that? Of couse someone would need to come up with a CUDA enabled MPEG-2 decoder.

riadmelb
24th February 2009, 23:27
I don't think you'll overload the cpu either way.

cpu load depends on the source resolution, resizing don't really impact -too- much

Agree, but if I plan to scale then enhance, the scaled image becomes my source. So applying filters to 720p is less cpu work comparing to 1080p.

Wouldn't it be possible with Nvidia cards to use a CUDA based MPEG-2 decoder and then use ffdshow's raw video processing after that? Of couse someone would need to come up with a CUDA enabled MPEG-2 decoder.

I think once the image passes to the video card, ffdshow cannot touch it any more.

LoRd_MuldeR
25th February 2009, 00:43
I think once the image passes to the video card, ffdshow cannot touch it any more.

Well, if you have a regular MPEG-2 or H.264 decoder filter (not a renderer!) you can simply put ffdshow between the decoder filter and the video renderer. This way ffdshow can act as a post-processor for the decoder filter. Of course this makes no sense, if the decoder filter is a pure software decoder. In that case you could simply use ffdshow as your decoder. But it would make sense if you use a CUDA-enabled MPEG-2/H.264 decoder, which performs the decoding (and also the deinterlacing!) on your GPU. The data flow would then be: CPU (source) -> GPU (decoder) -> CPU (ffdshow) -> GPU (renderer). That method also won't work with a DXVA-enabled decoder, as these decoders need to be connected to the renderer directly (as far as I know). CUDA may work, I think.

riadmelb
25th February 2009, 02:00
Nice one Lord, the only decoder that I know of that uses CUDA is CoreAVC, and it doesn't do MPEG-2, only AVC/H.264.

DigitalDeviant
26th February 2009, 16:00
Would developing a CUDA enabled MPEG-2 decoder be difficult? I don't know C but I would be interested in investing some time learning if this was something a relative novice could pull off.

lucassp
27th February 2009, 07:39
There are some examples in the CUDA SDK, and you could also ask neuron2 how did he do it. But I don't think a novice could pull this off.

Guest
27th February 2009, 07:45
Would developing a CUDA enabled MPEG-2 decoder be difficult? I don't know C but I would be interested in investing some time learning if this was something a relative novice could pull off. It depends on what you mean by a "decoder" (shades of Slick Willy).

I've already published code for a CUVID client and server that does decoding of MPEG2 streams. So that could be easily adapted for use in an application.

However, if you are talking about making a DirectShow decoding filter, it is more difficult.

roozhou
27th February 2009, 13:51
It depends on what you mean by a "decoder" (shades of Slick Willy).

I've already published code for a CUVID client and server that does decoding of MPEG2 streams. So that could be easily adapted for use in an application.

However, if you are talking about making a DirectShow decoding filter, it is more difficult.

Is it technically possible to develop a CUDA based deinterlacer? We send raw frames(or fields) in and get deinterlaced frames out.

Leak
28th February 2009, 15:00
Is it technically possible to develop a CUDA based deinterlacer? We send raw frames(or fields) in and get deinterlaced frames out.
Sure, why not? Deinterlacing is just another set of algorithms that operate on an image, and probably well parallizable to boot...

np: John Matthias - Evermore (You Don't Know Ninja Cuts (Disc 1))

roozhou
1st March 2009, 12:11
Sure, why not? Deinterlacing is just another set of algorithms that operate on an image, and probably well parallizable to boot...

np: John Matthias - Evermore (You Don't Know Ninja Cuts (Disc 1))

I mean using PureVideo Deinterlacer via CUDA.

Shakey_Jake33
24th May 2009, 11:41
A bit of a bump, but I see no sense in creating a new topic for this.

Just want to clarify, if I enable YADIF deinterlacing in ffdshow as well as Resize, does it automatically prioritise the deinterlacing and deinterlace the video before resizing (that seems like the most sensible approach), or do I have to load a YADIF AVISynth filter first?

Leak
24th May 2009, 14:32
Just want to clarify, if I enable YADIF deinterlacing in ffdshow as well as Resize, does it automatically prioritise the deinterlacing and deinterlace the video before resizing (that seems like the most sensible approach), or do I have to load a YADIF AVISynth filter first?
I assume you haven't noticed yet that you can re-arrange the order of the ffdshow filter list?

Just drag a filter up or down in the list, or click on the small triangles next to the checkbox... ;)

Shakey_Jake33
24th May 2009, 16:48
^I honestly had no idea you could do that! Cheers :)