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 5th June 2010, 14:42   #1  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
SmoothAdjust [v3.20 - Update 2015/11/15]

Code:
  +-------------------------------------------------------------------------------------------------------+
  |                                                                                                       |
  |   SmoothAdjust plugin: SmoothLevels(), SmoothTweak(), SmoothCurve(), SmoothCustom() & SmoothTools()   |
  |                                                                                                       |
  |                                         v3.20 by "LaTo INV."                                          |
  |                                                                                                       |
  |                                           15 November 2015                                            |
  |                                                                                                       |
  +-------------------------------------------------------------------------------------------------------+



      I.    DESCRIPTION
      II.   DISCLAIMER
      III.  INSTALLATION
      IV.   REQUIREMENTS
      V.    MULTITHREADING
      VI.   USAGE
      VII.  COMMON SETTINGS
      VIII. SMOOTHLEVELS - GENERAL SETTINGS
      IX.   SMOOTHLEVELS - LIMITING SETTINGS
      X.    SMOOTHTWEAK - GENERAL SETTINGS
      XI.   SMOOTHTWEAK - LIMITING SETTINGS
      XII.  SMOOTHCURVE SETTINGS
      XIII. SMOOTHCUSTOM SETTINGS
      XIV.  SMOOTHTOOLS SETTINGS
      XV.   16 BITS SETTINGS
      XVI.  CHANGELOG



 I. DESCRIPTION :
 ================

  SmoothAdjust is a set of 5 plugins to make YUV adjustements:
   - SmoothLevels allows to change levels & gamma with optional limiting
   - SmoothTweak  allows to change brightness, contrast, saturation & hue
   - SmoothCurve  allows to change a plane according to a fixed curve
   - SmoothCustom allows to change a plane according to a custom expression
   - SmoothTools  allows to use all the previous filters in one single pass

  These 5 plugins have a smoothing & dithering algorithm to avoid banding issue.
  Calculations are made in 32bits float to avoid rounding errors and artifacts.
  SmoothAdjust is multithreaded (up to 16 threads) and SSE2/AVX2 optimized.

  For automatic adjustments, see the "AutoAdjust" standalone plugin.



 II. DISCLAIMER :
 ================

  This program is free for non-commercial use only and must be distributed
  in its original form without any modification, including this documentation file.
  This program is provided as-is in the hope it will be useful but 
  without any warranty, including any hypothetical damages or issues.

  The official home page is "http://forum.doom9.org/showthread.php?t=154971",
  it always contains the latest version of this program.
  This page acts as the official support center, also the author is reachable
  through his member page: "http://forum.doom9.org/member.php?u=131032".

  This plugin has required a lot of work and hundreds of coding hours, so if you like
  it and feel the need to reward or inspire the author then please consider donating.
  Donations are a fast, easy and secure operation through Paypal: simply follow the
  link into the "Donate.url" shortcut (you do not need a Paypal account to donate).
  All donations will be very useful and I thank in advance all the generous people,
  also if you are on the doom9's forum please specify your nickname when donating.



 III. INSTALLATION :
 ===================

  There are different versions of SmoothAdjust to suit all installations of Avisynth:
   - x86 builds are for Avisynth 32bits
   - x64 builds are for Avisynth 64bits



 IV. REQUIREMENTS :
 ==================
   
  - Avisynth v2.6.x or Avisynth Plus
  - YUV Planar (Y8, YV411, YV12, YV16, YV24)
  - 8bits or 16bits (MSB/LSB)



 V. MULTITHREADING :
 ===================
  SmoothAdjust is internally multithreaded with official Avisynth version. 
  If AvisynthPlus or AvisynthMT is detected, internal multithreading is automatically disabled
  even if external multithreading isn't used (this can be reactivated in parameters).

  SmoothAdjust is designed to work with external multithreading, so fastest MT mode can be used.
  With AvisynthPlus, this plugin is a MT_NICE_FILTER (automatic register, no need to call SetFilterMtMode).
  With AvisynthMT, SetMtMode(1) must be called before SmoothAdjust.



 VI. USAGE :
 ===========

  - SmoothLevels( input_low, gamma, input_high, output_low, output_high, chroma, limiter, TVrange, preset,
                  Lmode, darkSTR, brightSTR, Ecurve, Ecenter, protect,
                  interp, dither, HQ, useMT, useOPT, debug, screenW, screenH, scale )

  - SmoothTweak( brightness, contrast, saturation, hue1, hue2, limiter, TVrange,
                 Lmode, limitSTR, Ecenter,
                 interp, dither, HQ, useMT, useOPT, debug, screenW, screenH, scale )

  - SmoothCurve( Ycurve, Ucurve, Vcurve, mode, limiter, TVrange,
                 interp, dither, HQ, useMT, useOPT, debug, screenW, screenH, scale )

  - SmoothCustom( Yexpr, Uexpr, Vexpr, limiter, TVrange,
                  interp, dither, HQ, useMT, useOPT, debug, screenW, screenH, scale )

  - SmoothTools( filename,
                 interp, dither, HQ, useMT, useOPT, debug, screenW, screenH, scale )

  - SmoothLevels16(...), SmoothTweak16(...), SmoothCurve16(...), SmoothCustom16(...), SmoothTools16(...) for 16 bits

