The math behind Iris to Aperture values

Tools of the trade, new plug-ins, log c etc.
Post Reply
Mohamed Selim
Posts: 7
Joined: Tue Aug 16, 2016 12:48 am

Hi,

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/com.arri.camera.LensLinearIris 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?

Thanks
Jan Heugel
Posts: 568
Joined: Wed Aug 13, 2014 3:15 pm
Location: Munich, Germany
Contact:

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]);
           }
           else
           {
                  printf("%.1f + %d/10\n", fNumberScale[fullApertureIdx], apertureTenth);
           }
    }
    else
    {
           printf("out of bounds\n");
    }
}
Here's an example list:
Iris_Example-list.png
Best regards,
Jan
You do not have the required permissions to view the files attached to this post.
Jan Heugel
Application Engineer
Mohamed Selim
Posts: 7
Joined: Tue Aug 16, 2016 12:48 am

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?

Cheers
fpalomares
Posts: 1
Joined: Wed Apr 03, 2024 12:51 am

Hi Arri Team,

So if my LensIris is set to: 2.0 +3/10, what would be the tcl formula to add to a Text node in Nuke?
Could you shed some light please?

Thanks
Jan Heugel
Posts: 568
Joined: Wed Aug 13, 2014 3:15 pm
Location: Munich, Germany
Contact:

Hi

@fpalomares
Why would you reverse this into the LDS-encoder's value?

@Mohamed,
yep that's the code I got for Nuke.


Best,
Jan
Jan Heugel
Application Engineer
Post Reply