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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th March 2020, 10:18   #1  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 630
Resize then sub-pixel shift without resampling twice?

One of the coolest thing about AVIsynth's built-in resizers is that they can perform both a resize and a sub-pixel crop with a single rescale. HOWEVER, the way they're set up assumes that the user wishes to crop first and then resize. If I wanted to resize first and then crop by a fractional number of pixels, I'd have to rescale twice like this:

Code:
mpeg2source("101.d2v")
bilinearresize(720,405)
spline144resize(720,304,0,50.5,720,304)
Are there any tricks or filters I can use to do this with only a single rescale? Assume that all numbers must be exact, and that God will kill a kitten if I use 59.85 (or any other number) as an approximation of 59.85185185185...
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.
Katie Boundary is offline   Reply With Quote
Old 6th March 2020, 10:43   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 770
Quote:
Originally Posted by Katie Boundary View Post
God will kill a kitten if I use 59.85 (or any other number) as an approximation of 59.85185185185...
Engineer: Ok... Sounds good to me.



Mathematician:

Quote:
Originally Posted by Katie Boundary View Post
as an approximation
Quote:
Originally Posted by Katie Boundary View Post
as an approximation
Quote:
Originally Posted by Katie Boundary View Post
an approximation





Jokes aside, I don't generally use the built-in crop function but when I do, I always crop first and then resize as I think it's easier for me to do the calculations and check it, so I don't know.
__________________
Broadcast Encoder
Avisynth memes: 1 - 2 - 3
Videotek - Audacity XP - LUT Collection
FranceBB is offline   Reply With Quote
Old 6th March 2020, 10:48   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
There's no such thing as "cropping by a fractional number of pixels." Just combine the scale and shift into one call and then crop:

Code:
spline16resize(720, 405, 0, 0.5, 720, last.height)
crop(0,50,0,-51)
Just shift by the fractional amount required to get the right alignment and then do the rest of the shift in the crop.

(I'm curious to know what colourspace mpeg2source is returning here that allows you to resize to an odd height. Could it be that you've left out some information? Surely not...)

PS Since I'm presumably still on ignore for daring to answer previous questions informatively and succinctly, I think it'd be fun if everyone else replied to say how great my answer is.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 6th March 2020, 12:44   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,626
Great answer Wonkey
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 7th March 2020, 04:56   #5  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 630
Quote:
Originally Posted by FranceBB View Post
I don't generally use the built-in crop function but when I do, I always crop first and then resize


Quote:
Originally Posted by wonkey_monkey View Post
There's no such thing as "cropping by a fractional number of pixels."
Yes there is. I do it every time I use a non-integer value for the src_left, src_top, src_width, or src_height parameters in the resize filters.

Quote:
Originally Posted by wonkey_monkey View Post
(I'm curious to know what colourspace mpeg2source is returning here that allows you to resize to an odd height. Could it be that you've left out some information? Surely not...)
I omitted converttorgb() because it wasn't relevant to the problem being discussed.

Quote:
Originally Posted by wonkey_monkey View Post
I'm presumably still on ignore for daring to answer previous questions informatively and succinctly
Actually it's for saying insane and incorrect things like "There's no such thing as cropping by a fractional number of pixels"
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.

Last edited by Katie Boundary; 7th March 2020 at 05:10.
Katie Boundary is offline   Reply With Quote
Old 7th March 2020, 12:13   #6  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
Quote:
Yes there is. I do it every time I use a non-integer value for the src_left, src_top, src_width, or src_height parameters in the resize filters.
That might be what you call it, but that's not what it is. You insist on making up your own language for things then acting indignant when no-one else plays along.

Quote:
I omitted converttorgb() because it wasn't relevant to the problem being discussed.
When are you going to learn? Everything is relevant. If you leave stuff out, for no good reason, it just needlessly confuses things because it's clear that you've left stuff out. You do this all the time and it's part of the reason you never get the answers you want.

Quote:
Actually it's for saying insane and incorrect things like "There's no such thing as cropping by a fractional number of pixels"
I believe what you meant to say was "Thank you".

And stop spamming the forum with your stupid memes. This isn't Facebook.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 7th March 2020 at 12:18.
wonkey_monkey is offline   Reply With Quote
Old 7th March 2020, 12:41   #7  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,734
The AviSynth docs and IanB call it "Sub Pixel Shifter"...

Quote:
Note the source cropping parameters are all floats. This allows any resizer to be used as a sub pixel shifter
https://forum.doom9.org/showthread.p...102#post938102

It's just semantics. I think that you could also call it "Crop by a fractional number of pixels".

