View Single Post
Old 4th October 2021, 20:39   #35  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,041
Oh - the fmtc require some (undocumented magic) of Avisynth to work as expected:

Code:
return fmtc_transfer(rgb_lin,transs="linear",transd="709",fulls=false, fulld=false).ConvertBits(8,fulls=true,fulld=false).ConvertToRGB()
Now it outputs also
green R'G'B'=16,211,16 and magenta R'G'B' =211,16,211.

Need post request for update docs at http://avisynth.nl/index.php/ConvertBits .

Current HLG monitor function now:
Code:
Function Convert422ToRGB24mon_lin_x4_HLG(clip c)
{
  uc=UToY(c)
  vc=VToY(c)
  uc=UserDefined2ResizeMT(uc,src_left=0.001,uc.width, uc.height, b=105, c=0)
  vc=UserDefined2ResizeMT(vc,src_left=0.001,vc.width, vc.height, b=105, c=0)
  uc=SincLin2ResizeMT(uc, src_left=0, uc.width*2, uc.height, taps=8)
  vc=SincLin2ResizeMT(vc, src_left=0, vc.width*2, vc.height, taps=8)
  yuv444=CombinePlanes(c, uc, vc, planes="YUV", source_planes="YYY", pixel_type="YUV444P10")

# jpsdr_plugin
#  rgb_lin=ConvertYUVtoLinearRGB(yuv444,Color=0,HDRMode=2)
#  rgb_lin=RGBAdjust(rgb_lin,r=3,g=3,b=3)

# avsresize
#rgb_lin=z_convertformat(yuv444,pixel_type="rgbps", colorspace_op="2020ncl:std-b67:2020:l=>rgb:linear:2020:l", nominal_luminance=800)
#rgb_lin=RGBAdjust(rgb_lin,r=3,g=3,b=3)

#fmtconv
  rgb_lin=fmtc_matrix(yuv444,mat="RGB", mats="2020",fulls=false, fulld=false)
  rgb_lin=fmtc_transfer(rgb_lin,transs="hlg",transd="linear",bits=32,fulls=false, fulld=false)
  rgb_lin=RGBAdjust(rgb_lin,r=3,g=3,b=3) 

  rgb_lin=SincLin2ResizeMT(rgb_lin,rgb_lin.width*4, rgb_lin.height*4, taps=16)
#return z_ConvertFormat(rgb_lin, pixel_type="rgbp8", colorspace_op="rgb:linear:709:l=>rgb:709:709:l").ConvertToRGB()
return fmtc_transfer(rgb_lin,transs="linear",transd="709",fulls=false, fulld=false).ConvertBits(8,fulls=true,fulld=false).ConvertToRGB()
# return ConvertLinearRGBToYUV(rgb_lin,Color=2).ConvertToRGB24(matrix="PC.709")  
}
fmtc again wins in sustained levels precision (very small - 1LSB at 8bit at some RGB channels). z_convertformat (very small) better with less visual intensity falling at the green-magenta transient.
jpsdr's plugin is subject to many questions.

And 2 of 3 full-3 primaries changing at transient examples:
Code:
# red-cyan
plY=Blankclip(width = 10, height = 1, pixel_type="Y10").Expr("sx 0 == 240 sx 1 == 252 sx 2 == 283 sx 3 == 359 sx 4 == 418 sx 5 = 495 sx 6 = 545 sx 7 == 548 sx 8 == 548 548 ? ? ? ? ? ? ? ? ?")
plU=Blankclip(width = 5, height = 1, pixel_type="Y10").Expr("sx 0 == 418 sx 1 == 418 sx 2 == 432 sx 3 == 600 606 ? ? ? ?")
plV=Blankclip(width = 5, height = 1, pixel_type="Y10").Expr("sx 0 == 848 sx 1 == 844 sx 2 == 799 sx 3 == 184 176 ? ? ? ?")
tr=CombinePlanes(plY, plU, plV, "YUV", "YYY", pixel_type="YUV422P10")

sust_l=Blankclip(width = 4, height = 1, pixel_type="YUV422P10").Expr("sx 0 == 237 sx 1 == 237 sx 2 == 237 237 ? ? ?","sx 0 == 418 418 ?","sx 0 == 848 848 ?").PointResize(50,1)
sust_r=Blankclip(width = 4, height = 1, pixel_type="YUV422P10").Expr("sx 0 == 548 sx 1 == 548 sx 2 == 548 548 ? ? ?","sx 0 == 606 606 ?","sx 0 == 176 176 ?").PointResize(52,1)

StackHorizontal(sust_l,tr)
StackHorizontal(last,sust_r)
rc=PointResize(width, 100)
# source finishes here, 75% red-cyan transient HLG 10bit 4:2:2

# blue-yellow
plY=Blankclip(width = 10, height = 1, pixel_type="Y10").Expr("sx 0 == 103 sx 1 == 103 sx 2 == 143 sx 3 == 294 sx 4 == 416 sx 5 = 568 sx 6 = 659 sx 7 == 684 sx 8 == 682 682 ? ? ? ? ? ? ? ? ?")
plU=Blankclip(width = 5, height = 1, pixel_type="Y10").Expr("sx 0 == 848 sx 1 == 848 sx 2 == 710 sx 3 == 202 169 ? ? ? ?")
plV=Blankclip(width = 5, height = 1, pixel_type="Y10").Expr("sx 0 == 485 sx 1 == 485 sx 2 == 507 sx 3 == 539 539 ? ? ? ?")
tr=CombinePlanes(plY, plU, plV, "YUV", "YYY", pixel_type="YUV422P10")

sust_l=Blankclip(width = 4, height = 1, pixel_type="YUV422P10").Expr("sx 0 == 103 sx 1 == 103 sx 2 == 103 103 ? ? ?","sx 0 == 848 848 ?","sx 0 == 485 485 ?").PointResize(50,1)
sust_r=Blankclip(width = 4, height = 1, pixel_type="YUV422P10").Expr("sx 0 == 682 sx 1 == 682 sx 2 == 682 682 ? ? ?","sx 0 == 176 176 ?","sx 0 == 539 539 ?").PointResize(52,1)

StackHorizontal(sust_l,tr)
StackHorizontal(last,sust_r)
by=PointResize(width, 100)
# source finishes here, 75% blue-yellow transient HLG 10bit 4:2:2
Looks not very great on simulator but at the monitoring looks better (additionally manually tweaked to look best at monitoring). They are not exist in 'old standard color bars' but possibly useful for testing too.

Last edited by DTL; 4th October 2021 at 21:37.
DTL is offline   Reply With Quote