Last version (2015/11/15): SmoothAdjust v3.20

Old version (for Avs2.5 or WinXP or Wine): SmoothAdjust v2.62


If you really like this filter, please consider donating...
It will help me a lot to continue development and support.
Thanks for all! (link in the .7z package)



v3.20:
updated for Avs v2.6.0 final
fixed AVX2 crash with Win7 without SP1

v3.00:
dropped Avs v2.5.x support
added AVX2 code (10% faster)
modified plugin to be thread-safe (MT_NICE_FILTER)

v2.95:
fixed minor things
tweaked multi-threading code

v2.90:
fixed possible freeze in MT code
added explicit error messages

v2.85:
fixed bugs inside multi-threading code
removed user32 dependency
added AVX2 detection (for future opt)

v2.80:
used new C++11 features
rewritten multi-threading (native)
speed optimization (40% faster)
exception-safe code
added a high quality interpolation mode
changed some parameter names
fixed bugs in SmoothTools parser

v2.62:
fixed minor things & bugs
dropped ICL builds support

v2.60:
used new interface for v2.6.x builds

v2.55:
added small optimizations

v2.51:
fixed crash in SmoothCurve

v2.50:
added SmoothTools
improved SmoothTweak
improved dithering
tweaked memory usage
tweaked multithreading
cleaned various stuff

v2.00:
added Avisynth 2.6.x support
added Y8, YV411, YV16, YV24 support
added 16bits support with stacked MSB/LSB
added SmoothCustom filter
added TVrange parameter
added AVX optimization

improved smoothing algorithm
improved debug view
improved startup delay
improved speed with smoothing OFF

added decimals support in SmoothCurve
fixed interp scaling in SmoothCurve
changed defaults in SmoothLevels
fixed gamma clamping bug in SmoothLevels

fixed crash with mod4 clip
fixed freeze in debug view
deleted Smode parameter
switched from ICL11 to ICL12
cleaned a lot the code
updated the documentation


_

Last edited by LaTo; 15th November 2015 at 16:52.
LaTo is offline   Reply With Quote
Old 5th June 2010, 14:43   #2  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Screenshots of SmoothCurve(show=true) & SmoothLevels(show=true):


* SmoothCurve - Click the image to enlarge *


* SmoothLevels - Click the image to enlarge *

Last edited by LaTo; 6th November 2011 at 19:04.
LaTo is offline   Reply With Quote
Old 5th June 2010, 15:23   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,380
Excellent LaTo, many thanks.

Can you clarify one thing.
Are the 'curves' in SmoothCurve composed of linear segments, or is some sort of non-linear interpolation (eg spline) done?
This example suggests linear.
Quote:
Originally Posted by LaTo View Post
Code:
"0-0;16-0;235-255;255-255" = TV to PC conversion
Gavino is offline   Reply With Quote
Old 5th June 2010, 15:26   #4  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Gavino View Post
Excellent LaTo, many thanks.

Can you clarify one thing.
Are the 'curves' in SmoothCurve composed of linear segments, or is some sort of non-linear interpolation (eg spline) done?
This example suggests linear.
Yes it's only linear at this time
LaTo is offline   Reply With Quote
Old 5th June 2010, 15:50   #5  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,567
So now we have a plugin. Nice, thank you!

P.S.
Oh, I know, I know what we need now -> LSFmod 2.0 -> super fast asm-optimized plugin from LaTo ^__^
Keiyakusha is offline   Reply With Quote
Old 5th June 2010, 15:56   #6  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Keiyakusha View Post
So now we have a plugin. Nice, thank you!

P.S.
Oh, I know, I know what we need now -> LSFmod 2.0 -> super fast asm-optimized plugin from LaTo ^__^
SmoothAdjust is only C code

It's on my todo list to add asm code, but before... I need to learn asm
LaTo is offline   Reply With Quote
Old 5th June 2010, 16:06   #7  |  Link
elguaxo
Registered User
 
elguaxo's Avatar
 
