Increasing fps in movie mode SX40 HS - page 2 - General Discussion and Assistance - CHDK Forum

Increasing fps in movie mode SX40 HS

  • 25 Replies
  • 22567 Views
*

Offline reyalp

  • ******
  • 14126
Re: Increasing fps in movie mode SX40 HS
« Reply #10 on: 03 / December / 2011, 16:48:44 »
Advertisements
Well of course they want to nudge us into spending 100's to 1000's of more $'s to upgrade your software, lol that's why we have CHDK (and hackintosh's too :) .
My observation from several years of working on CHDK is that Canon don't actually do this very much. The limits are mostly defined by hardware. The digital camera market is very competitive, both in cost and features. Canon certainly segments their models by features, but these are mostly defined by the hardware. Putting over-capable hardware in low end models is not usually cost effective (there are occasional exceptions). Canon does limit manual control on low end models, but that doesn't involve producing over-capable hardware, and the fraction of this market that cares about manual controls is insignificant.
Quote
How did you calculate those bitrates? How can we discover the maximum possible? Couldn't we turn down quality or bitrate in video mode to achieve 1080p 60fps @ 49.8 mp/sec - what does "mp" stand for btw?
The numbers quote above are millions of pixels per second (width X height X FPS). Bit rate depends on many things, but this should be sufficient to get an idea of the relative processing requirements. Of course, that does not mean you can program the hardware to do any arbitrary combination of dimensions and frame rate that falls under the limit.
Quote
If cameras of lesser quality (Panasonic's and Sony's) with similar specs to an SX40 can handle this why not ours?
Different hardware, different design trades. Higher frame rates is clearly a selling point. If Canon could just turn it on and have it work, it would make them more competitive against Sony and Panasonic. So why wouldn't they ?
Quote
By thinking outside of limitations we transcend them, there is no such thing as can't.
Nonsense, every piece of hardware has real limits. No amount of software will make a cheap P&S lens and sensor competitive with a good DSLR lens and sensor. These things have real, objectively measurable qualities.
Quote
So, that's why I'm so sure we can accomplish this if we put our heads together and start working on it rather than back and forthing on "can it be done?".
I'm trying to give you my perspective as someone who has many hundreds of hours digging through Canon firmwares and working on CHDK. You are free to ignore my advice, of course.
Quote
Maybe we can use another scripting language as a way to support this feature. ML is using C and Perl apparently, on DRYos Canon hardware, same as we've got (SX40 has a CMOS sensor).
This doesn't make any sense, and leaves me wondering if you are equipped to undertake the task you propose. Any new capabilities are based on reverse engineering the firmware. Choice of language and development tools is just a matter of what is convenient for the task at hand. CHDK itself is written in C and assembler, not a "scripting language". The script interfaces are just a CHDK feature to allow users more control over CHDK and the camera.

To be clear, to make any progress on this, you will need a firm grasp of C, assembly language and reverse engineering concepts.
Quote
This thread can be the basis for such a project. Give me a week or two to learn uBasic and LUA a bit, and I'll be here with all my findings.
ubasic and Lua won't help you. You can use Lua to call firmware functions, but you still need to disassemble and reverse engineer the firmware dump to find the ones you want and figure out what they might do.
Don't forget what the H stands for.

*

Offline 051r15

  • *
  • 21
  • SX40 HS
Re: Increasing fps in movie mode SX40 HS
« Reply #11 on: 03 / December / 2011, 21:40:00 »

My observation from several years of working on CHDK is that Canon don't actually do this very much. The limits are mostly defined by hardware. The digital camera market is very competitive, both in cost and features. Canon certainly segments their models by features, but these are mostly defined by the hardware. Putting over-capable hardware in low end models is not usually cost effective (there are occasional exceptions). Canon does limit manual control on low end models, but that doesn't involve producing over-capable hardware, and the fraction of this market that cares about manual controls is insignificant.

Different hardware, different design trades. Higher frame rates is clearly a selling point. If Canon could just turn it on and have it work, it would make them more competitive against Sony and Panasonic. So why wouldn't they ?

I'm trying to give you my perspective as someone who has many hundreds of hours digging through Canon firmwares and working on CHDK. You are free to ignore my advice, of course.

This doesn't make any sense, and leaves me wondering if you are equipped to undertake the task you propose. Any new capabilities are based on reverse engineering the firmware. Choice of language and development tools is just a matter of what is convenient for the task at hand. CHDK itself is written in C and assembler, not a "scripting language". The script interfaces are just a CHDK feature to allow users more control over CHDK and the camera.

To be clear, to make any progress on this, you will need a firm grasp of C, assembly language and reverse engineering concepts.

ubasic and Lua won't help you. You can use Lua to call firmware functions, but you still need to disassemble and reverse engineer the firmware dump to find the ones you want and figure out what they might do.

Awesome, reyalp thank you. My background is mostly low level coding, html/css/javascript/jquery.... SOME objectiveC . And reverse engineering I've done a bit on Ubuntu & Mac to allow me to use unsupported hardware in various configurations.
 
Glad to know Canon isn't Apple on pricing/hardware, but they left out RAW which could have given them a lot of edge didn't they? Your advice and experience are tremendously valuable, especially to someone like myself who barely knows where to begin in the mass of information on the forum/net. My thinking was, similar hardware+same os kernel, would be the best place to start.

So now I'll be dumping my firmware (1.00f) and looking for the sector dealing with video.
 You'd be a saint to point me to the best clearest information on making sense of the firmware for a complete beginner (yes I've used search but all the results I'm finding are a bit over my head at this stage).
I mainly get about four hours in the late evening to work on any such project, and I'm willing to put in the time and effort to finally figure out if this can be done or not.

The SX1 had 1080p @ 30fps with a DIGIC IV and smaller CMOS. I really believe the hardware is capable enough to handle it. Don't get me wrong I really do love native 24fps it looks great. My style of editing/projects I'm working on however finds me using slow motion a lot, with programs such as twixtor, and 24fps comes out a bit jerky.
 
The Sony HD cameras @60fps, I was using and still have access to, produce a whole different  sort of image, which is why I'd like to be able to capture all of my footage with one camera and why I went with Canon to begin with. Image "vibrancy" I guess you could say, was better than life oftentimes on Canons both still and video, while Sony images looked "metallic" or "flat" in comparison despite manual settings.

So I don't want to lug around telephoto lenses for a DSLR everywhere, I want HD video with as many manual controls as i can have, I want stunningly good photographs in RAW that are print quality up to small poster size, a hotshoe, "vari-angle" screen and a few in camera effects (I love color accent)... and I've got it all right here in the SX40. If they made a fixed lens macro/telephoto DSLR for under $20,000 somehow I would have went with that. As it stands though I'm ready to roll up my sleeves and bitbang this firmware!

Far from shunning your advice reyalp you've been the biggest help to me so far . No one else in the community even seems interested and the other guy got mad and left. So help me out just a bit every now and then and we can ideally have an even better CHDK than we do now!

Now I know to concentrate on the firmware...

*

Offline 051r15

  • *
  • 21
  • SX40 HS
Re: Increasing fps in movie mode SX40 HS
« Reply #12 on: 04 / December / 2011, 01:38:52 »
Okay 145 views, probably less than 15 myself, anyone have anything to contribute at all? Opinion, speculation, anything? This is new territory here...

Re: Increasing fps in movie mode SX40 HS
« Reply #13 on: 04 / December / 2011, 02:01:19 »
Okay 145 views, probably less than 15 myself, anyone have anything to contribute at all? Opinion, speculation, anything? This is new territory here...
You have that right .. new territory.  You probably need to assume that most CHDK forum viewers have little or no programming skills.  And then you have to deduct all those that don't really care about using a P&S camera to shoot video.  And then deduct those who don't really care to make the video rate faster - what is there is good enough.

I see that you are keen to tackle this but the CHDK community who are actually active, capable of doing any development and interested in breaking a video mode limit is pretty small.

I'm trying not to be negative here - I just don't want you to have expectations that the group cannot meet.



« Last Edit: 04 / December / 2011, 02:03:37 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Increasing fps in movie mode SX40 HS
« Reply #14 on: 04 / December / 2011, 06:33:09 »
it shouldn't be a herculean task to figure this out.

we can accomplish this if we put our heads together

Well, I think you underestimate the effort required and complexity of the Canon firmware and whilst the relatively small number of 'developers' will be happy to offer general advice, none will engage fulltime in the project, they are far too busy with other matters.

*

Offline 051r15

  • *
  • 21
  • SX40 HS
Re: Increasing fps in movie mode SX40 HS
« Reply #15 on: 04 / December / 2011, 12:23:36 »
Thanks waterwingz and microfunguy for the realistic expectations on any collaboration. I'll go it alone, no problem.
As far as general advice, which is all I'm really asking for from those who'd know best, where's the best place to start learning about the firmware for an absolute beginner. And, if it isn't any trouble or you know off the top of your head (seeing as how you've guys have been all through the firmware) what section deals with video- or is it scattered?
 What I mean is this, when reverse engineering a device to use on a computer for example you'll have to find the section in the system table that deals with the correct device and re-code the id's and change some 1's to 0's among other things   

ex.1


                Name (_ADR, 0x00060001)
                OperationRegion (P020, PCI_Config, 0x49, One)
                Field (P020, AnyAcc, NoLock, Preserve)
                {
                    U0WK,   1
                }

                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x05)
                        {
                            "AAPL,clock-id",
                            0x02,
                            "AAPL,device-internal",
                            0x20,
                            Buffer (One)
                            {
                                0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (One, U0WK)
                    }
                    Else
                    {
                        Store (Zero, U0WK)
                    }

-from a dsdt table for a hackintosh

This is somewhat easy to do because of terminal which allows you to see vendor id's and where everything is mapped to the memory/hardware. So for example if I wanted to use an unsupported wlan card I could get around any white/black lists by either tricking os/bios into thinking it's something else or adding my own support (new kext) which would be more difficult.

So to clarify, since I can't just lspci my camera to get info, how would I find the section dealing with video? Once I've found the section can I just change some values in DISKBOOT.BIN to enable the desired results , or would I need a lua script to either supress this function/enable that function to go on top of that?

Am I completely off here? Please, any advice just pointing me in the right direction is appreciated and will help advance the technology. I'm not asking anyone to take their time and make this happen that's my job but any off the top of the head info you would share/ link to either explaining unfamiliar concepts or pointing me to sections of interest would be more than helpful.

Apparently this won't be easy at all and you dev's and guru's know better than I do what I've just got myself into...

BTW microfunguy from what I understand you've done tremendous things to advance our state of knowledge and tech and I thank you for your contributions to the world.

Re: Increasing fps in movie mode SX40 HS
« Reply #16 on: 04 / December / 2011, 12:48:30 »
when reverse engineering a device to use on a computer for example you'll have to ...  change some 1's to 0's

Hmmm  ... I guess so.

Quote
Am I completely off here?

Yes, I have no idea what you are talking about   :)
 
Quote
BTW microfunguy from what I understand you've done tremendous things to advance our state of knowledge

I have done NOTHING !

I rely on the expertise of others, past and present, and study CHDK as a way of learning 'C' beyond the usual webpages discussing "Hello World" and 'foo-bar'.


You have to (ideally) use IDA Pro to disassemble the firmware and then spend far more time than you have available figuring-out how video works.

Some of the video code is copied to CHDK and hacked to do (arguably useful) things like changing quality and bitrate, on suitable cameras.

As an example, see here :-

http://trac.assembla.com/chdk/browser/trunk/platform/g12/sub/100g/movie_rec.c


David

*

Offline 051r15

  • *
  • 21
  • SX40 HS
Re: Increasing fps in movie mode SX40 HS
« Reply #17 on: 04 / December / 2011, 13:09:42 »

Yes, I have no idea what you are talking about   :)


