ConvertBits

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(ConvertBits: 3.7.1. changes, allowed parameters, frame props)
(ConvertBits: bit parameter made optional)
Line 26: Line 26:
 
::Source clip.  
 
::Source clip.  
  
:{{Par2||bits|(required)}}
+
:{{Par2|bits|int|(actual bit depth)}}
::Bit depth of output clip. Valid values: ''8'', ''10'', ''12'', ''14'', ''16'' (integer) or ''32'' (floating point).  
+
::Bit depth of output clip. If provided valid values are: ''8'', ''10'', ''12'', ''14'', ''16'' (integer) or ''32'' (floating point).  
 +
::From 3.7.1 parameter is optional since no bitdepth change is needed when doing only range conversion (fulls-fulld) or artistic dithering (dither_bits<bit depth)
 +
::<3.7.1: required
  
 
:{{Par2|truerange|bool|true}}
 
:{{Par2|truerange|bool|true}}
Line 39: Line 41:
 
::*If ''1'', add [[wikipedia:Floyd–Steinberg_dithering|error diffusion (Floyd-Steinberg)]] dither <sup>[http://forum.doom9.org/showthread.php?p=1838145#post1838145 doom9]</sup>
 
::*If ''1'', add [[wikipedia:Floyd–Steinberg_dithering|error diffusion (Floyd-Steinberg)]] dither <sup>[http://forum.doom9.org/showthread.php?p=1838145#post1838145 doom9]</sup>
 
::Dithering is allowed only for scaling down (bit depth reduction), not up. Bit depth can be kept though if a smaller dither_bits is given.
 
::Dithering is allowed only for scaling down (bit depth reduction), not up. Bit depth can be kept though if a smaller dither_bits is given.
::Until 3.7.1: Dithering is allowed only for 10-16bit (not 32bit float) sources.
 
 
::From 3.7.1: no limit. Note: (behind the scenese) 32 bit float clips are first converted down to 16 (or less if needed) bits, then are further dithered down from this intermediate clip.
 
::From 3.7.1: no limit. Note: (behind the scenese) 32 bit float clips are first converted down to 16 (or less if needed) bits, then are further dithered down from this intermediate clip.
 +
::<3.7.1: Dithering is allowed only for 10-16bit (not 32bit float) sources.
  
 
:{{Par2|dither_bits|int|{{Template:FuncArg|bits}}}}
 
:{{Par2|dither_bits|int|{{Template:FuncArg|bits}}}}
Line 46: Line 48:
 
::Has no effect if {{FuncArg|dither}}=''-1'' (off).
 
::Has no effect if {{FuncArg|dither}}=''-1'' (off).
 
::* from 3.7.1 Arbitrary number from 1 to {{FuncArg|bits}}, inclusive.
 
::* from 3.7.1 Arbitrary number from 1 to {{FuncArg|bits}}, inclusive.
::* until 3.7.1: Must be an even number from ''2'' to {{FuncArg|bits}}, inclusive.
+
::* <3.7.1: Must be an even number from ''2'' to {{FuncArg|bits}}, inclusive.
::* until 3.7.1: In addition, must be >= ({{FuncArg|clip}}.[[Clip_properties#Color_Format|BitsPerComponent]]-8).
+
::* <3.7.1: In addition, must be >= ({{FuncArg|clip}}.[[Clip_properties#Color_Format|BitsPerComponent]]-8).
 
:{{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.''
Line 60: Line 62:
 
::''Use the default value unless you know what you are doing.''
 
::''Use the default value unless you know what you are doing.''
 
::From 3.7.1: can be any combination with {{FuncArg|fulls}}.
 
::From 3.7.1: can be any combination with {{FuncArg|fulls}}.
::Until 3.7.1: ''must'' match {{FuncArg|fulls}}.
+
::<3.7.1: ''must'' match {{FuncArg|fulls}}.
  
  

Revision as of 15:23, 9 December 2021

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 14bit – 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.
int  bits = (actual bit depth)
Bit depth of output clip. If provided valid values are: 8, 10, 12, 14, 16 (integer) or 32 (floating point).
From 3.7.1 parameter is optional since no bitdepth change is needed when doing only range conversion (fulls-fulld) or artistic dithering (dither_bits<bit depth)
<3.7.1: required
bool  truerange = true
Hint: forget it. Deprecated, do not use. Maybe once removed.
When converting from true 10-16 bit formats, truerange=false indicates bitdepth of 16 bits regardless of the 10-12-14 bit format. Not applicable for non planar formats.
int  dither = -1
Dithering is allowed only for scaling down (bit depth reduction), not up. Bit depth can be kept though if a smaller dither_bits is given.
From 3.7.1: no limit. Note: (behind the scenese) 32 bit float clips are first converted down to 16 (or less if needed) bits, then are further dithered down from this intermediate clip.
<3.7.1: 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).
  • from 3.7.1 Arbitrary number from 1 to bits, inclusive.
  • <3.7.1: Must be an even number from 2 to bits, inclusive.
  • <3.7.1: In addition, must be >= (clip.BitsPerComponent-8).
bool  fulls = (auto)
Use the default value unless you know what you are doing.
Default value can come from _ChromaRange frame property
If true (RGB default), scale by multiplication: 0-255 → 0-65535;

Note: full scale U and V chroma is specially handled

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.
From 3.7.1: can be any combination with fulls.
<3.7.1: must match fulls.


ConvertBits writes _ChromaRange frame property (0-full or 1-limited)


Changes

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