FPS control - page 3 - General Discussion and Assistance - CHDK Forum
supplierdeeply

FPS control

  • 36 Replies
  • 18115 Views
Re: FPS control
« Reply #20 on: 30 / June / 2014, 16:53:04 »
Advertisements
I'm trying to learn and replicate the FPS Control funnel achieved here using my SX220HS-101e. (It's needed for the speed camera project).

I've successfully managed to override the fps on my sx220 100a.
I'm stuck on the code responsible for disabling the audio and any help would really be appreciated. At this point, I can slow the FPS for just a few seconds but then the camera crashes (even before the recording is stopped), I suspect due to the audio not being disabled.

Would anybody be able to give me some pointers on how I can troubleshoot this? How can I verify that the ram location funnel used to disable audio is the same on the 101e version?

The slow motion video mode on sx220 is limited to 640x480 so I needed to find a way to disable the audio to be able to use higher resolutions with fps overrides. This was the hardest part but I got lucky.

To do it we have to:
-modify a ram location(*(0xC2E3C+0x8)=0) in the right place in movie_rec.c task to prevent the audio being written.
-start recording and call a function that effectively disables the AudioIC and prevents a crash after the recording stops.

I found the function by backtracing 0xC0920000+0x118(audio on/off flag)  to the movie record task.
Here's what I've done so far:
  • set up a working cross-compiler on Ubuntu 1404 (x86) using the German pre-built version
  • SVN the latest trunk code
  • applied funnel's changes to /platform/sx220hs/sub/101b/movie_rec.c
  • added entry for disable_audio to /include/conf.h
  • compiled and ran a new DISKBOOT.BIN
  • changed camera version references in his fpscontrol.lua script from 100a to 101b
  • ran the fpscontrol.lua script with default values (camera on 720p Movie mode)

Ultimately, I need to mute the audio and reduce the FPS on a CCD camera (e.g. SX200) but I wanted to start with something very similar to what funnel used first to lower the learning curve slightly. Unfortunately disassembly isn't something I've done before but I'm keen to learn.


*

Offline srsa_4c

  • ******
  • 4451
Re: FPS control
« Reply #21 on: 30 / June / 2014, 18:11:18 »
  • set up a working cross-compiler on Ubuntu 1404 (x86) using the German pre-built version
  • SVN the latest trunk code
  • applied funnel's changes to /platform/sx220hs/sub/101b/movie_rec.c
  • added entry for disable_audio to /include/conf.h
  • compiled and ran a new DISKBOOT.BIN
  • changed camera version references in his fpscontrol.lua script from 100a to 101b
  • ran the fpscontrol.lua script with default values (camera on 720p Movie mode)
You can find function addresses in funcs_by_name.csv (but you likely already fixed all addresses in the script too). From a quick look, the fw variable responsible for audio mute is the same in 100a and 101e, and so is the "function that disables the AudioIC". Funnel forgot to publish the conf-related parts, so that's up to you (config IDs have changed since 2012). If you're not sure whether conf.disable_audio is effective, change
( (int)conf.disable_audio == 1)
to
( 1 )
(or if you now C, you know what to do).
Disclaimer: I've never tried this.

Re: FPS control
« Reply #22 on: 30 / June / 2014, 19:45:21 »
Thanks for the quick reply srsa_4c !

Your suggestion about the config IDs sounds like it's right on the money. I had only added one line to conf.h inside the typedef struct:
Code: [Select]
int disable_audio;

Re: FPS control
« Reply #23 on: 04 / July / 2014, 11:35:46 »
If you're not sure whether conf.disable_audio is effective, change
( (int)conf.disable_audio == 1)
to
( 1 )

I tried your suggestion srsa_4c but the audio still won't disable.

I even took it a step further and removed all other references to conf.disable_audio from funnel's changes and created the attached movie-rec.c file. (The unmodfied file is also attached for comparison.) With no changes to any other files, I compiled a new DISKBOOT.BIN, and used a very simple lua script to record a 5 second clip but the audio is still present during playback.

  • Have I missed any other required changes to disable audio?
  • Could the movie_status==4 && *(int*)0x85B8==1) check be preventing sub_FF05BA94 being called?
  • Could the problem lie with the 0xC2E3C address?

Thanks very much for the help!


*

Offline srsa_4c

  • ******
  • 4451
Re: FPS control
« Reply #24 on: 04 / July / 2014, 12:17:05 »
  • Have I missed any other required changes to disable audio?
  • Could the movie_status==4 && *(int*)0x85B8==1) check be preventing sub_FF05BA94 being called?
  • Could the problem lie with the 0xC2E3C address?
