Log in

View Full Version : A note on Simpleresize


Katie Boundary
11th June 2016, 04:48
If Simpleresize is fed RGB data instead of YUV data, it will incorrectly report a problem with the horizontal resolution not being a multiple of 2, rather than a problem with the colorspace.

This should be fixed.

Reel.Deel
11th June 2016, 05:00
Simpleresize is designed such that it can only accept image widths that are divisible by 2. This is fine with me. I never use odd numbers for my image widths anyway. HOWEVER, it has a slight bug: If the edges of the image are cropped by odd numbers, but the result is still even, Simpleresize will mistakenly assume that the result is odd and throw an error.

This should be fixed.

Please post your script and exact error message. Does it help if you add align=true to crop? Just wondering, any particular reason you're using SimpleResize?

Katie Boundary
11th June 2016, 05:08
Please post your script and exact error message.

Script:

mpeg2source("blahblahblah.d2v")

converttorgb()

crop(7,0,-9,-0)

simpleresize(352,240)

Error message:

Avisynth open failure:
SimpleResize: Horizontal pixels must divide by 2

Does it help if you add align=true to crop?

I don't know. I'll try it, but it shouldn't be necessary.

Just wondering, any particular reason you're using SimpleResize?

Faster than bilinear in this extremely specific application (reducing by 2 in both directions), but without the half-pixel "shift" allegedly produced by the quick-and-dirty Reduceby2 filter.

EDIT: Nope, align=true didn't do jack.

Reel.Deel
11th June 2016, 05:20
Script:

mpeg2source("blahblahblah.d2v")

converttorgb()

crop(7,0,-9,-0)

simpleresize(352,240)


SimpleResize only accepts YUY2 and YV12, so you must convert back to YUV before SimpleResize.

Groucho2004
11th June 2016, 11:02
Wow, an entire thread just because RTFM (http://avisynth.nl/index.php/SimpleResize) seems to be a concept too difficult to grasp for some people.

I suppose this stretch of K-T Boundary forum pollution™ shall pass as well.

raffriff42
11th June 2016, 13:59
Has anybody used WarpedResize [with a YV12 source] lately? For me it is warping Chroma from one side instead of centered like Luma, which looks a bit odd:
LoadPlugin(p + "SimpleResize\Avisynth_2.5_Alpha\SimpleResize.dll")
ColorBars(pixel_type="YV12")
Subtitle("5 4 3 2 1 0 1 2 3 4 5",
\ align=5, size=Height*0.2, font="Courier New",
\ text_color=$aaffffff, halo_color=$ff000000)
WarpedResize(Width, Height, 1.5, 1.0)
Subtitle("WarpedResize(hWarp=1.5)", align=8,
\ text_color=$ebebeb, halo_color=$ff000000)
return Last
https://www.dropbox.com/s/3yr5xqzlkhlxaex/WarpedResize-colorbars.jpg?raw=1

...but this fixes the problem:
## fix WarpedResize YV12 chroma bug; make warp arguments optional
function WarpedResize2(clip C, int width, int height, float "hWarp", float "vWarp")
{
Assert(C.IsYV12,
\ "WarpedResize2: source must be YV12")
Assert(width % 4 == 0,
\ "WarpedResize2: 'width' arg must be mod 4")
Assert(height % 4 == 0,
\ "WarpedResize2: 'height' arg must be mod 4")

hWarp = Default(hWarp, 1.0)
vWarp = Default(vWarp, 1.0)

U = C.UToY .WarpedResize(width / 2, height / 2, hWarp, vWarp)
V = C.VToY .WarpedResize(width / 2, height / 2, hWarp, vWarp)
Y = C .WarpedResize(width, height, hWarp, vWarp)

return YToUV(U, V, Y)
}https://www.dropbox.com/s/wm4ufklws62cs90/WarpedResize2-colorbars.jpg?raw=1

GMJCZP
11th June 2016, 17:00
Very interesting, raffriff42.
This could be the missing puzzle stone to move from DVD PAL to NTSC. (http://forum.doom9.org/showthread.php?p=1768230#post1768230)

Katie Boundary
11th June 2016, 19:46
SimpleResize only accepts YUY2 and YV12, so you must convert back to YUV before SimpleResize.

Whoops. Well, mystery solved.

Wow, an entire thread just because RTFM (http://avisynth.nl/index.php/SimpleResize) seems to be a concept too difficult to grasp for some people.

I suppose this stretch of K-T Boundary forum pollution™ shall pass as well.

Which of the following more closely qualifies as "forum pollution": a sincere inquiry resulting from an error message that specified the wrong error, or a post pointlessly and senselessly bitching about the aforementioned inquiry?

Groucho2004
11th June 2016, 21:03
Which of the following more closely qualifies as "forum pollution": a sincere inquiry resulting from an error message that specified the wrong error, or a post pointlessly and senselessly bitching about the aforementioned inquiry?
You changed the wording of your original post (as you frequently do) so it has become pointless to even start a discussion.

Katie Boundary
11th June 2016, 22:43
You changed the wording of your original post (as you frequently do)

I clarified the nature of the problem, but it doesn't change any of the relevant facts or even significantly alter the conversation.

jmac698
12th June 2016, 00:34
bilinearresize or pointresize should work, and should be fast, if not, try the avisynth+ version, or you could convey rgb as yuv, by stuffing y into g, b into v, r into u.

johnmeyer
12th June 2016, 02:06
You changed the wording of your original post (as you frequently do) so it has become pointless to even start a discussion.Yes, he did this to me a few days ago in this thread:

Superior field-matching filter needed (http://forum.doom9.org/showthread.php?t=173579)

I commented on it at the time, but didn't realize until now that it is a habit.

Lots of people edit their posts to correct typos, update links, add references to later posts, etc. I think that is within normal forum etiquette. However, when the nature of the post is significantly changed, especially when it is the thread starter, and even more especially when people have already responded to what was originally said, it messes everything up.

I agree with you that, under these circumstances, it is pointless to try to have any sort of discussion. I have learned my lesson and will stick to threads that don't have this problem.

Katie Boundary
12th June 2016, 06:32
Yes, he did this to me a few days ago in this thread:

Superior field-matching filter needed (http://forum.doom9.org/showthread.php?t=173579)

I commented on it at the time, but didn't realize until now that it is a habit.

I actually made that edit before I saw your post. Additionally, the edit did absolutely nothing to change the flow or meaning of the conversation in any way, just as it didn't in this one.