zivilyn861

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Counting frames in a video source #2064
    zivilyn861
    Member

    So I went back into the blank_line() function in video_gen.cpp (the only place I’ve seen vbi_hook() called), and incremented there. Strangely, that else if branch doesn’t seem to be getting executed as often as one would think. It’s happening at least once (to set the frameCount), but it’s certainly not being called more than that. I think there’s a bug somewhere where the TVout developer forgot to change some code around. You can tell in the TVout_vid struct that the lines_frame that’s being referenced here has a //remove me comment there, making me think it may have been partially removed at some point. Strangely, hardcoding the comparison to something like _NSTC_LINE_FRAME (which is what lines_frame should be for an NTSC signal) doesn’t do it either.

    For now, I’ve moved my frameCount++ to the if block above that, which seems to occur at the beginning of each frame. That itself gives me a much better (and sane) frame count, albeit technically a small fraction of time off from reality. I’ll dig into the TVout library later to see if I can find the issue.

    Thanks so much for your continued help here; it saved me tons of time.

    in reply to: Counting frames in a video source #2062
    zivilyn861
    Member

    Yeah, the counter is increasing by about 5,000 per second. That’s rough timing based on eyeballing it.

    in reply to: Counting frames in a video source #2060
    zivilyn861
    Member

    Thank you, that worked for getting the number to update on the display. It looks like the INT0 interrupt is hit much more often than a full frame, however. The number gets way too high too quickly. Only incrementing frameCount every 60 (or 64) calls to INT0_vect gets me close to the expected rate, which leads me to believe that this may be called for each line instead of each frame. Judging by the display.scanLine = 0 line, I think that’s what’s happening.

    Perhaps there’s another ISR I can use for it? Otherwise I can simply do some math to make it work out, but it’s technically work the microcontroller shouldn’t be doing in an ISR, so I’d like to make it as accurate and minimally-intensive as possible.

    Sorry for all of the questions, I’m digging into it myself but figured you have a better understanding of the code base in either case.

    Thanks!

    in reply to: Counting frames in a video source #2056
    zivilyn861
    Member

    Certainly, below is what I’m using for my loop().


    void loop() {
    sprintf(s, "Frames: %d", tv.count_frames());
    tv.print(0, 0, s);
    }

    As a simple test, that’s all I’m printing. For what it’s worth, I’m using the OverlayDemo code as a baseline. In thise case, count_frames() is implemented as such in TVout.cpp:


    int TVout::count_frames() {
    return frameCount;
    }

    That goes back to a volatile int frameCount in video_gen.cpp.

    in reply to: Counting frames in a video source #2053
    zivilyn861
    Member

    I’m having a bit of an issue that maybe you can help clarify a bit more.

    I’ve tried both methods you’ve mentioned (incrementing a volatile int/unsigned long within either ISR(TIMER1_OVF_vect) or a function that I set the *vbi_hook() function pointer to) with some unexpected results. As you suspected, my goal is to display a running total of frames elapsed via an overlay. I have a function that accesses the volatile variable within TVout.cpp so that my sketch can sprintf it to the overlay.

    The issue I’m having is that, while I can easily set the frameCount variable to a static number, I’m having issues with it when I try an increment. For example, inside of the ISR(TIME1_OVF_vect) function, a frameCount++; statement ends up displaying “42” as the framecount, and that count doesn’t change.

    Both methods more or less produce the same results. I suspect I’m missing something really simple here–can you help?

    Thanks!

    in reply to: Counting frames in a video source #2051
    zivilyn861
    Member

    Ah, perfect! Thank you very much!

Viewing 6 posts - 1 through 6 (of 6 total)