DGDecomb

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

I was playing around trying to fix the VPP one-frame delay for bobbing and nothing was working but then I decided to try something off-the-wall and shockingly it worked to flush the VPP and fully correct random access:

Code: Select all

	// Frame is on GPU and everything configured at this point.
	err = cuvidMapVideoFrame(cuDecoder, 0, &outPtr, &_pitch, &vpp);
	if (err != CUDA_SUCCESS)
		env->ThrowError("PVBob: could not run the VPP");
	if (vpp.second_field == 1)
	{
		// This is found heuristically to solve the VPP one-frame delay problem.
		cuvidUnmapVideoFrame(cuDecoder, outPtr);
		vpp.second_field = 0;
		err = cuvidMapVideoFrame(cuDecoder, 0, &outPtr, &_pitch, &vpp);
		if (err != CUDA_SUCCESS)
			env->ThrowError("PVBob: could not run the VPP");
	}
	// Postprocessed frame gets copied back to CPU at this point.
I also found a way to reduce the GPU<-->CPU traffic, increasing the frame rate by 50fps for 1920x1080. I'll regression test a bit and then slip-stream it. I will look into applying this fix to DGIndexNV and DGSource(deinterlace=2). It's not clear that it can be applied directly.
User avatar
hydra3333
DG Approved/Moose Approved
Posts: 260
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: DGDecomb

Post by hydra3333 »

admin wrote:I was playing around trying to fix the VPP one-frame delay for bobbing and nothing was working but then I decided to try something off-the-wall and shockingly it worked to flush the VPP and fully correct random access.

I also found a way to reduce the GPU<-->CPU traffic, increasing the frame rate by 50fps for 1920x1080. I'll regression test a bit and then slip-stream it. I will look into applying this fix to DGIndexNV and DGSource(deinterlace=2). It's not clear that it can be applied directly.
Crikey, Charlie ! Nice going.
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

No bodgy code for me. Don't want to come a gutser.
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

I figured out how to make the fix work for DGIndexNV and DGSource(deinterlace=2). I'll do some thorough testing before slipstreaming it.
DAE avatar
Guest

Re: DGDecomb

Post by Guest »

Just keeps getting better and better
DAE avatar
Sharc
Moose Approved
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

Re: DGDecomb

Post by Sharc »

Seems like I have a blackout, but how can I IVTC a 59.94 telecined 25fps source using DGTelecide() and DGDecimate() such as to get the 25.00 fps progressive source back?
(I think the 59.94 telecined material is 3:2:3:2:2 telecined)
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

Please post a sample. There are too many uncertainties in your post to comment yet.
DAE avatar
Sharc
Moose Approved
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

Re: DGDecomb

Post by Sharc »

Here is a sample (sorry for the confusion, I meant a 25 => 29.97 telecined source, not 59.94)
http://www.mediafire.com/file/by4ykayn2dmotwx/ma_30i.ts
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

This script makes the video 25 fps.

dgsource("C:\Users\Don\Downloads\ma_30i.dgi")
dgtelecide()
dgdecimate(cycle=6,keep=5) # makes 24.975 fps
assumefps(25)

The stream has no audio, so I could not assess whether the 24.975 vs. 25 will be an issue. Worst case, you may need to shrink the audio a bit, or leave it at 24.975 if your target format accepts that.
DAE avatar
Sharc
Moose Approved
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

Re: DGDecomb

Post by Sharc »

Thanks! I came to the exactly same conclusion with my experiments, but I thought I might have missed something. So there is no "direct route" for IVTCing this by field matching plus m by n decimation to hit the 25.00fps

Actually, it is not a real problem. I just bumped across it when I converted a 25p (deinterlaced mpeg2 PAL 25i home video) to 29.97i using good old DGPulldown, and encoding it to AVC (x264). When inspecting the hard-telecined alternating 3p-3c-3p-3c ... and 4p-2c-4p-2c... pattern every about 100 frames (p=clear, c=combed frame) I wondered how the heck to IVTC this properly. :o
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

