Can't complie but have tweaked some coding

Started by garry23, April 09, 2015, 05:18:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


In another post I suggested a tweak to the dof focus reporting and hoped some kind developer would 'magically' tweak things.

I think I was asking too much.

Although I'm not a coder, I thought I would try and make a halfway step, ie do some coding myself.

Here are my simple tweaks to lens.c, plus a global variable would need to be added as a toggle in the DoF menu, ie where you switch dof reporting on and off. I have not been able to do this as I don't know where to look.

Please don't crucify me!!!! I'm trying to learn.

    const uint64_t        coc = 29; // 1/1000 mm
    const uint64_t        coc = 19; // 1/1000 mm
    const uint64_t        fd = info->focus_dist * 10; // into mm
    const uint64_t        fl = info->focal_len; // already in mm

    // If we have no aperture value then we can't compute any of this
    // Not all lenses report the focus distance
    if( fl == 0 || info->aperture == 0 )
        info->dof_near        = 0;
        info->dof_far        = 0;
        info->hyperfocal    = 0;
        info->rel_abs = 1; //This is a global toggle set in DoF menu. 1 = relative reporting, 0 =
// Absolute. This toggle needs adding to the DoF menu as a user input
// with a default of 1

    const uint64_t        fl2 = fl * fl;

    // The aperture is scaled by 10 and the CoC by 1000,
    // so scale the focal len, too.  This results in a mm measurement
    const uint64_t H = ((1000 * fl2) / (info->aperture  * coc)) * 10;
    info->hyperfocal = H;

    // If we do not have the focus distance, then we can not compute
    // near and far parameters
    if( fd == 0 )
        info->dof_near        = 0;
        info->dof_far        = 0;

    // fd is in mm, H is in mm, but the product of H * fd can
    // exceed 2^32, so we scale it back down before processing
    info->dof_near = (H * fd) / ( H + fd ); // in mm
    if( fd >= H )
        info->dof_far = 1000 * 1000; // infinity
        info->dof_far = (H * fd) / ( H - fd ); // in mm
//Check if absolute reporting requested and adjust dofs
   Info->dof_near = fd-dof_near
Info->dof_far = fd+dof_far
// Note a refinement would be to add some text or colour to indicate rel vs abs reporting
// But this is a refinement that isn't needed


Bottom line: once again I hope someone with the ability to compile nightlies will add this simple tweak.


some tips:

- have you tried compiling in the cloud?
- C is case sensitive
- programmers are anal about indentation
- '=' does not mean 'equals?', it means 'set'; '==' means 'equals?'
- you probably don't want to mess with the actual lens_info values, instead just change what is displayed.



Thanks for the prompt feedback.

I'll look into the 'in the cloud' approach...but I hope a kind developer come to be rescue :-)




Looked at 'in the cloud' and is far too complicated for me, plus the 64bit vs 32bit issues.

I think I may be able to achieve what I'm looking for once the scripting engine is up and running, when I can write my own DoF calculations and, hopefully, write large text on the LV screen, as my old eyes have difficulty with the ML small text :-)