Page 3 of 4

Re: [RESOLVED] not able to feed the encoder

Posted: Mon Oct 23, 2017 5:14 pm
by admin
Thanks, mparade! In addition to the CUVID fix it would be helpful for you to test the Vapoursynth interface (using the AvsCompat fix I released).

Edit: If you get the latest test build of Vapoursynth R40-test1 you will not need my version of AvsCompat.dll.

Re: [RESOLVED] Apply project range to audio (for MKV)

Posted: Wed Oct 25, 2017 8:22 am
by hydra3333
OK, if you are referring to the last item in this list then I must have been reading it wrongly.
r40:
fixed rgb output sometimes being flipped in avisource
added alpha output settings to avisource, the default is no alpha output
fixed gamma being infinite if not set in levels, bug introduced in r39
removed the hack needed to support avisynth mvtools, the native mvtools has been superior for several years now and removing the hack makes avisynth filter creation much faster
added avisynth+ compatibility
only do prefetching in avfs with vs script when linear access is detected, fixes excessive prefetching that could make opening scripts very slow
is avfs (Avisynth Virtual File System) not something different and unrelated to loading avisynth plugins like yours ?

Ah, sorry, you mean in regard to handling fulldepth rather than in regard to prefetch which I what I was thinking, oops.

Right wrong or indifferent, my patched version of avisynth_compat.cpp ended up with this snippet in regard to prefetch.

Code: Select all

    // MPEG2DEC
    SOURCE(MPEG2Source)
    PREFETCHR0(LumaYV12)
    PREFETCHR0(BlindPP)
    PREFETCHR0(Deblock)

    // Meow
    SOURCE(DGSource)
    PREFETCHR0(DGDenoise)
    PREFETCHR0(DGSharpen)
    // DGBob yadif based deinterlacer http://rationalqm.us/board/viewtopic.php?f=0&t=463&p=6712&hilit=dgbob#p6712  
    // http://rationalqm.us/board/viewtopic.php?f=14&t=559&p=6732&hilit=dgbob#p6732
    temp = int64ToIntS(vsapi->propGetInt(in, "mode", 0, &err));
    //PREFETCH(DGBob, (temp > 0) ? 2 : 1, 1, -2, 2) // close enough?
    // I dont think so.  DG said always previous + current + next ... fudge it a bit for doublerate, what the heck
    switch (temp) {
    case 0:
      PREFETCH(DGBob, 1, 1, -1, 1); break; // single framerate deinterlacing -1,current,+1
    case 1:
      PREFETCH(DGBob, 1, 1, -2, 2); break; // double framerate deinterlacing -2,current,+2 although I reckon hydra3333 got it wrong and its actually -1,current,+1 ... -2,2 can't hurt too badly I guess
    case 2:
      PREFETCH(DGBob, 1, 1, -2, 2); break; // double framerate deinterlacing to single rate (makes slow motion) -2,current,+2 although I reckon hydra3333 got it wrong and its actually -1,current,+1  ... -2,2 can't hurt too badly I guess
    }
    // not sure what to do about PVBob either
    // which is DG's cuda based PureVideo deinterlacer http://rationalqm.us/board/viewtopic.php?f=14&t=559&start=240#p6786 ... act like DGBob for the time being
    temp = int64ToIntS(vsapi->propGetInt(in, "mode", 0, &err));
    switch (temp) {
    case 0:
      PREFETCH(PVBob, 1, 1, -1, 1); break; // single framerate deinterlacing -1,current,+1
    case 1:
      PREFETCH(PVBob, 1, 1, -2, 2); break; // double framerate deinterlacing -2,current,+2 although I reckon hydra3333 got it wrong and its actually -1,current,+1 ... -2,2 can't hurt too badly I guess
    case 2:
      PREFETCH(PVBob, 1, 1, -2, 2); break; // double framerate deinterlacing to single rate (makes slow motion) -2,current,+2 although I reckon hydra3333 got it wrong and its actually -1,current,+1  ... -2,2 can't hurt too badly I guess
    }
    BROKEN(IsCombed)
    PREFETCHR0(FieldDeinterlace)
    PREFETCH(Telecide, 1, 1, -2, 10) // not good
    PREFETCH(DGTelecide, 1, 1, -2, 10) // also not good
    temp = int64ToIntS(vsapi->propGetInt(in, "cycle", 0, &err));
    PREFETCH(DGDecimate, temp - 1, temp, -(temp + 3), temp + 3) // probably suboptimal
    PREFETCH(Decimate, temp - 1, temp, -(temp + 3), temp + 3) // probably suboptimal to

Re: [RESOLVED] Apply project range to audio (for MKV)

Posted: Wed Oct 25, 2017 9:02 am
by admin
Yes, the prefetches were what I was interested in. Thanks!

Re: [RESOLVED] not able to feed the encoder

Posted: Sat Jan 20, 2018 9:22 pm
by hydra3333
Hello, a couple of dumb user questions:

I am mis-understanding what's going on with HDR 10bit -> 8bit and "dithering down" to 8bit in DGSource, so a hint or a link would be appreciated if someone could spare the time.