Join Date: Jun 2006
Posts: 260
Thanks!
elguaxo is offline   Reply With Quote
Old 5th June 2010, 17:53   #8  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,567
Quote:
Originally Posted by LaTo View Post
SmoothAdjust is only C code
Oh really? So such speedup only because of avs -> C port... So (probably) there is still place for improvements.

P.S.
Well, then super fast not asm-optimised LSFmod 2.0 from LaTo will be fine!
Keiyakusha is offline   Reply With Quote
Old 5th June 2010, 19:57   #9  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 587
Un grand merci !
I have to wait to test the dithering part of your plugin...
Can it contain a 'shift' of the space like using a combination of different extra mirrored pixels for gradfun2db ? (Like 32 + 28)
MatLz is offline   Reply With Quote
Old 5th June 2010, 20:04   #10  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by MatLz View Post
Can it contain a 'shift' of the space like using a combination of different extra mirrored pixels for gradfun2db ? (Like 32 + 28)
I didn't understand your question but the dithering inside is different from gradfun2db.
GradFun2DB removes band in a video, but this one only prevents banding... So if the banding is already present in the clip, it will not remove it!
It's not the same goal

Last edited by LaTo; 5th June 2010 at 20:31.
LaTo is offline   Reply With Quote
Old 6th June 2010, 14:51   #11  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 587
Quote:
Originally Posted by LaTo View Post
I didn't understand your question
Yeah...my english is so limited

Maybe you will better understand if you read my two posts in this page :
http://forum.doom9.org/showthread.php?t=152127&page=25

(I hope you will )
MatLz is offline   Reply With Quote
Old 6th June 2010, 14:53   #12  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by MatLz View Post
Yeah...my english is so limited

Maybe you will better understand if you read my two posts in this page :
http://forum.doom9.org/showthread.php?t=152127&page=25

(I hope you will )
Ok, it's to remove the edge/border issue?
LaTo is offline   Reply With Quote
Old 6th June 2010, 15:00   #13  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 587
Yes and no, this problem is known since a long time now but mirroring a different number of pixels doesn't give the same effect.
And the combination of the two, in serial or parallele, gives really nice results
MatLz is offline   Reply With Quote
Old 6th June 2010, 15:03   #14  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by MatLz View Post
Yes and no, this problem is known since a long time now but mirroring a different number of pixels doesn't give the same effect.
And the combination of the two, in serial or parallele, gives really nice results
OK, maybe an addition to GF2mod, I will look at this later
LaTo is offline   Reply With Quote
Old 6th June 2010, 15:13   #15  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 587
Quote:
Originally Posted by LaTo View Post
OK, maybe an addition to GF2mod, I will look at this later
Nice!
(When you will have the time to look at that, don't hesitate to pm me, in french of course , to explain me what is the 'technical' reason of these differences)
Thanks.
MatLz is offline   Reply With Quote
Old 6th June 2010, 17:08   #16  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Someone could test this x64 version please? SmoothAdjust-x64.dll

Last edited by LaTo; 6th June 2010 at 17:16.
LaTo is offline   Reply With Quote
Old 6th June 2010, 19:39   #17  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Did only a very quick splash&go test, but the x64 dll it seems to work. (Calling all three filters with default() parameters.)

More later - a thunderstorm is coming up, I'll shut down now.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 6th June 2010, 22:47   #18  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
So far, everything seems to work. No crashes, no garbled output. It works.

However, it seems that the dithered-smoothing operation could need a little more work. Example: Pretty dark Intro of an average DVD show. Target operation: Levels(16,2.6,235,0,255,false).

Source frame:


Results:


The smoothing of the dark blocking isn't as effective as gradfun2db. Also, there is a problem at high-contrast transitions.

(Sorry I didn't cross-check if it's the same with the 32bit build ... funnily, on the new machine the Avisynth64 setup is more complete then the 32bit counterpart...)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 7th June 2010, 07:09   #19  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Update 2010.06.07

v1.02:
added x64 build
fixed a bug in SmoothLevels
LaTo is offline   Reply With Quote
Old 7th June 2010, 07:13   #20  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Didée View Post
So far, everything seems to work. No crashes, no garbled output. It works.

However, it seems that the dithered-smoothing operation could need a little more work. Example: Pretty dark Intro of an average DVD show. Target operation: Levels(16,2.6,235,0,255,false).

Source frame:


Results:


The smoothing of the dark blocking isn't as effective as gradfun2db. Also, there is a problem at high-contrast transitions.

(Sorry I didn't cross-check if it's the same with the 32bit build ... funnily, on the new machine the Avisynth64 setup is more complete then the 32bit counterpart...)
Thanks for report!

Problem with high-contrast transitions should be fixed with 1.02

And I'll add later more options to be more aggressive with smoothing
LaTo 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 23:36.


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