201 - 212 of 212 Posts

#### Mr.D

·
##### Registered
Joined
·
3,314 Posts

Quote:
Originally Posted by sspears /forum/post/17462915

One thing to point out is that 709 does not define the display gamma. This is something that sRGB does do.

Charles Poynton is trying to get a get everyone to agree on a display gamma. He is currently proposing 2.35 as the standard.

I bang it around between 2.2 and 2.5 for checking robustness. I actually prefer towards the higher point for recreational viewing : depending on display.

Actually it would be easier just to stick with 2.2 rigidly as its the oft quoted standard video display gamma. I guess you have to factor in older material though.

In terms of linearising the "proper" way is to throw the inverse of the rec.709 transfer curve at it. The notional display gamma shouldn't come into it. Maybe linearising with a simple gamma should be termed "flattening" instead of "linearising".

#### yesgrey

·
##### Registered
Joined
·
45 Posts

Quote:
Originally Posted by Mr.D /forum/post/17462330

Assume that the rec.709 transfer curve is a valid wrapper for the format and use that as a standard to linearise with.
Quote:
Originally Posted by Mr.D /forum/post/17463109

In terms of linearising the "proper" way is to throw the inverse of the rec.709 transfer curve at it. The notional display gamma shouldn't come into it. Maybe linearising with a simple gamma should be termed "flattening" instead of "linearising".

Mr.D,

I've understood that for linearizing it's preferable to use the inverse of rec.709 transfer function, even though we could never recover the original linear data. However, I'm still missing one thing, and I would like to know if you could help me out with it...

Considering that generally the video is being mastered with black at 16 and white at 235, apparently without any valid data bellow and above that, which values should I use as 0.0 and 1.0 with the inverse of rec.709 transfer function?

If I use 16 as 0.0 and 235 as 1.0, values bellow 16 will be negative and values above 235 will be > 1.0. If I use 0 as 0.0 and 255 as 1.0, all values will be within the 0.0-1.0 range. This is not a problem, but I would like to know which of them should be preferable. Do you have any idea about that?

#### Mr.D

·
##### Registered
Joined
·
3,314 Posts

Quote:
Originally Posted by yesgrey /forum/post/18743930

Mr.D,

If I use 16 as 0.0 and 235 as 1.0, values bellow 16 will be negative and values above 235 will be > 1.0. If I use 0 as 0.0 and 255 as 1.0, all values will be within the 0.0-1.0 range. This is not a problem, but I would like to know which of them should be preferable. Do you have any idea about that?

More often than not its 16-235 in terms of the calculation. However its usually done in float so you preserve the full 0-255 range intact and it flows through back to integer when you "re-gamma". Things like this are very important in post production: transparency.