^ Lol that's how I've been feeling! I'm in study mode now though :) This is the stuff I know, so I'm just trying to correlate things the best I can. The link you provided is actually spot on, this is the section of code I'd like to focus on thank you !

*

Offline reyalp

  • ******
  • 14126
Re: Increasing fps in movie mode SX40 HS
« Reply #18 on: 04 / December / 2011, 15:39:19 »
... snip ...
-from a dsdt table for a hackintosh
This is DSDT, which is part of the ACPI BIOS system.  DSDT hacking really isn't analogous to what you have to do to reverse engineer camera firmwares. DSDT is a documented interface with a proper specification (even though the DSDT of your particular device isn't documented) and can be decompiled into a relatively high level human readable format.

Canon camera firmware (as dumped in PRIMARY.BIN) is just ARM machine code and arbitrary data, with no documentation or specification at all. It can only be decompiled into assembly language.
Quote
how would I find the section dealing with video?
You would disassemble the firmware binary (preferably with IDA, but some free tools available, see the wiki) and then look for things that appear related to video in some way. As I mentioned before, Canon does leave in their asserts, so you can often find which areas of the code relate to original Canon source files (e.g. MovieRec.c). You can also look at task names, and event proc names. The IDC scripts will help you find some of these things if you use IDA. CHDK already hooks one of the movie related tasks (see platform/<camera>/sub/<version>/boot.c and movie_rec.c) so that might provide some clues as well.

There is no one specific section dealing with video. Video is complicated and there is a lot of code connected to it

No matter what you have to be able to read disassembled ARM machine code and figure out what it does. Really. You will not get anywhere without this skill. If you do not have significant assembly language experience, you have a very steep learning curve ahead, equivalent to at least a few semesters of university level courses. If you know some other assembler well, picking up ARM through the reference manuals is not hard, see http://chdk.wikia.com/wiki/Developer_Technical_Documents

Even for people who are very fluent in assembler, analyzing disassembled code is a difficult, extremely time consuming task.
Quote
Once I've found the section can I just change some values in DISKBOOT.BIN to enable the desired results
CHDK is written in C, with some inline assembler as well. To change CHDK, you set up the development environment (start here http://chdk.wikia.com/wiki/For_Developers ) change the C code and build a DISKBOOT.BIN (or PS.FI*) from that. If you don't know C, you need to learn some first. How involved the changes are depends entirely on what you find in the reverse engineering step.
Quote
or would I need a lua script to either supress this function/enable that function to go on top of that
If your change can be accomplished by calling a firmware function or changing a specific memory location, then you might be able to do it with Lua. If it involves more complicated changes to code, you'd need to do it in the C code.

Lua is convenient for investigating, because you can call eventprocs (see http://chdk.wikia.com/wiki/Event_Procedure) and random firmware functions without rebuilding (see http://chdk.wikia.com/wiki/Lua/Lua_Reference/Native_Function_Calls ) Combined with the PTP interface (http://chdk.wikia.com/wiki/PTP_Extension) this can be very helpful for development.
Quote
Am I completely off here?
Pretty far...
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Increasing fps in movie mode SX40 HS
« Reply #19 on: 04 / December / 2011, 16:49:44 »
you have to be able to read disassembled ARM machine code and figure out what it does.

And the SX40HS has over 1.1 million lines of ARM assembly code in the dis-assembled firmware - all completely undocumented.

Plus there's the code for the DigIC co-processor / DSP which no one has figured out at all yet.
There is a possiblity that much of the video encoding is being done by this processor not the main ARM CPU.

Good luck!

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal