Vertical Sync counter
DynamoBen
Posts: 366
I'm creating a video test app that displays the number of frames that have passed since the start of the test. The idea is I can review the recorded video file and see how many dropped frames there were (a jump from 1 to 3 is a dropped frame).
However to do this I need increment a counter each time a vertical sync occurs. The only way I can think of doing this is by adding a counter in the vertical sync code in the TV object. Can anyone suggest or think of another or better way to accomplish this?
However to do this I need increment a counter each time a vertical sync occurs. The only way I can think of doing this is by adding a counter in the vertical sync code in the TV object. Can anyone suggest or think of another or better way to accomplish this?
Comments
My numbers seem to be increasing faster than 30fps. What is the default frame rate? Is there way to specify frame rate?
·
repeat
··· if tv_status<>status_state
····· if tv_status==2························ ' sync data 1=invisible, 2=visible
······· str(string($0A,16,$0B,12))
······· hex(sync_count++,2)
······· status_state := tv_status
(b) In non-interlaced mode, tv_status is set each field = 60 times per second
For this to work I only want to increment the counter when tv_status changes state (1 to 2). The last line is there to update the temp variable called status_state. When tv_status and status_state are different I know that the tv_status state has changed so I update the counter and then update the temp variable.
60fps seems right based on what I'm seeing, any way to slow things down?
Place the last line one indent backwards, and it should work, as expected.
Andy
· repeat
··· if tv_status<>status_state
····· if tv_status==2······················· ' sync data 1=invisible, 2=visible
······· str(string($0A,16,$0B,12))
······· hex(sync_count++,4)
····· status_state := tv_status
Post Edited (DynamoBen) : 9/21/2007 6:06:12 PM GMT
I'm having trouble reading the tv_status variable when I setup my code objects as follows:
My code (read tv_status and display counter)
|_ TV_Text
····|_ TV
If I make a copy of TV_Text and bury my code in it my counter works fine, but I'm trying to avoid this as much as I can. What am I not missing?·
However I kicked it all out of my TV programs (and my version of TV_TEXT) and used the DAT original.
- Remove the VARs
- Remove the LONGMOV
- Do the fine-work ...
Makes the programs much more readable and avoids above problems.
However: No second or third monitor
Are you saying you edited your TV_text file and removed:
- VARs
- LONGMOV
And now you handle these things in your object instead of TV_Text?
Post Edited (DynamoBen) : 9/21/2007 9:41:04 PM GMT
Whenever I have an object that is shared at different levels, I change the code for the object to put all of the variables in the DAT section rather than the VAR section. Multiple copies of objects have individual VAR sections, but they all share the same DAT section. In your case, if you did this, all TV_TEXT objects would refer to the same TV output.
Mike's suggestion for creating accessor functions for getting variable pointers is also very handy in many cases. Too bad we can't use function pointers!
Ken
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
No, there is no handling... However I changed it to non-interlaced, for the sake of better quality on 240 line monitors...
That leaves just 7 lines for the 32 line ROM-fonts, but is VERY readable now
I planned to squeeze the ROM font to 16 lines, by changing TV, but that was shifted to the coming Tutorial...
The options are:
1. Just edit the existing copy of tv_text
2. Make a new copy of TV_text then edit the copy
3. Make a copy of tv_text and add in my code into it
Originally I made a copy of TV_Text and added my code to it. The issue I ran into was if I added days, hours, minutes, seconds, and frames to the displayed counter it slowed down and wasn't displaying every frame. I then moved the counter routine to its own COG but this got me thinking that breaking things apart (TV, TV_Text, My Object) to remedy the issue more cleanly.
Post Edited (DynamoBen) : 9/24/2007 10:40:10 PM GMT