Motion Detection too slow? - page 21 - Script Writing - CHDK Forum  

Motion Detection too slow?

  • 253 Replies
  • 186971 Views
*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #200 on: 02 / July / 2008, 21:36:14 »
Advertisements
Ah..duh. That should have been obvious. But it brings up another question: How do we know that the previous buffer is the most recent? Was that derived from some insight from the disassembled firmware (per DataGhost's similar thread on the subject)?

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Motion Detection too slow?
« Reply #201 on: 03 / July / 2008, 04:24:41 »
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.

See my earlier shutter speed test post since the hardware is the same:
http://chdk.setepontos.com/index.php/topic,32.105.html
http://chdk.setepontos.com/index.php?action=dlattach;topic=32.0;attach=248

Now, the LEDs are numbered like this:

1  2  3  4  5  6  7
14 13 12 11 10 9  8

First LEDs 12 and 14 are enabled for 60 ms (the "flash"), then they are disabled and at virtually the same time LED1 is enabled for 6 ms. When LED1 is disabled, LED2 is enabled at the same time. After the last LED shuts down, all LEDs are off for 10 seconds. This is when I read the result during shot review (I write down the lowest number led that is shining in the photo).

During the sequence there is no off time. Thus, if I get a shot with no LEDs shining, I know the delay was greater than the entire sequence or 60ms + 14*6ms = 144 ms.

When I say "virtually at the same time", it's all below 400 ns. The ms delays are accurate to about 0.5% or so. The delays are obviously configurable (it's an xtal stabilized uC running code written in C, timing verified on an oscilloscope).

*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #202 on: 03 / July / 2008, 17:56:04 »
For the A720

I've been doing some more looking around and have gotten a very nice improvement in response (from 120 ms to 90ms).

I used DataGhosts advanced memory viewer to check out the addresses I got from mx3's program. I did not find a changing index at the location I had previously posted. Then I scrolled around the memory a bit (after adding some code to read buttons in DataGhost's viewer) and came across a memory location cycling across 0,1,2. (0x2084). I looked around some more in that general area and noticed a location that repeated 3 addresses (0x2148). These addresses corresponded to the three addresses that mx3's find_u32s.exe produces (in the right hand list). I then figured I needed to find the address where these three addresses exist sequentially, which turned out to start at 0x21D0. Note that 0x21D0 is the third address given by mx3's program (see one of my above posts).

So, the following code gives 90ms response on the A720:
Code: [Select]
void *vid_get_viewport_live_fb() {
    void **fb=(void **)0x21D0;
    unsigned char buff = *((unsigned char*)0x2084);
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }
    return fb[buff];
}

I also tested using the current and next index, and both resulted in slower performance.

So, I'd suggest verifyng the memory locations obtained with mx3's program if you're trying to get the fastest response.

Edit: Now that I went through all that, I see that the step that I didn't understand for using mx3's program correctly is to look for the addresses that are right next to each other in memory. The first address is the one you want (0x21D0). However, I'm still in the dark on how to find the index location (other than looking around in the memory viewer).
« Last Edit: 03 / July / 2008, 18:03:42 by Bg~ »

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: Motion Detection too slow?
« Reply #203 on: 03 / July / 2008, 20:51:57 »
That's strange, for now everybody has found base & index addresses distant by 0x10, as you did find before. I looked at this address for my camera, and it is actually cycling throug 0/1/2. I looked around in memory (+- 0x200), and the only address quickly changing I found is 0x6E98, which is cycling through 1/2 and sometimes 4 too.
So I haven't found similar improvement for SD1000 :(


*

Offline Jucifer

  • *****
  • 251
  • [A710IS]
Re: Motion Detection too slow?
« Reply #204 on: 04 / July / 2008, 05:14:41 »
<snip>
[0x000021D0] : 1065A4D0
[0x000021D4] : 106D8DD0
[0x000021D8] : 107576D0
<snip>