DGSource() manual indicates:
fulldepth: true/false (default: 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 the video is dithered down to 8-bit for delivery. If you need a reduced color space (less than 16 bits) for your high-bit-depth processing, you can use ConvertBits() as needed after your DGSource() call.
I gather hevc HDR (10/12 bit) to SDR (8 bit) requires "tonemap" type conversion, a la https://forum.doom9.org/showthread.php?p=1831247 ?
Hence I don't understand how to interpret this "When fulldepth=false and the video is HEVC 10-bit or 12-bit, then the video is dithered down to 8-bit for delivery" which seems to "dither down" rather than "tonemap" (poor wording I know, sorry) ?

So I wonder, does 10bit/12bit here not mean HDR10 ? https://en.wikipedia.org/wiki/High-dynamic-range_video

Unless I'm 100% off base, h.264 AVC seems to do 10bit and 12bit HDR too (eg for uploading HDR content to youtube, and maybe there's HDR phones/cameras around now or soon ?) - does that mean DGSource (and say a 1050Ti or 750Ti card; well, a 1050Ti I guess) is capable of decoding mpeg4 AVC 10 bit as well ?
Oh, just spotted this :(
admin wrote:
Fri Jun 02, 2017 6:23 pm
CUVID does not support high-bit-depth AVC.
so I suppose 10/12 bit AVC decoding is off the table.

And ...
admin wrote:
Sun Jun 19, 2016 7:27 am
CUDA and CUVID are not the same thing. I use CUDA for fast color space conversion for display in DGIndexNV. I use CUVID for decoding in both DGIndexNV and DGDecodeNV.
Um, does this imply that gpu accelerated HDR10/HDR10+ -> SDR "tonemap conversion" function is a possibility inside DGSource :) or other DG software ? :)

Re: [RESOLVED] not able to feed the encoder

Posted: Sun Jan 21, 2018 6:47 am
by admin
hydra3333 wrote:
Sat Jan 20, 2018 9:22 pm
I am mis-understanding what's going on with HDR 10bit -> 8bit and "dithering down" to 8bit in DGSource, so a hint or a link would be appreciated if someone could spare the time.
I use the term "dither" in a general way to just mean a bit depth reduction. I don't know the details of the nVidia dithering. It may use "tonemapping". In any case, if it does not serve your needs then you can deliver full-depth and reduce it with other filters.
Hence I don't understand how to interpret this "When fulldepth=false and the video is HEVC 10-bit or 12-bit, then the video is dithered down to 8-bit for delivery" which seems to "dither down" rather than "tonemap" (poor wording I know, sorry) ?
See above.
Um, does this imply that gpu accelerated HDR10/HDR10+ -> SDR "tonemap conversion" function is a possibility inside DGSource :) or other DG software ? :)
See above.

Your remaining questions were answered in a reply to your post at the forum you cited.

Re: [RESOLVED] not able to feed the encoder

Posted: Mon Jan 22, 2018 4:42 am
by hydra3333
OK. Thank you.
admin wrote:
Sun Jan 21, 2018 6:47 am
Your remaining questions were answered in a reply to your post at the forum you cited.
Yes they were answered there by some kind soul.

In regard to tonemap like in here https://github.com/ifb/vapoursynth-tonemap and "DG software", what I meant to wonder was would it be faster in a CUDA accelerated sense or does it seem trivial in terms of cpu cost and thus not worth it as new cuda plugin ?

I wondered because tonemapped hdr -> sdr seems reasonably likely to be a handy thing into the mid term future. As may be AV1 support I guess although that'd seem to be problematic and depend on the users' cards and nvidia's software.

Re: [RESOLVED] not able to feed the encoder

Posted: Mon Jan 22, 2018 7:09 am
by admin
That's an interesting idea, hydra3333. I'll look into it. Thanks.

Re: [RESOLVED] not able to feed the encoder

Posted: Tue Jan 23, 2018 10:53 am
by admin
I'm starting a new thread about this.

viewtopic.php?f=8&t=617

Re: [RESOLVED] not able to feed the encoder

Posted: Sun Jun 30, 2019 7:27 am
by mparade
If you have an application that accepts 16 bit you can omit the convertbits call. Or you can change it to convertbits(10) if your application accepts 10 bit.
x265 accepts both 16 and 10 bit input but it is still not clear to me which would have better results finally in case of HDR input:

1. by using ConvertBits(10) and feeding x265 with 10-bit input or
2. by omitting the call and feeding x265 with 16-bit input.

Output depth in x265 is set to 10-bit.

Thank you very much for any kind of help.

Re: [RESOLVED] not able to feed the encoder

Posted: Sun Jun 30, 2019 8:06 am
by admin
The results will be the same. There is no information (all zeros) in the lower 6 bits when delivering 10-bit content as YUV420P16.

Re: [RESOLVED] not able to feed the encoder

Posted: Sun Jun 30, 2019 2:53 pm
by mparade
Thanks!

Re: [RESOLVED] not able to feed the encoder

Posted: Sun Jun 30, 2019 5:20 pm
by admin
You are most welcome and thank you for your contributions over the years. :salute: