[RESOLVED] HEVC/H.265 10/12-bit Support
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
[RESOLVED] HEVC/H.265 10/12-bit Support
Simply because the other ticket is marked as resolved, I guess I should create a new one to bring it to your attention.
Well, the UHD bluray is just one reason to ask for 10 bit support. The other reason is that broadcasting 4k TV program has been using HEVC Main10 profile for a long time. Thus the support to decode them is fairly demanded. LAVFilter can already decode using h/w correctly, so I'm more interested in how far we are from the goal. Appreciate if you can share some news (if any), or better, share some new binaries .
Well, the UHD bluray is just one reason to ask for 10 bit support. The other reason is that broadcasting 4k TV program has been using HEVC Main10 profile for a long time. Thus the support to decode them is fairly demanded. LAVFilter can already decode using h/w correctly, so I'm more interested in how far we are from the goal. Appreciate if you can share some news (if any), or better, share some new binaries .
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Thanks for pointing out this use case for MAIN10. I wasn't aware of it.
What I can tell you is that nVidia is actively working on it and when they have it completed for CUVID, I will immediately release a new binary.
What I can tell you is that nVidia is actively working on it and when they have it completed for CUVID, I will immediately release a new binary.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
@MeteorRain
How are you processing MAIN10? Does the filter deliver 10-bit in some form for use with Avisynth? What form is it? Or does the filter dither down and deliver 8 bits? Your answers will guide my development. Thank you.
How are you processing MAIN10? Does the filter deliver 10-bit in some form for use with Avisynth? What form is it? Or does the filter dither down and deliver 8 bits? Your answers will guide my development. Thank you.
- Aleron Ives
- Posts: 126
- Joined: Fri May 31, 2013 8:36 pm
Re: (Shameless feature request) HEVC/H.265 10-bit Support
I would certainly hope dithering to 8 bits isn't part of the processing chain, as that rather negates the point of using 10 bits. Not only does a higher bit depth decrease banding artifacts, but it can result in up to 30% better compression, assuming the video has lots of flat blocks (e.g. animation).
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Well sure, Aleron, but given that Avisynth is 8-bit, what is the accepted way for a source filter to deliver 10 bits so that it can be used downstream? For example, what does LAV filters deliver for 10-bit sources? Dithering to 8 bits would be only a useful additional option.
As I mentioned, now is the time for you guys to guide the development. I don't know anything at all about 10-bit chains. Tell me what is needed.
As I mentioned, now is the time for you guys to guide the development. I don't know anything at all about 10-bit chains. Tell me what is needed.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
From my point of view, I'd like to see an option specifying the output format.
If you ever observed the lsmash-works package, it actually comes with an option format="XXX" where you can specify "YUV420P8" for 8bit yv12, and "YUV420P10" for 10bit. Also 16bit and RGB options available.
For DGNV, I don't see a reason to support so many colorspaces by default, so I'd say output_depth = 8 / 10 is enough.
For 8 bit output, either dither down, or truncate, since people who use this option are simply looking for a quick dirty solution.
For 10 bit output, or even 16 if you want to support, produce a picture with 2x width, and use 2 consecutive pixels to present 1 high bit depth pixel.
There are plenty of filters to work with high bit depth, so technically any reasonable output can be converted into a common format so there should not be many worries on that.
Hope this helps.
If you ever observed the lsmash-works package, it actually comes with an option format="XXX" where you can specify "YUV420P8" for 8bit yv12, and "YUV420P10" for 10bit. Also 16bit and RGB options available.
For DGNV, I don't see a reason to support so many colorspaces by default, so I'd say output_depth = 8 / 10 is enough.
For 8 bit output, either dither down, or truncate, since people who use this option are simply looking for a quick dirty solution.
For 10 bit output, or even 16 if you want to support, produce a picture with 2x width, and use 2 consecutive pixels to present 1 high bit depth pixel.
There are plenty of filters to work with high bit depth, so technically any reasonable output can be converted into a common format so there should not be many worries on that.
Hope this helps.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
By the way I'm actually not aware that we can use DGNV in DXVA mode.
If the CUVID version hasn't been completed, is it possible to support decoding Main10 using DXVA?
AFAIK LAVFilter has supported that for a while and I'm getting ~0% CPU usage when decoding Main10 HEVC 4k on GTX950.
(And I'm actively introduce this to my friend so hopefully you'll get more donations to support the development )
If the CUVID version hasn't been completed, is it possible to support decoding Main10 using DXVA?
AFAIK LAVFilter has supported that for a while and I'm getting ~0% CPU usage when decoding Main10 HEVC 4k on GTX950.
(And I'm actively introduce this to my friend so hopefully you'll get more donations to support the development )
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Be sure to don't mix things, because there is 2 seperate things :
- Bit depth for the DCT (or similar) matrix use for calculation.
- Bit depth of the video.
You can encode 8 bits video with 10 bits precision matrix. That's what it's done in anime fansubs with x264 10 bits.
When you decode this, output is 8 bits.
There is the same thing for MPEG-2, where DCT matrix can be 8,9 or 10 bits, but video is 8bits. MPEG-2 DVD compliant can be 8,9 or 10 bits DCT matrix, and on MPEG-2 stream (DVD compliant also), it's even allowed to switch precision matrix "on the fly".
Personnaly i would see 2 steps :
- First take care of 8 bits video encoded with 10 bits matrix.
- Then see what to do with 10 bits video.
For avisynth, in the first place, indeed use dither or truncate in case of 10 bits video.
After, maybe search to see what format/trick filters uses to work with more than 8 bits (for those who are), but it's probably just using 16 bits.
This is not a standard thing for avisynth, so i personnaly think that the default output option should be 8 bits.
- Bit depth for the DCT (or similar) matrix use for calculation.
- Bit depth of the video.
You can encode 8 bits video with 10 bits precision matrix. That's what it's done in anime fansubs with x264 10 bits.
When you decode this, output is 8 bits.
There is the same thing for MPEG-2, where DCT matrix can be 8,9 or 10 bits, but video is 8bits. MPEG-2 DVD compliant can be 8,9 or 10 bits DCT matrix, and on MPEG-2 stream (DVD compliant also), it's even allowed to switch precision matrix "on the fly".
Personnaly i would see 2 steps :
- First take care of 8 bits video encoded with 10 bits matrix.
- Then see what to do with 10 bits video.
For avisynth, in the first place, indeed use dither or truncate in case of 10 bits video.
After, maybe search to see what format/trick filters uses to work with more than 8 bits (for those who are), but it's probably just using 16 bits.
This is not a standard thing for avisynth, so i personnaly think that the default output option should be 8 bits.
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Thanks, guys. 10-bit DCT etc. should already be supported. We're not talking about that. We're talking about delivering 10-bit video to Avisynth.
It's easy to wave your hands and say deliver 10-bit any way you want but that doesn't help me. I already know I can deliver it any way I want! The question is what specifically I should want, and that is determined by what people are actually doing with 10-bit chains and what downstream filters are already expecting. So I'd really appreciate hearing from anyone that actually implements a 10-bit chain using Avisynth.
It's easy to wave your hands and say deliver 10-bit any way you want but that doesn't help me. I already know I can deliver it any way I want! The question is what specifically I should want, and that is determined by what people are actually doing with 10-bit chains and what downstream filters are already expecting. So I'd really appreciate hearing from anyone that actually implements a 10-bit chain using Avisynth.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
That's not true.jpsdr wrote:Be sure to don't mix things, because there is 2 seperate things :
- Bit depth for the DCT (or similar) matrix use for calculation.
- Bit depth of the video.
You can encode 8 bits video with 10 bits precision matrix. That's what it's done in anime fansubs with x264 10 bits.
When you decode this, output is 8 bits.
Lots of anime fansubs make good use of debanding filters and pass 10 bit videos directly to 10 bit x264.
Even if they feed 8 bit videos, the internal input preprocessor will promote the bitdepth to 10 bit before even start encoding.
Thus there's no way to actually distinguish between them, and of course the decoded video will always be 10 bit, such as in P010 colorspace.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Sure. But it's ... uh, quite confusing.admin wrote:It's easy to wave your hands and say deliver 10-bit any way you want but that doesn't help me. I already know I can deliver it any way I want! The question is what specifically I should want, and that is determined by what people are actually doing with 10-bit chains and what downstream filters are already expecting. So I'd really appreciate hearing from anyone that actually implements a 10-bit chain using Avisynth.
The most common formats people use are, interleave 10 bit and stacked 16 bit.
Stacked 16 bit is to have a picture with 2x height, where MSB on the top half, and LSB on the bottom half.
Thus, if a 16 bit pixel is 0xMMLL, then it's the following pattern.
Code: Select all
MMMMMMMM
MMMMMMMM
MMMMMMMM
MMMMMMMM
LLLLLLLL
LLLLLLLL
LLLLLLLL
LLLLLLLL
Interleave 10 bit is to have a picture with 2x width, where MSB and LSB are grouped together.
Thus if a 10 bit pixel is 0xmMLL, then the following pattern.
Code: Select all
MLMLMLMLMLMLMLML
MLMLMLMLMLMLMLML
MLMLMLMLMLMLMLML
MLMLMLMLMLMLMLML
Interleave 10 bit is used by x264 to retrieve data from avisynth.
So the high bitdepth process chain is like, if the source is 10 bit
Code: Select all
LWLibavVideoSource(format="YUV420P16", stacked=true) # Stacked 16
Varies of filters # Stacked 16
f3kdb(...) #Interleave 10
# To x264
Code: Select all
AVISource(...) # 8
U16() # Stacked 16
Varies of filters # Stacked 16
f3kdb(...) #Interleave 10
# To x264
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
If you wanna make everyone happy, then the following options are suggested,
(See also LWLibavVideoSource.)
Code: Select all
int output_depth = 8 (8..16)
Specify output depth.
For 9..16, 2 pixels will be used to represent 1 such pixel.
bool stacked = false
Use the stacked format for a hack of AviSynth high bit-depth support if set to true.
The stacked format splits MSB and LSB into vertically, and MSB comes on top of output image.
Otherwise use the interleaved format.
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Thanks MeteorRain! That's exactly what I needed. I can forward this information to nVidia and they can deliver like that from CUVID, thus avoiding any need for my filter to have to massage things.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Most demanding format are stacked 16 and just 8.
If you are asking nVidia guys to do the job, kindly ask them to do stacked 16. If someone need 8 bit, just cut and return the upper half.
If you are asking nVidia guys to do the job, kindly ask them to do stacked 16. If someone need 8 bit, just cut and return the upper half.
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Sounds good, thanks again.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Is that 10-bit and how do you rip these UHD disks? Just AnyDVD HD as usual?
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
It should be 10-bit but I haven't decided whether or not to place that order.admin wrote:Is that 10-bit and how do you rip these UHD disks? Just AnyDVD HD as usual?
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Sorry for going OT here by asking about rippers guys. Let's keep it to 10-bit support.
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Well, it's not totaly 100% off topic in a way. Quick answer : As far as i know, UHD Blu-Ray have new protection and nothing is able to decrypt yet.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
3 months passed and now GTX 10o0 even supports 12-bit decoding. Still no updates from their dev team?
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Still waiting...
My guess is CUVID is not high on the priority list. We just have to wait and see.
My guess is CUVID is not high on the priority list. We just have to wait and see.
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Intel just released a version of the MSDK that supports 10-bit HEVC decoding. As a result of the vacillation by nVidia regarding CUVID I am seriously considering updating DGDecIM to support HEVC, which would bring us 10-bit support. Going forward, I am not entranced by the idea of maintaining two lines of development, so if nVidia doesn't get off the pot with CUVID, we may have to say goodbye. Decisions, decisions.
- MeteorRain
- Posts: 133
- Joined: Fri Jul 25, 2014 4:04 pm
- Location: Portland
Re: (Shameless feature request) HEVC/H.265 10-bit Support
Well I doubt if that'll support hevc-10 on 4th gen iGPU.