VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. The Resize8 function linked to below is an updated version of Resize8 1.2 2015.02.23 by mawen1250.

    The initial changes compared to the original Resize8 are listed in the next post.

    Previous version (prior to the addition of the SAR related arguments).
    Resize8 2024-06-15.zip

    Current version.
    Resize8 2024-06-24.zip
    -----------------------------

    From version 2024-06-22 - Attempting to make a sample/pixel aspect ratio in frame properties more tolerable:

    When resizing with most resizers, unless the storage aspect ratio (width / height) for the resized video matches the storage aspect ratio of the source video, the resizing stretches the video in some manner. In order to prevent the video being stretched, a new sample aspect ratio must be calculated manually and used when encoding the video. Some newer resizers such as the AVSResize plugin (or VapourSynth's native resizers) will use the source video's sample aspect ratio in frame properties, and update that sample aspect ratio after resizing.
    The problem is, sometimes you do actually want to stretch the video to correct the way it displays, while sometimes you want to resize it while still having it display with the same aspect ratio on playback. Sometimes, you might think the sample aspect ratio in frame properties is wrong and want to correct it while resizing. Therefore....

    Three new arguments have been added relating to the SAR written to frame properties after resizing.
    These arguments have no affect on the resizing, only the SAR written to frame properties.

    DAR (float - display aspect ratio). The default is 0.0, which means an unspecified DAR.
    SAR (float - sample aspect ratio). The default is 0.0, which means an unspecified SAR.
    Keep (bool). The default is false. Keep determines whether Resize8 calculates a new SAR after resizing, keeps the source SAR, or keeps the source DAR after resizing if one is specified and calculates a new SAR accordingly.

    If neither a DAR or SAR are specified Resize8 takes the source SAR from frame properties, if one exists.
    If a DAR is specified Resize8 converts it to a SAR and uses it as the source SAR (when keep=false).
    If a SAR is specified Resize8 uses it as the source SAR (when keep=false).

    When keep=false (the default) Resize8 always calculates a new SAR after resizing and writes it to frame properties.

    When keep=true and no DAR is specified, Resize8 writes the source SAR to frame properties after resizing, while calculating a new DAR for the resized video (displayed when Info or Show are true).
    If a DAR is specified when keep=true, it becomes the DAR for the output video, therefore Resize8 calculates a new SAR for frame properties after resizing (also displayed when Info or Show are true).

    There's also a new argument named Info. Like the Show argument, Info=true displays the resizing strings as well as the input and output aspect ratios, but instead of displaying that info over a blank clip as Show=true does, Info=true displays it over the resized video.

    Some examples:

    Resizing a non-anamorphic 16:9 video to a different aspect ratio and calculating a new SAR.
    The DAR remains unchanged.

    Resize8(1048,576, Info=true)



    Stretching a non-anamorphic 16:9 video while resizing and therefore keeping the original SAR.
    The video has a new DAR.

    Resize8(1048,576, keep=true, Info=true)



    Resizing a 16:9 NTSC DVD to 16:9 PAL dimensions.

    Resize8(720,576, Info=true)



    Over-riding the SAR in frame properties for the 16:9 NTSC DVD and resizing to PAL dimensions.

    Resize8(720,576, SAR=40.0/33.0, Info=true)
    or
    Resize8(720,576, DAR=20.0/11.0, Info=true)
    or
    Resize8(720,576, SAR=16.0/11.0, keep=true, Info=true)

    Last edited by hello_hello; 25th Jun 2024 at 03:21.
    Quote Quote  
  2. Changes compared to the original Resize8.
    The default output should be exactly the same as the original.

    --- There's a help file of sorts.

    --- All Avisynth+ color spaces and bitdepths are supported.

    --- Any resizer with the same arguments for cropping as the native Avisynth resizers can be used.

    --- The Jinc, ResampleMT and SplineResize plugins are added as "known" resizers.
    The SplineResize plugin kernels are limited to 8 bit video, and don't support all color spaces.
    For SplineResize the individual planes are converted to YV12 for resizing, so all Avisynth 2.6
    colorspaces are supported that way.
    Support for the SplineResize plugin as a native resizer has been removed since version 2024-06-22.

    --- The Resize8_Separate() function has been removed, but it's functionality is retained via
    an additional Resize8 argument "separate", so Resize8(separate=true) can be used instead.

    --- New arguments, "RStr" and "RStr_c", for specifying named arguments as strings. They can be used
    instead of the a1 and a2 arguments for "known" resizers.
    For example:
    Resize8(1280,720, kernel="Bicubic", RStr="b=0.5,c=0.5")
    Resize8(1280,720, kernel="Spline36ResizeMT", RStr="prefetch=4, threads=2")

    --- New "show" argument
    show=true bypasses the resizing stage and opens a blank clip to display the full resizing strings
    as subtitles, as well as some other basic info. It might be useful if there's problems using the
    "RStr" arguments, or just to confirm the function is behaving as expected.

    --- Resize8 will attempt to use the the ResampleMT plugin for it's default resizing, but if it's not
    loaded it will use the native Avisynth resizers instead.

    --- When specifying a luma resizer with the kernel argument, the same kernel is now
    automatically used for chroma, unless a different chroma resizer is specified with kernel_c.
    Likewise, the "_c" arguments now default to the same values as their non "_c" counterparts,
    but only when the same kernel is used for both luma and chroma (when kernel = kernel_c).

    --- Adaptive ringing repair now works when downscaling, not just upscaling, but it's disabled
    for downscaling by default. It's also disabled for all "unknown" resizers by default.

    --- For RGBA, the luma kernel is applied to the R-G-B-A planes, except when a chroma kernel is specified
    or the default kernels are used, in which case the chroma kernel is used for the alpha plane.
    For YUVA, the luma kernel is applied to the Y-U-V-A planes, except when a chroma kernel is specified
    or the default kernels are used, in which case the chroma kernel is used for the U-V planes.

    --- The "alpha" argument behaves a little differently.
    If the source has no alpha plane and alpha=true, one will be added to the output when possible.
    The defaults for alpha are true when an alpha plane exists, and false when it doesn't.

    --- Added some simple, one line functions to the end of the Resize8 script. They can easily be modified
    to change the default resizing kernels and set default resizer strings.

    --- There's a help file of sorts.

    --- All Avisynth+ color spaces and bitdepths are supported.

    --- Any resizer with the same arguments for cropping as the native Avisynth resizers can be used.

    --- The Jinc, ResampleMT and SplineResize plugins are added as "known" resizers.
    The SplineResize plugin kernels are limited to 8 bit video, and don't support all color spaces.
    For SplineResize the individual planes are converted to YV12 for resizing, so all Avisynth 2.6
    colorspaces are supported that way.

    --- The Resize8_Separate() function has been removed, but it's functionality is retained via
    an additional Resize8 argument "separate", so Resize8(separate=true) can be used instead.

    --- New arguments, "RStr" and "RStr_c", for specifying named arguments as strings. They can be used
    instead of the a1 and a2 arguments for "known" resizers.
    For example:
    Resize8(1280,720, kernel="Bicubic", RStr="b=0.5,c=0.5")
    Resize8(1280,720, kernel="Spline36ResizeMT", RStr="prefetch=4, threads=2")

    --- New "show" argument
    show=true bypasses the resizing stage and opens a blank clip to display the full resizing strings
    as subtitles, as well as some other basic info. It might be useful if there's problems using the
    "RStr" arguments, or just to confirm the function is behaving as expected.

    --- Resize8 will attempt to use the the ResampleMT plugin for it's default resizing, but if it's not
    loaded it will use the native Avisynth resizers instead.
    The ResampleMT plugin is no longer used by default from version 2024-06-22.

    --- When specifying a luma resizer with the kernel argument, the same kernel is now
    automatically used for chroma, unless a different chroma resizer is specified with kernel_c.
    Likewise, the "_c" arguments now default to the same values as their non "_c" counterparts,
    but only when the same kernel is used for both luma and chroma (when kernel = kernel_c).

    --- Adaptive ringing repair now works when downscaling, not just upscaling, but it's disabled
    for downscaling by default. It's also disabled for all "unknown" resizers by default.

    --- For RGBA, the luma kernel is applied to the R-G-B-A planes, except when a chroma kernel is specified
    or the default kernels are used, in which case the chroma kernel is used for the alpha plane.
    For YUVA, the luma kernel is applied to the Y-U-V-A planes, except when a chroma kernel is specified
    or the default kernels are used, in which case the chroma kernel is used for the U-V planes.

    --- The "alpha" argument behaves a little differently.
    If the source has no alpha plane and alpha=true, one will be added to the output when possible.
    The defaults for alpha are true when an alpha plane exists, and false when it doesn't.

    --- Added some simple, one line functions to the end of the Resize8 script. They can easily be modified
    to change the default resizing kernels and set default resizer strings.
    Last edited by hello_hello; 23rd Jun 2024 at 22:41.
    Quote Quote  
  3. New version dated 2021-12-30 in the opening post.
    Quote Quote  
  4. New version dated 2022-09-23 in the opening post with a minor bug fix.

    An alpha plane wasn't always being added when it should have been.
    Quote Quote  
  5. New version dated 2023-02-03 in the opening post. See the opening post for details.
    Quote Quote  
  6. New version dated 2023-02-09 in the opening post. See the changelog (just some minor tweaks).
    Quote Quote  
  7. New version dated 2024-01-18 in the opening post. See the "changes" text file in the zip file for details.
    Quote Quote  
  8. # ResampleMT (multithreaded). https://github.com/jpsdr/ResampleMT
    # JincResize (multithreaded). http://avisynth.nl/index.php/JincResize
    # SplineResize (limited to 8 bit video, not multithreaded).
    # http://avisynth.nl/index.php/External_filters#Resizers
    #
    Got a link to a 64bit version of SplineResize ?

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  9. Originally Posted by Selur View Post
    # SplineResize (limited to 8 bit video, not multithreaded).
    # http://avisynth.nl/index.php/External_filters#Resizers
    #
    Got a link to a 64bit version of SplineResize ?

    FYI - FMTC has Spline - where taps * 2 is number of sample points if you wanted custom natural cubic splines

    FMTC is available for x64, not limited to 8bit video, multithreaded, and dualsynth capable
    Quote Quote  
  10. Originally Posted by Selur View Post
    Got a link to a 64bit version of SplineResize ?

    Cu Selur
    I don't think a 64 bit version has ever existed. I hadn't thought about that for a while because the last time I used the SplineResize plugin I was still running 32 bit Avisynth. I think I'll remove it for the next version of Resize8, because even for 8 bit video it requires a workaround. The individual planes are extracted as Y for resizing by the function, but the SplineResize plugin can't resize Y8.

    Originally Posted by poisondeathray View Post

    FYI - FMTC has Spline - where taps * 2 is number of sample points if you wanted custom natural cubic splines

    FMTC is available for x64, not limited to 8bit video, multithreaded, and dualsynth capable
    FMTConv also uses different names for the cropping arguments compared to the native Avisynth resizsers, and the function name is always fmtc_resample, so it won't work with Resize8 directly unless I add special FMTConv syntax and a way to specify it.
    FMTConv can be used with CropResize by prefixing the resizer name with "F_", for example kernel="F_Spline36", so I could probably add the same for Resize8, but there's always the option of using a wrapper function. The main objective of Resize8 is to correct the chroma shift caused by Resizers that assume "center" though, and that's not the case for FMTConv or AVSResize. Although thinking about it, I've become quite attached to ringing repair when upscaling, and I don't think FMTConv or AVSResize include ringing repair themselves.

    I might have to update Resize8 again in the near future as I found a problem when Resize8 is used as the resizer for CropResize, the source is anamorphic YUV420, the height is mod2, and when an output height isn't specified as an argument for CropResize.
    When those planets line up, there's a CombinePlanes error due to the source and target plane dimensions being different. I'm quite sure that's impossible, but I tested the previous version of Resize8 and it's outputting the same error. The cause is still a mystery though....
    Last edited by hello_hello; 28th Jan 2024 at 07:01.
    Quote Quote  
  11. I don't think a 64 bit version has ever existed.
    okay.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  12. I eventually discovered the Resize8 function wasn't the cause of the error I mentioned in my previous post, but rather it's a ResampleMT bug. Of course that was the last place I looked, especially as the bug seems quite resolution/cropping specific, but I've reported it in the "JPSDR plugins pack" thread. It's an odd one...
    https://forum.doom9.org/showthread.php?p=1996435#post1996435

    If the ResampleMT plugin (or the plugins pack) is loaded, Resize8 will use GuassResizeMT to resize the clip used for ringing repair, so if an error along the lines of "the clips are different sizes" pops up, the only solution at the moment is to disable ringing repair or prevent the ResampleMT plugin (or the plugins pack) from loading so Resize8 will use GuassResize instead. I've used Resize8 with ResampleMT numerous times though and this is the first problem I've found, so hopefully it won't be too much of an issue before the bug is fixed.
    Quote Quote  
  13. New version dated 2024-06-15 in the opening post. See the "changes" text file in the zip file for details.
    Quote Quote  
  14. New version dated 2024-06-22 in the opening post.
    There's also a description of the new functionality, with some pictures to illustrate.
    Quote Quote  
  15. I fixed a problem with an error message not displaying and re-uploaded the zip file. It's not important, so I left the version date the same (2024-06-22).
    Quote Quote  
  16. After a lot of changes, apparently missing a few minor bugs is inevitable.
    There's a link for a new version dated 2024-06-24 in the opening post.
    Changes in the included text file.
    Quote Quote  
  17. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I have some scripts using this function, but I have the old version. If I update the plugin to the new version, is that all I need to do or I might have to tweak the existing settings in the scripts?
    Quote Quote  
  18. The original version and this one have the same default values and their default output's should be the same, assuming of course there's not a chroma location in frame properties other than "left", which would cause this version to handle chroma placement slightly differently. That's not really a negative though.

    This version has had quite a few new arguments added, but the original ones still remain, although one difference is when you specify a kernel with the original version it only applies to the luma resizing and the chroma resizing remains unchanged. For this version, specifying a kernel applies to both the luma and chroma resizing and you need to also specify kernel_c if you want a different chroma resizer.

    This is the sort of thing I mean (I changed the function name for the original Resize8 to Resize8Old so I could use them together).

    PropClearAll() # temporarily delete frame properties, just in case

    A = Resize8Old(960,540)
    B = Resize8(960,540)
    Compare(A, B)

    Image
    [Attachment 80128 - Click to enlarge]


    When upscaling the default for kernel_c is Lanczos (and I'm upscaling).

    A = Resize8Old(960,540, Kernel="Bicubic") # still uses Lanczos for chroma
    B = Resize8(960,540, Kernel="Bicubic") # uses Bicubic for chroma
    Compare(A, B)

    Image
    [Attachment 80129 - Click to enlarge]


    A = Resize8Old(960,540, Kernel="Bicubic", Kernel_c="Bicubic")
    B = Resize8(960,540, Kernel="Bicubic")
    or
    A = Resize8Old(960,540, Kernel="Bicubic")
    B = Resize8(960,540, Kernel="Bicubic", Kernel_c="Lanczos")

    Compare(A, B)

    Image
    [Attachment 80130 - Click to enlarge]
    Last edited by hello_hello; 25th Jun 2024 at 00:30.
    Quote Quote  
  19. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I see thanks for the clarification!
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!