Converter translates Bayer raw data to RGB format

Yu-Chieh Chen and Tai-Shan Liao, National Applied Research Laboratories, Hsinchu, Taiwan -- EDN Europe, 01 Mar 2010

CMOS image sensors include the color filters of an RGB (red/ green/blue) Bayer array, which lets the sensor detect colors. The image data, the output from the image sensor, is Bayer raw data (Figure 1). Unfortunately, most consumer-grade imagedisplaying devices require an RGBimage- data format with red, green, and blue in each pixel’s data. Therefore, you often need a Bayer-raw-datato- RGB converter between an image sensor and a displaying device. This Design Idea describes such a converter in Verilog HDL (hardware-description language). You can implement the code, available from the online version of this Design Idea at www.edn-europe.com/article.asp?articleid=3838, into a CPLD or an FPGA.

To make the design easy to understand, the RGB data is only 24 bits deep. A 320x240-pixel test-bench pattern verifies the design (Figure 2). The image data for red, green, and blue are 88h, 66h, and 22h, respectively. Figure 3 shows the timing of the converter, and Figure 4 shows the flow chart. In Figure 3, the PCLK (processor-clock) signal’s rising edge latches the 24-bit RGB data. The LVAL (line-valid) cap signal is the synchronized line-valid signal for reading the data. The process begins when the FVAL (frame-valid)- data signal goes high. When that action occurs, sensor data begins writing to FIFO1 (first-in/first-out), FIFO2, and the data register. After saving the data, FIFO1 reads it out. FIFO2 and the data register read their data at the same time. Those readouts occur one clock cycle after FIFO1 starts reading. The next 24-bit RGB data remains the same in the data register, and it combines the data from FIFO1 and FIFO2, which read out at the same rising edge of the clock. The line-count signal shows whether the data is even or odd, which influences the combinational sequences of the data that reads out from FIFO1, FIFO2, and the data register.

Figure 5 is the ModelSim simulation waveform of the converter. The 24-bit RGB output-data values 88h, 66h, and 22h are red, green, and blue data, respectively. The figure shows the 24-bit RGB data as having red, green, and blue values of 88h, 66h, and 22h, respectively, during every line-data period. The line-data period matches the default pixel value in the image data’s test-bench pattern.


 

Our Sponsors



Ads by Google