EOS M3 porting - page 46 - DryOS Development - CHDK Forum  

EOS M3 porting

  • 746 Replies
  • 417563 Views
*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #450 on: 10 / February / 2018, 14:02:54 »
Advertisements
(those settings likely only influence the video stream properties, not the sensor setup).
Some sensor and video timer settings can be found in fdl tables(for EOS M3 see 0xFC426F4C). I was trying to swap them(to get 30 fps instead 24) but with no success.

Quote
Full HD 60p is likely not implemented (it's not in 750D/760D which appears to use a similar sensor).
I know it. But I'm not sure is this because of technical limitations or marketing.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #451 on: 11 / February / 2018, 08:35:21 »
@Ant
For 101a, the movie recording time limit seems to be defined by this
Code: [Select]
FC140606    movw    r9, #0x707
Unfortunately, it's in a very long routine (that btw appears to do all sorts of initialization, res and bitrates), and it's used calculate more than one limit.

I've got an error while trying to reproduce this long function (fc140028):
Code: [Select]
movie_rec.c \-> movie_rec.o
D:\WINDOWS\Temp\ccQBT8ct.s: Assembler messages:
D:\WINDOWS\Temp\ccQBT8ct.s:666: Error: value of 265 too large for field of 1 bytes at 1370
make[1]: *** [movie_rec.o] Error 1
make: *** [all-recursive] Error 1
The source code was taken from capdis output.
Unfortunately, temporary *.s file is deleted after compilation stops.
Any help?

« Last Edit: 11 / February / 2018, 08:44:41 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: EOS M3 porting
« Reply #452 on: 11 / February / 2018, 08:52:55 »
I've got an error while trying to reproduce this long function (fc140028):
Code: [Select]
movie_rec.c \-> movie_rec.o
D:\WINDOWS\Temp\ccQBT8ct.s: Assembler messages:
D:\WINDOWS\Temp\ccQBT8ct.s:666: Error: value of 265 too large for field of 1 bytes at 1370
make[1]: *** [movie_rec.o] Error 1
make: *** [all-recursive] Error 1
The source code was taken from capdis output.
Unfortunately, temporary *.s file is deleted after compilation stops.
Any help?
My guess: the jumptable in question is already very close to its capabilities (largest index byte is 0xfc). If you added code within the reach of the table, you exceeded the reachable range. Convert the table to use tbh instruction.
If you did not add any code, the compiler may have used larger instructions here and there, causing the same issue.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #453 on: 11 / February / 2018, 09:08:09 »
Convert the table to use tbh instruction.
Thanks. This was helpfull:
Code: [Select]
"    tbh     [pc, r3]\n" // (jumptable r3 22 elements)
"branchtable_fc1400dc:\n"
"    .short((loc_fc140280 - branchtable_fc1400dc) / 2)\n" // (case 0)
...

I did not try to increase the limit but the it's decreasing works well.
« Last Edit: 11 / February / 2018, 09:39:03 by Ant »


*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #454 on: 11 / February / 2018, 10:36:31 »
However, when I attempted to change these (still on sx280), video recording failed to start and eventually the camera crashed with E09.

On M3 these values can not be encreased too much. In this case the movie timer stops at 0" and "Memory card error" occures later.
At the moment I managed to increase the average bitrate from 22 to ~40 Mb/s (1080p25 mode).
Maybe there are limitations somewhere else.
« Last Edit: 11 / February / 2018, 12:16:38 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: EOS M3 porting
« Reply #455 on: 11 / February / 2018, 14:40:03 »
However, when I attempted to change these (still on sx280), video recording failed to start and eventually the camera crashed with E09.

On M3 these values can not be encreased too much. In this case the movie timer stops at 0" and "Memory card error" occures later.
At the moment I managed to increase the average bitrate from 22 to ~40 Mb/s (1080p25 mode).
Maybe there are limitations somewhere else.
It appears to work for me too (still sx280). Previously, I was experimenting in 1080p60 mode where all my changes ended up crashing the camera.
Now I changed the 1080p30 bitrate (used the 1080p60 values), and that worked.
So, it appears that some limited movie mode support is possible.
In the same function, there is a constant that appears to correspond to the audio bitrate (128000 on my cam). Did not try to play with that yet.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #456 on: 11 / February / 2018, 17:51:51 »
So, it appears that some limited movie mode support is possible.

Did you found the address of current bitrate to display it during movie recording.

*

Offline srsa_4c

  • ******
  • 4451
Re: EOS M3 porting
« Reply #457 on: 12 / February / 2018, 13:57:32 »
Did you found the address of current bitrate to display it during movie recording.
I have not found anything like that so far.
The CHDK bitrate display relies on filesystem (free space) information. Unfortunately, that does not update during video recording on DIGIC 6 cameras.

For current bitrate, there are a few places one might look at.
- The ARM side movie record related tasks (not only task_MovieRecord, there are tasks with "tric" in their name, and possibly others).
- The audio/video codec & muxer core's memory. Its firmware is above 0xe00000 (sx280, m10), its work RAM seems to be above 0xf00000 (only checked on sx280). This is another Xtensa variant (many things suggest so), configured as big endian. I have not been able to decode its instructions, except for one (retw.n: 0xd1, 0x0f).
On the sx280, a large part of the 0xe00000 - 0xf00000 region has also ARM code and data - I don't know which core uses that.
edit: when recording video, the task that writes to the card is TskCocoa0 on the sx280. "Cocoa" seems to be the ARM side interface to the audio/video codec and muxer system running on the dedicated core.

I think I found another bit of information:
Code: [Select]
    FC1403C4 4F F0 29 0B   mov.w     r11, #0x29
...
    FC140442 2A 20         movs      r0, #0x2A
These constants (there might be more, watch the offset they get written into) seem very much like h.264 levels multiplied by 10.
« Last Edit: 13 / February / 2018, 12:51:26 by srsa_4c »


*

Offline srsa_4c

  • ******
  • 4451
Re: EOS M3 porting
« Reply #458 on: 25 / February / 2018, 13:58:46 »
Did you found the address of current bitrate to display it during movie recording.
After some detective work, I found something that I think we could use as bitrate information.
There is a function identified by the string "APENDSTRM". Its address can be found right before that string (it's in a table that gets copied to RAM).
Among other things, it gets a list of chunks that need to be written to card. If you sum up the chunk sizes, you get the amount of data written to card in that pass. Bitrate can be calculated from that.
On the sx280 I did the following (excerpts only, to give an idea):
Code: [Select]
void __attribute__((naked,noinline)) sub_fc02167a_my() { // "APENDSTRM"
asm volatile (
"    push    {r4, lr}\n"
"    mov     r4, r0\n"
"push   {r0}\n"             // +
"ldr    r0, [r0, #8]\n"     // +
"ldr    r0, [r0, #4]\n"     // +
"bl     getchunkinfo\n"     // +
"pop    {r0}\n"             // +
"    ldr     r0, [r0, #8]\n"
"    ldr     r1, [r0, #4]\n"
"    ldr.w   r0, [r4, #0xe0]\n"
"    bl      sub_fc0290fc\n"
"    cmp     r0, #0\n"
"    str     r0, [r4, #0x14]\n"
"    bne     loc_fc02169e\n"
"    ldrb.w  r1, [r4, #0xa8]\n"
"    add.w   r0, r4, #0x9c\n"
"    bl      sub_fc0291de\n"
"    str     r0, [r4, #0x14]\n"
"loc_fc02169e:\n"
"    pop     {r4, pc}\n"
);
}
Code: [Select]
void getchunkinfo(int *r0) {
    if (mybadr > MYBUFEND-4096)
        return;
    int m;
    m = *r0; // num of chunks
    mybadr += sprintf((char*)mybadr,"%d chunks\n",m);
    int *cl = (int*)(*(r0+1));
    while (m>0) {
        mybadr += sprintf((char*)mybadr," addr %x, size %x, unk %x\n",*cl,*(cl+1),*(cl+2));
        cl+=3;
        m--;
    }
}
I replaced APENDSTRM's func pointer in RAM with a pointer to my replacement function.
Structs may differ on other cameras.
Example log (first APENDSTRM call):
Code: [Select]
6 chunks
 addr 161450, size 8, unk 1
 addr 161458, size 8, unk 1
 addr 61d0000, size 1fc5, unk 1
 addr 62d0000, size 1ee1ac, unk 1
 addr 61d1fc5, size 1ec3, unk 1
 addr 64be1ac, size 10dfbc, unk 1

Re: EOS M3 porting
« Reply #459 on: 20 / March / 2018, 20:22:56 »
Hello, new to chdk.   

I have an M3 (1.2.0 firmware) I'd like to use w/ motion detection, probably with the 22mm or 28mm lens to capture mason bees as they hatch and come out of their hotel.  I'll setup the camera on a tripod and leave it there for a long time on a/c power.

Will this work?  Is there a recommended motion detection script for the M3?

Thank you


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal