S1 IS - page 2 - CHDK Releases - CHDK Forum  

S1 IS

  • 28 Replies
  • 10878 Views
*

Offline reyalp

  • ******
  • 12171
Re: S1 IS
« Reply #10 on: 14 / June / 2012, 16:16:02 »
Advertisements
Things are going great now, the skies have been very dark and dangerous for a few days, and the MD script is running without hiccups for dozens of hours at a time, always responding quickly when I walk over to test it.
For lighting, you can probably get away with reducing the size and resolution of the area used for motion detection, using the pixel step and masking options. A reasonably strong strike will light up the whole scene.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #11 on: 17 / June / 2012, 16:00:47 »
Some update (more like a blogpost).
I've been working on the movie quality control. I've found the routines that control the recording bitrate, and managed to implement CHDK's bitrate and quality overrides.
(Side note: these routines are very similar to those in Ixus30/40)

Everything would be great, if the camera would not crash when a greater amount of these overrides is in effect. I use a "grid" pattern on my monitor to create a hard to compress scene. With the bitrate set to 1x (original) the recording is stable (the highest original quality is a bitrate with average (not more than) 64kB/frame in 640x480 mode). However, I got crashes with 0.25x bitrate, 1.5x ... 2x bitrate, and with constant quality (~88-99%) filming that pattern.
I tried several things, but the unstable operation has not changed.
The trouble is, I simply can not find the reason how my modifications could have such an effect. I suspect that there's a bug in the firmware routines (or even worse, in the DIGIC itself), that I'm exposing.

The crashes seem to be memory corruption related. I either get a regular assert (= camera restarts) or an unresponsive camera with the display showing garbage (either the display is "reprogrammed" to show some random memory area or the liveview buffers are overwritten by the misbehaving movie routines).

In VGA mode, the trouble begins when the size of an individual compressed frame reaches ~204kB. In such cases (when I stopped the recording before a potential crash), those frames are corrupted and the AVI also gets corrupted (the AVI index is not affected). Interestingly, there's a constant (observed value is 0x32000 = 204800) in the parameters passed to the encoder routine (I tried to play with it without success). The issue may be related to the buffering of the frames (the recording buffer is almost 20MByte), the crash always seems to happen after the amount of recorded data exceeds the buffer size.

No new build this time (the only usable change would be that recording mode change works now).

