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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th October 2013, 01:52   #221  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 29
Hi Asmodian,

here's my little avisynth script. I can get this to work with CCE 2.5, but CCE SP3 won't work, nor will Tmpgenc with it. I need to go RGB to use the Virtualdub DeLogo plugin with Avisynth, then back to YUY2 for avisynth to use ResampleHQ. Also a question. One person said that the Dither plugin gave a sharper output to ResampleHQ. Is this so? I'd like to try it and compare encodes with it. What would be an equivalent Dither script I could use, if someone could suggest one? Thanks.

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio.dll")
mpeg2source("O:\The Runaways - School Days (RAGE SD).d2v", info=3)
converttorgb32()
LoadVirtualDubPlugin("C:\VirtualDubMod_1_5_10_2_All_inclusive\plugins\delogo.vdf", "delogo")
delogo(1,"","C:/Delogo/Mask Files/Deblend.bmp", "C:/Delogo/Mask Files/Alpha.bmp", "c:/Delogo/Mask Files/Color.bmp", "C:/Delogo/Mask Files/Repair.bmp", 15, 40, 1, 0)
crop(98,2,-94,-0)
ResampleHQ(width=720, height=576, dstcolorspace="YUY2", srcmatrix="TV.601", kernel="spline36", chroma_kernel="spline36")
ConvertToYUY2
astronob is offline   Reply With Quote
Old 12th October 2013, 21:34   #222  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
You are going back to YUY2 after ResampleHQ but that is ok as ResampleHQ supports RGB color spaces.

Maybe the one person who thought Dither is sharper was in the context of YV12 or YUY2? Dither is "sharper" than ResampleHQ because dithering is not currently supported for YV12 and YUY2 in ResampleHQ. Dithering is mostly destroyed by DCT compression.

Here is an example Dither script to implement a ResampleHQ like resize. Like with ResampleHQ I suggest you only use liner light resize when downsampling.
Code:
Dither_convert_8_to_16()
Dither_y_gamma_to_linear()
Dither_resize16(1280, 720)
Dither_y_linear_to_gamma()
DitherPost()
If you want an anti-ringing algorithem applied you can replace Dither_resize16 with Dither_resize16nr. There are good examples in the Dither docs.
Asmodian is offline   Reply With Quote
Old 27th October 2013, 08:24   #223  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 29
Thanks, but putting "dither" in the script, gives me "DitherPost: Input Must Be Planar." I have no idea what that means. Also, can someone PLEASE explain why ResampleHQ won't work with Tmpgenc but works fine with old version of cinema craft encoder? When I try and frameserve the script to Tmpgenc, I get a line in red letters "ResampleHQ Internal Error:". The latest version of CCE won't work either. I'm at a loss. Is there something extra I need to put in the script so Tmpgenc will work? Thanks. Also, I don't think ResampleHQ supports RGB color space. If I put "RGB" instead of "YUY2" in the script. It won't work. Has ResampleHQ been updated to work with RGB color space now? Thanks.

Last edited by astronob; 27th October 2013 at 08:31.
astronob is offline   Reply With Quote
Old 27th October 2013, 08:50   #224  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by astronob View Post
Thanks, but putting "dither" in the script, gives me "DitherPost: Input Must Be Planar." I have no idea what that means.
YUY2 is not a planar colorspace, Y, U and V components are interleaved and packed in pairs of pixels. You can convert first your clip with ConvertToYV16(), which is the same as YUY2 but in a planar form.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 27th October 2013, 09:01   #225  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 29
Doesn't work, colors are stuffed up. In addition, no one has offered an explanation for the "ResampleHQ Internal Error" error message.
astronob is offline   Reply With Quote
Old 30th October 2013, 22:53   #226  |  Link
Richard1485
Guest
 
Posts: n/a
I received that error only when I used Avisynth MT. The normal Avisynth has always been fine. My two cents!
  Reply With Quote
Old 4th February 2014, 16:19   #227  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 153
Please integrate YV24 support.
De-M-oN is offline   Reply With Quote
Old 15th May 2015, 19:34   #228  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
This projected seems to be dormant since 2011, but there was a newer source code posted and since version 8 did not include a 64-bit plugin I decided to build it. I can't promise it will be stable as it was never released by the creator, but it does appear to be working. I included a compile of the x86 version too, but I would trust version 8 over this one.

