[RESOLVED] HEVC/H.265 10/12-bit Support

Support forum for DGDecNV
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HEVC/H.265 10-bit Support

Post by admin »

1. Performance issue. Yes, I had miscoded the HEVC display stuff.

2. FPS. The values are in the stream. I'm not going to lie about them. I *may* consider adding an option to force normalization for values close to typical ones, but you'll have to make a really strong case for it.

3. Crash. You shot yourself in the foot by omitting the .dgi on the -o option (manual says it must be present). Nevertheless, just for you, I added code to add the .dgi if it is absent.

I slipstreamed 1 and 3 above. Have at it, and thank you for your report and assistance. :bravo:
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: HEVC/H.265 10-bit Support

Post by MeteorRain »

#3 is just something I noticed when I was testing the performance issue, where I saved a bit typing by "-o a" and it crashed :o

#2 -- I'll take a look at the HEVC header and see what happened.

Thanks!
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HEVC/H.265 10-bit Support

Post by admin »

For sure, no developer likes their application to crash...in any circumstances.
MeteorRain wrote: #2 -- I'll take a look at the HEVC header and see what happened.
Go for it, thanks. CUVID returns those values to me. I didn't check the actual stream, but I can't even imagine that CUVID doesn't just return what is in the stream. I'll check with the reference decoder too.
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: HEVC/H.265 10-bit Support

Post by MeteorRain »

Image
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: HEVC/H.265 10-bit Support

Post by MeteorRain »

This should be the only issue left with HEVC that I can find so far. Your professionalism impressed me and I deeply appreciate your fantastic work.

Thank you.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HEVC/H.265 10-bit Support

Post by admin »

Thank you for your kind words. They nourish my soul.

I may have to parse the VUI parameters myself as it appears CUVID is going wrong. I will inform nVidia about it. Thanks for your analysis.

Image

That's what is returned for the smaller sample you gave me.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HEVC/H.265 10-bit Support

Post by admin »

I have slipstreamed a work-around for your FPS issue. Please re-download and update DGIndexNV. Also, please inform me if you run into any further cases of improperly detected frame rate. I have notified nVidia of this CUVID problem and they have acknowledged it is a bug and will fix it in a future driver version.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HEVC/H.265 10-bit Support

Post by admin »

I'm marking this thread resolved as decoding of 10-bit source is now supported. If you need to deliver 10-bit on the output, please open a new thread fully describing your tools, work flow, and display device that make such a use case feasible. Note that 10-bit output surfaces are expected to be supported in the 8.0 toolset. We will need to decide how we deliver that to Avisynth.
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: [RESOLVED] HEVC/H.265 10-bit Support

Post by jpsdr »

With the lot of improvements and more than 8 bit colors added, at least for avs+ and VDubMod, maybe the data can "just" be output on simple 16bits data ?
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10-bit Support

Post by admin »

Sure, simple is good. I'm still interested in the full use cases.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10-bit Support

Post by admin »

I've got full depth delivery for DGDecodeNV working. It will be like this:

DGSource("file.dgi",fulldepth=true)
ConvertBits(8) # for testing

I return CS_YUV420P16 frames to Avisynth+. Unused bits are zeroed. I still have to revise the pulldown code for full depth and then I will make a slipstream. It's working with CUDA 6.5 libraries and locally modified headers, so I did not have to drop support for any older cards to get this going. ;)

At some point I also have to add full depth support to the other included DG filters.

I also added output of the number of CUDA cores to the GPU Info dialog, and fixed D3D operation on Windows 10.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10-bit Support

Post by admin »

I forgot to mention: HEVC 10- and 12-bit 4:2:0 will be supported. CUVID does not support high-bit-depth AVC.
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: [RESOLVED] HEVC/H.265 10-bit Support

Post by jpsdr »

Thanks for this, i think it will be a great step.
:bow:
My questions are just to understand how it will work.
- What will the fulldepth default value will be ?
- In case of 10-12 bits, the ouput will be 16 bits if i understand properly. Is there a possibility to know what was the original "true" bit depth ? (Was my 16bits video a 10 or a 12 bits indeed) ?

