Monday, November 25, 2013

VBI injection: it works!!

I've got my VBI injection code working well enough to be able generate complete laserdisc data.  In the above example, I successfully have generated the following data:

Track 0 Field 0 WhiteFlag:1 L16:f86767 L17:f81313 L18:f83210
Track 0 Field 1 WhiteFlag:0 L16:f86760 L17:800001 L18:800002

To break that down, on line 11 I have a solid white line (white flag), and on line 16, 17, and 18, I have data that begins with 0xF8.  And so on.  This is what I was attempting to generate so to have it succeed is very gratifying.

You may notice that there is a little wobble with the white lines in that they are not consistently drawn in the same place.  This _may_ be due to the way the AVR handles external interrupts by default.  I haven't looked into this too closely yet.  I suspect it may not matter at all since the official laserdisc spec does allow for some small variation about when the line is drawn.

1 comment:

  1. This is _awesome_ work! Our fiendish plot will be successful! mwuahahahaha...

    I think you're right about the wobble being due to how interrupts are handled; the AVR CPU finishes processing the current instruction before jumping to the ISR, so the number of cycles is unpredictable. Perhaps the main thread could sit in a long series of NOPs, or an infinite jump either of these takes just one cycle, so the count is always the same. The commonly used technique is to put the CPU into sleep mode before the start of the line, in which case it always takes the same number of cycles after the interrupt occurs to get to the ISR code. I think you already know all this, though! :)

    The LM1881 datasheet doesn’t speak to sync pulse timing accuracy, but it’s designed for overlay applications like this, so it shouldn’t be the cuplrit.

    As you say, a slight wobble is probably fine. Laserdisc players themselves had a fair amount of jitter in the VBI data due to the vagaries of time-base correction for rotational speed errors. The early players used fairly simple analog CCD "memory" and feedback from the spindle servo, so they were even less stable than the average home player with digital TBC.