Shop OBEX P1 Docs P2 Docs Learn Events
Need Advise: How to Analyze Video Input — Parallax Forums

Need Advise: How to Analyze Video Input

MavromatisMavromatis Posts: 5
edited 2008-04-18 20:01 in Propeller 1
Hi there,

I'm trying to figure out the easiest way to analyze a composite video input. I'm trying to get my screen masking controller to automatically detect if the video is 16x9 or 4:3, etc. Any ideas?

Video:
www.mavromatic.com/archives/000670

Blog Post:
www.mavromatic.com/archives/000563


Thanks,
Danny

Comments

  • AleAle Posts: 2,363
    edited 2008-04-11 20:03
    Probably you should measure the times for line/frame they will be sort of fixed for each mode... that can be done with the prop when the signal has proper CMOS levels

    Edit: Have a look at the Propeller Counters application note at parallax's doc page
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-04-11 21:10
    I wasn't aware 16:9 signaling was availible on composite, I thought it had to be component.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-04-11 23:02
    You can do 16:9 on composite. Don't have a clue how to tell the difference though.
  • Harrison.Harrison. Posts: 484
    edited 2008-04-11 23:34
    You could calculate the aspect ratio by using a sync separator chip (EL1883) to count the number of lines where the video signal is below the black voltage level. You'll probably want to use an ADC or threshold circuit that can sample each video line at least a few times so you can distinguish between a single black pixel and an entire black line. You can then keep a counter of the total number of black lines for the upper half of the frame and use that to select the aspect ratio.
  • MavromatisMavromatis Posts: 5
    edited 2008-04-12 04:46
    Harrison,

    I see that EL1883 will give my HSYNC and VSYNC. So I can count the lines... how would I go about checking the lines content to see if the line is black?

    I have done a SDI mod to my DVD player using a SDI encoder from the 8 data lines + H/V sync + CLK and an FPGA (verilog). I would like to stay away from such a project since it required a lot of time and circuits to get it to work. www.mavromatic.com/archives/000029

    I could use a PC and a video input card and run software to analyze the video but I would like an embedded device to do it...

    Danny

    Post Edited (Mavromatis) : 4/12/2008 5:00:12 AM GMT
  • RinksCustomsRinksCustoms Posts: 531
    edited 2008-04-12 15:04
    since composite is a "fixed screen" and the 16:9 ratio is just a scaled down 16:9 image with reduced resolution to a max of 480p (~256 x 192 analog), all you'd need is an H-SYNC separator and offset a sample reading on a line where the black bars are or not. The NTSC screen is a timed event making scanning for an all black line within the bar region easy.

    wait for H-SYNC
    pause for the time it takes NTSC to run through like 5-10 lines
    test next few lines for black level with an ADC to determine if the screen has black bars or not

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • MavromatisMavromatis Posts: 5
    edited 2008-04-12 15:54
    RinksCustoms said...
    since composite is a "fixed screen" and the 16:9 ratio is just a scaled down 16:9 image with reduced resolution to a max of 480p (~256 x 192 analog), all you'd need is an H-SYNC separator and offset a sample reading on a line where the black bars are or not. The NTSC screen is a timed event making scanning for an all black line within the bar region easy.

    wait for H-SYNC
    pause for the time it takes NTSC to run through like 5-10 lines
    test next few lines for black level with an ADC to determine if the screen has black bars or not

    I really need to know if its 1.85:1, 2.35:1, etc. not just if it's 4:3 or 16x9. So I would need to know what type of letterboxing is happening. What parts would I need to make this work?

    Thanks,
    Danny
  • Harrison.Harrison. Posts: 484
    edited 2008-04-12 16:17
    I thought letterboxing just applied to the vertical screen space (top and bottom of screen). If this is the case, then it will be really easy. All you have to do is basically count the number of black lines on the top half of the video frame.

    I did something similar to this with a PIC a few years ago. I used an EL1881 sync separator to trigger an interrupt on the composite sync output that would run take 6 ADC samples on the video line. I stored this data in an array that I processed outside the interrupt routine. Your situation can just increment a 'black line' counter instead of storing in an array.

    As for an explanation on how the EL1881/EL1883 chips work: The composite sync output contains both vertical and horizontal sync information. It signals every new video line, and every time the frame goes back to the top. Using the sync chip is perfect for this situation because it means you'll know exactly which video line you are on. No need to guess which line you are on with messy delay routines.
  • MavromatisMavromatis Posts: 5
    edited 2008-04-12 16:31
    Harrison. said...
    I thought letterboxing just applied to the vertical screen space (top and bottom of screen). If this is the case, then it will be really easy. All you have to do is basically count the number of black lines on the top half of the video frame.

    I did something similar to this with a PIC a few years ago. I used an EL1881 sync separator to trigger an interrupt on the composite sync output that would run take 6 ADC samples on the video line. I stored this data in an array that I processed outside the interrupt routine. Your situation can just increment a 'black line' counter instead of storing in an array.

    As for an explanation on how the EL1881/EL1883 chips work: The composite sync output contains both vertical and horizontal sync information. It signals every new video line, and every time the frame goes back to the top. Using the sync chip is perfect for this situation because it means you'll know exactly which video line you are on. No need to guess which line you are on with messy delay routines.


    Sweet, sounds like that is my solution. Yes, I only need to know the top bar height (since the bottom is the same). If there is no letterboxing, I know it's 4:3, so I could trigger a side masking.

    So the EL1881 chip will signal a new line... the composite sync output should trigger a total of 525 lines/NTSC, right? Then using ADC, I can check if the output value is 0 (or some value) for black, if so, add to my masking counter?

    Thanks,
    Danny

    Post Edited (Mavromatis) : 4/12/2008 4:38:01 PM GMT
  • MavromatisMavromatis Posts: 5
    edited 2008-04-18 20:01
    I got a EL 1883... my question is now... If I wire up the composite input to the IC, what output would I wire up to a ADC on the propeller?

    Here is the data sheet: www.intersil.com/data/fn/fn7010.pdf

    Danny
Sign In or Register to comment.