Download
l33tmeatwad is offline   Reply With Quote
Old 15th May 2015, 19:42   #229  |  Link
burfadel
Registered User
 
Join Date: Aug 2006
Posts: 2,229
Quote:
Originally Posted by l33tmeatwad View Post
This projected seems to be dormant since 2011, but there was a newer source code posted and since version 8 did not include a 64-bit plugin I decided to build it. I can't promise it will be stable as it was never released by the creator, but it does appear to be working. I included a compile of the x86 version too, but I would trust version 8 over this one.

Download
It's unfortunate development hasn't continued on it. The plugin seems to produce a subtle, but nice, improvement over the standard spline filters.
burfadel is offline   Reply With Quote
Old 15th May 2015, 19:51   #230  |  Link
De-M-oN
Registered User
 
Join Date: Apr 2012
Location: Germany
Posts: 153
Spline100 has the best compressability which is awesome for youtube.

Also I like the ringing free scaling by Spline100 in general


edit: oh I thought it was the SplineResize Thread instead of ResampleHQ. sorry.

edit 2: But I can add something to this thread as well:

The documentation of ResampleHQ says youtube uses tv.601

But thats wrong. They use tv.709.

Last edited by De-M-oN; 15th May 2015 at 22:51.
De-M-oN is offline   Reply With Quote
Old 10th April 2020, 06:21   #231  |  Link
Treaties Of Warp
Registered User
 
Join Date: Apr 2019
Posts: 14
BUMP!!!

Is there any way to add Spline100 and Spline144 to ResampleHQ?
Treaties Of Warp is offline   Reply With Quote
Old 29th March 2021, 02:21   #232  |  Link
Upscale_Lover
Registered User
 
Join Date: Feb 2018
Posts: 1
Any way to downscale 4k SDR content to 720p using ResampleHQ? What is the source matrix value for 4k?
Upscale_Lover is offline   Reply With Quote
Old 29th March 2021, 05:06   #233  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,041
Quote:
Originally Posted by Upscale_Lover View Post
Any way to downscale 4k SDR content to 720p using ResampleHQ? What is the source matrix value for 4k?
Possibly that plugin https://forum.doom9.org/showthread.p...07#post1843107 will helps with SDR too.

With
ConvertYUVtoLinearRGB()
Do_resample()
ConvertLinearRGBtoYUV()

"What is the source matrix value for 4k?"

It depends on content source. May be any of 601/709/2020 for SDR. Try to look in metadata if available.

Last edited by DTL; 29th March 2021 at 05:10.
DTL is offline   Reply With Quote
Old 20th July 2021, 07:39   #234  |  Link
joearmstrong
Registered User
 
joearmstrong's Avatar
 
Join Date: Jul 2013
Posts: 38
Since v2.1.0 ResampleHQ supports HDR sources in Vapoursynth. Unfortunately there's no update for the Avisynth version. Someone should compile a new version for Avisynth from the latest Vapoursynth release.
joearmstrong is offline   Reply With Quote
Old 20th July 2021, 10:36   #235  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by joearmstrong View Post
Since v2.1.0 ResampleHQ supports HDR sources in Vapoursynth. Unfortunately there's no update for the Avisynth version. Someone should compile a new version for Avisynth from the latest Vapoursynth release.
ResampleHQ for VapourSynth is a script using core filters to convert to linear light and resize. It's not a plugin like the AviSynth version. Regardless, the same can be accomplished with avsresize. Take a look at the ">8bit (AVIsynth+) linear/gamma light aware resizing?" thread.
Reel.Deel is offline   Reply With Quote
Old 20th July 2021, 14:23   #236  |  Link
joearmstrong
Registered User
 
joearmstrong's Avatar
 
Join Date: Jul 2013
Posts: 38
I confused something. Thanks for the explanation. What is the correct script for HDR gamma-aware resize?

