View Full Version : Avisynth and YV12/NV12
heyer
26th March 2012, 18:36
Hey everyone, my issue is kinda wierd, but I'll try to explain it clearly. I like to use the avisynth based frameinterpolation software called "SVP".
My chain goes like this: LAV filters --> ffdshow raw filter --> madVR
Now, it seems that avisynth only accepts YV12 input, does this mean, that if LAV filters outputs NV12 to ffdshow, that ffdshow automaticly changes it to YV12 for avisynth, and then back again to NV12 for madVR?
Since NV12 input is reported from madVR.
Does this mean that I should force YV12 output from LAV to get max performance? What are the differences between the two color spaces?
Also completely unrelated: When LAV filters used CUVID for decoding, does it only get back NV12 color space, which it has to change to YV12 for avisynth? Or does CUVID also supply YV12?
nevcairiel
26th March 2012, 18:59
What are the differences between the two color spaces?
The difference between NV12 and YV12 is just how the bytes are arranged in memory, the image information is otherwise 100% the same.
Also completely unrelated: When LAV filters used CUVID for decoding, does it only get back NV12 color space, which it has to change to YV12 for avisynth? Or does CUVID also supply YV12?
CUVID always outputs NV12.
heyer
26th March 2012, 19:03
Ah, so since it's basicly the same way to store information, I'm guessing the conversion isn't very CPU intensive?
CruNcher
26th March 2012, 20:40
it costs a fraction of it though NV12 highers throughput on the GPU side and their the major differences take place
Mikey2
15th May 2012, 11:15
Thanks for this information! I have the same setup and the same question[s]. So to clarify: when using aviSynth, I should use YV12 throughout since aviSynth cannot work with NV12? This avoids the unnecessary conversion between that and madVR.
Conversely, if I am not using aviSynth in a particular preset, I should use NV12? I have a fast computer, so I noticed no problems with computer processing resources. Therefore, is it even worth changing this every-time I decide to use aviSynth or not? (I read that NV12 is more compatible with GPU HW (such as madVR HW deinterlacing) but it also appears that However, most of the time I do not do this ( and handle the de-interlacing farther up the filter graph.)
Since performance is not a problem, my main concern is this: Do these conversions work like "evil" trans-codes on pre-decoded [audio] material such as switching around from mp3/aac and back again? (In that case data is most likely lost.) From what I gather, the answer is "no" with YV12 <> NV12 uncompressed color-spaces. However, IMHO it just "feels" right to make as few unnecessary colorspace changes.
To summarize:
With aviSynth:
Lav Decoder outputs YV12 ->ffdShow running aviSynth in YV12 -> madVR rendering YV12
Without aviSynth:
LAV Decoder outputs NV12 -> ffdshow optional (no change bc not using the aviSynth filter module) -> madVR rendering NV12
Is this correct, or are my tweaks/assumptions incorrect?
Any advice wouild be greatly appreciated! ...thanks in advance!
MikeY
nevcairiel
15th May 2012, 11:27
NV12 and YV12 are the same colorspace, its just different memory layout. There is absolutely zero loss of information when you convert between them. If done right (say with some SSE2), its also plenty fast.
Hardware decoders output NV12, Software decoders typically YV12. Hardware deinterlacing requires NV12 on most cards.
All of the components in your setup above should be capable to convert between YV12 and NV12 with the proper speed and without losing information.
I don't know how ffdshow works, maybe you can just let LAV always output NV12 and if avisynth is on, ffdshow converts it to YV12 for you?
Avisynth accepts both YV12 and I420 interchangeably. Internally the U and V data pointers are simply swapped to accommodate the chroma data order difference.
:edit: Wrong! "NV12 is Nvidia's proprietary name for Intel's I420 format. Apart from the name they are the same."
Dark Shikari
16th May 2012, 01:17
NV12 is Nvidia's proprietary name for Intel's I420 format. Apart from the name they are the same.NV12 has interleaved U and V channels; it is not the same as I420.
nevcairiel
16th May 2012, 07:05
The "NV" does not mean NVIDIA..... :)
Not to mention that both AMD and Intel also require NV12 when doing hardware processing
:o Oops, I am remembering very badly. In March and April 1999 Nvidia registered a number of NV* fourcc's but not NV12.
:o and Oops, yes NV12 is indeed a 2 plane format with the Y channel in the 1st plane and interleaved U and V channels in the 2nd plane. There is apparently a related format NV21 which has the U and V channels swapped. The information content is the same as for YV12 just the in memory layout is different.
markanini
21st May 2012, 22:39
Add 'SwapUV' to your script.
bcn_246
10th December 2012, 04:37
I also thought that 'NV12' had something to do with Nvidia (was using CUDA for H.264 decoding... seemed logical).
So just to clarify... NV12 and YV12 store the same amount of image data...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.