View Single Post
Old 2nd October 2016, 20:19   #203  |  Link
dipje
Registered User
 
Join Date: Oct 2014
Posts: 268
Another thing I noticed in r20. Am I doing something wrong, making wrong assumptions or is there something wrong in fmtconv somewhere?

I read a simple movie file (YUV420P8).

I resample to YUV444P16, use matrix to go RGB48 (from BT709), I transfer to linear, I use primaries to go from 709 to 2020, I transfer from linear to 2048 with a contrast value of 1000.0 / 10000.0 (0.1), then matrix to YUV with BT2020 (non-constant) matrix.

As a test, I do the reverse directly in the script. Matrix to RGB from BT2020nc, transfer to linear from 2084 with a contrast value of 10000.0 / 1000.0 (10.0), I use primaries to go from 2020 to 709, I transfer from linear to regular 709, and I use matrix to go to YUV with BT709 matrix.

The result should be pretty much exact the same as the input (with some rounding errors here and there or something), but what I get is a clear 'levels' difference. It seems as if somewhere in the process there is a 'limited range / full range' mix up. The colors seem right, it's just a little bit of levels / contrast that seems different.

I ended up added 'fulls' and 'fulld' everywhere to make sure it does what I expect it to but I still get the same.

Am I doing wrong? Fmtconv wrong? Or is this just the result from going from 709 to 2084 and back since it's not a pure 1-to-1 mapping or something?

My code copy & pasted to be clear:
Code:
orig = c
c = core.fmtc.resample(c, w = 1920, h = 1080, css = '444', kernel = 'spline36')
c = core.fmtc.matrix(c, fulls = False, fulld = True, mats = '709', col_fam = vs.RGB)
c = core.fmtc.transfer(c, fulls = True, fulld = True, transs = '61966-2-1', transd = 'linear')
c = core.fmtc.primaries(c, prims = '709', primd = '2020')
c = core.fmtc.transfer(c, fulls = True, fulld = True, transs = 'linear', transd = '2084', cont = 1000.0 / 10000.0)
c = core.fmtc.matrix(c, fulls = True, fulld = False, matd = '2020', col_fam = vs.YUV)
c = core.fmtc.resample(c, css = '420')
c = core.fmtc.bitdepth(c, fulls = False, fulld = False, bits = 10, dmode = 5)

z = c
z = core.fmtc.resample(z, css = '444', kernel = 'spline36')
z = core.fmtc.matrix(z, fulls = False, fulld = True, mats = '2020', col_fam = vs.RGB)
z = core.fmtc.transfer(z, fulls = True, fulld = True, transs = '2084', transd = 'linear', cont = 10)
z = core.fmtc.primaries(z, prims = '2020', primd = '709')
z = core.fmtc.transfer(z, fulls = True, fulld = True, transs = 'linear', transd = '709')
z = core.fmtc.matrix(z, fulls = True, fulld = False, matd = '709', col_fam = vs.YUV)
z = core.fmtc.resample(z, css = '420', kernel = 'spline36')
z = core.fmtc.bitdepth(z, fulls = False, fulld = False, bits = 8, dmode = 5, ampo = 1, ampn = 1)

# At this moment 'orig' and 'z' look different although they should look pretty much the same I guess
dipje is offline   Reply With Quote