ConvertBits

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(deprecated arguments - see https://forum.doom9.org/showthread.php?p=1831880#post1831880)
m (update for AVS+ r2632)
Line 12: Line 12:
  
 
{{FuncDef
 
{{FuncDef
|ConvertBits(clip, int bits [, bool ''truerange'', int ''dither'', float ''scale'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )}}
+
|ConvertBits(clip, int bits [, bool ''truerange'', int ''dither'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )}}
  
  
Line 18: Line 18:
  
 
{{Func3Def
 
{{Func3Def
|ConvertToFloat(clip, int bits [, bool ''truerange'', int ''dither'', float ''scale'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )
+
|ConvertToFloat(clip, int bits [, bool ''truerange'', int ''dither'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )
|ConvertTo16bit(clip, int bits [, bool ''truerange'', int ''dither'', float ''scale'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )
+
|ConvertTo16bit(clip, int bits [, bool ''truerange'', int ''dither'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )
|ConvertTo8bit(clip, int bits [, bool ''truerange'', int ''dither'', float ''scale'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )}}
+
|ConvertTo8bit(clip, int bits [, bool ''truerange'', int ''dither'', int ''dither_bits'', bool ''fulls'', bool ''fulld'' ] )}}
  
  
Line 30: Line 30:
  
 
:{{Par2|truerange|bool|true}}
 
:{{Par2|truerange|bool|true}}
::'''''Deprecated – use the default value.'''''
+
::''Deprecated – use the default value.''
  
 
{{HiddenAnchor|dither}}
 
{{HiddenAnchor|dither}}
Line 37: Line 37:
 
::Dithering is allowed only for scaling down (bit depth reduction), not up.
 
::Dithering is allowed only for scaling down (bit depth reduction), not up.
 
::Dithering is allowed only for 10-16bit (not 32bit float) sources.
 
::Dithering is allowed only for 10-16bit (not 32bit float) sources.
 
:{{Par2|scale|float|1.0}}
 
::'''''Deprecated – use the default value.'''''
 
  
 
:{{Par2|dither_bits|int|{{Template:FuncArg|bits}}}}
 
:{{Par2|dither_bits|int|{{Template:FuncArg|bits}}}}
Line 77: Line 74:
  
 
:{{Par2|fulls|bool|(auto)}}
 
:{{Par2|fulls|bool|(auto)}}
::'''''Use the default value unless you know what you are doing.'''''
+
::''Use the default value unless you know what you are doing.''
 
::If ''true'' (RGB default), scale by multiplication: 0-255 → 0-65535;
 
::If ''true'' (RGB default), scale by multiplication: 0-255 → 0-65535;
 
::if ''false'' (YUV default), scale by [[wikipedia:Arithmetic_shift|bit-shifting]].
 
::if ''false'' (YUV default), scale by [[wikipedia:Arithmetic_shift|bit-shifting]].
Line 85: Line 82:
  
 
:{{Par2|fulld|bool|{{Template:FuncArg|fulls}}}}
 
:{{Par2|fulld|bool|{{Template:FuncArg|fulls}}}}
::'''''Use the default value unless you know what you are doing.'''''
+
::''Use the default value unless you know what you are doing.''
 
::At the moment, ''must'' match {{FuncArg|fulls}}.
 
::At the moment, ''must'' match {{FuncArg|fulls}}.
  

Revision as of 03:30, 5 March 2018

AVS+
This feature is specific to AviSynthPlus.

It is not supported in other AviSynth versions.


ConvertBits

Changes bit depth while keeping color format the same, if possible.
If the conversion is not possible – for example, converting RGB32 to 16bit – an error is raised.


ConvertBits(clip, int bits [, bool truerange, int dither, int dither_bits, bool fulls, bool fulld ] )


(older bit-depth conversion filters – deprecated)

ConvertToFloat(clip, int bits [, bool truerange, int dither, int dither_bits, bool fulls, bool fulld ] )
ConvertTo16bit(clip, int bits [, bool truerange, int dither, int dither_bits, bool fulls, bool fulld ] )
ConvertTo8bit(clip, int bits [, bool truerange, int dither, int dither_bits, bool fulls, bool fulld ] )


clip   = (required)
Source clip.
bits   = (required)
Bit depth of output clip. Valid values: 8, 10, 12, 14, 16 (integer) or 32 (floating point).
bool  truerange = true
Deprecated – use the default value.
int  dither = -1
If 0, add ordered dither; if -1 (default), do not add dither.
Dithering is allowed only for scaling down (bit depth reduction), not up.
Dithering is allowed only for 10-16bit (not 32bit float) sources.
int  dither_bits = bits
Exaggerated dither effect: dither to a lower color depth than required by bits argument.
Has no effect if dither=-1 (off).
  • Must be an even number from 2 to bits, inclusive.
  • In addition, must be >= (clip.BitsPerComponent-8).
Examples
Conversion   Allowed Values 
16 → 12bit 8, 10, 12
16 → 10bit 8, 10
16 →   8bit 8
14 → 10bit 6, 8, 10
14 →   8bit 6, 8
12 → 10bit 4, 6, 8, 10
12 →   8bit 4, 6, 8
10 →   8bit 2, 4, 6, 8
bool  fulls = (auto)
Use the default value unless you know what you are doing.
If true (RGB default), scale by multiplication: 0-255 → 0-65535;
if false (YUV default), scale by bit-shifting.
Use case: override greyscale conversion to fullscale instead of bit-shifts.
Conversion from and to float is always full-scale.
Alpha plane is always treated as full scale.
bool  fulld = fulls
Use the default value unless you know what you are doing.
At the moment, must match fulls.


Changes

20170310 r2440 parameter dither_bits
20170202 r2420 parameters fulls, fulld
Personal tools