Log in

View Full Version : Video-optimizing with ffdshow & Avisynth the right way... but how??


El Bastardo
5th March 2008, 12:48
Hello knolegable forum gurus -_^

I'm reading through these forums for quite a while now but now I thought I'm stuck in my process and need some help.



Technically I'm no newbie to the whole but I lack deepened special knowledge on this and that so I'm asking the pros to give me tips and maybe defeat my half-knowledge.

My questions are regarding Decoding only (I do not encode myself... yet).
I primary use ffdshow (tryouts), Avisynth, Haali Media Splitter, VSFilter and maybe DScaler 5 to play back videos (mainly Anime) with Zoomplayer 5 and are looking for the "best" way to use Avisynth as a frameserver to spice the quality up in real time while watching.

The "things" I'm currently using in ffdshow are: deinterlasing (5-tap lowpass), post processing (deblocking for Luminance and Chroma and Dering for Luminance with mplayer and accurate deblocking), resizing (I'm still experimenting between Gauss, Spline and Lanczos with 2-Pass (Spline is often the slowest) and Avisynth for sharpening etc. with a "LimitedSharpenFaster" and "Soothe" combo with the aid of MT (multi-threading).
I'm also using the "quene output samples"

Things I think to know about ffdshow and the whole optimization procedure:
It is important for performance and quality in which sequence you use the things mentioned above (you can reorder the left list from top to bottom in ffdshow). Is this true?? - I saw so many custom written Avisynth scripts here (OK they are all for decoding) and I think they have similarities regarding this. So first cropping (don't bring the joke "no first loading plugins ^_^ ), than this than that... .

Currently I think it's important and let ffdshow do things in this order: First deinterlsing than post processing followed by resizing and last Avisynth.

Could someone explain more about this whole "order of optimization" things please (maybe I'm totally wrong informed)??


Yeah I know there is no best solution for all sources but I want something I can call "basic optimizations that look somewhat good on everything".
So things I want to know: Are the things I described and currently run are "good basics" or what would you swich??


And here is my current Avisynth build. The biggest problems are how to optimize the utilization of the MT plugin (I'm running an AMD Dual Core 4800+).
I'm using this with "input colorspace = YV12", "Ignore Pulldown" and Buffer ahead = 1
---------------
SetMTMode(1,3)
SetMemoryMax(1024)
ffdshow_source()
SetMTMode(5)
MT( "dull = last
sharp = dull.LimitedSharpenFaster( ss_x=1.5, ss_y=1.5, Smode=3, \
strength=200, overshoot=1, undershoot=1 )
Soothe( sharp, dull, 20 )", 3 )
#SetMTMode(1)
#FastLineDarkenMOD( thinning=0, strength=50 )
#Subtitle("Number of threads used: "+string(GetMTMode(true)) \
#+" Current MT Mode: "+string(GetMTMode()))
----------

My understanding is that with this construct MT is first initalized and generally set to MTMode 5 (isn't there a better way to do this?).
In the next lines for LSF and Soothe only, I switch to MT so they should operate under MT and not MTMode anymore.

The last lines are my experimenting lines.
I tried to use FastLineDarkenMOD in addition and in combination with MTMode 1 but it killed my framerate.
And the last two lines are there to check the current MTMode when needed.

I also tried to use "Toon-v1.0" or "Deen" but they did not bring me good performance.



So the bottom line: What is a good combination and where to start looking for improvements??



Thanks in advance for your help and have a nice day!!

foxyshadis
5th March 2008, 22:03
You might be interested in this thread (https://forum.doom9.org/showthread.php?t=115727).

El Bastardo
13th March 2008, 12:05
WOW now that are a lot of information. So it took me some time to check things out but it helped. I could learn much new things and narrow down my sepcific questions.

As far as the concept goes the information in this thread are mainly for real time DVD playback (so of uncompressed material in MGEP-2 in general).
Yeah I noticed the link to the "FFDShow settings for divx/xvid"-thread I read it but this wasn't specific enough and threw up another question.



So to narrow things down and sum up:

New question: Is deinterlacing useless when viewing/processing compressed anime (H.264; Xvid; etc.)?? - As seen in the "FFDShow settings for divx/xvid" guide the author does not encourage to use deinterlacing in general. Is this just to save CPU power or due to the fact that the author himself is not omniscient ^_^ or is it really useless for preprocessed material (compressed = preprocessed I mean)??

As fat as I understood it is important indeed in which order to apply the processing steps and as far as I understand at the moment a sequence of "deinterlacing --> post processing --> resizing --> sharpening --> noise reduction" is recommended (??).


The posts did not give any additional information about if my assumptions regarding the MT plugin are right (see my transcript of my current Avisynth script).


What dows the following plugins do exactly and are they better that some counterparts already built in in ffdshow:
- Deen
- Fluxsmooth
- fft3dfilter


That would bring me an additional step further!!

El Bastardo
15th May 2008, 15:50
I guess nobody has an answer to this specific questions yet... or nobody want's to quickly write them down... anyway I got an additional one regarding audio playback while watching DVD:

When you watch a DVD with 5.1 sound, using ffdshow to decode audio and video, how can you configure ffdshow to use all 8 speakers (7.1)??

I mean in the mixer tab even if I choose 7 channels the side speakers are dead when the source is "only" 5.1.
Isn't there a possibility to, let's say, instruct ffdshow to put out the two back channels from the source to the two back speakers AND the two side speakers??

There is a mapping tab but there I only can change channel mapping like front left stream to side right speaker ect. but how can I force it to use all speakers??


Another example: I play back a video file with only stereo sound (2.0) and I want all speakers to play back the sound so effective three times 2.0 (stereo fia front, side and rear speakers)!!

Leak
15th May 2008, 16:51
Isn't there a possibility to, let's say, instruct ffdshow to put out the two back channels from the source to the two back speakers AND the two side speakers??
(NB: I might be mixing up rows and columns in the following since I only have stereo speakers and the dialog isn't labelled, so if it doesn't work right one way, try the other...)

The mixer matrix contains a factor for every combination of input and output channels that defines which amount of an input channel is mixed into an output channel. The output speaker dropdown list basically only chooses how many output channels are going to be used and produces a default matrix to downmix accordingly, but it doesn't make up any extra channels.

For that, you need a custom matrix:

A "1" in the matrix basically means "take the signal of the corresponding the input channel (defined by the column) as-is and add it to the corresponding output channel (defined by the row)"; higher or lower values mix more or less of the signal into the output. So if you want to mix a stereo signal into 8 channels you need to put a "1" where each the input channel intersects with any of the left output channels, do the same for the right channels and use "0.5" for both the left and right input channels in all of the center rows.

Mixing 5.1 into 7.1 works the same way - you'll just have to decide which channels to mix into the two remaining output channels, and make sure the sum of the factors is about 1, or the mix you'll hear on those two channels is going to be much louder (or much more quiet) than the rest...

np: Isan - Waves (Blue Skied An' Clear (Disc 1))

El Bastardo
15th May 2008, 19:06
Sweeeeet that's it.
That solves two problems because I never understodd what the custom matrix is good for ^_^

I think the "normalize matrix" box is something like a function that tries to cancel sound peaks in some channles or am I wrong??
Anyway thanks for the good explanation.

The only thing left that would be nice if you could save up more than one custom matrix so one profile for 2.0 to 7.1 and one for 5.1 to 7.1!!

Leak
15th May 2008, 19:33
The only thing left that would be nice if you could save up more than one custom matrix so one profile for 2.0 to 7.1 and one for 5.1 to 7.1!!
That's what the "Profile / Preset settings" page is there for - you can define as many presets as you want and switch between them via the ffdshow audio decoder tray icon, among other things...

np: Styrofoam - Hard To Find (A Heart Without A Mind EP)

El Bastardo
15th May 2008, 22:29
Stupid me I should have thought about this.

I already use profiles for different video settins to (two of them) to autoload one when using Zoom player and another when using WMP but I created them long ago and nearly forgot about their existence ^_^'

(...)and make sure the sum of the factors is about 1, or the mix you'll hear on those two channels is going to be much louder (or much more quiet) than the rest...
you mean the sum in every ROW should be exactly one or did I misinterpret something?? - Because ASAIunderstand every single column represents the INPUT channels and every row represents the OUTPUT so I can take 0.5 of channel L (column) and 0.5 of channel R (column) and output them both to channel C (row) so in the horizontal row C I have two times 0.5 equals one?!

Leak
16th May 2008, 10:42
you mean the sum in every ROW should be exactly one or did I misinterpret something?? - Because ASAIunderstand every single column represents the INPUT channels and every row represents the OUTPUT so I can take 0.5 of channel L (column) and 0.5 of channel R (column) and output them both to channel C (row) so in the horizontal row C I have two times 0.5 equals one?!
Exactly. I guess I should have mentioned the word "row" somewhere in there... :)

"Normalize matrix" simply scales down all values in the matrix by the same factor so that the resulting channels don't clip; but if the sum per row isn't the same for every output channel the overall volumes between them will still differ.