500 likes | 665 Views
Video. James E. Stine, Jr. Oklahoma State University ECEN 3233: Digital Logic Design. Video. Video is really revolutionizing the digital market today and you can expect that this trend will continue.
E N D
Video James E. Stine, Jr. Oklahoma State University ECEN 3233: Digital Logic Design
Video • Video is really revolutionizing the digital market today and you can expect that this trend will continue. • Video is probably one of the more challenging elements of digital logic, but I feel one of the most exciting. • I wanted to give you a feel about video both analog (old school) and digital (new school). • I hope that this will be as “eye-opening” as it was to me the first time I played with video.
What ya know! • You probably already know a couple of things, because video is everywhere including your homes. • There are several standards: • NTSC/PAL • SECAM • VGA/XGA • These are the root elements. • We will get to HDTV later.
NTSC • NTSC was developed in late 1940s and in use for black and white TVs • PAL (European) and SECAM (French) was soon developed right after. • Each standard has several things it covers: • Number of lines on a screen • Refresh rate • Maximum color resolution • Many standards now, but we will focus on these for right now.
Basic Display • Originally an electron beam was focused on a screen by way of a Cascode Ray Tube (CRT). • An image or Raster Image is generated by sweeping an electron beam that excites phosphors on the front of the CRT. • The Raster starts at the upper left, moving left to right, and top to bottom. • Each Raster consists of a number of lines (rows) and a number of pixels or dots per row. • The number of pixels per row and lines per image make up the picture’s resolution. • NTSC has 525 lines • PAL has 625 lines • VGA has 480 lines
Sine Wave : Basics of AC Power • Raster technology based on power systems at times of its creation. • American homes use 60 Hz or 60 cycles/second • So NTSC uses 60 frames/second • European homes use 50 Hz. • PAL uses 50 frames/second. [Source: WikiPedia]
Basics • Scanning process involves repeated number of steps to control movement of electron gun (still used to control insertion of dopants into semiconductors). • Image produced is based on number of horizontal lines at end of scanning process. • Electron gun must reset at bottom of screen and retrace back to upper left of screen and start again. • Synchronization pulses (like clocks) to indicate these events: • One for horizontal axis (hsync) • One for vertical axis (vsync) • Raster Image (NTSC) • 525 lines begins with a horizontal sync (hsync) • Actual pixel information (actually Amplitude Modulated (AM) signals) • Lines that compose image are drawn • Image is told to retrace by vertical sync (vsync)
60 Hz or 60 frames/sec • 60 frames/second is a lot of data for one screen. • Even if the electron beam could move real quickly, its still a lot of data. • So, a clever scheme was invented to give engineers more time to draw things on the screen. • So, two frames are used to create the image. • This process is called interlacing. • NTSC then has 30 frames/second.
Raster Scan Interlacing 525/2 = 262.5 lines where the raster draws these lines with gaps in between them (field 1), then field 2 comes along to fill-in the gaps - your eyes cannot tell the difference except if you see a image or picture of a TV
Video Games • Other methods besides interlacing to help with the problem with 60 frames/second. • Called progressive scan and many computer games work this way. • So instead of sending frame a and then frame b, 60 frames/second are sent. • However, only 262.5 lines are sent and not the full 525. • Actually lowers vertical resolution, but no flicker.
VGA/XGA • You may be used to VGA/XGA screens and these do not interlace (yeah!) • Bad thing is that pixel rate is high to accommodate 640x480 image at 60 fps • Summarize raster process: • Image is composed of a number of scanlines. • Scan line starts with hsync that retraces e-gun back to left side, one line down. • Pixel data follows sync pulse for line. • After a set number of lines (525/2 = 262.5), a vsync is generated to instruct monitor to retrace to top of screen. • Before and after vertical sync there are blanking lines with nothing on them.
RS-170 • Original B/W TVs had something called the RS-170 standard to adhere to later rename RS-170A. • The standard was supposed to be the standard to adhere to no matter what! • But you can vary and it will probably work. • Most of the standard that I will be talking on from now on will be NTSC, but there are subtle differences for PAL which I might mention here and there.
Scanline Breakdown • RS-170A defines a single peak-peak voltage of 1 V (some say 1.4 V), but TVs work with Automatic Gain Control (AGC) to make sure value is somewhere between 1.0-1.5 Volts. • Abritrary unit of measurement called IRE. • Start with blanking level (0 IRE = 0.25 - 0.30 V) • Called front-porch and lasts 1.5 us • Hsync next and lasts 4.5 us is -40 IRE or 0 Volts (Ground or Logic 0). • Breezway is next at 0.6 us which is 0 IRE • Color burst (later) is 8-10 cycles of 3.58 MHz modulated on top of blanking level. • 40 IRE and lasts 2.5 us • Back porch at a blanking level of 0 IRE. • Then B/W signal which lasts for 52.6 us. • This means total scan is 63.5 us and hsync is 16.625 KHz.
NTSC/PAL Line Timings Intensity or brightness is proportional to the voltage during video scan, blanking level sets black level (1.0 V or 100 IRE or 140 peak to peak)
Problem? 1/4.2 Mhz = 238 ns but pixel time is 52.6 us / 256 = 205 ns [224 pixels is 234.82 ns]
Vertical Sync Format http://www.ntsc-tv.com
Screen Layout • Blanking lines at top and bottom of image (about 4-10) • Maximum to have is about 16 lines of overscan for top and 16 lines for bottom. • 224 lines of active video. • 256 lines is way too much! (you cannot see difference). • 4-10 lines of vsync. • 6 lines of vsync is probably good at maxium.
Color : The CandyMan Can • RS-170 did not originally have color and like all good engineering tricks, engineers had to figure a way around a standard that was already available. • You do not to want to disrupt signal! • Solution: ride signal on top of signal • radios do this all the time. • Usually 8-10 cycles of a color-burst tone (3.58 MHz for NTSC) added during blanking period. • Color is called chroma signal. • Brightness is called luma signal.
Relationship between Color Burst and Color Bars Send color burst tone and add chroma on top of it. By shifting chroma signal with reference to the original color burst, you get all the colors.
Funky Math • 3.579545 MHz for color burst signal. • 1/f = 280 ns • Send color burst and phase shift color by some amount (0 - 280 ns) • Send color burst for 10 cycles during blanking period for each line then add color burst to amplitude phase shifted by some amount. • Phase shift is just a delay ( you will see later in other classes).
Color Math • Standard composite signal consists of a signle channel that must contain all synchronization information as well as video and audio. • Remember modulate (?) signal on top of composite signal without disturbing amplitude portion of black/white signal. • Modulation is multiplication of two signals usually based on a sine wave. NTSC Luma PAL Luma Actually called quadrature modulation, but I defer that to your later classes! (save this lecture) Modulation
How about others? • Let’s show complete equation just for food for thought - just think digital :).
I vs Q Relationship I and Q are perpendicular to each other and form color. The angle of C defines its color and magnitude is color saturation. Interesting fact: S-video chroma and luma are different lines and not modulated together - modulation allows two signals on one line.
VGA • RGB signals have always been easier to handle than NTSC/PAL (no duh). • Can’t we just send RGB signals without encoding on separate analog signals. • Some monitors actually had separate hsync and vsync signals since these were usually just digital clocks with different duty cycles. • This is called VGA or RGB displaying.
VGA basics • Same as before but separate RGB signals so don’t have to worry about them. • 640x480 pixels • Refresh rate of 60 Hz. • Master timing = 25.175 MHz (39.722 ns) • Spec is 0.7 V (but 1.0 V seems to work too). • RGB (0.7 V, 0.7 V, 0.7 V) = color white • Use a D-subminiature (dsub) 15 connection.
dsub 15 connection 5 signals, 5 grounds
VGA Signals • Each RGB channel must be between 0 and 5 Volts. • 24-bit color would be 8 bits/channel. • Each channel would be 0-255 values. • Video DACs convert signals from digital to analog. • Remember VGA is analog signals. • We do not have one of these and, therefore, connect directly to our FPGA so we can only represent 23 colors or 8 colors. • There are special chips with these vDACs or video DACs to handle conversion to db15.
Timing Breakdown • 31.77 us per line • Hsync = 3.77 us • Black = 1.89 us • Video = 25.17 us • Black = 0.94 us Where’s 640?
Modified Timing • 25.17 us + 8*39.722ns = 25.49 us • New Blanking period = 1.89 us - 0.318 us = 1.57 us 800 cycles or 31.77 us is non-negotiable!!
C-code // Draw Line Function // assume pixels are stored in 640 byte array in RGB format Unsigned char pixel_data[640] = {…}; // render line for (pixel = 0; pixel <= 799; pixel++) { // test for sync if (pixel >=0 && pixel <= 94) hsync(on); else hsync(off); // test for blanking periods if ((pixel >= 95 && pixel <= 135) || (pixel >= 776 && pixel <= 799)) { VGA_video(0); // send black if (pixel >= 136 && pixel <= 775) { VGA_video(pixel_data[pixel-136]); }
States Don’t forget vsync which is taken care of by breaking screen into lines and then using counter to turn vsync on when necessary
C-code // render frame for (line=0; line <= 524; line++) { // test for sync if (line >= 0 && line <= 1) { Vsync(ON); else Vsync(OFF); // test for blanking periods if ((line >= 2 && line <= 33) || (line >= 514 && line <= 524)) VGA_video(0); // send black // test for active video if (line >= 34 && line <= 514) draw_line(); } // end line
Video Games • Older video games used 8x8 pixels as a character (e.g. Mario, PacMan) • This is called sprite. • Today, graphics designers, usually artists, digitize pictures, however, process is similar in terms of memory reference. • Because the screen does not have to be that big, some screens are actually smaller to allow more time to do processing of game.
Vectored Graphics Before bit-mapped raster graphics, vectored graphics worked well where instead of a having a constantly moving image being painted, vectored displays allow the position of the beam by an x-y input
Graphics Controllers • Newer systems have dedicated chips to handle graphics, such as nVidea G4 based processors. • Example: 6545/6845 CRT Controller
HDTV • HDTV is pure digital television where no analog signals are involved. • Because its digital, all you have to worry about is the digital clocks. • Becaues its digital you can also compress the image, which give you more time to do stuff. • 1981 was first HDTV demonstration. • But had to wait until 21st century to have enough power to handle processing of image (compression). • As you may or may not know, 2009 will have all digital broadcasts and cease any use of analog transmission.
HDTV • HDTV still works the same way. • Number of lines in the vertical display is called the resolution. • There are still progressive and interlaced scanning (yes, remember). • Number of frames/second is still based on power as a historical element. • 24p = 24 progressive scan frames/sec • 50i = 25 interlaced frames/second. • But, things are fast enough that it doesn’t have to be exact!
Raster Graphic HDTV SDTV [Source: WikiPedia] Greater processing power makes greater image quality!
How good is Digital Video? [Source: WikiPedia]
Conclusions • Digital logic allows video to happen!!! • Get interested in video - it will be your future! • Especially if you are interested in digital logic! • Digital system design is esstential to making architectures that can handle data. • Data speeds up by making things operate in parallel as opposed to serially. • It is important to make things adaptable to older elements!