Fast zoom during video -> crash - Script Writing - CHDK Forum supplierdeeply

Fast zoom during video -> crash

  • 19 Replies
  • 9460 Views
Fast zoom during video -> crash
« on: 14 / March / 2015, 09:55:45 »
Advertisements
Powershot D30

I wrote a little script which zooms in or out fast when "set" is pressed. (vidzoom.lua)
It works fine when the camera is idle but when I use it during video shooting the whole camera crashes (turns off).
This happens with 1080p and 480p, disabling autofocus via Canon menu doesn't help either.
Using zoomdiag.lua I made sure to use valid values for set_zoom(x).

What could be causing this this crash?

Also: When I tried reducing the zoom speed I noticed that set_zoom_speed(x) doesn't seem to have any effect. 0, 1, 10, 100, 1000 all look the same to me.

Canon Powershot D30 w/ CHDK 1.3.0

Re: Fast zoom during video -> crash
« Reply #1 on: 14 / March / 2015, 10:12:37 »
What could be causing this this crash?
Please go to the Miscellaneous Stuff -> Debug menu and select  Save ROM crash log.   Post the resulting ROMLOG.LOG file from the root of you SD card here.

Quote
Also: When I tried reducing the zoom speed I noticed that set_zoom_speed(x) doesn't seem to have any effect. 0, 1, 10, 100, 1000 all look the same to me.
AFAIK, that function only works on a few (older) cameras.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Fast zoom during video -> crash
« Reply #2 on: 14 / March / 2015, 10:24:35 »
Thanks for the fast reply! Debug log attached.

Quote
AFAIK, that function only works on a few (older) cameras.
The D30 has at least two zoom speeds: Quite fast while idle, very slow during shooting video.
Where would I start to find out whether this can be manipulated via native calls?
Canon Powershot D30 w/ CHDK 1.3.0

Re: Fast zoom during video -> crash
« Reply #3 on: 14 / March / 2015, 10:41:22 »
Manipulating zoom position is problematic on many CHDK ports.  The issue seems to be CHDK making calls to move the lens mechanism that the camera is not expecting - which tends to get it confused. And trying to do that while video is active probably makes that worse.  There are several build options that try to get around this - mostly found by trial & error on specific cameras I suspect.

Here's what your crash dump says - which indicates you are seeing that sort of problem.

ASSERT!! FocusLensController.c Line 912
Occured Time  2015:03:14 15:06:05
Task ID: 15990819
Task name: PhySw


These are the build options for the D30 :

Code: [Select]
    #define CAM_HAS_ZOOM_LEVER                  1    // Camera has dedicated zoom buttons
    #define CAM_NEED_SET_ZOOM_DELAY           300    // Define to add a delay after setting the zoom position
    #define CAM_USE_OPTICAL_MAX_ZOOM_STATUS     1    // Use ZOOM_OPTICAL_MAX to reset zoom_status when switching from digital to optical zoo
    #define CAM_USE_ALT_SET_ZOOM_POINT          1    // Define to use the alternate code in lens_set_zoom_point()
    #define CAM_USE_ALT_PT_MoveOpticalZoomAt    1    // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()

We could try builds with one or either of the last two removed and see what happens?  I suppose a longer delay might be another "shot in the dark" worth trying.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline srsa_4c

  • ******
  • 4451
Re: Fast zoom during video -> crash
« Reply #4 on: 14 / March / 2015, 11:02:28 »
Debug log attached.
It's the usual focus related crash ( IsFocusLensHandle() fails ), CHDK and the firmware is trying to take control of focus at the same time. I don't think anybody has solved this. As you noticed, disabling Canon AF doesn't help.