edit:
Increasing that limit (0x32000) before the compression routine AND reporting a framesize not more than the limit to the following routines seems to stabilize the recording. (This destroys the oversized frames' lower parts of course.) Maybe the compression code can't reduce the size of those oversized compressed frames correctly? Faulty DSP code?
« Last Edit: 17 / June / 2012, 22:22:24 by srsa_4c »

Re: S1 IS
« Reply #12 on: 21 / June / 2012, 18:14:37 »
Hi
I've also been lurking on here a few months now, toying with getting a replacement for my aging (but still fully functional, albeit with replaced CCD) S1.... and  lo and behold, a total genius appears.
Srsa, you have my undying gratitude... I've just spent a paltry hour getting your code up and running, and I've now got some lovely RAW images off my S1.
I'm only slightly annoyed that I'm just back from vacation, where I was using the dive housing to photograph a couple of dives... I'm itching to get into RAW editing of my u/w shots, and banish that blue tint forever!

I've still to get to grips with the functionality in chdk, so I'll be reading the manuals and lurking in the newbies forum, but really just wanted to offer my thanks

*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #13 on: 19 / July / 2012, 00:25:43 »
Prealpha 3

Quote
changes since prealpha2
* bugs fixed *
- capture mode change works (from a script)
- subject distance override works, but requires user attention (needs to be switched off before switching off the camera, followed by halfpress to let the cam autofocus)
  caused assert at shutdown while testing, hence the above warning
  only useful in scripts
- redraw of the overlay now uses a more appropriate firmware function which should work faster
- ISO override now possible, with issues
  The camera's internal implementation differs from that of later cameras,
  my current workaround consists of a heap of hacks. The sensitivity range roughly equals to the
  official ISO50...400 range. When overridden, the JPEG and DNG Exif will contain a value which is
  related, but does not equal to the set value. Moreover, various utilites strongly disagree about
  these ISO values (Irfanview, exiftool, Raw Therapee). I have no idea, what the real ISO is.
  Another solution for scripts is to set propcase 21 to a known market ISO value (50, 100, 200, 400).
- better colors chosen (hopefully)

* movie mode *
- quality and bitrate override has been implemented, with issues:
 - random crashes were observed when using extreme overrides (low bitrate, high bitrate, high quality), mostly when
   recording a scene with unusual complexity (e.g. high contrast fine grid on a monitor)
 - the size of an individual compressed frame can not exceed 204800 bytes (sad firmware limitation)
  - if it does, the frame will be clipped to prevent corruption of the file
  - many software can't deal with clipped mjpeg frames, VirtualDub can (lower parts of those frames will be lost)
  - this framesize can also be reached with regular high detail scenes!
 - 1x (default) bitrate means an average frame size of 64kB in VGA fine mode
 - the camera routines use 15 levels of compression internally (0=best quality, 14=worst quality)
  - this is mapped to CHDK constant quality like this: 0 .. 40 = worst quality, 96 .. 99 = best quality

* known problems *
- The shoot command may not complete in scripts, use keypress emulation OR delays if you encounter this.
- ubtest (script) usually locks up because of "shoot" being broken
- If you override subject distance in a script (SD override makes no sense otherwise), don't forget to disable it before you switch off the camera.
- Don't load CHDK if you want to make sure that the camera doesn't crash during movie record.
- ISO override works, but the real ISO is not really known
- No control over dark frame subtraction yet

I'd like to stress that using the movie quality / bitrate overrides can cause instability / crash. If you're brave enough to try and experience crashes, feel free to report how it happened. The worst kind of crash I ever encountered looks like this: the LCD displays some pattern and the camera gets unresponsive (needs battery removal). Since a few code tweaks, I haven't got this kind of crash again. If you do, please report it. The other kind of crash is a regular camera restart which happens while recording. The recording will be lost in both cases.
Furthermore, as written above, by using high quality / high bitrate with high detail scenes, you risk broken frames. There is currently no warning for this.

Source can be found at https://www.assembla.com/code/chdk-s1/subversion/nodes/branches/s1-merge

If you happen to have a fast CF card and risk trying the movie overrides, don't hesitate to report the maximum bitrate the camera is able to keep up with.
Also write here if you find some regressions.

update: build removed
« Last Edit: 21 / July / 2012, 16:20:30 by srsa_4c »


*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #14 on: 21 / July / 2012, 16:24:53 »
Prealpha 4

Quote
change since prealpha3
* movie mode *
- the 204800 bytes/frame limitation has been lifted to 262144 bytes/frame which is what later cameras use in VGA mode
  this should eliminate the possibility of frame corruption (tested, frame sizes over 220kBytes observed with no corruption)

* known problems *
- The shoot command may not complete in scripts, use keypress emulation OR delays if you encounter this.
- ubtest (script) usually locks up because of "shoot" being broken
- If you override subject distance in a script (SD override makes no sense otherwise), don't forget to disable it before you switch off the camera.
- Don't load CHDK if you want to make sure that the camera doesn't crash during movie record.
- ISO override works, but the real ISO is not really known
- No control over dark frame subtraction yet
- No control over the flash

edit

After doing some test recordings, it's now confirmed that movie recording is unstable. It can crash the camera - sometimes sooner sometimes later. Don't load CHDK if you want reliable recording.
I also managed to mess up the colors in record mode... Fix will follow soon.

edit2

Movie record instability: seems like power save (display off, which can't be disabled in Canon menu) kicks in in the middle of recording, reason yet unknown. Perhaps something similar happens with the running MD script?

edit 2b
The issue may be connected to CHDK's use of LockMainPower / UnlockMainPower.

attachment removed, new release towards the end of the thread
« Last Edit: 27 / July / 2012, 15:04:11 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #15 on: 27 / July / 2012, 15:02:12 »
Prealpha 5
Quote
changes since prealpha4
bugs fixed
- instability caused by CHDK's use of LockMainPower / UnlockMainPower has been solved (the functions exist, but have different effect than in any of the later cameras)
  - may help with the motion detection issue reported in the forum
  - will help with movie recording
- another try to create a palette that is not unreadable in record mode (see palette viewer in rec and play mode to see why it's hard)

new feature
- the default assert handler has been replaced with a custom one that shuts down the camera instead of restarting it on an assert
  the camera will switch off with extended lens when this happens (which is what later cameras do)
  it will also try to save some debugging info to the card in case of a crash
  be sure to switch the camera off by pressing the OFF button when this happens, or it _may_ drain the batteries

* movie mode *
- instability of the movie recording should be gone
- the movie bitrate display has been replaced with another that shows
  - internal "quality factor", Q0 = best quality, Q14 = worst quality, useful in constant bitrate mode
  - current video frame size
  - average video frame size (average of the last 64 frames)
- the movie file size limit has been increased to almost 2GB (untested, may not work)



* known problems *
- The shoot command may not complete in scripts, use keypress emulation OR delays if you encounter this.
- ubtest (script) usually locks up because of "shoot" being broken
- If you override subject distance in a script (SD override makes no sense otherwise), don't forget to disable it before you switch off the camera.
- ISO override works, but the real ISO is not really known
- No control over dark frame subtraction yet
- No control over the flash
edit: attachment removed
« Last Edit: 28 / July / 2012, 00:39:36 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #16 on: 28 / July / 2012, 00:38:15 »
 :-[
Prealpha 6
Quote
changes since prealpha5
bug fixed
- previous change didn't prevent Canon's "display off" from kicking in while recording a movie
  from now on, phantom events will be sent every 10 seconds in movie mode too to keep this from happening

* movie mode *
- bitrate display shows average of total (video + audio) bitrate / second instead of average frame size



* known problems *
- The shoot command may not complete in scripts, use keypress emulation OR delays if you encounter this.
- ubtest (script) usually locks up because of "shoot" being broken
- If you override subject distance in a script (SD override makes no sense otherwise), don't forget to disable it before you switch off the camera.
- ISO override works, but the real ISO is not really known
- No control over dark frame subtraction yet
- No control over the flash
- Masking of zoom lever is not effective in record mode when ALT is active
I really hope the movie crash is fixed for real this time...

edit:
Those who want motion detection, please use prealpha2. While movie features seem to have been stabilized in prealpha6, MD scripts (and possibly others) hang  :(
Will continue to investigate, why.
« Last Edit: 30 / July / 2012, 10:14:08 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #17 on: 04 / August / 2012, 19:47:51 »
Prealpha 7
Quote
changes since prealpha6
bug fixed
- some experimental parts of the LockMainPower/UnlockMainPower replacement caused problems with scripts (blank screen), should now work as before

new feature
- dark frame subtraction control now possible (but results in uselessly noisy pictures when disabled)
- somewhat faster motion detection (not available in stitch or movie mode)

* known problems *
- The shoot command may not complete in scripts, use keypress emulation OR delays if you encounter this.
- ubtest (script) frequently locks up because of problems around sensing the shooting state
- If you override subject distance in a script (SD override makes no sense otherwise), don't forget to disable it before you switch off the camera.
- ISO override works, but the real ISO is not really known
- No control over the flash
- Masking of zoom lever is not effective in record mode when ALT is active
- Prevention of power save doesn't always work reliably (kicked in once while running the memory viewer module).
  Either get out of ALT mode (by pressing the shortcut button) or use a button which is not influenced by CHDK (rec, play, zoom lever in record mode) when this happens.
So, as written above, scripts that shoot should now work without the display blanking issue.


*

Offline srsa_4c

  • ******
  • 4035
Re: S1 IS
« Reply #18 on: 27 / August / 2012, 17:45:29 »
I now had the chance to try the camera with a high speed card (Kingston ultimate 266x). Unsurprisingly, the camera can't really take advantage of its speed. According to the benchmark, the highest writing speed can barely reach 3.5MB/s, which is not much higher than the performance on "normal" CF cards.
According to the camera's "ATA.INFO" event procedure (trying several CF cards), DMA capability is never recognized. The reason is probably that DMA became part of the official CF specification at the time the firmware was developed (2003-2004), see http://en.wikipedia.org/wiki/CompactFlash#CF.2B_and_CompactFlash_specification_revisions.
The biggest impact of this is that high bitrate VGA movie recordings are only possible at 15fps.

Re: S1 IS
« Reply #19 on: 22 / January / 2013, 00:44:37 »
Will continue to work on CHDK for S1 IS?
Are waiting for the final version.
Thank you!