Synchronised video and delays in tasks - General Discussion and Assistance - CHDK Forum supplierdeeply

Synchronised video and delays in tasks

  • 10 Replies
  • 4118 Views
Synchronised video and delays in tasks
« on: 23 / February / 2011, 17:26:28 »
Advertisements
Quote
The synchronisation between two or more cameras when taking still images is excellent, typically 0.2 msec.

Video synch is poor and random so I am looking for ideas to improve that.

(rest of initial post removed because irrelevant.)

EDIT:

The movie task is called every 1/30 sec and there is nothing we can do to synch two or more cameras.
« Last Edit: 25 / February / 2011, 13:00:31 by Microfunguy »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Synchronised video and delays in tasks
« Reply #1 on: 25 / February / 2011, 18:54:00 »
Sync could be sourced from USB shutter sync, and if you could adjust the system clock frequency of one of the cameras for a little while (just for a little while to prevent safety checks from shutting down the camera -- assuming there are any) you could drift the clocks so that movie task calls ended up in sync...?

Clock frequency experiments have been attempted before (at least using the obvious clues from fw dump strings). I can't remember whether it was always just completely ineffective or if someone actually got a crash (=possibly success), but I'm pretty sure it was before we had easy access to ROMLOG and native calls from Lua and PTP i.e. hacking was slower than it's today.

Re: Synchronised video and delays in tasks
« Reply #2 on: 25 / February / 2011, 19:12:43 »
Sync could be sourced from USB shutter sync

Can you explain a little more, the capture_task() is not entered on full or half-press in movie mode of course.

Quote
you could drift the clocks so that movie task calls ended up in sync...?

Keeping a button pressed to enable that drifting would be useful.

Do we know if the Canon firmware alters clock frequency and why ?

I can flash an led at every frame and an inexpensive microcontroller could measure synch and give an indication (bad/OK/GOOD).
We have to assume frame-capture is related to movie_task() execution time.


Quote
it was before we had easy access to ROMLOG and native calls from Lua and PTP

Oh dear, I knew that I should have followed that aspect of CHDK, there is just too much to do  ;)

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Synchronised video and delays in tasks
« Reply #3 on: 25 / February / 2011, 19:58:41 »
My assumption was that video frame period is low jitter, hopefully controlled by a counter divided from system clock or some other clock whose frequency we could find a way to control. Then if this clock frequency is slowed down for a little while and then returned (on one camera), the sync error will change.

If that's possible, then it's probably possible to get two cameras in video sync by adjusting until sync is good (you probably have a better idea on how to get feedback for manual or automatic adjustment than I do), even if it may work only after both have already started recording video (but I'd start with the assumption that video sync may equal to live view LCD display refresh sync since the signal source is supposedly the same CCD readout mode).

Clock frequency related threads I could find:
http://chdk.setepontos.com/index.php?topic=4442.0
http://chdk.setepontos.com/index.php?topic=4013.0
http://chdk.setepontos.com/index.php?topic=2375.msg21974#msg21974
http://chdk.setepontos.com/index.php?topic=2139.msg19836#msg19836

But it could very well be that there's some more elegant way to adjust the movie readout mode frame delay (I wouldn't be surprised if there's a counter variable or register somewhere that could be adjusted to make the next frame to be acquired a bit later, but finding it may not be easy since we have no peripheral documentation). Chances are it's in DSP code either inaccessible to us or in one of those zlib packed code segments that we don't know how to disassemble, though.
« Last Edit: 26 / February / 2011, 05:31:22 by fudgey »


Re: Synchronised video and delays in tasks
« Reply #4 on: 25 / February / 2011, 20:08:54 »
Thanks, I may play around with that but I don't expect to get very far.

Even if I do, I am not doing it for over one hundred firmware versions.

Re: Synchronised video and delays in tasks
« Reply #5 on: 28 / February / 2011, 10:23:25 »
I have spent some time looking at the movie-capture task on the A620 and S95.

Whether synch can be adjusted or not, we need some way of indicating it.

One method is to monitor the A/V outputs, extract the frame-synch pulses and measure the time difference.
Problem is, the LCD will blank.
 Maybe the memory-mapped I/O register can be overriden or there is another function that ensures the LCD stays on ?

A second method, is to flash the autofocus led every time the task is entered.
(toggling is easier and maybe better as you get a signal with equal high and low times).

On the A620, a jump to a function that uses debug_led() will flash the led as soon as the dial is in the movie position.

This is useful because the user can see the amount of synch without having to start recording.

On the S95, and presumably some other cameras, a jump to the led function as soon as possible at the task entry only flashes the led when recording.

Is it likely that some other function is called every 1/29.97 seconds when the switch is in the movie position and the led toggling could be done there ?

(Some cameras have a momentary movie button of course.)

Surely the movie task is always running when the switch is in the movie position ?

@reyalp

You once posted comments about why you cannot always simply include a "BL" to your own routine.
Can you remember what you said ?

When do we have to save registers and how do we know which ones ?

« Last Edit: 28 / February / 2011, 10:26:26 by Microfunguy »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Synchronised video and delays in tasks
« Reply #6 on: 28 / February / 2011, 14:14:27 »
@reyalp
You once posted comments about why you cannot always simply include a "BL" to your own routine.
Can you remember what you said ?
This? http://chdk.setepontos.com/index.php?topic=5722.msg56279#msg56279

*

Offline whim

  • ******
  • 2041
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Synchronised video and delays in tasks
« Reply #7 on: 28 / February / 2011, 14:44:41 »
Quote
@reyalp

You once posted comments about why you cannot always simply include a "BL" to your own routine.
Can you remember what you said ?

... Or maybe this ?

hth,

wim


Re: Synchronised video and delays in tasks
« Reply #8 on: 28 / February / 2011, 15:35:44 »
Thanks, both links are very useful.
I will only be able to find this thread again because I started it.
How are you keeping track of the vast range of topics discussed ?

*

Offline reyalp

  • ******
  • 13456
Re: Synchronised video and delays in tasks
« Reply #9 on: 01 / March / 2011, 15:45:32 »
When do we have to save registers and how do we know which ones ?
You can look at the surrounding code and figure it out, or...  http://tools.assembla.com/chdk/browser/trunk/include/asmsafe.h

The B/BL issue described in the previously linked posts only affects trying to BL from RAM to a literal ROM address.
Don't forget what the H stands for.

 

Related Topics