|
發表於 2006-12-8 14:28:27
|
顯示全部樓層
對於 CoreAVC 的 Output levels 似乎很多人有疑義:
http://forum.doom9.org/showthread.php?p=911912#post911912
The true secret of CoreAVC is not its unusually efficient AVC decoding code - which will someday be equalled and perhaps even bested by ffdshow - but a little-noticed capability which has slipped quietly under the radar of most everyone but myself...
The story begins long ago in the misty veils of ancient times, but to make it shorter, I'll summarize its most important points. The VMR9 renderer, for sure, and probably also VMR7, both have a strange behaviour regarding YUV data presented to their input pins.
In particular, if any YUV format is presented, values outside the range of 16-235 (TV levels) are clamped; RGB inputs are not clamped. After uncountably extensive tests by yours truly using every filter combination imaginable, it has been determined that the clamping behaviour holds true for every case, and in no case is there an exception but one.
Avery Lee, the creator of VirtualDub, has been investigating the strange quirks of luma levels in the VMR renderers here.
You may be asking yourself right now, "why oh why would I want PC level range when most video is coded in TV range?". Some good reasons come to mind: your video output device is probably a PC monitor or LCD, which expects PC levels.
Feeding TV levels to such a device results in washed-out blacks (compounding the backlight leakage already present on LCDs) and dim whites.
During encoding or re-encoding, the AviSynth command:
ColorYUV(levels="TV->PC"
can be used to stretch the TV levels to fit your device, or alternately, ffdshow's 'levels' filter can do it in realtime. But if ffdshow is sending any YUV format to the renderer, this will be utterly useless due to clamping.
Knowing this, it is time to shift the focus of our examination to CoreAVC. This nice little filter has a checkbox labelled "Fix VMR9 color range". When checked, the output of VMR9 is observed to be full PC range, using a full-range source and with any YUV format selected as output (and no, it's not secretly sending RGB; the input pin of the VMR9 renderer was checked to make sure).
Never, ever in the history of VMR9 has any piece of software been able to make this impossible event occur. Somewhere in the VMR9 or elsewhere in the system, exists a method to force the VMR9 to pass full PC range without clamping, from a YUV input.
It is also observed, that if CoreAVC is set to output any YUV format, and ffdshow is set to accept that format and output any YUV format (no RGB formats checked), then the renderer will observe the usual clamping behavior. Thus, the CoreAVC filter must be directly connected to the VMR9 renderer's input pin in order for the fix to work.
The hope is now to find out how they did it. If the information can be obtained, developers of all other filters may also incorporate the fix into their software. The fix has many advantages; most importantly it means that ffdshow can output YV12 without the heavy CPU burden of conversion to RGB, yet still maintain PC range.
To wrap up, a request is now issued to CoreCodec to provide this small tidbit of information, which would both provide the video community with a much-needed fix, yet still maintain the advantage CoreAVC enjoys by means of its efficient decoding architecture.
Note: Verification
The behavior as stated above can be verified by running three instances of MPC. Your should have two source materials, one encoded in TV range, the other PC range, output in either VMR9 or VMR9 Renderless. Drivers newer than 84.21 on Nvidia cards may cause unpredictable results. Finally, make sure ffdshow is NOT set to accept any raw video inputs, to avoid having it get in between CoreAVC and the VMR9 renderer.
MPC #1: CoreAVC filter set to RGB32 output ("Fix VMR9 levels" checkbox state shouldn't matter)
MPC #2: CoreAVC filter set to any YUV ouput, checkbox checked (should cause unclamped passthrough)
MPC #3: CoreAVC filter set to any YUV output, checkbox unchecked (should cause clamping to TV range)
If your source is TV range, #1-3 should appear identical and show TV range
If your source is PC range, #1,2 should appear identical and show PC range, while #3 shows TV range.
--------------------------------------------------------------------------------
Last edited by Isochroma : 5th December 2006 at 05:37.
如果再加上 KMP 本身的 Levels conversion 以及 CoreAVC Video Deocder 本身的 Bug, 事情很容易就複雜化了!
|
|