DoF values and other related items - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

DoF values and other related items

  • 50 Replies
  • 18253 Views
Re: DoF values and other related items
« Reply #10 on: 20 / November / 2009, 14:14:59 »
Advertisements
I should note that these addresses are in particular for the SX10 103a and that the DryOS/VXWorks function structure comparisons are relative to the A570 101a.

Re: DoF values and other related items
« Reply #11 on: 20 / November / 2009, 15:10:56 »
I should note that these addresses are in particular for the SX10 103a and that the DryOS/VXWorks function structure comparisons are relative to the A570 101a.

Maybe so, but it made it easy for me to find the corresponding function for the SX200IS at location 0xFF92F6F8.

Can you explain in more detail how you found it as similar code occurs at a number of locations.

Re: DoF values and other related items
« Reply #12 on: 20 / November / 2009, 15:33:06 »
I should note that these addresses are in particular for the SX10 103a and that the DryOS/VXWorks function structure comparisons are relative to the A570 101a.
Maybe so, but it made it easy for me to find the corresponding function for the SX200IS at location 0xFF92F6F8.
Can you explain in more detail how you found it as similar code occurs at a number of locations.

The structure for A570 GetFocusLensSubjectDistanceFromLens is:
Code: [Select]
FFE720F4: E92D4010 STMFD SP!, {R4, LR}
FFE720F8: E59F306C LDR R3, =0xC0CC (ffe7216c)
FFE720FC: E24DD004 SUB SP, SP, #0x4
FFE72100: E5932000 LDR R2, [R3]
FFE72104: E3520000 CMP R2, #0x0
FFE72108: E3A01F95 MOV R1, #0x254
FFE7210C: E59F005C LDR R0, =0xFFE70FD0 (ffe72170) **"FocusLensController.c"
FFE72110: 1A000000 BNE FFE72118
FFE72114: EB0161C2 BL FFECA824
FFE72118: EBFFFEB8 BL FFE71C00----->GetFocusLensSubjectDistance
FFE7211C: E1A03800 LSL R3, R0, #0x10
FFE72120: E3730801 CMN R3, #0x10000
FFE72124: E3A02000 MOV R2, #0x0
FFE72128: E1A0100D MOV R1, SP
FFE7212C: E28D0002 ADD R0, SP, #0x2
FFE72130: E1A04823 LSR R4, R3, #0x10
FFE72134: 0A000008 BEQ FFE7215C
FFE72138: EB004F52 BL FFE85E88
FFE7213C: E59F3030 LDR R3, =0x7D8A8 (ffe72174)
FFE72140: E1DD20F2 LDRSH R2, [SP, #0x2]
FFE72144: E5931000 LDR R1, [R3]
FFE72148: E1A02082 LSL R2, R2, #0x1
FFE7214C: E2811F79 ADD R1, R1, #0x1E4
FFE72150: E19130B2 LDRH R3, [R1, R2]
FFE72154: E0633004 RSB R3, R3, R4
FFE72158: E1A03803 LSL R3, R3, #0x10
FFE7215C: E1A00823 LSR R0, R3, #0x10
FFE72160: E28DD004 ADD SP, SP, #0x4
FFE72164: E8BD8010 LDMFD SP!, {R4, PC}

Note that it branches to the "GetFocusLensSubjectDistance" function at address FFE72118.
Now for the SX10, as I noted I figured the address entry points were incorrect and that the correct address for "GetFocusLensSubjectDistance" should be that given for GetCurrentTargetDistance: FF93A3AC.  Searching the disassembly for all references to this address result in 14 instances, so I looked at all 14 instances for similarity to the A570 structure. Inoted that only 2 contained a reference to "FocusLensController.c": FF836170 and FF93A6B8.  Comparing further, I can note that in the FF93A6B8 function, the following the branch to GetCurrentTargetDistance, the R0 value is transferred into R4 for safekeeping while the rest of the function finishes (similar to A570) and the function finishes with the value being restored from R4 back to R0, whereas in the FF836170 function, the branch is followed by a few more branches and the value in R0 is not preserved directly, also, the function doesn't end with a stored register value being restored to R0.  All-in-all, the function at FF93A6B8 seemed to have the most similar operation compared to the A570 reference, so I tested and got the results I was looking for.

Not very scientific, but it seems to have worked.

Re: DoF values and other related items
« Reply #13 on: 20 / November / 2009, 16:18:17 »
Not very scientific, but it seems to have worked.

Unlike my method which a tester tells me has crashed his SX200IS  ;)


Re: DoF values and other related items
« Reply #14 on: 20 / November / 2009, 16:44:06 »
Not very scientific, but it seems to have worked.

Unlike my method which a tester tells me has crashed his SX200IS  ;)
Did a quick disassemble and check.  Try

GetFocusLensSubjectDistance FF92F7E4
GetFocusLensSubjectDistanceFromLens FF92FBC0

These are the same for both 100c and 100d versions.

Re: DoF values and other related items
« Reply #15 on: 20 / November / 2009, 16:47:41 »
Did a quick disassemble and check.  Try

GetFocusLensSubjectDistance FF92F7E4
GetFocusLensSubjectDistanceFromLens FF92FBC0

These are the same for both 100c and 100d versions.

and:
GetCurrentTargetDistance FF8BDCC0 for good measure

Re: DoF values and other related items
« Reply #16 on: 20 / November / 2009, 16:53:19 »
A further clue is to look for a reference to the string "".SubjectDistance=%d".  In DryOS (the ones I've looked at) it seems to only appear once (twice in VXWorks).  The address branched to just before this (typically two instructions previous) should be the entry to GetFocusLensSubjectDistance and work from there.

Re: DoF values and other related items
« Reply #17 on: 20 / November / 2009, 17:41:37 »
Thanks.

I will try that later or tomorrow.

Assuming that it was not coincidence, not sure why the wrong values crashed the camera.

Unless he was looking at the SDM 'Focus Test' OSD that displays focused distance from front of lens and distance to sensor.


Re: DoF values and other related items
« Reply #18 on: 20 / November / 2009, 20:12:05 »
Thanks.

I will try that later or tomorrow.

Assuming that it was not coincidence, not sure why the wrong values crashed the camera.

Unless he was looking at the SDM 'Focus Test' OSD that displays focused distance from front of lens and distance to sensor.

Yes hopefully it should work.  Those functions are virtually identical to the SX10 functions which work fine on CHDK.

Re: DoF values and other related items
« Reply #19 on: 21 / November / 2009, 17:07:51 »
hopefully it should work


Yes it does, thanks.

I guess someone should correct the trunk version.

 

Related Topics