Page 1 of 3

[RESOLVED] CLIP + cropping

Posted: Sun Dec 02, 2018 12:54 pm
by Zathor
Hello Don,

Based on my current work with DGSource() and cropping and also based on that post (and following) https://forum.doom9.org/showpost.php?p= ... count=6638 I noticed this issue here, which I cannot explain myself:

Source size (MKV/AVC): 638x398
CLIP 0 2 0 2
(Btw why is the order of the values in CLIP and the default DGSource() crop values different?)

DGSource(dgifile): 638x398 (as expected)
DGSource(dgifile, crop_t=0, crop_b=2, crop_l=0, crop_r=2): error - All crops must be at least mod 4! (here I would have expected the same result as above as this is the cropping based on the CLIP values)
DGSource(dgifile, crop_t=0, crop_b=4, crop_l=0, crop_r=4): 636x396

Why is DGSource() without crop values able to crop something what crop cannot do?

EDIT: Could you maybe add a check that if the crop values match the CLIP values, that it is shown as without any crop values specified?
Or even better, enable MOD2 in crop as it does work in CLIP (e.g. I tested the file above with CLIP 0 6 0 0 and CLIP 2 6 6 0).

Also it would be great if values of 0 would overwrite the CLIP values.

Thanks in advance for any thoughts,
Zathor

Re: CLIP + cropping

Posted: Sun Dec 02, 2018 2:54 pm
by admin
I'll look into it all, Zathor. Give me some days. Thank you for the observations and suggestions.

Re: CLIP + cropping

Posted: Sun Dec 02, 2018 6:19 pm
by admin
Can you link me to your source file please, Zathor?

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 1:50 am
by Zathor
Sure, my sample file is:
http://www.mediafire.com/file/x1226kyz6 ... e.mkv/file

Take your time :)

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 6:44 am
by admin
Thanks for that. A little heads-up for you: probably the whole CLIP mechanism will be removed and the cropping dialog will become a cropping calculator, that just gives you values you can subsequently use in DGSource() cropping or in the Avisynth cropping. I will check but IIRC the mod 4 limitation on DGSource() cropping is an NVDec limitation. Formally, interlaced YV12 cannot be cropped mod 2, so I suppose that is the reason for it.

Your further thoughts will be appreciated as the main thing is to make things work smoothly in MeGUI.

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 7:33 am
by admin
When I index your file I get CLIP 0 4 0 4 but you said CLIP 0 2 0 2. Can you give me a file that produces 0 2 0 2? Thank you.

I need a mod 2 clip to get to the bottom of things and test it with NVDec. I asked the user at the other forum for it but he's being uncooperative so far in giving it to me. You see, he knows better than me and tells me it is "nothing special".

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 11:42 am
by Zathor
admin wrote:
Mon Dec 03, 2018 6:44 am
Thanks for that. A little heads-up for you: probably the whole CLIP mechanism will be removed and the cropping dialog will become a cropping calculator, that just gives you values you can subsequently use in DGSource() cropping or in the Avisynth cropping. I will check but IIRC the mod 4 limitation on DGSource() cropping is an NVDec limitation. Formally, interlaced YV12 cannot be cropped mod 2, so I suppose that is the reason for it.
Thanks, sounds great!
If the limitation of mod 4 has to stay, ok, that is then the way to go.
admin wrote:
Mon Dec 03, 2018 7:33 am
When I index your file I get CLIP 0 4 0 4 but you said CLIP 0 2 0 2. Can you give me a file that produces 0 2 0 2? Thank you.
I need a mod 2 clip to get to the bottom of things and test it with NVDec.
Very strange, with that file I do get this dgi file:
https://www.mediafire.com/file/lri4bx73 ... e.dgi/file
which does include CLIP 0 2 0 2
Does it maybe vary based on the engine? I do have a 970 GTX.

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:01 pm
by admin
Hmm. Can you please give me your DGIndexNV INI file?

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:02 pm
by Zathor
Here it is:

Code: Select all