Well, not much I can help at this point, as
Disclaimer: I've never tried this.
You can check whether 0x85b8 and 0xc2e3c are used similarly in funnel's and your firmware version (check the asm parts of movie_rec.c). If yes, then these addresses are obviously unchanged and - according to funnel - they should work. You can also check whether movie_status is correct in either ports (see stubs_min.S or stubs_entry.S).
If it still doesn't work, then reverse engineering is required - that consists of
- trying to understand what the firmware code does (assembly skills are required for this one)
- logging some data that helps understanding stuff
- perhaps watching the content of suspicious memory ranges while recording clips with and without audio (the latter means high speed video or miniature mode) - this can be done either with chdkptp and its rmem command or a memory viewer on camera
...
Note that CHDK 1.3 will lock up the camera when
- any file operation is attempted during video recording (that includes loading of scripts and modules)
- you exit ALT mode during video recording
due to a bug.

Re: FPS control
« Reply #25 on: 08 / July / 2014, 10:05:22 »
Thanks again for the help srsa!

You can check whether 0x85b8 and 0xc2e3c are used similarly in funnel's and your firmware version

There is a small section at the very end of movie_rec.c in the 101b code that's missing from the 100a version:
Code: [Select]
//added to fix compiler error
 "loc_FF188A74:\n"
                 "LDR     R0, =0xC2E3C\n"
                 "LDR     R0, [R0,#8]\n"
                 "CMP     R0, #0\n"
                 "BEQ     sub_FF1863B0\n"
                 "BNE     sub_FF05BA94\n"
This  references both the 0xC2E3C value and the sub_FF05BA94 function used to disable audio. Looks like I'll need to find some spare time and assembly skills to figure out the significance of this secion ::)

*

Offline srsa_4c

  • ******
  • 4451
Re: FPS control
« Reply #26 on: 08 / July / 2014, 12:32:49 »
There is a small section at the very end of movie_rec.c in the 101b code that's missing from the 100a version:
Code: [Select]
//added to fix compiler error
 "loc_FF188A74:\n"
                 "LDR     R0, =0xC2E3C\n"
                 "LDR     R0, [R0,#8]\n"
                 "CMP     R0, #0\n"
                 "BEQ     sub_FF1863B0\n"
                 "BNE     sub_FF05BA94\n"
This  references both the 0xC2E3C value and the sub_FF05BA94 function used to disable audio.
Even so, this is just a copy of the firmware code without any changes. The solution used in the 100a port is equivalent (those 2 lines referencing sub_FF188A74 with "loc to sub" comment).
I'm starting to think that funnel forgot to publish some details... Another possibility is that there's a bug in the 101b port - it was done by fixing up differing addresses by hand which can result in typos and unnoticed changes.
Does his script work for you in the silent movie modes?

Re: FPS control
« Reply #27 on: 08 / July / 2014, 14:43:04 »
Does his script work for you in the silent movie modes?
I reverted back to the stock standard trunk build and tried the script with default parameters in Super Slow Motion Movie and Miniature Effect modes. Obviously this means the Version checks (100a) in his script returns false.

It does work though ... changing the FPS with Left/Right keys definitely changes the timing. Oddly enough, the FPS specified by the default parameter only seems to take effect almost 3 seconds into the clip. I only mention this because one of funnel's firmware changes checks for the first frame when disabling audio.
Code: [Select]
if( (int)conf.disable_audio == 1 && movie_status==4 && *(int*)0x85B8==1)  //if recording_started && is_first_frame
Perhaps the reason the audio doesn't get disabled in normal movie mode involves checking is_first_frame. I probably need to read up how to flash the LED, so I can check whether the "disable audio" code is actually called.
« Last Edit: 08 / July / 2014, 14:44:44 by Indizacam »


Re: FPS control
« Reply #28 on: 26 / March / 2015, 18:13:36 »
FPS control or FPS override, is a very important topic for me, and so I give here some feedback about testing the scripts given here in my cameras.
I have tested funnel's fpscontrol.lua and worked well in IXUS 220 / ELPH 300HS, at miniature mode in video. Please mind that this camera captures video at miniature mode only in 640x480.
I have also tested a1ex's fps.lua which worked also  in IXUS 220 / ELPH 300HS. I had to start the script and after I exited alt mode, and after this I pushed the video button to start capturing.

I have also tested funnel's fpscontrol.lua, and a1ex's fps.lua in poweshot S95 and powershot A1200. Both scripts did not work with these cameras.

I hope that someone of the programmers  will finally solve the problem to disable audio and continue this very interesting project.
« Last Edit: 26 / March / 2015, 18:20:12 by mercier »

*

Offline ursamajor

  • **
  • 64
  • SX150IS, SX510HS
    • Per aspera ad astra...
Re: FPS control
« Reply #29 on: 17 / May / 2016, 09:03:10 »
I know the topic is relatively old, but, beeing in searching of this features for my compact Canon (I already have fps override on my 550D, thanks to Magic Lantern) I tested the script. Unfortunatelly, on my SX510HS don't work properly.
It starts, but after 1-2 s the display became black and camera freezes.  :(
SX510HS, SX150IS (retired) :D

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal