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, 11:18   #1  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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...
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 6th March 2020, 11:43   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
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.
FranceBB is offline   Reply With Quote
Old 6th March 2020, 11:48   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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, 13:44   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
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, 05:56   #5  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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"
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 7th March 2020 at 06:10.
Katie Boundary is offline   Reply With Quote
Old 7th March 2020, 13:13   #6  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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 13:18.
wonkey_monkey is offline   Reply With Quote
Old 7th March 2020, 13:41   #7  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
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 13:47.
manolito is offline   Reply With Quote
Old 17th March 2020, 11:24   #8  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
So, does anyone know of a way?
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 17th March 2020, 12:56   #9  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,923
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, 13:40   #10  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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, 03:16   #11  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
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.
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline   Reply With Quote
Old 20th March 2020, 06:27   #12  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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!"

__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 20th March 2020 at 06:29.
Katie Boundary is offline   Reply With Quote
Old 20th March 2020, 09:33   #13  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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 11:51.
wonkey_monkey is offline   Reply With Quote
Old 20th March 2020, 16:01   #14  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,436
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, 17:42   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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, 03:03   #16  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,923
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, 21:20   #17  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 22nd March 2020 at 21:24.
Katie Boundary is offline   Reply With Quote
Old 23rd March 2020, 00:32   #18  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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; 23rd March 2020 at 00:46.
wonkey_monkey is offline   Reply With Quote
Old 23rd March 2020, 01:42   #19  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,436
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, 03:43   #20  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
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 17:53.


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