Capturing movie frames and mute_on_zoom() - General Discussion and Assistance - CHDK Forum

Capturing movie frames and mute_on_zoom()

  • 6 Replies
  • 1816 Views
Capturing movie frames and mute_on_zoom()
« on: 11 / March / 2010, 09:29:28 »
Advertisements
It would seem that mute_on_zoom() is called for every movie frame.

Do we know if it is called before or after the movie frame is appended to the movie file ?

Do we know where in the code the frame is actually saved ?



David

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Capturing movie frames and mute_on_zoom()
« Reply #1 on: 12 / March / 2010, 04:11:35 »
It would seem that mute_on_zoom() is called for every movie frame.
Yes.
Quote
Do we know if it is called before or after the movie frame is appended to the movie file ?
Probably before.
Quote
Do we know where in the code the frame is actually saved ?
AviWrite (MovWrite) task?

Re: Capturing movie frames and mute_on_zoom()
« Reply #2 on: 12 / March / 2010, 05:24:39 »
Thanks.
I am briefly (two msecs) flashing the autofocus led every frame.
Now, I need to compare the synchronisation of two cameras by displaying the pulses on an oscilloscope.
Maybe a delay can then be introduced in the movie task (using the up/down buttons) to bring the cameras into synch.

It depends how much time is allowed for the movie task.

Re: Capturing movie frames and mute_on_zoom()
« Reply #3 on: 16 / March / 2010, 20:41:01 »
AviWrite is actually a task.

So, we have separate  movie record and avi write tasks.

I wonder if there is a fixed time-offset between those two tasks ?

Is there are communication between the tasks ?


*

Offline reyalp

  • ******
  • 12374
Re: Capturing movie frames and mute_on_zoom()
« Reply #4 on: 18 / March / 2010, 21:57:06 »
Quote
Is there are communication between the tasks ?
Probably.

Pretty much all the tasks sit in a loop reading a message queue. That is followed by a switch statement that deals with each message.

From a540 AviWrite
Code: [Select]
ROM:FFD3D428                  LDR     R3, =0x6486C ; this is the address of the "message queue" variable
ROM:FFD3D42C                  MOV     R1, R7
ROM:FFD3D430                  LDR     R0, [R3]
ROM:FFD3D434                  MOV     R2, #0
ROM:FFD3D438                  BL      ReceiveMessageQueue
If you look for that address used with other message queue functions (e.g. PostMessageQueue), you will find at least some of the things that communicate with that task. It looks like MovieRecord does (sub_FFD3E168 for one).

FWIW, it also looks like AviWrite calls ReceiveMessageQueue in a number of places, not just in the tasks main loop.

Happy hunting  :D
Don't forget what the H stands for.

Re: Capturing movie frames and mute_on_zoom()
« Reply #5 on: 19 / March / 2010, 06:15:20 »
I think you will be able to offer some valuable advice, so let me describe the 'problem' in more detail.
As you know, still images can be captured with a high degree of synchronisation, typically 1/5000 sec.
Movies are captured with far less precision.
For stereo movies involving 'action', they need to be synchronised to less than one msec.

First question is, when is the movie frame captured ?
If that is determined by a hardware timer then we cannot delay that time to achieve synch.
If we could flash an led in synch with that timer we could at least indicate the synch difference on an external device.

After the movie frame is captured, the MovieRecord task will be executed.
Is that a fixed time after the frame is captured ?
If so, we can flash the led in that task and it will be in synch with the frame capture.
If the MovieRecord and AviWrite tasks are not a constant time after frame capture then we cannot measure synch.

So, is each task executed at a fixed rate or can a task be interrupted by another task ?

I have just added a jump to 'blink_led' at the start of MovieRecord task and a friend will look at the signal on an oscilloscope to see how regular it is.

On my A620, that task can either be exited, continually looped or branch through one of ten other chunks of code.

In one branch, CHDK unlocks optical zoom.
In another branch (called for every movie frame), the mute-on-zoom is executed.

Amongst all this there is also a branch to hardware failure caused by JPEG time-out.

Again, I can flash an led at the start of the mute-on-zoom branch and see how regular the timing is.

Any idea why lock optical zoom is in the particular branch that it is ?


*

Offline reyalp

  • ******
  • 12374
Re: Capturing movie frames and mute_on_zoom()
« Reply #6 on: 20 / March / 2010, 00:13:05 »
I don't have much to offer off the top of my head.

I would try to get the sequence of messages that MovieRecord task sees when a recording is started, and then experiment with doing your sync at various stages of that. Perhaps something similar to what I did for capt_seq_task messages http://chdk.setepontos.com/index.php/topic,3994.msg44914.html#msg44914

There's another task (on a540 anyway) that may be involved: MovieCtrlTask

I don't know why unlock optical zoom is where it is.
Don't forget what the H stands for.

 

Related Topics