View Single Post
Old 2nd January 2012, 15:57   #372  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Mandarinka:

Code:
# 16-bit TV-range -> full range with extra curvature
# s0 = new slope at 0
# c  = length of the curved part, > 0, no specific unit
#
# Matlab code:
# c  = 1/16;
# s0 = 2;
# x = linspace (0, 1, 10001);
# y1 = (x * 219 + 16) / 256; % Scale [0 ; 1]
# t = ((y1*256 - 16) / 219);
# k = (s0-1)*c;
# y2 = ((1+c) - (1+c)*c ./ (t + c)) * k + t * (1 - k);
# plot (x, y1, x, y2); grid on;
Function fslg_remap_luma_search_clip (clip src, float "s0", float "c")
{
	s0 = Default (s0, 2.0)
	c  = Default (c,  1.0/16)

	k = (s0 - 1) * c
	t = "x 4096 - 56064 / 0 1 clip"
	e = String(k)+" "+String(1+c)+" "+String((1+c)*c)+" "+t+" "+String(c)
\		+" + / - * "+t+" 1 "+String(k)+" - * + 65536 *"

	src.Dither_lut16 (
\		yexpr=e,
\		expr="x 32768 - 32768 * 28672 / 32768 +",
\		y=3, u=3, v=3
\	)
}
__________________
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