Quote:

Originally Posted by

**ADU**
Natural log of (normalized) output divided by natural log of (normalized) input is the only way I know to compute gamma (point or otherwise), as it's defined here...

__http://en.wikipedia.org/wiki/Gamma_correction__
That should give you the slope on a

__log-log__ plot for each point, if the gamma is not constant. If you think there's another way to calculate it, you'll have to explain it to me.

I'll give it a go

I'll use P(f,x) to denote a point gamma function P with arguments f and x. Think of it as meaning

*"the point gamma of function f at point x"*. And let's use f(x) to denote an arbitrary function that relates luminance to digital video level. f(x) could be the Rec. 709 OETF, or its inverse, or the BT.1886 function, etc. In short, any function we would like to find the point gamma of at various points along its curve. The type of point gamma you have used can be defined as follows:

1. P(f,x) = Log(f(x))/Log(x)

*Note: you can interpret Log(x) as the natural logarithm of x if you so wish, but there is no particular assumed base because a change of base makes no difference to the value of the formula above. *
Another definition for P(f,x) we could use is, in written English,

*"the gradient of the log-log plot of f(x) at x"*. If you look at some posted graphs, that is clearly the implied definition. I've derived the following formula for that type of point gamma:

2. P(f,x) = x f'(x)/f(x)

*Note: that yields the gradient of the log-log plot of f(x) at the point (Log(x),Log(f(x))) in that plot.*
If you would like the derivation, I can supply that on request, but I'll omit it for the sake of brevity now. Now we can ask whether the two definitions for P(f,x) are equivalent. That is, can we choose either one and get the same result? In general the answer the answer is "no". I will come back to that later. First let's examine a case where the two definitions

*do* give the same result. Let f(x) be a simple power law "gamma function":

f(x) = x^k

k is an arbitrary constant, but it could be 2.4. And I've used scare quotes above, because there is a

gamma function Γ used in mathematics that is completely different to what we are discussing here. I am, therefore, not really keen on the name "gamma function", but you know what I'm referring to. So let's calculate P(f,x) using the two definitions above.

1. P(f,x) = Log(f(x))/Log(x) = Log(x^k)/Log(x) = k Log(x)/Log(x) = k

2. P(f,x) = x f'(x)/f(x) = x k x^(k-1)/x^k = k x^k/x^k = k

So, for that particular gamma function f(x), the two definitions yield the same result, which is the exponent k in x^k. Now, let's consider a different gamma function f(x):

f(x) = k

Again, k is an arbitrary constant, but we could suppose it is any number in the interval from 0 to 1. The function f(x) is a bit silly and I could have chosen more realistic functions, but let's not complicate matters unnecessarily. Again, we calculate P(f,x) using the two definitions:

1. P(f,x) = Log(f(x))/Log(x) = Log(k)/Log(x)

2. P(f,x) = x f'(x)/f(x) = x 0/k = 0

Two different results! It should be clear now that the two formulae for P(f,x) do not give the same result for all functions f(x). Where they agree, f(x) is a solution of this equation:

3. f'(x) = f(x) Log(f(x))/(x Log(x))

I am not entirely sure, but I think the only solutions f(x) of equation 3

*are* of the form x^k. But, of course, we would like to use point gamma to find the effective gamma for other functions of a different form to that - that is largely the point of point gamma. And if - as appears to be the case - the two definitions for P(f,x) give different results, then we need to know which to choose.

Quote:

Originally Posted by

**ADU**
IMO, the blue curve on this sRGB plot at the above Wikipedia Gamma link is wrong btw, because it represents the "point gamma" (apparently) as constant below the break point.

I'm not sure how the above plot was computed, but based on my math, the sRGB decoding transfer function has a gamma of about 1.8 at the break point (which is 4.045% stimulus or .0031 relative luminance). The gamma approaches 1.0 as you get closer to a 0% stimulus, as shown on this graph posted by Joel B. of SpectraCal...

I have produced my own plot:

The constant gamma in the plot is a consequence of the lower luminance part of the Rec. 709 OETF being linear. If we let f(x) be the inverse of that part of the function then:

f(x) = x/4.5

Applying definition 2 for P(f,x), the log-log plot gradient is as follows:

2. P(f,x) = x f'(x)/f(x) = (x/4.5)/(x/4.5) = 1

You are not getting that because your definition of point gamma is not the same as the log-log plot gradient definition.

Cheers.