My Idea:
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l",resample_filter="spline36",resample_filter_uv="spline36",approximate_gamma=false)
Spline36Resize(1920,1080)
z_ConvertFormat(pixel_type="YUV422P10",colorspace_op="rgb:linear:2020:l=>2020ncl:st2084:2020:l",resample_filter="spline36",resample_filter_uv="spline36",approximate_gamma=false)

Last edited by joearmstrong; 20th July 2021 at 15:01.
joearmstrong is offline   Reply With Quote
Old 20th July 2021, 15:10   #237  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
I think the HDRTools plugin makes it even easier.

z_ConvertFormat(chromaloc_op="top_left=>mpeg2")
ConvertYUVtoLinearRGB(color=1, outputmode=2)
Spline36Resize(1920,1080)
ConvertLinearRGBtoYUV(color=1, outputmode=2)
z_ConvertFormat(chromaloc_op="mpeg2=>top_left")

It should return a 16-bit YV12 clip you can feed to the encoder. I think the chroma location should also be changed before and after resizing because the standard resizer does not use the UHD one.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 21st July 2021, 01:20   #238  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 447
Quote:
Originally Posted by joearmstrong View Post
I confused something. Thanks for the explanation. What is the correct script for HDR gamma-aware resize?

My Idea:
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l",resample_filter="spline36",resample_filter_uv="spline36",approximate_gamma=false)
Spline36Resize(1920,1080)
z_ConvertFormat(pixel_type="YUV422P10",colorspace_op="rgb:linear:2020:l=>2020ncl:st2084:2020:l",resample_filter="spline36",resample_filter_uv="spline36",approximate_gamma=false)
Here version with removed redundant stuff:
Quote:
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084=>rgb:linear",resample_filter="spline36",approximate_gamma=false)
z_ConvertFormat(1920,1080,pixel_type="YUV422P10",colorspace_op="rgb:linear=>2020ncl:st2084",resample_filter="spline36",approximate_gamma=false)
StvG is offline   Reply With Quote
Old 21st July 2021, 05:47   #239  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by StvG View Post
Here version with removed redundant stuff:

Code:
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084=>rgb:linear",resample_filter="spline36",approximate_gamma=false)
z_ConvertFormat(1920,1080,pixel_type="YUV422P10",colorspace_op="rgb:linear=>2020ncl:st2084",resample_filter="spline36",approximate_gamma=false)
I want to add some linear light downscaling examples to the wiki:
  • For 1080p HD (Rec709) content:
    Code:
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:limited=>rgb:linear:709:full", resample_filter="spline36", approximate_gamma=false)
    z_ConvertFormat(width=1280, height=720, pixel_type="YUV420P16", colorspace_op="rgb:linear:709:full=>709:709:709:limited", resample_filter="spline36", approximate_gamma=false)
  • And if for some reason you wanted to resize SD NTSC content:
    Code:
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="470bg:601:170m:limited=>rgb:linear:170m:full", resample_filter="spline36", approximate_gamma=false)
    z_ConvertFormat(width=320, height=240, pixel_type="YUV420P16", colorspace_op="rgb:linear:170m:full=>470bg:601:170m:limited", resample_filter="spline36", approximate_gamma=false)
  • And regular RGB content:
    Code:
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="rgb:srgb:709:full=>rgb:linear:709:full", resample_filter="spline36", approximate_gamma=false)
    z_ConvertFormat(width=1280, height=720, pixel_type="RGBP16", colorspace_op="rgb:linear:709:full=>rgb:srgb:709:full", resample_filter="spline36", approximate_gamma=false)

Is that the correct way of doing it?
Reel.Deel is offline   Reply With Quote
Old 21st July 2021, 09:10   #240  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 447
Quote:
Originally Posted by Reel.Deel View Post
Is that the correct way of doing it?
Yes, the syntax is correct.
"approximate_gamma=false" will dramatically decrease the speed and probably doesn't worth it.
For UHD scaling if there is no chromaloc property, chromaloc_op="top_left=>top_left" should be added to both lines.

Scaling in linear light could easily lead to increased/created haloing. The chance is very high using spline36.

Last edited by StvG; 21st July 2021 at 10:21. Reason: typo
StvG 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 21:17.


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