45
45
#define V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION 0x03
47
47
struct v4lconvert_data {
49
int flags; /* bitfield */
50
int control_flags; /* bitfield */
51
int supported_src_formats; /* bitfield */
52
unsigned int no_formats;
53
char error_msg[V4LCONVERT_ERROR_MSG_SIZE];
54
struct jdec_private *jdec;
55
struct v4l2_frmsizeenum framesizes[V4LCONVERT_MAX_FRAMESIZES];
56
unsigned int no_framesizes;
57
int convert1_buf_size;
58
int convert2_buf_size;
59
int rotate90_buf_size;
61
int convert_pixfmt_buf_size;
62
unsigned char *convert1_buf;
63
unsigned char *convert2_buf;
64
unsigned char *rotate90_buf;
65
unsigned char *flip_buf;
66
unsigned char *convert_pixfmt_buf;
67
struct v4lcontrol_data *control;
68
struct v4lprocessing_data *processing;
70
/* Data for external decompression helpers code */
72
int decompress_in_pipe[2]; /* Data from helper to us */
73
int decompress_out_pipe[2]; /* Data from us to helper */
75
/* For mr97310a decoder */
78
/* For cpia1 decoder */
79
unsigned char* previous_frame;
49
int flags; /* bitfield */
50
int control_flags; /* bitfield */
51
int supported_src_formats; /* bitfield */
52
unsigned int no_formats;
53
char error_msg[V4LCONVERT_ERROR_MSG_SIZE];
54
struct jdec_private *jdec;
55
struct v4l2_frmsizeenum framesizes[V4LCONVERT_MAX_FRAMESIZES];
56
unsigned int no_framesizes;
57
int convert1_buf_size;
58
int convert2_buf_size;
59
int rotate90_buf_size;
61
int convert_pixfmt_buf_size;
62
unsigned char *convert1_buf;
63
unsigned char *convert2_buf;
64
unsigned char *rotate90_buf;
65
unsigned char *flip_buf;
66
unsigned char *convert_pixfmt_buf;
67
struct v4lcontrol_data *control;
68
struct v4lprocessing_data *processing;
70
/* Data for external decompression helpers code */
72
int decompress_in_pipe[2]; /* Data from helper to us */
73
int decompress_out_pipe[2]; /* Data from us to helper */
75
/* For mr97310a decoder */
78
/* For cpia1 decoder */
79
unsigned char *previous_frame;
82
82
struct v4lconvert_pixfmt {
87
87
void v4lconvert_fixup_fmt(struct v4l2_format *fmt);
89
89
unsigned char *v4lconvert_alloc_buffer(int needed,
90
unsigned char **buf, int *buf_size);
90
unsigned char **buf, int *buf_size);
92
92
void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest,
93
const struct v4l2_format *src_fmt, int bgr, int yvu);
93
const struct v4l2_format *src_fmt, int bgr, int yvu);
95
95
void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst,
96
int width, int height, int yvu);
96
int width, int height, int yvu);
98
98
void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
99
int width, int height, int yvu);
99
int width, int height, int yvu);
101
101
void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst,
102
int width, int height);
102
int width, int height);
104
104
void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst,
105
int width, int height);
105
int width, int height);
107
107
void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
108
int width, int height, int yvu);
108
int width, int height, int yvu);
110
110
void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
111
int width, int height);
111
int width, int height);
113
113
void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
114
int width, int height);
114
int width, int height);
116
116
void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst,
117
int width, int height);
117
int width, int height);
119
119
void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst,
120
int width, int height);
120
int width, int height);
122
122
void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst,
123
int width, int height, int yvu);
123
int width, int height, int yvu);
125
125
void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
126
int width, int height);
126
int width, int height);
128
128
void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst,
129
const struct v4l2_format *src_fmt);
129
const struct v4l2_format *src_fmt);
131
131
void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest,
132
int width, int height);
132
int width, int height);
134
134
void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest,
135
int width, int height);
135
int width, int height);
137
137
void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest,
138
const struct v4l2_format *src_fmt, int yvu);
138
const struct v4l2_format *src_fmt, int yvu);
140
140
void v4lconvert_spca501_to_yuv420(const unsigned char *src, unsigned char *dst,
141
int width, int height, int yvu);
141
int width, int height, int yvu);
143
143
void v4lconvert_spca505_to_yuv420(const unsigned char *src, unsigned char *dst,
144
int width, int height, int yvu);
144
int width, int height, int yvu);
146
146
void v4lconvert_spca508_to_yuv420(const unsigned char *src, unsigned char *dst,
147
int width, int height, int yvu);
147
int width, int height, int yvu);
149
149
int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
150
const unsigned char *src, int src_size,
151
unsigned char *dst, int width, int height, int yvu);
150
const unsigned char *src, int src_size,
151
unsigned char *dst, int width, int height, int yvu);
153
153
void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst,
154
int width, int height, int yvu);
154
int width, int height, int yvu);
156
156
void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst,
157
int width, int height);
157
int width, int height);
159
159
void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst,
160
int width, int height);
160
int width, int height);
162
162
int v4lconvert_decode_pac207(struct v4lconvert_data *data,
163
const unsigned char *inp, int src_size, unsigned char *outp,
164
int width, int height);
163
const unsigned char *inp, int src_size, unsigned char *outp,
164
int width, int height);
166
166
int v4lconvert_decode_mr97310a(struct v4lconvert_data *data,
167
const unsigned char *src, int src_size, unsigned char *dst,
168
int width, int height);
167
const unsigned char *src, int src_size, unsigned char *dst,
168
int width, int height);
170
170
void v4lconvert_decode_sn9c2028(const unsigned char *src, unsigned char *dst,
171
int width, int height);
171
int width, int height);
173
173
void v4lconvert_decode_sq905c(const unsigned char *src, unsigned char *dst,
174
int width, int height);
174
int width, int height);
176
176
void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
177
int width, int height);
177
int width, int height);
179
179
void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
180
unsigned char *rgb, int width, int height, unsigned int pixfmt);
180
unsigned char *rgb, int width, int height, unsigned int pixfmt);
182
182
void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
183
unsigned char *rgb, int width, int height, unsigned int pixfmt);
183
unsigned char *rgb, int width, int height, unsigned int pixfmt);
185
185
void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
186
int width, int height, unsigned int src_pixfmt, int yvu);
186
int width, int height, unsigned int src_pixfmt, int yvu);
188
188
void v4lconvert_hm12_to_rgb24(const unsigned char *src,
189
unsigned char *dst, int width, int height);
189
unsigned char *dst, int width, int height);
191
191
void v4lconvert_hm12_to_bgr24(const unsigned char *src,
192
unsigned char *dst, int width, int height);
192
unsigned char *dst, int width, int height);
194
194
void v4lconvert_hm12_to_yuv420(const unsigned char *src,
195
unsigned char *dst, int width, int height, int yvu);
195
unsigned char *dst, int width, int height, int yvu);
197
197
void v4lconvert_rotate90(unsigned char *src, unsigned char *dest,
198
struct v4l2_format *fmt);
198
struct v4l2_format *fmt);
200
200
void v4lconvert_flip(unsigned char *src, unsigned char *dest,
201
struct v4l2_format *fmt, int hflip, int vflip);
201
struct v4l2_format *fmt, int hflip, int vflip);
203
203
void v4lconvert_crop(unsigned char *src, unsigned char *dest,
204
const struct v4l2_format *src_fmt, const struct v4l2_format *dest_fmt);
204
const struct v4l2_format *src_fmt, const struct v4l2_format *dest_fmt);
206
206
int v4lconvert_helper_decompress(struct v4lconvert_data *data,
207
const char *helper, const unsigned char *src, int src_size,
208
unsigned char *dest, int dest_size, int width, int height, int command);
207
const char *helper, const unsigned char *src, int src_size,
208
unsigned char *dest, int dest_size, int width, int height, int command);
210
210
void v4lconvert_helper_cleanup(struct v4lconvert_data *data);