ConvertStacked

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Double-Width/interleaved format)
Line 43: Line 43:
 
=== Stacked / lsb ===
 
=== Stacked / lsb ===
 
<div style="max-width:62em" >
 
<div style="max-width:62em" >
 +
  
 
::1st example,
 
::1st example,
Line 55: Line 56:
 
  [[ConvertBits]](8, dither=0) # '0' means on, '-1' means off
 
  [[ConvertBits]](8, dither=0) # '0' means on, '-1' means off
 
</div>
 
</div>
 +
  
 
::2nd example,
 
::2nd example,
Line 67: Line 69:
 
=== Double-Width / interleaved format ===
 
=== Double-Width / interleaved format ===
 
<div style="max-width:62em" >
 
<div style="max-width:62em" >
 +
  
 
::3rd example (F3KDB can work with lsb but Double-Width is faster than lsb),
 
::3rd example (F3KDB can work with lsb but Double-Width is faster than lsb),
 
<div {{BoxWidthIndent|46|4}} >
 
<div {{BoxWidthIndent|46|4}} >
  ## this not needed since neo_f3kdb support HBD, but just for example
+
  ## this not needed since neo_f3kdb support HBD, but just for examples below.
 
  ## 10bit clip here
 
  ## 10bit clip here
  [[ConvertBits]](16, truerange=false)
+
  [[ConvertBits]](16, truerange=false) #convey 10bit clip on 16 bit clip by set truerange=false
 
  '''ConvertToDoubleWidth'''()
 
  '''ConvertToDoubleWidth'''()
 
  [[F3KDB]](Input_Mode=2,Input_Depth=10,Output_Mode=2,Output_Depth=10)
 
  [[F3KDB]](Input_Mode=2,Input_Depth=10,Output_Mode=2,Output_Depth=10)
 
  '''ConvertFromDoubleWidth'''(bits=10)
 
  '''ConvertFromDoubleWidth'''(bits=10)
 
</div>
 
</div>
 +
  
 
== Changes ==
 
== Changes ==

Revision as of 00:31, 14 September 2019

AVS+
This feature is specific to AviSynthPlus.

It is not supported in other AviSynth versions.

Contents


These conversion filters are to allow filters that use 16-bit video in a pseudo-8-bit colorspace aka stacked (or lsb) and interleaved format to interact with AviSyth+ high bit depth formats aka HBD. They are intended to serve as a stopgap until more plugins appear supporting true high bit depth.


Notes

  • In Stack16 aka lsb, the picture is made of two parts: one containing the highest 8 bits (MSB) for each pixel, stacked on top of another containing the lowest 8 bits (LSB). it's used in Dither tools and many others.
  • the Double-Width aka interleaved 16-bit is similar to Stack16, but the MSBs and LSBs are horizontally interleaved which is like Native HBD, and it's faster than lsb. the known examples of it existing in flash3kyuu_deband\F3kdb\f3kdb_dither with input/output_Mode=2, LSMASHSource (not in the last updates since it support HBD) and some dither package functions like Dither_out(), TODO: verify.
  • both can be between 9-16 bits not only 16bit


Syntax and Parameters

ConvertToStacked(clip clip ] ) Accepts a 16-bit (HBD) clip and returns a stacked 8-bit clip.
ConvertToDoubleWidth(clip clip ] ) Accepts a 16-bit (HBD) clip and returns a Double-Width 8-bit clip.

clip  clip =
Source clip. Must be native 16 bit: YUV420P16, YUV422P16, YUV444P16, Y16.


ConvertFromStacked(clip clip, int bits ] ) Accepts a stacked clip and returns a HBD clip.
ConvertFromDoubleWidth(clip clip, int bits ] ) Accepts a Double-Width clip and returns a HBD clip.

clip  clip =
Source clip. Must be YV12, YV16, YV24 or Y8.
int  bits = 16
Bit depth of returned clip. Must match the original bit depth. see the 1st and 3rd example.


Examples

Stacked / lsb


1st example,
## Decoding 10bit, YUV 4:2:0 source
## this is not needed nowadays since LSMASHSource added HBD support
## so nowadays only LWLibavVideoSource(<path>) will did the job
## but just for example, keep in mind that lsb is the slowest 
LWLibavVideoSource(<path>, stacked=true, format="YUV420P10")
ConvertFromStacked(bits=10)
## the line below is only if you need to down to 8bit
ConvertBits(8, dither=0) # '0' means on, '-1' means off


2nd example,
## some 16bit HBD clip here
ConvertToStacked()
Dfttest(lsb_in=true, lsb=true)
ConvertFromStacked()
## Continue filtering with 16bit HBD

Double-Width / interleaved format


3rd example (F3KDB can work with lsb but Double-Width is faster than lsb),
## this not needed since neo_f3kdb support HBD, but just for examples below.
## 10bit clip here
ConvertBits(16, truerange=false) #convey 10bit clip on 16 bit clip by set truerange=false
ConvertToDoubleWidth()
F3KDB(Input_Mode=2,Input_Depth=10,Output_Mode=2,Output_Depth=10)
ConvertFromDoubleWidth(bits=10)


Changes

20170310 r2440 first added
Personal tools