Edit :
I've noticed in the avs+ header that there is also CS_YUV420P10 or CS_YUV420P12 avaibles. Is it too much complex to output the exact color format ? I'm sure that some people would like to stay with the exact original bit depth and not expand it if possible.
If i said that, it's because (it's the case for nnedi3 for exemple) filters have different paths code according bit depth, and most of the time, the higher it is, the "less" optimised it is, and the slower it is. So, it would be... (don't know the correct english word) "too bad"/"a waiste" to have 12bits bits depths, when 10 would have been enough. I said 12, because the first thing you can do is reduce 16 to 12 without any worries, because you know it will not be higher.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

Good morning, jp, I hope your weekend is off to a stellar start.

Great points and questions. I hope this clarifies things.

1. fulldepth default is false. When fulldepth=true and the encoded video is HEVC 10-bit or 12-bit, then DGSource() delivers 16-bit data to Avisynth with the unused lower bits zeroed. The reported pixel format is CS_YUV420P16. If either of the two conditions are not met, then DGSource() delivers 8-bit YV12 or I420 data, as determined by the i420 parameter. When fulldepth=false and the video is HEVC 10-bit or 12-bit, then CUVID dithers down to 8-bit for delivery.

2. Two ways to get the bitness: 1) DGIndexNV info dialog profile field, 2) DGI file DEPTH line.

3. CUVID delivers full 16 bits only, and I don't care to add code for all the conversions when you can simply use ConvertBits(), which also allows extra options, such as choice of dithering method, etc. Here is an example:

DGSource("file.dgi",fulldepth=true) # delivers 16 bits
ConvertBits(12) # discards 4 lower bits

pinterf can implement these conversions way better than me.

I'm about to check it all in and slipstream, so if you have any further suggestions, now is the time.
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by jpsdr »

admin wrote: 3. CUVID delivers full 16 bits only, and I don't care to add code for all the conversions when you can simply use ConvertBits(), which also allows extra options, such as choice of dithering method, etc.
...
pinterf can implement these conversions way better than me.
Great point also indeed... ;)
Thanks for the informations, no suggestions for now, and thanks for your work.

Unfortunately WE start could have been a little better... :( But it will finaly be good for now.

... A more generic question comes to mind...
HEVC, 10bits, 4k... may lead to a bad word... HDR !!!! :D
I don't know if you've followed things, but proper HDR conversion seems ... difficult.
Is there by any chance anything in CUDA that can handle properly HDR (and it's metadata) stream to offer proper decoding of it ?
I ask because it seems "logical" that a device which purpose go in the direction if UHD/4k, that HDR may be also in the features.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

Thanks, jp! Of course you are absolutely right.
jpsdr wrote: Unfortunately WE start could have been a little better... :( But it will finaly be good for now.
Sorry about your weekend. There's still time for brilliance. Never despair; it's always onward and upward. All experiences provide important information.

If some HDR metadata from the stream is missing, please describe what's needed and please give a link to the specification to allow the data to be extracted, or passed to Avisynth. I haven't been following other video sites closely. I understand that there are still competing metadata schemes. I am not aware of any relevant metadata offered by CUVID, but I could be mistaken, or maybe it can be derived from other information. Perhaps this is more of a renderer issue. If you could help us with "proper decoding" you'd be the bee's knees, the cat's meow, the guardian of all that is right and good, a towering icon in the pantheon of video gods.

Thanks, jp, that's great.
DAE avatar
Guest

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by Guest »

Don't know if this helps but here is a link
https://developer.nvidia.com/displaying ... -and-bolts
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

Thanks, gonca, reading now...

That looks great. Thanks. Still looks like a renderer issue but keeping an open mind here.
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by jpsdr »

Unfortunately i know almost nothing about HDR, except it seems to be some kind of nightmare.
I never said anything was missing. It's just that it seems that to convert properly HDR, you need metadata that seems to be only on the h265 stream, and these informations can't be transmitted to avisynth. Or if they can, it could only be via some trick, like using the alpha channel of YUV for exemple... :scratch:
So,if "proper" HDR decode can be done, it's only while you're still within the processing of the h265 stream. Also, it's more guess than anything.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

I'll research the matter and do whatever is needed to support HDR processing workflows. Thanks for bringing the matter to my attention, jp.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

The HEVC spec includes a mastering display colour volume SEI message, which signals HDR metadata. I can expose its contents in the index file.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

I had a screw-up in the uploaded 2053 slipstream 102, so I have removed it. Corrected version coming shortly. :facepalm:
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by admin »

All fixed in slipstream 103.
DAE avatar
Guest

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by Guest »

U da man!!! :hat:
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: [RESOLVED] HEVC/H.265 10/12-bit Support

Post by jpsdr »

Nice for the metadata things.
I've posted [elsewhere], to try so see if someone has an idea how to go to a second step here
Post Reply