The math behind Iris to Aperture values

Thu Feb 09, 2017 1:14 am


I would like to know how ARRIRAW Converter spits out the "exr/aperture" value which is not detected in the raw file in Nuke for example.

I have read the Metadata white paper and honestly the math is to complicated for me. I would like to build a tool in Nuke to auto convert the Lens Iris values in the raw metadata to an aperture value.

for example i have an ARRIRAW file loaded in ARRIRAW Converter with the following:
- Iris: 5.6+3/10
- Linear Iris: 6272

The same file in Nuke:
- arri/camera/LensIris: 6.21606

EXR converted from ARRIRAW Converter and read in Nuke:
- exr/aperture: 5.65685
- exr/ 6.272

I'm after the aperture value which in this case is 5.65685. How do you convert those Iris or Linear Iris to that number?

Mohamed Selim
Posts: 7
Joined: Tue Aug 16, 2016 12:48 am

Re: The math behind Iris to Aperture values

Thu Feb 09, 2017 3:14 pm

Dear Mohamed,

out of "there's a hundred pages document which you should look at", this is what's relevant for you:

Regular iris values
How to calculate regular Iris values from linear iris values:
Code: Select all
nt16 n = (LinearIris + 50) / 1000;
// now n equals the index + 1 of the correct T-stop without fraction (because n is an integer value)
// +50 is just because of rounding

n -= 1;
// subtract an offset of -1 to get the correct index
double FullAperture = exp2((double)n / 2);

// now calc 2^(n/2). n/2 has to be calculated float, result FullAperature is also floating point
To get the [1/10] of Aperture Stop out of the fraction do the following:
// get the fraction
int16 FractionAperture = (LinearIris + 50) % 1000;

// get the Aperture Tenth
int16 ApertureTenth = FractionAperture / 100;

While the above code is mathematically correct, it does not match the rounding conventions established in film and photography for centuries. A tabled approach prints the more familiar values:

Code: Select all
void printApertureValue(U32 apertureValue)
[i]    // Standard full-stop f-number scale
    // (conventional rounding of sqrt(2.0^N) N=-1,0,1,2,...,16)[/i]
    double fNumberScale[18] = {0.7,1.0,1.4,2,2.8,4,5.6,8,11,16,22,32,45,64,90,128,180,256};
    int linearIris = apertureValue + 50; // + 50 for rounding
    int fullApertureIdx  = linearIris / 1000;
    int fractionAperture = linearIris % 1000;
    int apertureTenth    =  fractionAperture / 100;
    if(0 <= fullApertureIdx && fullApertureIdx < 18)
           if(apertureTenth == 0)
                  printf("%.1f\n", fNumberScale[fullApertureIdx]);
                  printf("%.1f + %d/10\n", fNumberScale[fullApertureIdx], apertureTenth);
           printf("out of bounds\n");

Here's an example list:


Best regards,
Jan Heugel
Application Engineer
Jan Heugel
Posts: 297
Joined: Wed Aug 13, 2014 3:15 pm
Location: Munich, Germany

Re: The math behind Iris to Aperture values

Fri Feb 10, 2017 1:07 pm

Hey Jan

Thanks. But the code posted above is exactly what I don't understand. How exactly do you do this on a calculator for instance?

This seems like code you have to do in some keda be of software?

Mohamed Selim
Posts: 7
Joined: Tue Aug 16, 2016 12:48 am

Return to Workflow