Help with DGDecNV vs LWLibavSource + TIVTC

Support forum for DGDecNV
Post Reply
User avatar
Selur
Posts: 134
Joined: Mon Nov 05, 2012 3:49 pm
Location: Germany
Contact:

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Selur »

I got a source that is soft telecined, I know I could handle it with fieldop=1, which works fine.
(So yes, I can handle the source fine.)

My problem is, that I don't understand why I get different matches/results when using:

Code: Select all

clip = core.tivtc.TFM(clip=clip)
clip = core.tivtc.TDecimate(clip=clip)
depending on whether I use:

Code: Select all

clip = core.dgdecodenv.DGSource("G:/Temp/mkv_91f99f4fa9c16149c3fd0287606826e8_853323747.dgi",fieldop=2)
or:

Code: Select all

clip = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/interlaceAndTelecineSamples/soft telecine/sample_from_DVD.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
as source filter?
(matches after dgdecodenv.DGSource seem worse)

Comparison code:

Code: Select all

# Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# source: 'G:\TestClips&Co\files\interlaceAndTelecineSamples\soft telecine\sample_from_DVD.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: (using) telecine
# Loading G:\TestClips&Co\files\interlaceAndTelecineSamples\soft telecine\sample_from_DVD.mkv using DGSource
clip = core.dgdecodenv.DGSource("G:/Temp/mkv_91f99f4fa9c16149c3fd0287606826e8_853323747.dgi",fieldop=2)
clip2 = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/interlaceAndTelecineSamples/soft telecine/sample_from_DVD.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)

# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip=clip)
clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976

clip2 = core.tivtc.TFM(clip=clip2)
clip2 = core.tivtc.TDecimate(clip=clip2)# new fps: 23.976

clip = core.std.StackVertical([clip, clip2])

# Output
clip.set_output()
frame 2:
Image
frame 27:
Image

Link to the clip I used on GoogleDrive

Not sure whether this is an issue with the source, the drivers or DGDecNV.
(Got the sample from a Hybrid user, who complained that TIVTC produced jerky results. After some testing, I noticed that this was caused by using DGDecNV.)

Using Vapoursynth R61, I'm on Windows 11 64bit, 64GB RAM, Ryzen 9 7950x, Geforce RTX 4080 with current NVIDIA Studio drivers 527.56.

Cu Selur
Ps.: hope you all have/had a Merry Christmas / some pleasant holidays.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Bullwinkle »

Your scripts use MKV but your link gives an MP4. The name is different too. The MP4 has _tivtc. You'll have to sort that out before we can investigate. Did you give the encode by accident? We need the source file sample_from_DVD.mkv.
User avatar
Selur
Posts: 134
Joined: Mon Nov 05, 2012 3:49 pm
Location: Germany
Contact:

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Selur »

Doh, sorry. Yes, I accidentally uploaded a reencode. :/
Here's a link to the mkv. :hat:
(will also adjust the link in the first post)

Thanks!

Cu Selur
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

Thank you. Investigating...
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

This appears to be user error.

Consider the initial report of jerkiness you got from a user. It's easy to understand why that is occurring. Your script specifies fieldop=2. That already effectively decimates down to 23.976. fieldop=2 is just the same as fieldop=1 when it is pure soft 3:2 as here, except that fieldop=2 will deliver the framerate as 29.97 whereas fieldop=1 will deliver 23.976. Both of them have already decimated (by not doing pulldown) so that adding TDecimate() with fieldop=1/2 will delete extra frames making it jerky. If you want to use TFM/TDecimate you must have fieldop=0! You need repeat=true for lsmash. This is the solution for your user.

BTW, fieldop=2 (ignore) is intended only for debugging stuff, not for normal use. The manual says this:

"This option is mostly intended for power users, who would use it as a diagnostic aid for inspecting the encoded pictures."

To show that matches are irrelevant here, I run this script (Avisynth):

Code: Select all

loadplugin("d:\tmp\Selur\lsmashsource.dll")
loadplugin("D:\Don\Programming\C++\DGDecNV\DGDecodeNV\x64\Release\DGDecodeNV.dll")
loadplugin("tivtc.dll")
dg=DGSource("sample_from_DVD.dgi",fieldop=0).tfm().tdecimate()
ls=LWLibavVideoSource(source="sample_from_DVD.mkv", format="YUV420P8", repeat=true).tfm().tdecimate()
return Subtract(ls,dg)
It's gray the whole way, baby!

Things should be the same in the Vapoursynth world.

Note that the MPEG2 decoders are different for the two source filters, but the differences in the decoded video are too tiny to affect anything. MPEG2 does not have a spec-defined output like AVC/HEVC; things can differ for use of different IDCT algorithms etc.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

Hello?
User avatar
Selur
Posts: 134
Joined: Mon Nov 05, 2012 3:49 pm
Location: Germany
Contact:

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Selur »

Sorry, for some reason email notification doesn't work and I was busy the last few days.

Argh, I misunderstood the field handling. :o
Instead of fieldop=2, I should have used fieldop=0. :/
with:

Code: Select all

clip = core.dgdecodenv.DGSource("J:/tmp/mkv_91f99f4fa9c16149c3fd0287606826e8_853323747.dgi",fieldop=0)
clip2 = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/interlaceAndTelecineSamples/soft telecine/sample_from_DVD.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)

# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip=clip)
clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976

clip2 = core.tivtc.TFM(clip=clip2)
clip2 = core.tivtc.TDecimate(clip=clip2)# new fps: 23.976

clip = core.std.StackVertical([clip, clip2])
Everything looks fine.
Thanks for clearing that up. :)

Cu Selur
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

No problem. Thank you for the update and happy to be of assistance.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

@Selur

Any chance you could post the resolution over here?

https://forum.doom9.org/showthread.php? ... ost1979903

I ask because the way you left it you are saying this is the fault of DGDecodeNV. Think if it was your own software, you'd want the record corrected. Thank you!
User avatar
Selur
Posts: 134
Joined: Mon Nov 05, 2012 3:49 pm
Location: Germany
Contact:

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Selur »

Sure, no problem.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Help with DGDecNV vs LWLibavSource + TIVTC

Post by Rocky »

Thank you.
Post Reply