ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VP_SDK / VP_Api / vp_api_picture.h
1 /**
2  *  \brief    VP Api. Output SDL stage declaration
3  *  \author   Sylvain Gaeremynck <sylvain.gaeremynck@parrot.fr>
4  *  \author   Aurelien Morelle <aurelien.morelle@parrot.fr>
5  *  \author   Thomas Landais <thomas.landais@parrot.fr>
6  *  \version  2.0
7  *  \date     first release 16/03/2007
8  *  \date     modification  28/03/2007
9  */
10
11 #ifndef _VP_API_PICTURE_H_
12 #define _VP_API_PICTURE_H_
13
14 #include <VP_Os/vp_os_types.h>
15 #ifdef USE_FFMPEG
16 #include <libavutil/avutil.h>
17 #else
18 /**
19  * Pixel format. Notes:
20  *
21  * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
22  * color is put together as:
23  *  (A << 24) | (R << 16) | (G << 8) | B
24  * This is stored as BGRA on little endian CPU architectures and ARGB on
25  * big endian CPUs.
26  *
27  * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
28  * image data is stored in AVFrame.data[0]. The palette is transported in
29  * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
30  * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
31  * also endian-specific). Note also that the individual RGB palette
32  * components stored in AVFrame.data[1] should be in the range 0..255.
33  * This is important as many custom PAL8 video codecs that were designed
34  * to run on the IBM VGA graphics adapter use 6-bit palette components.
35  */
36 enum PixelFormat {
37     PIX_FMT_NONE= -1,
38     PIX_FMT_YUV420P,   ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
39     PIX_FMT_YUV422,    ///< Packed pixel, Y0 Cb Y1 Cr
40     PIX_FMT_RGB24,     ///< Packed pixel, 3 bytes per pixel, RGBRGB...
41     PIX_FMT_BGR24,     ///< Packed pixel, 3 bytes per pixel, BGRBGR...
42     PIX_FMT_YUV422P,   ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
43     PIX_FMT_YUV444P,   ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
44     PIX_FMT_RGBA32,    ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
45     PIX_FMT_YUV410P,   ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
46     PIX_FMT_YUV411P,   ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
47     PIX_FMT_RGB565,    ///< always stored in cpu endianness
48     PIX_FMT_RGB555,    ///< always stored in cpu endianness, most significant bit to 1
49     PIX_FMT_GRAY8,
50     PIX_FMT_MONOWHITE, ///< 0 is white
51     PIX_FMT_MONOBLACK, ///< 0 is black
52     PIX_FMT_PAL8,      ///< 8 bit with RGBA palette
53     PIX_FMT_YUVJ420P,  ///< Planar YUV 4:2:0 full scale (jpeg)
54     PIX_FMT_YUVJ422P,  ///< Planar YUV 4:2:2 full scale (jpeg)
55     PIX_FMT_YUVJ444P,  ///< Planar YUV 4:4:4 full scale (jpeg)
56     PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
57     PIX_FMT_XVMC_MPEG2_IDCT,
58     PIX_FMT_UYVY422,   ///< Packed pixel, Cb Y0 Cr Y1
59     PIX_FMT_UYVY411,   ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
60     PIX_FMT_NB,
61 };
62 #endif
63
64 #define OVERPAD                 16
65 #define MB_WIDTH_Y              16
66 #define MB_HEIGHT_Y             MB_WIDTH_Y
67 #define MB_WIDTH_C              8
68 #define MB_HEIGHT_C             MB_WIDTH_C
69
70
71 // SQCIF
72 #define SQCIF_WIDTH             128
73 #define SQCIF_HEIGHT            96
74 #define SQCIF_SIZE              (SQCIF_WIDTH * SQCIF_HEIGHT)
75
76 // QCIF
77 #define QCIF_WIDTH              176
78 #define QCIF_HEIGHT             144
79 #define QCIF_SIZE               (QCIF_WIDTH * QCIF_HEIGHT)
80
81 #define QQVGA_WIDTH             160
82 #define QQVGA_HEIGHT            120
83 #define QQVGA_SIZE              (QQVGA_WIDTH * QQVGA_HEIGHT)
84
85 // QQCIF
86 #define QQCIF_WIDTH             88
87 #define QQCIF_HEIGHT            72
88 #define QQCIF_SIZE              (QQCIF_WIDTH * QQCIF_HEIGHT)
89
90 // QQVGA
91 #define QQVGA_WIDTH             160
92 #define QQVGA_HEIGHT            120
93 #define QQVGA_SIZE              (QQVGA_WIDTH * QQVGA_HEIGHT)
94
95 // QVGA
96 #define QVGA_WIDTH              320
97 #define QVGA_HEIGHT             240
98 #define QVGA_SIZE               (QVGA_WIDTH * QVGA_HEIGHT)
99
100 // TWEAKY QQVGA
101 #define TWEAKY_QQVGA_WIDTH      320
102 #define TWEAKY_QQVGA_HEIGHT     (240-16)
103 #define TWEAKY_QQVGA_SIZE       (TWEAKY_QQVGA_WIDTH * TWEAKY_QQVGA_HEIGHT)
104
105 // CIF
106 #define CIF_WIDTH               352
107 #define CIF_HEIGHT              288
108 #define CIF_SIZE                (CIF_WIDTH * CIF_HEIGHT)
109
110 // VGA
111 #define VGA_WIDTH               640
112 #define VGA_HEIGHT              480
113 #define VGA_SIZE                (VGA_WIDTH * VGA_HEIGHT)
114
115
116 typedef struct _vp_api_picture_
117 {
118   enum PixelFormat format;    // camif -> encoder : PIX_FMT_YUV420P
119
120   uint32_t         width;     // camif -> encoder
121   uint32_t         height;    // camif -> encoder
122   uint32_t         framerate; // camif -> encoder
123
124   uint8_t         *y_buf;     // camif -> encoder
125   uint8_t         *cb_buf;    // camif -> encoder
126   uint8_t         *cr_buf;    // camif -> encoder
127
128   uint32_t         y_pad;     // 2* camif_config.y_pad
129   uint32_t         c_pad;     // 2* camif_config.c_pad
130
131   uint32_t         y_line_size;
132   uint32_t         cb_line_size;
133   uint32_t         cr_line_size;
134
135   uint32_t         vision_complete;
136   uint32_t         complete;
137   int32_t          blockline;
138 }
139 vp_api_picture_t;
140
141
142 #endif // ! _VP_API_PICTURE_H_