Motion Detection too slow? - page 20 - Script Writing - CHDK Forum supplierdeeply

Motion Detection too slow?

  • 253 Replies
  • 187075 Views
Re: Motion Detection too slow?
« Reply #190 on: 29 / April / 2008, 08:14:00 »
Advertisements
Point taken ;-)

I presume Mr. Fife did not "go gently into the good night".

Thanks!
Steve

*

Offline oidipos

  • *
  • 1
  • SD 800 IS / IXUS 850
    • herzhirnhand.de
SD800 IS / IXUS850: sub 100ms lag time
« Reply #191 on: 29 / June / 2008, 02:51:45 »

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: Motion Detection too slow?
« Reply #192 on: 29 / June / 2008, 16:36:30 »
Good work oidipos, mx3 and DataGhost!

It works on ixus70_sd1000 too, with addresses 0x6F8C (array) and 0x6F9C (index) (found in _LiveImage.c__520+0x364, LDR R3, =0x6F9C | LDR R2, =0x6F8C | LDRB R0, [R3] | LDR R1, [R2,R0,LSL#2]).

I had lags from 120 to 180ms, and only 120 to 140ms with this mod, and 160 to 180ms without decrementing the index (using MD-test found somewhere on this forum).

But I still don't know why my digicIII camera sucks like that and cannot go below 100ms :(

*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #193 on: 01 / July / 2008, 21:32:10 »

It works on ixus70_sd1000 too, with addresses 0x6F8C (array) and 0x6F9C (index) (found in _LiveImage.c__520+0x364, LDR R3, =0x6F9C | LDR R2, =0x6F8C | LDRB R0, [R3] | LDR R1, [R2,R0,LSL#2]).

cyril42e,

Where would I find this info for an A720? Where is _LiveImage.c__ from?

Edit: I see that string in the A720 firmware, but I don't have IDA Pro. Are there other options?
« Last Edit: 01 / July / 2008, 21:35:11 by Bg~ »


*

Offline mx3

  • ****
  • 372
Re: Motion Detection too slow?
« Reply #194 on: 02 / July / 2008, 01:23:50 »
Edit: I see that string in the A720 firmware, but I don't have IDA Pro. Are there other options?

you can try this my lazy method
skype: max_dtc. ICQ: 125985663, email: win.drivers(at)gmail, eVB decompiler

*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #195 on: 02 / July / 2008, 08:39:51 »
Edit: I see that string in the A720 firmware, but I don't have IDA Pro. Are there other options?

you can try this my lazy method

Thanks mx3. I'm going to quote it again and mention that the find_diffs.bat and zzz.bar are in the attachment below mx3's post (since it took me a bit to figure that out).  :)


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Motion Detection too slow?
« Reply #196 on: 02 / July / 2008, 16:38:54 »
Okay, I got the speedup to work on my a570is. Using my MDFB-080419-DigicIII.bas with default settings (apart from 4s review for readout) and my dusty LED blinker I used a few months back for these things, I now got the following MD response times (statistics from 3 separate sets of 32 consecutive detections, all successful, 96 shots in total):

fastest: 81 ms +- 3 ms
slowest: 111 ms +- 3 ms
median: 87 ms
average: 90 ms

Only 4 shots out of 96 were slower than 99 ms +- 3 ms.
56% of the shots reacted at 87 ms +- 3 ms or faster.

This is a significant improvement over current trunk. The fastest response time didn't improve (of course), but the distribution is now much tighter. It used to go up to 150 ms or more and have average and median a couple of tens of ms higher (I also re-checked with a recent unpatched build and it performed like in my old measurements, so I didn't repeat them).

It looks like my old dumps in this thread were useful after all (http://chdk.setepontos.com/index.php/topic,405.msg3451.html#msg3451)... I grabbed trunk 430 and patched platform/a570/sub/100e/lib.c with the function in oidipos's post above using adresses 0x65CC and 0x65DC (diff below).

Code: [Select]
24,26c24,33
< void *vid_get_viewport_live_fb()
< {
<     return (void*)0x0;
---
> void *vid_get_viewport_live_fb() {
>     void **fb=(void **)0x65CC;
>     unsigned char buff = *((unsigned char*)0x65DC);
>     if (buff == 0) {
>         buff = 2;
>     }
>     else {
>         buff--;
>     }
>     return fb[buff];

*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #197 on: 02 / July / 2008, 17:33:39 »
A720IS
Code: [Select]
CRW_0001.jpg is the dark frame ram dump.

find_diffs CRW_0001.JPG CRW_0002.JPG 10 6400 > 720.regions.txt

(0x00658BD0 + 0x1900 = 0x0065A4D0) bytes: 3F480
(0x006D74D0 + 0x1900 = 0x006D8DD0) bytes: 3F480
(0x00755DD0 + 0x1900 = 0x007576D0) bytes: 3F480

find_u32s CRW_0001.JPG CRW_0002.JPG 1900 0065A4D0 006D8DD0 007576D0 1065A4D0 106D8DD0 107576D0> 720.refs


[0x000020DC] : 1065A4D0
[0x00002148] : 107576D0
[0x000021D0] : 1065A4D0
[0x000021D4] : 106D8DD0
[0x000021D8] : 107576D0
[0x0000930C] : 107576D0
[0x00009338] : 107576D0
[0x0000933C] : 107576D0
[0x0000937C] : 1065A4D0
[0x00018434] : 1065A4D0
[0x000184A8] : 1065A4D0
[0x000184B4] : 1065A4D0
[0x00018560] : 1065A4D0
[0x000418D8] : 1065A4D0
[0x000B0428] : 1065A4D0
[0x000C5738] : 1065A4D0
[0x00187298] : 1065A4D0
[0x00304008] : 107576D0
[0x00304908] : 1065A4D0
[0x003140E0] : 106D8DD0
[0x003140E4] : 106D8DD0

This works for the A720IS. I'll do a speed test comparison shortly.

Code: [Select]
void *vid_get_viewport_live_fb() {
    void **fb=(void **)0x20DC;
    unsigned char buff = *((unsigned char*)0x20EC);
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }
    return fb[buff];
}
« Last Edit: 02 / July / 2008, 17:47:19 by Bg~ »


*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #198 on: 02 / July / 2008, 18:42:58 »
Well I get very consistent 120ms response with MD_B. With the unmodified code, i get between 100ms and 160 ms (A720). I'll try fudgey's script later. What are you using for testing your response time, fudgey? I'm using jonnythe's program.

One thing I don't quite understand is why the code speeds up the response. I know about the three live images buffers updated sequentially, but
Code: [Select]
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }

doesn't select any specific buffer, it just cycles through them. How do we know that it's using the latest buffer?

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: Motion Detection too slow?
« Reply #199 on: 02 / July / 2008, 21:09:37 »
One thing I don't quite understand is why the code speeds up the response. I know about the three live images buffers updated sequentially, but
Code: [Select]
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }
doesn't select any specific buffer, it just cycles through them. How do we know that it's using the latest buffer?

Because of this right before:
Code: [Select]
unsigned char buff = *((unsigned char*)0x20EC);
So it doesn't cycle through the buffers, it takes the previous one (which is the latest).
Could have been written:
Code: [Select]
void *vid_get_viewport_live_fb() {
    void **fb=(void **)0x20DC;
    unsigned char buff = (*((unsigned char*)0x20EC) - 1 + 3) % 3;
    return fb[buff];
}
(But I have to admit that I had the same reaction than you the first time I read this code :D)
« Last Edit: 02 / July / 2008, 21:12:46 by cyril42e »

 

Related Topics