For your 29.97 fps file of 1524 frames, there is no choice of M and N that exactly gives 25.000 fps. You can get a little closer to it with TDecimate because TDecimate allows a cycle up to the size of the file. For example, this gives 25.014 fps:

tdecimate(cycleR=252,cycle=1524)

The problem really arises because pulldown from 25 to 29.97 cannot exactly hit 29.97 unless the number of frames is very large. As long as you decimate the added fields then assumefps(25) will recreate the original file.
DAE avatar
Sharc
Moose Approved
Posts: 233
Joined: Thu Sep 23, 2010 1:53 pm

Re: DGDecomb

Post by Sharc »

Ah I see, very clear. We can't take the total frame number out of the equation. Thank you.
User avatar
admin
Site Admin/DG Approved
Posts: 4464
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDecomb

Post by admin »

You're welcome, Sharc. It's always my pleasure to discuss interesting problems with you.
User avatar
tormento
DG Approved/Moose Approved
Posts: 572
Joined: Mon Sep 20, 2010 2:18 pm

DGDecomb

Post by tormento »

I am a spring chicken about inverse telecine, pulldown etc, so be kind to me ;)

I need to port the script

Code: Select all

DGSource("F:\In\Stand Alone Complex\01 Sezione 9, pubblica sicurezza\01.dgi", ct=24,cb=24,cl=0,cr=0)
tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()
to a CUDA accelerated version of it, as I need to convert the following

Code: Select all

Video
ID                             : 1
ID in the original source medi : 4113 (0x1011)
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L4.1
Format settings                : CABAC / 2 Ref Frames
Format settings, CABAC         : Yes
Format settings, Reference fra : 2 frames
Codec ID                       : V_MPEG4/ISO/AVC
Duration                       : 26 min 13 s
Bit rate mode                  : Variable
Bit rate                       : 29.4 Mb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Variable
Frame rate                     : 59.940 (59940/1000) FPS
Original frame rate            : 29.970 (30000/1001) FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Interlaced
Scan type, store method        : Separated fields
Scan order                     : Top Field First
Bits/(Pixel*Frame)             : 0.236
Stream size                    : 5.38 GiB (84%)
Language                       : Japanese
Default                        : Yes
Forced                         : No
Original source medium         : Blu-ray
to 23.976 keeping time lenght.

I need help :)

P.S: It's the same file type of the link https://send.cm/d/BykZ posted in my delay difference thread.
User avatar
Rocky
Moose Approved
Posts: 2221
Joined: Fri Sep 06, 2019 12:57 pm

DGDecomb

Post by Rocky »

Well, you start with:

DGSource()
DGTelecide()
DGDecimate()

and then tweak if needed, although it seems to work fine on "03 Una piccola ribellione.mkv". I would need the source to help with tweaking. And maybe we will need to add some additional functionality. Nobody ever seemed that interested in these filters so I stopped early.
User avatar
tormento
DG Approved/Moose Approved
Posts: 572
Joined: Mon Sep 20, 2010 2:18 pm

DGDecomb

Post by tormento »

Rocky wrote:
Mon Jun 06, 2022 6:35 pm
I would need the source to help with tweaking.
Thanks Rocky, I used the very same example in DGSource documentation and it worked flawlessly.

The episode is of the same BD, so it maintains the same properties..

I can't tell the quality difference, as I am a deinterlace noob. ;)
Rocky wrote:
Mon Jun 06, 2022 6:35 pm
Nobody ever seemed that interested in these filters so I stopped early.
Perhaps they had not enough exposure on other forums. They seem to work really well.
User avatar
Rocky
Moose Approved
Posts: 2221
Joined: Fri Sep 06, 2019 12:57 pm

DGDecomb

Post by Rocky »

Super happy you find the filters working good for you. I'm always willing to keep working on them, so let me know if you run into any issues. As always, for CUDA filters, we make some trade-offs for speed but still we want to maintain an acceptable quality level.
Post Reply