As to not doing it in float then your only real recourse is to use the maximal data range. The slight difference you will get in terms of pixel interpolation as a result will be tiny (unless you can recalculate the transfer curve accordingly although I think you will end up with a non-reversible transform.

I've said before with video you will likely get 99% of the benefits of linear processing if you use a simple gamma rather than the transfer curve especially with something like scaling and you have the easy reversibility of a simple gamma.

I would recommend preserving the full range at the cost of pixel value perfection for the linearistation stage.

Its important however that you have transparency with your linearisation. You should be able to pop it into linear and back out again with no net difference to the original.

I do often come across film imagery that has a tell tale 10 code value (10 bit log) error indicative of sloppy log/lin/log conversion. With some kit you will get a cumulative rounding error if you employ too many seperate linearisation stages. The good news is that it doesn't get any worse after a certain point.

I never visually reference things in linear . I just do the processing steps I need in linear and then pop back out referencing in the target colorspace. Some people and companies have a solely linear pipeline with film and video being linearised prior to handing to the artists. More and more I come across artists who just do not have a clue when it comes to colorspace as a result. You could argue that its one less thing for the artists to mess up.

Float solves a lot of problems but its a question of whether you want to carry around that amount of data for minimal net improvement.

·
##### Registered
Joined
·
1,687 Posts

Quote:
Originally Posted by yesgrey /forum/post/18743930

If I use 16 as 0.0 and 235 as 1.0, values bellow 16 will be negative and values above 235 will be > 1.0.

This is the correct approach, otherwise the linear section is in the wrong place. One of the advantages of having a linear section is that it is simple to extend the linear section back into the negative space below signal 16 and then the transform can be done cleanly back and forth. With the straight power functions it's not clear what to do with negative numbers but whatever you do you should ensure that if you start with say a 12 signal then after you invert and then reapply you end up with 12 again and don't clip everything to 16. (At the very least this will ensure that test patterns work properly). At the top end there is less problem mathematically with either approach and again you just need to ensure that you get back what comes in.

John

·
##### Registered
Joined
·
8,136 Posts
@Mr.D,

yesgrey's application is an offline-calculation app which aims at creating a "perfect" monstruous 3D lut. For this purpose he already does all his calculations in 64bit float, anyway. So he'll definitely be using float. The only question is:

(1) Does the Rec709 transfer function expect video black to be at 0.0? In this case BTB would be negative numbers. Which should not be a problem. In this case the linear segment of the transfer function would be in the lower IREs of the visible range.

(2) Does the Rec709 transfer function expect video black to be at 16.0/255.0? In this case the linear segment of the transfer function would be burried in the BTB area. Which somehow doesn't make much sense to me, personally. Why using a linear segment, if it's burried in BTB?

You have a good point about reversibility, though. IMHO the junction point of the linear and power segments of the transfer function is not properly defined. I mean if you feed the border value (at which the segments meet) into the linear and into the power functions, you don't get the same result. Which means that this 2-part transfer function is not propery reversible. @yesgrey, maybe that's one of the causes for the problems you currently have? I think the transfer function needs to be adjusted so that the linear and power segments properly merge into each other. That way reversibility would be restored, I think.

·
##### Registered
Joined
·
1,687 Posts

Quote:

IMHO the junction point of the linear and power segments of the transfer function is not properly defined. I mean if you feed the border value (at which the segments meet) into the linear and into the power functions, you don't get the same result.

You have to make it a continuous function by using the unrounded values see "Theory of the transformation" in
http://en.wikipedia.org/wiki/SRGB

I start with gamma and K0 and solve for phi and alpha so that the discontinuity is removed.

John

·
##### Registered
Joined
·
8,136 Posts

Quote:

You have to make it a continuous function by using the unrounded values see "Theory of the transformation" in
http://en.wikipedia.org/wiki/SRGB

I start with gamma and K0 and solve for phi and alpha so that the discontinuity is removed.

Ah - thanks! Not sure, maybe yesgrey is already doing that. It's not really my area of expertize...

#### yesgrey

·
##### Registered
Joined
·
45 Posts

Quote:
Originally Posted by Mr.D /forum/post/18745402

More often than not its 16-235 in terms of the calculation. However its usually done in float so you preserve the full 0-255 range intact and it flows through back to integer when you "re-gamma".
Quote:

This is the correct approach, otherwise the linear section is in the wrong place.

Thanks. This was one of the things I was still missing. I was already trying this approach, but wasn't sure if it was the correct one...

Quote:

I think the transfer function needs to be adjusted so that the linear and power segments properly merge into each other. That way reversibility would be restored, I think.
Quote:

You have to make it a continuous function by using the unrounded values see "Theory of the transformation"

It's funny, I already have added this as an option in my program, but now I realize it shouldn't be an option, it should be a must.

Only recently I've realized that all the values used in the formulas indicated in the standards are only rounded values, so we should not take them exactly as our reference...

Thank you all for the help.

#### yesgrey

·
##### Registered
Joined
·
45 Posts

Quote:

I start with gamma and K0 and solve for phi and alpha so that the discontinuity is removed.

Any special reason?

Why not starting with gamma and alpha and calculate k0 and phi like in the article? Doing this only the linear segment will change, while with your way both linear segment and the power curve are affected, but the transition point is kept.

·
##### Registered
Joined
·
1,687 Posts

Quote:
Originally Posted by yesgrey /forum/post/18748496

Any special reason?
not sure I can remember exactly why I made that choice, as you point out I probably felt that the exponent and transition point where more important than the other varaibles, certainlt amny differences will not lead to measurable differences in output, the important thing is that it's continuous and as smooth as possible which either approach gives.

John

#### yesgrey

·
##### Registered
Joined
·
45 Posts

Quote:

I probably felt that the exponent and transition point where more important than the other varaibles

Yes, I think you might be right and that would be preferable to keep the transition point and treat all values in the original regions with the same kind of formula. Of course this only makes sense if the standard formula was used for the encoding...

#### ChuckZ

·
##### Registered
Joined
·
1,071 Posts
I thought this little blurb might add something to the discussion:

What is super-resolution?

In a nutshell, motion-interpolated scaling!

201 - 212 of 212 Posts