Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th December 2012, 14:32   #1  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
Resize(height, width, crop) on YV12

Can I use LanczosResize(1280,720,2,3,-3,-2) on YV12

Or I have to ConvertToRGB() before this case?

Last edited by bxyhxyh; 25th December 2012 at 15:10.
bxyhxyh is offline   Reply With Quote
Old 25th December 2012, 21:34   #2  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
It works correctly in YV12, no problem.
TheSkiller is offline   Reply With Quote
Old 26th December 2012, 12:29   #3  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by bxyhxyh View Post
Can I use LanczosResize(1280,720,2,3,-3,-2) on YV12

Or I have to ConvertToRGB() before this case?
It'll work. But you'll screw up the chroma in the process. There's a reason for the crop rules:

http://avisynth.org/mediawiki/Crop
manono is offline   Reply With Quote
Old 26th December 2012, 13:33   #4  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
Quote:
Originally Posted by manono View Post
It'll work. But you'll screw up the chroma in the process. There's a reason for the crop rules:

http://avisynth.org/mediawiki/Crop
So which one is safer?
Code:
ConvertToRGB()
Crop(2,3,-3,-2)
LanczosResize(1280,720)
ConvertToYV12()
or first one?

Last edited by bxyhxyh; 26th December 2012 at 13:39.
bxyhxyh is offline   Reply With Quote
Old 26th December 2012, 17:10   #5  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
@ manono are you sure the crop rules, referring to crop(), apply to the internal cropping abilities of a resizer as well?
I maybe wrong, but I thought using the internal cropping these rules don't apply, i.e. chroma is fine. But the internal cropping has it's own quirk – it's not exactly suited to crop excess pixels like black bars.
Quote:
For cropping off hard artifacts like VHS head noise or letterbox borders always use Crop. For extracting a portion of an image and to maintain accurate edge resampling use the resize cropping parameters.

Last edited by TheSkiller; 26th December 2012 at 17:13.
TheSkiller is offline   Reply With Quote
Old 26th December 2012, 18:38   #6  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by TheSkiller View Post
@ manono are you sure the crop rules, referring to crop(), apply to the internal cropping abilities of a resizer as well?
I maybe wrong, but I thought using the internal cropping these rules don't apply, i.e. chroma is fine.
You are right. The restrictions only apply when explicitly using the Crop() function. The resizers are able to do sub-pixel resampling so that the correct chroma alignment is maintained.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 26th December 2012, 21:38   #7  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
I was going by an old post of sh0dan's after 'knowing' you couldn't do it even within the resizer itself:
Quote:
"But what about the left and right crop values having to be the same as stated in number 2)? Is this due to the colorspace of YV12 as well?"

There is only chroma every second pixel - if you crop at odd numbers on either side, chroma will be shifted a pixel.
Therefore it is not possible to crop odd numbers without resampling chroma (which is done in the resizer).
http://forum.doom9.org/archive/index.php/t-51923.html

I guess things have changed since then. Or I misunderstood the implications of cropping while resizing. I apologize for contradicting you, TheSkiller.
manono is offline   Reply With Quote
Old 27th December 2012, 12:07   #8  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by manono View Post
I was going by an old post of sh0dan's after 'knowing' you couldn't do it even within the resizer itself:
sh0dan's point was that if you want to crop at odd boundaries, you have to use the resizer (which does the necessary resampling).
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 27th December 2012, 23:21   #9  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
A trick worth mentioning in regards to the hard cropping done by crop and the windowed cropping done by the resizers is to use the resizer to do the resampling and cropping but with mod N extra guard pixels that are subsequently hard cropped off. E.g :-
Code:
...Source(...) # YV12
Spline16Resize(710+8, 558+8, 5-4, 9-4, 715+4, 567+4)
Crop(4, 4, -4, -4)
The number of guard pixels should be greater than the number of the resizers taps.

For bonus points if the intent is to actually resize then the input cropping guard amounts needs to be scaled by the resize factor. Remember the resizer input cropping values are floats.
IanB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:31.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.