Last edited by manolito; 7th March 2020 at 12:47.
manolito is offline   Reply With Quote
Old 17th March 2020, 10:24   #8  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 630
So, does anyone know of a way?
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.
Katie Boundary is offline   Reply With Quote
Old 17th March 2020, 11:56   #9  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 6,225
cropping by a fraction is "resizing".
because you can't technically crop by a fraction it's an illusion done by resizing.
huhn is offline   Reply With Quote
Old 17th March 2020, 12:40   #10  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
Quote:
Originally Posted by Katie Boundary View Post
So, does anyone know of a way?
I literally gave you the code to do it and an explanation of how it works.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 18th March 2020, 02:16   #11  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 677
The result of an operation must consists of full pixels. You can't resize to integers and then crop to floats. Your can't have a result of 719.5px width for example.

And as others have mentioned, you can't crop subpixels for real. "Cropping" inside resizer changes the source-target pixel mapping, not actually removing pixels or subpixels.
MeteorRain is offline   Reply With Quote
Old 20th March 2020, 05:27   #12  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 630
Quote:
Originally Posted by huhn View Post
cropping by a fraction is "resizing".
because you can't technically crop by a fraction it's an illusion done by resizing.
You technically can, but it involves using a resampling filter, which is more commonly used for, but not the same thing as, resizing.

Quote:
Originally Posted by MeteorRain View Post
The result of an operation must consists of full pixels. You can't resize to integers and then crop to floats. Your can't have a result of 719.5px width for example.
Doesn't matter because (a) I'm asking how to do this as a single operation, not as two, and (b) I'm not asking how to get a fractional width as a result.

Quote:
Originally Posted by MeteorRain View Post
And as others have mentioned, you can't crop subpixels for real. "Cropping" inside resizer changes the source-target pixel mapping, not actually removing pixels or subpixels.
"It's not a half-dozen, mom! It's six!"

__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.

Last edited by Katie Boundary; 20th March 2020 at 05:29.
Katie Boundary is offline   Reply With Quote
Old 20th March 2020, 08:33   #13  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
Quote:
Originally Posted by Katie Boundary View Post
Doesn't matter because (a) I'm asking how to do this as a single operation
I've already given you the simplest solution (subject to your restrictions, which are nonsensical) with a single resample, but thanks to your bad attitude it seems like you're going to miss out. Shame.

I recommend that no-one else wastes their time on this thread because the question has been answered.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 20th March 2020 at 10:51.
wonkey_monkey is offline   Reply With Quote
Old 20th March 2020, 15:01   #14  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,222
Quote:
Originally Posted by wonkey_monkey View Post
I recommend that no-one else wastes their time on this thread because the question has been answered.
I'm still baffled that anyone replies to any of these threads trying to help. The same thing plays out every time. Haven't you all learned not to feed the ingrate yet?
Stereodude is offline   Reply With Quote
Old 20th March 2020, 16:42   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
I live in hope that one day she might learn to say "thank you."

Besides, there's always the possibility that someone else might be looking for the same answer.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 21st March 2020, 02:03   #16  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 6,225
Quote:
Originally Posted by Katie Boundary View Post
You technically can, but it involves using a resampling filter, which is more commonly used for, but not the same thing as, resizing.
in the video world resizing and resampling are the "same" thing these terms are used as everyone see fits.

feel free to go on a crusade to rename every case of resizing in the video world where it is actually rescaling/resampling and "correct" it.
huhn is offline   Reply With Quote
Old 22nd March 2020, 20:20   #17  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 630
Quote:
I recommend that no-one else wastes their time on this thread because the question has been answered.
Wrong.

Quote:
Originally Posted by Stereodude View Post
I'm still baffled that anyone replies to any of these threads trying to help. The same thing plays out every time.
What baffles me is that there are so many illiterate morons who feel the need to dump off-topic shit in my threads and then complain about the amount of shit in them. People like YOU are the reason why this plays out every time. Post constructively or STFU.
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.

Last edited by Katie Boundary; 22nd March 2020 at 20:24.
Katie Boundary is offline   Reply With Quote
Old 22nd March 2020, 23:32   #18  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,911
Quote:
Wrong.
Well, why don't you try telling me what's wrong with my answer instead of just ignoring it completely? Then maybe, just maybe, you will get an answer that satisfies you.

Do you really not realise how excruciatingly difficult you make it for people to help you?
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 22nd March 2020 at 23:46.
wonkey_monkey is offline   Reply With Quote
Old 23rd March 2020, 00:42   #19  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,222
Quote:
Originally Posted by Katie Boundary View Post
What baffles me is that there are so many illiterate morons who feel the need to dump off-topic shit in my threads and then complain about the amount of shit in them. People like YOU are the reason why this plays out every time. Post constructively or STFU.
ROFL...

Tell us how you really feel Katie. Let it all out. We're here for you!
Stereodude is offline   Reply With Quote
Old 23rd March 2020, 02:43   #20  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,231
Given what is happening in this world at the moment, most of us are worried about our friends, neighbors, and our community, but this one is still self-centered and spouting attitude.

So much for "a crisis brings out the best in everyone."

Or, maybe this IS her best ...
johnmeyer 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 15:50.


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