and in platform/a720/sub/100c/lib.c:
void *vid_get_viewport_fb()
{
    return (void*)0x1065A4D0; // 0x107D5FD0
}



But for A710:

[0x0000522C] : 105F25E0
[0x00005230] : 10670EE0
[0x00005234] : 106EF7E0

void *vid_get_viewport_fb()
{
    return (void*)0x1055A7E0; //0x105f25e0;
}

Huh?

Also the index really seems to be at 0x522C+0x10=0x523C, verified with freshly patched memory viewer. ;)

*

Offline Bg~

  • *
  • 27
Re: Motion Detection too slow?
« Reply #205 on: 04 / July / 2008, 23:47:38 »
cyril, maybe it's a DryOS thing. Maybe someone with a different DryOS camera could take a look with the memory viewer and verify the index location.

Jucifer, I'm basically poking around in the dark. I've no idea how mx3 and Grand and those guys figure all this stuff out from scratch. :)

*

Offline cyril42e

  • ***
  • 111
  • SD1000/Ixus70 1.02a
    • CR-TEKnologies
Re: Motion Detection too slow?
« Reply #206 on: 05 / July / 2008, 04:48:16 »
cyril, maybe it's a DryOS thing. Maybe someone with a different DryOS camera could take a look with the memory viewer and verify the index location.
Oh yes you are right, I forgot that A720 is DryOS, there are probably some differences in how the memory is organized even with the same code...

Re: Motion Detection too slow?
« Reply #207 on: 18 / July / 2008, 04:56:36 »
Hello,

I think I found the vid_get_viewport_fb values for SD870 / Ixus 860 (mx3's program and comparing in IDA):

Code: [Select]
void *vid_get_viewport_live_fb()
{
    //return (void*)0;//0x10670ee0;
void **fb=(void **)0x8FCC;
    unsigned char buff = *((unsigned char*)0x8E90);
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }
    return fb[buff];
}

For me this works faster than the default. Perhaps someone else could verify this.

Regards,
Chris
IXUS 860IS (SD870)


*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: Motion Detection too slow?
« Reply #208 on: 25 / July / 2008, 03:27:25 »
Been a bit slow on the uptake... Well anyway, the tweak positively confirmed in IXUS950/SD850 1.00c, giving the expected 30ms improvement with the resulting response in the 120-130ms range. This was obtained with DataGhost's java script md_meter.html; johnnythe's utility generally gives "faster" and more scattered results. The patch code reads:
Code: [Select]
void *vid_get_viewport_live_fb()
{
    void **fb=(void **)0x8C58;
    unsigned char buff = *((unsigned char*)0x8C74);
    if (buff == 0) {
        buff = 2;
    }
    else {
        buff--;
    }
    return fb[buff];
}
so whoever feels like/able to, please add to the plant.

Re: Motion Detection too slow?
« Reply #209 on: 10 / September / 2008, 21:29:57 »
hello there everyone...first time poster here. 

Joined yesterday and have spent most of last night, the majority of my day at work today (shh dont tell) and also tonight searching the boards, finding new things to add-on to my S5, and trying to figure things out.  I do, however, unfortunately agree with some other newbies that the boards are tough---many many pages, deleted posts that leave the threads confusing to say the least, and tons and tons of additional updates without a sticky post with the latest and greatest scripts (in their fullest, updates and all).  I am finding it very tedious going through and seeing what was added, where, and why.  Further, im worried im missing parts due to the deleted posts!  Does anyone have a full MD script with all the updates for the S5? Trying to get it as fast as possible!  Also--im willing to test out the speeds i get---is it MD_Test that does that? If so where is it---that seems to have disappeared as well....

anyone able to help out here?  Thank you much in advance!! :-)
Canon PowerShot S5 IS
chdk-fw:101b build:0.5.1-499
motion detect = MDFB-080419-DigicIII

 

Related Topics