Quote
The D30 has at least two zoom speeds: Quite fast while idle, very slow during shooting video.
Where would I start to find out whether this can be manipulated via native calls?
You can find lots of named event procedures in the CHDK source: funcs_by_address.csv (all names ending with _FW are event procedures, remove "_FW" from their name when using them in a script.
Actual usage is much more complicated though:
- you need to find out how to register them
- you need to determine the number and the meaning of their parameters
- some of them can be dangerous to the hardware
- you can expect lots of crashes (even when using correct parameters)

I was experimenting with some ComputerZoom (short form: CZ) event procedures a while ago: one of them caused the lens to extend in playback mode (!), and all those I tried crashed the camera during video recording.

Re: Fast zoom during video -> crash
« Reply #5 on: 14 / March / 2015, 13:24:11 »
You can find lots of named event procedures in the CHDK source: funcs_by_address.csv (all names ending with _FW are event procedures, remove "_FW" from their name when using them in a script.

Thanks, that's gonna come in handy one day.
Canon Powershot D30 w/ CHDK 1.3.0

Re: Fast zoom during video -> crash
« Reply #6 on: 14 / March / 2015, 13:36:58 »
These are the build options for the D30 :

Code: [Select]
    #define CAM_HAS_ZOOM_LEVER                  1    // Camera has dedicated zoom buttons
    #define CAM_NEED_SET_ZOOM_DELAY           300    // Define to add a delay after setting the zoom position
    #define CAM_USE_OPTICAL_MAX_ZOOM_STATUS     1    // Use ZOOM_OPTICAL_MAX to reset zoom_status when switching from digital to optical zoo
    #define CAM_USE_ALT_SET_ZOOM_POINT          1    // Define to use the alternate code in lens_set_zoom_point()
    #define CAM_USE_ALT_PT_MoveOpticalZoomAt    1    // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()

We could try builds with one or either of the last two removed and see what happens?  I suppose a longer delay might be another "shot in the dark" worth trying.

Ok, I tried a few combinations and commenting out
Code: [Select]
#define CAM_USE_ALT_SET_ZOOM_POINT          1    // Define to use the alternate code in lens_set_zoom_point()got rid of the crash when I run the script with manual focus set. Result:
Powershot D30 Quickzoom

Maybe that's due to my lack of understanding for the internal mechanics of the camera but I was quite surprised that the image went out of focus so badly. Is it correct that the focus has to be adjusted to the zoom to maintain the set distance?

I was also surprised that the camera refocussed even though it was set to manual focus but that would make sense if the answer to the above question is yes.

Anyway... You were right, waterwingz! That fixed the crash. Now I can continue with my original experiments, thanks a lot!  :D

Do you consider it a good idea to commit my changes to the file if I don't find something else that's now broken by them? What would be the procedure for that?
Canon Powershot D30 w/ CHDK 1.3.0

*

Offline reyalp

  • ******
  • 14080
Re: Fast zoom during video -> crash
« Reply #7 on: 14 / March / 2015, 14:31:12 »
Maybe that's due to my lack of understanding for the internal mechanics of the camera but I was quite surprised that the image went out of focus so badly. Is it correct that the focus has to be adjusted to the zoom to maintain the set distance?
It seems to be. The CHDK set_zoom code tries to re-focus after moving the zoom for this reason, which is probably connected to your crash.

You could try commenting out the shooting_set_focus in core/shooting.c shooting_set_zoom
CAM_NEED_SET_ZOOM_DELAY might might also be relevant

Quote
The D30 has at least two zoom speeds: Quite fast while idle, very slow during shooting video.
Where would I start to find out whether this can be manipulated via native calls?
Most of the cameras that allow zooming in video natively do this, presumably to limit how much noise is picked up in the video.
Don't forget what the H stands for.


Re: Fast zoom during video -> crash
« Reply #8 on: 14 / March / 2015, 14:35:24 »
That fixed the crash. Now I can continue with my original experiments, thanks a lot!  :D Do you consider it a good idea to commit my changes to the file if I don't find something else that's now broken by them? What would be the procedure for that?
If this turns out to be a good fix, it should get added to the autobuild.   

The procedure to do that is to make a patch (diff) file and post it here :  Adding new cameras, applying patches into trunk (with source code prepared) with an brief explanation of what you did (or just a link to the forum thread where the patch is dicussed).

One caveat at this point might be that this change needs a little more testing.  You now have scripted zoom in video record mode working.   But did that break scripted zoom in regular shooting mode?  Probably some testing needed - there is an old script here that might help :  http://chdk.setepontos.com/index.php?topic=7071.msg76172#msg76172
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Fast zoom during video -> crash
« Reply #9 on: 14 / March / 2015, 14:44:31 »
Wait a minute!
I just remembered that I didn't see any defocussing with the old build.
Here's a crappy video of the old behaviour:
www.youtube.com/watch?v=kxdcIRDzATU
Canon Powershot D30 w/ CHDK 1.3.0

 

Related Topics