3015e475bdafcbf9c69a3655f5956861be2240f0
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VP_SDK / VP_Stages / vp_stages_yuv2rgb.h
1 /**
2  *  @file   vp_stages_yuv2rgb.h
3  *  @brief  VP Stages. YUV to RGB converter stage declaration
4  */
5
6 ///////////////////////////////////////////////
7 // INCLUDES
8
9 #ifndef _VP_STAGES_YUV2RGB_INCLUDE_
10 #define _VP_STAGES_YUV2RGB_INCLUDE_
11
12 /** 
13  * @addtogroup VP_Stages
14  * @{ */
15
16 /** 
17  * @defgroup vp_stages_yuv2rgb YUV-4:2:0p to RGB converter stage
18  *
19  * \section Brief
20  * \code
21  Gets in input a frame which type is vp_api_picture_t and format is planar YUV-4:2:0.
22  Converts it into RGB format : RGB-565 (16 bits), RGB24 or Alpha-RGB (32 bits)
23  Stores the result frame into the output buffer.
24  * \endcode
25  *
26  * \section History
27  *
28  * @{ */
29
30 #include <VP_Api/vp_api.h>
31 #include <VP_Api/vp_api_picture.h>
32
33 ///////////////////////////////////////////////
34 // TYPEDEFS
35
36 /** Select RGB format
37  */
38 typedef enum _VP_STAGES_RGB_FORMAT
39 {
40   VP_STAGES_RGB_FORMAT_MARKER_BEGIN = -1,
41   VP_STAGES_RGB_FORMAT_RGB565       = 0,
42   VP_STAGES_RGB_FORMAT_RGB24,
43   VP_STAGES_RGB_FORMAT_ARGB32,
44   VP_STAGES_RGB_FORMAT_MARKER_END
45 } VP_STAGES_RGB_FORMAT;
46
47 typedef enum _VP_STAGES_YUV2RGB_CONVERSION_MODE
48 {
49   VP_STAGES_YUV2RGB_MODE_NORMAL = 0,
50   VP_STAGES_YUV2RGB_MODE_UPSIDE_DOWN,
51 } VP_STAGES_YUV2RGB_CONVERSION_MODE;
52
53
54 /**
55  *  @brief   Configuration structure for the YUV-4:2:0p to RGB-Alpha converter stage
56  */
57 typedef struct _vp_stages_yuv2rgb_config_
58 {
59   VP_STAGES_RGB_FORMAT rgb_format; //!< Select RGB format
60
61 #ifdef USE_YUV2RGB_STRETCH
62   uint32_t*  hline0;
63   uint32_t*  hline1;
64   uint32_t*  vline;
65 #endif  // < USE_YUV2RGB_STRETCH
66
67   VP_STAGES_YUV2RGB_CONVERSION_MODE mode;
68
69 } vp_stages_yuv2rgb_config_t;
70
71
72 /**
73  *  @var     vp_stages_YUV_to_RGB_t
74  *  @brief   Define pointer type to a YUV to RGB conversion function
75  */
76 typedef void (*vp_stages_YUV_to_RGB_t)(vp_stages_yuv2rgb_config_t *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes);
77
78 ///////////////////////////////////////////////
79 // FUNCTIONS
80
81 void asm_yuvrgb565(uint8_t* dst, int32_t dst_rbytes, uint32_t* src, int y);
82
83 /**
84  *  @fn      vp_stages_yuv2rgb_stage_open(vp_stages_yuv2rgb_config_t *)
85  *  @brief   Open the YUV to RGB converter stage.
86  *  @param   cfg  Stage configuration
87  *  @return  C_RESULT : VP_SUCCESS
88  */
89 C_RESULT vp_stages_yuv2rgb_stage_open(vp_stages_yuv2rgb_config_t *cfg);
90
91
92 /**
93  *  @fn      vp_stages_yuv2rgb_stage_transform(vp_stages_yuv2rgb_config_t *, vp_api_io_data_t *, vp_api_io_data_t *)
94  *  @brief   Apply a transform over the YUV to RGB converter stage.
95  *
96  *  Gets in input a vp_api_picture_t frame which contains the Y, U, and V arrays.\n
97  *  Calls internal generic function vp_stages_YUV_to_RGB.
98  *  @param   cfg  Stage configuration
99  *  @param   in   Input buffer : contains a vp_api_picture_t *
100  *  @param   out  Output buffer
101  *  @return  C_RESULT : VP_SUCCESS
102  *  @author  Julien Floret <julien.floret.ext\@parrot.com>
103  *  @date    Last modification  30/04/2007
104  */
105 C_RESULT vp_stages_yuv2rgb_stage_transform(vp_stages_yuv2rgb_config_t *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out);
106
107
108 /**
109  *  @fn      vp_stages_yuv2rgb_stage_close(vp_stages_yuv2rgb_config_t *)
110  *  @brief   Close the YUV to RGB converter stage.
111  *  @param   cfg  Stage configuration
112  *  @return  C_RESULT : VP_SUCCESS
113  */
114 C_RESULT vp_stages_yuv2rgb_stage_close(vp_stages_yuv2rgb_config_t *cfg);
115
116 // vp_stages_yuv2rgb
117 /** @} */
118 // VP_Stages
119 /** @} */
120
121 #endif // ! _VP_STAGES_YUV2RGB_INCLUDE_