Software Drivers

rgb2ycrcb.c File Reference


Detailed Description

This is main code of Xilinx RGB to YCrCb Color Space Converter (RGB2YCRCB) device driver. Please see rgb2ycrcb.h for more details of the driver.

MODIFICATION HISTORY:

Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 5.00a tb 02/27/12 Updated for RGB2YCRCB v5.00.a

#include "rgb2ycrcb.h"
#include "xenv.h"
#include "stdio.h"

Functions

void RGB_select_standard (u32 standard_sel, u32 input_range, u32 data_width, struct rgb_coef_inputs *coef_in)
u32 RGB_coefficient_translation (struct rgb_coef_inputs *coef_in, struct rgb_coef_outputs *coef_out, u32 data_width)
void RGB_set_coefficients (u32 BaseAddress, struct rgb_coef_outputs *coef_out)
void RGB_get_coefficients (u32 BaseAddress, struct rgb_coef_outputs *coef_out)


Function Documentation

u32 RGB_coefficient_translation struct rgb_coef_inputs *  coef_in,
struct rgb_coef_outputs *  coef_out,
u32  data_width
 

Translate input coefficients into coefficients that can be programmed into the RGB2YCrCb core.

Parameters:
coef_in is a pointer to a rgb_coef_inputs data structure.
coef_out is a pointer to a rgb_coef_output data structure.
Returns:
The 32-bit value: bit(0)= Acoef + Bcoef > 1.0 bit(1)= Y Offset outside data width range [-2^data_width, (2^data_width)-1] bit(2)= Cb Offset outside data width range [-2^data_width, (2^data_width)-1] bit(3)= Cr Offset outside data width range [-2^data_width, (2^data_width)-1] bit(4)= Y Max outside data width range [0, (2^data_width)-1] bit(5)= Y Min outside data width range [0, (2^data_width)-1] bit(6)= Cb Max outside data width range [0, (2^data_width)-1] bit(7)= Cb Min outside data width range [0, (2^data_width)-1] bit(8)= Cr Max outside data width range [0, (2^data_width)-1] bit(9)= Cr Min outside data width range [0, (2^data_width)-1]
Note:

void RGB_get_coefficients u32  BaseAddress,
struct rgb_coef_outputs *  coef_out
 

Read the RGB2YCrCb coefficient/offset registers.

Parameters:
BaseAddress is the Xilinx EDK base address of the RGB2YCrCb core (from xparameters.h)
coef_out is a pointer to a rgb_coef_output data structure.
Returns:
None.
Note:

void RGB_select_standard u32  standard_sel,
u32  input_range,
u32  data_width,
struct rgb_coef_inputs *  coef_in
 

Select input coefficients for 4 supported Standards and 3 Input Ranges.

Parameters:
standard_sel is the standards selection: 0 = SD_ITU_601 1 = HD_ITU_709__1125_NTSC 2 = HD_ITU_709__1250_PAL 3 = YUV
input_range is the limit on the range of the data: 0 = 16_to_240_for_TV, 1 = 16_to_235_for_Studio_Equipment, 3 = 0_to_255_for_Computer_Graphics
data_width has a valid range of [8,10,12,16]
coef_in is a pointer to a rgb_coef_inputs data structure.
Returns:
None.
Note:

void RGB_set_coefficients u32  BaseAddress,
struct rgb_coef_outputs *  coef_out
 

Program the RGB2YCrCb coefficient/offset registers.

Parameters:
BaseAddress is the Xilinx EDK base address of the RGB2YCrCb core (from xparameters.h)
coef_out is a pointer to a rgb_coef_output data structure.
Returns:
None.
Note:
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.