Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th March 2012, 19:36   #1  |  Link
heyer
Registered User
 
heyer's Avatar
 
Join Date: Feb 2012
Posts: 13
Avisynth and YV12/NV12

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?
heyer is offline   Reply With Quote
Old 26th March 2012, 19:59   #2  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 9,602
Quote:
Originally Posted by heyer View Post
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.

Quote:
Originally Posted by heyer View Post
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.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 26th March 2012, 20:03   #3  |  Link
heyer
Registered User
 
heyer's Avatar
 
Join Date: Feb 2012
Posts: 13
Ah, so since it's basicly the same way to store information, I'm guessing the conversion isn't very CPU intensive?
heyer is offline   Reply With Quote
Old 26th March 2012, 21:40   #4  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,949
it costs a fraction of it though NV12 highers throughput on the GPU side and their the major differences take place
__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004
CruNcher is offline   Reply With Quote
Old 15th May 2012, 12:15   #5  |  Link
Mikey2
Registered User
 
Join Date: Nov 2010
Posts: 80
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
Mikey2 is offline   Reply With Quote
Old 15th May 2012, 12:27   #6  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 9,602
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?
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 16th May 2012, 01:45   #7  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
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."

Last edited by IanB; 17th May 2012 at 01:03. Reason: Retract delusional statement
IanB is offline   Reply With Quote
Old 16th May 2012, 02:17   #8  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,689
Quote:
Originally Posted by IanB View Post
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.
Dark Shikari is offline   Reply With Quote
Old 16th May 2012, 08:05   #9  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 9,602
The "NV" does not mean NVIDIA.....
Not to mention that both AMD and Intel also require NV12 when doing hardware processing
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 17th May 2012, 01:01   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Oops, I am remembering very badly. In March and April 1999 Nvidia registered a number of NV* fourcc's but not NV12.

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.
IanB is offline   Reply With Quote
Old 21st May 2012, 23:39   #11  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 296
Add 'SwapUV' to your script.
markanini is offline   Reply With Quote
Old 10th December 2012, 04:37   #12  |  Link
bcn_246
Registered User
 
bcn_246's Avatar
 
Join Date: Nov 2005
Location: UK
Posts: 146
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...
bcn_246 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.