Version=DGIndexNV 2053.0.0.161
Window_Position=0,0
Info_Window_Position=0,0
Process_Priority=2
Playback_Speed=3
AVS_Template_Folder=
AVS_Template_File=template.avs
AVS_Template_File_Index=0
AVS_Enable_Template=1
AVS_Overwrite=0
Full_Path_In_Files=1
MRUList[0]=D:\MeGUI\file.mkv
MRUList[1]=
MRUList[2]=
MRUList[3]=
Enable_Info_Log=1
Loop_Playback=0
AVC_Extension=264
MPG_Extension=m2v
VC1_Extension=vc1
HEVC_Extension=265
Deinterlace=0
UsePF=0
AlwaysCrop=1
UseD3D=0
Snapped=0
ResponseOnAudioMismatch=1
Enable_Audio_Demux=1
CUDA_Device=255
Decode_Modes=0,0,0,0
Full_Info=1
Bare_Demux=0
Disable_Encrypted_Audio_Warning=0
Fine_Cropping=0
Force_Zoom=0
StrictAVC=0
PGSForcedOnly=0

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:17 pm
by Zathor
And if it helps this was the command line used:
"D:\MeGUI\MeGUI_dgindexnv\bin\x86\Debug\tools\dgindexnv\dgindexnv.exe" -i "D:\MeGUI\file.mkv" -o "D:\MeGUI\file.dgi" -h

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:18 pm
by admin
Thanks, that's really strange. I did establish that the AVC display_area is 638 x 398, so it is in fact mod 2. I'll investigate why I cannot get 0 2 0 2. But it's moot if I get rid of all the CLIP stuff. Still, I like to know what is going on.

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:19 pm
by admin
Ah, it's CLI! Now it all makes sense.

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:24 pm
by Zathor
Sorry for not writing that sooner. MeGUI is always about CLI :oops:

Re: CLIP + cropping

Posted: Mon Dec 03, 2018 12:52 pm
by admin
Yes, but I should have realized that too. :oops:

Re: CLIP + cropping

Posted: Tue Dec 04, 2018 9:59 am
by admin
Zathor wrote:

"Why is DGSource() without crop values able to crop something that crop cannot do?"

Ah, this is the key question. When you have no cropping specified by parameters, then the decoder honors the stream's configured VUI display_area, even when the area is mod 2. However, when you set up a crop with parameters then the create decoder call is passed a user-configured display_area structure. Now, when this is configured identically to the stream's display_area structure, it works only for mod 4. So this appears to be an NVDec limitation. I will confirm it with nVidia, but this appears to be what is happening and why we must enforce mod 4 for configured cropping.

Re: CLIP + cropping

Posted: Tue Dec 04, 2018 11:09 am
by admin
nVidia replies "There indeed used to be a mod4 restriction, but I believe recent drivers should have eliminated this restriction. Which driver version were you using ? (if it's still there, it should be considered a bug)"

It's still there in 417.01, so it will be treated as a bug. I will probably allow mod 2 with a warning that it may work properly only after a future driver revision.

Re: CLIP + cropping

Posted: Tue Dec 04, 2018 12:15 pm
by Zathor
Thank you very much for your work!
So I will force mod4 for the moment as well.

Re: CLIP + cropping

Posted: Thu Dec 06, 2018 4:30 pm
by admin
It turns out that mod 2 is broken only for top and left cropping. It works fine for right and bottom. nVidia says it is on the TO DO list to fix top and left. So my plan is to allow mod 2 cropping but with a warning that top and left mod 2 crops may not work until fixed in a future driver version.

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 10:42 am
by admin
Watch me pull a rabbit out of my hat!

Here is a 64-bit test version for the cropping redesign. You should be able to figure things out from the revised documents. Note the renaming of the DGSource() cropping and resize parameters. Less typing is a good thing, am I wrong? Feedback from any interested users on the binaries and docs will be gratefully received so I can shake this out before slipstreaming it. This test version also includes the fix for the FPS detection for MKV/MP4 streams.

http://rationalqm.us/misc/CropRedesign.rar

@Zathor

If possible, please enforce (or warn) mod-4 only for top and left crops. I will inform you if and when that gets fixed. Thank you for your support of DGDecNV in MeGUI.

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 2:15 pm
by DJATOM
DGSource("project.dgi", resize_w=1280, resize_h=720) <-- leftovers in the examples part of manual.

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 3:35 pm
by admin
Good eyes, thanks DJ.

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 4:05 pm
by Guest
Changed avatar again?

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 4:08 pm
by admin
Bullwinkle was feeling left out.

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 5:27 pm
by Guest
Yogi felt left out too, he is smarter than the average bear after all

Did you mean to remove "Always Crop 1088 -> 1080"?
Edit, it still seems to crop to 1080

Re: CLIP + cropping

Posted: Fri Dec 07, 2018 5:50 pm
by admin
That option never made any sense so you can pretend that it is always on. There's no reason not to always honor the stream's coded display area.