ccap-rs 1.6.0

Rust bindings for ccap — high-performance, cross-platform webcam/camera capture with hardware-accelerated pixel format conversion (DirectShow/AVFoundation/V4L2), including common RGB/YUV workflows and video file input/playback support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
/**
 * @file ccap_convert_c.h
 * @author wysaid (this@wysaid.org)
 * @brief Pure C interface for pixel conversion functions in ccap library.
 * @date 2025-05
 *
 * @note This is the C interface for pixel conversion. For C++, use ccap_convert.h instead.
 */

#pragma once
#ifndef CCAP_CONVERT_C_H
#define CCAP_CONVERT_C_H

#include <stdbool.h>
#include <stdint.h>

#include "ccap_config.h"

#ifdef __cplusplus
extern "C" {
#endif

/* ========== Conversion Backend Management ========== */

/** @brief Conversion backend enumeration */
typedef enum {
    CCAP_CONVERT_BACKEND_AUTO = 0,             /**< Automatically choose the best available backend */
    CCAP_CONVERT_BACKEND_CPU = 1,              /**< CPU implementation */
    CCAP_CONVERT_BACKEND_AVX2 = 2,             /**< AVX2 implementation */
    CCAP_CONVERT_BACKEND_APPLE_ACCELERATE = 3, /**< Apple Accelerate implementation */
    CCAP_CONVERT_BACKEND_NEON = 4,             /**< ARM NEON implementation */
} CcapConvertBackend;

/** @brief Conversion flags for color space and range */
typedef enum {
    CCAP_CONVERT_FLAG_BT601 = 0x1,                                                      /**< Use BT.601 color space */
    CCAP_CONVERT_FLAG_BT709 = 0x2,                                                      /**< Use BT.709 color space */
    CCAP_CONVERT_FLAG_FULL_RANGE = 0x10,                                                /**< Use full range color space */
    CCAP_CONVERT_FLAG_VIDEO_RANGE = 0x20,                                               /**< Use video range color space */
    CCAP_CONVERT_FLAG_DEFAULT = CCAP_CONVERT_FLAG_BT601 | CCAP_CONVERT_FLAG_VIDEO_RANGE /**< Default: BT.601 video range */
} CcapConvertFlag;

/**
 * @brief Check if AVX2 is supported by the CPU
 * @return true if AVX2 is available, false otherwise
 */
CCAP_EXPORT bool ccap_convert_has_avx2(void);

/**
 * @brief Check if AVX2 is currently enabled
 * @return true if AVX2 is enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_can_use_avx2(void);

/**
 * @brief Enable or disable AVX2 implementation
 * @param enable true to enable AVX2, false to disable
 * @return true if AVX2 is available and enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_enable_avx2(bool enable);

/**
 * @brief Check if Apple Accelerate is available
 * @return true if Apple Accelerate is available, false otherwise
 */
CCAP_EXPORT bool ccap_convert_has_apple_accelerate(void);

/**
 * @brief Check if Apple Accelerate is currently enabled
 * @return true if Apple Accelerate is enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_can_use_apple_accelerate(void);

/**
 * @brief Enable or disable Apple Accelerate implementation
 * @param enable true to enable Apple Accelerate, false to disable
 * @return true if Apple Accelerate is available and enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_enable_apple_accelerate(bool enable);

/**
 * @brief Check if ARM NEON is supported by the CPU
 * @return true if ARM NEON is available, false otherwise
 */
CCAP_EXPORT bool ccap_convert_has_neon(void);

/**
 * @brief Check if ARM NEON is currently enabled
 * @return true if ARM NEON is enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_can_use_neon(void);

/**
 * @brief Enable or disable ARM NEON implementation
 * @param enable true to enable ARM NEON, false to disable
 * @return true if ARM NEON is available and enabled, false otherwise
 */
CCAP_EXPORT bool ccap_convert_enable_neon(bool enable);

/**
 * @brief Get the current conversion backend that will be used
 * @return Current conversion backend
 */
CCAP_EXPORT CcapConvertBackend ccap_convert_get_backend(void);

/**
 * @brief Set the conversion backend
 * @param backend Backend to set
 * @return true if the backend was set successfully, false otherwise
 */
CCAP_EXPORT bool ccap_convert_set_backend(CcapConvertBackend backend);

/* ========== Color Space Conversion Functions ========== */

/**
 * @brief Convert single YUV pixel to RGB using BT.601 video range
 * @param y Y component
 * @param u U component
 * @param v V component
 * @param r Output R component (0-255)
 * @param g Output G component (0-255)
 * @param b Output B component (0-255)
 */
CCAP_EXPORT void ccap_convert_yuv_to_rgb_601v(int y, int u, int v, int* r, int* g, int* b);

/**
 * @brief Convert single YUV pixel to RGB using BT.709 video range
 * @param y Y component
 * @param u U component
 * @param v V component
 * @param r Output R component (0-255)
 * @param g Output G component (0-255)
 * @param b Output B component (0-255)
 */
CCAP_EXPORT void ccap_convert_yuv_to_rgb_709v(int y, int u, int v, int* r, int* g, int* b);

/**
 * @brief Convert single YUV pixel to RGB using BT.601 full range
 * @param y Y component
 * @param u U component
 * @param v V component
 * @param r Output R component (0-255)
 * @param g Output G component (0-255)
 * @param b Output B component (0-255)
 */
CCAP_EXPORT void ccap_convert_yuv_to_rgb_601f(int y, int u, int v, int* r, int* g, int* b);

/**
 * @brief Convert single YUV pixel to RGB using BT.709 full range
 * @param y Y component
 * @param u U component
 * @param v V component
 * @param r Output R component (0-255)
 * @param g Output G component (0-255)
 * @param b Output B component (0-255)
 */
CCAP_EXPORT void ccap_convert_yuv_to_rgb_709f(int y, int u, int v, int* r, int* g, int* b);

/* ========== Color Channel Shuffling ========== */

/**
 * @brief Convert RGBA to BGRA (swap R and B channels)
 * @param src Source RGBA data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGRA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgba_to_bgra(const uint8_t* src, int src_stride,
                               uint8_t* dst, int dst_stride,
                               int width, int height);

/**
 * @brief Convert BGRA to RGBA (swap R and B channels)
 * @param src Source BGRA data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGBA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgra_to_rgba(const uint8_t* src, int src_stride,
                               uint8_t* dst, int dst_stride,
                               int width, int height);

/**
 * @brief Convert RGBA to BGR (remove alpha, swap R and B channels)
 * @param src Source RGBA data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGR data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgba_to_bgr(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert BGRA to RGB (remove alpha, swap R and B channels)
 * @param src Source BGRA data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGB data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgra_to_rgb(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert RGBA to RGB (remove alpha channel)
 * @param src Source RGBA data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGB data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgba_to_rgb(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert BGRA to BGR (remove alpha channel)
 * @param src Source BGRA data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGR data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgra_to_bgr(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert RGB to BGRA (add alpha=255, swap R and B channels)
 * @param src Source RGB data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGRA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgb_to_bgra(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert BGR to RGBA (add alpha=255, swap R and B channels)
 * @param src Source BGR data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGBA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgr_to_rgba(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert RGB to RGBA (add alpha=255)
 * @param src Source RGB data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGBA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgb_to_rgba(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert BGR to BGRA (add alpha=255)
 * @param src Source BGR data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGRA data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgr_to_bgra(const uint8_t* src, int src_stride,
                              uint8_t* dst, int dst_stride,
                              int width, int height);

/**
 * @brief Convert RGB to BGR (swap R and B channels)
 * @param src Source RGB data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGR data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_rgb_to_bgr(const uint8_t* src, int src_stride,
                             uint8_t* dst, int dst_stride,
                             int width, int height);

/**
 * @brief Convert BGR to RGB (swap R and B channels)
 * @param src Source BGR data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGB data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 */
CCAP_EXPORT void ccap_convert_bgr_to_rgb(const uint8_t* src, int src_stride,
                             uint8_t* dst, int dst_stride,
                             int width, int height);

/* ========== YUV to RGB Conversions ========== */

/**
 * @brief Convert NV12 to BGR24
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_uv UV plane data (interleaved)
 * @param src_uv_stride UV plane stride in bytes
 * @param dst Destination BGR24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_nv12_to_bgr24(const uint8_t* src_y, int src_y_stride,
                                const uint8_t* src_uv, int src_uv_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert NV12 to RGB24
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_uv UV plane data (interleaved)
 * @param src_uv_stride UV plane stride in bytes
 * @param dst Destination RGB24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_nv12_to_rgb24(const uint8_t* src_y, int src_y_stride,
                                const uint8_t* src_uv, int src_uv_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert NV12 to BGRA32
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_uv UV plane data (interleaved)
 * @param src_uv_stride UV plane stride in bytes
 * @param dst Destination BGRA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_nv12_to_bgra32(const uint8_t* src_y, int src_y_stride,
                                 const uint8_t* src_uv, int src_uv_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert NV12 to RGBA32
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_uv UV plane data (interleaved)
 * @param src_uv_stride UV plane stride in bytes
 * @param dst Destination RGBA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_nv12_to_rgba32(const uint8_t* src_y, int src_y_stride,
                                 const uint8_t* src_uv, int src_uv_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert I420 to BGR24
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_u U plane data
 * @param src_u_stride U plane stride in bytes
 * @param src_v V plane data
 * @param src_v_stride V plane stride in bytes
 * @param dst Destination BGR24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_i420_to_bgr24(const uint8_t* src_y, int src_y_stride,
                                const uint8_t* src_u, int src_u_stride,
                                const uint8_t* src_v, int src_v_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert I420 to RGB24
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_u U plane data
 * @param src_u_stride U plane stride in bytes
 * @param src_v V plane data
 * @param src_v_stride V plane stride in bytes
 * @param dst Destination RGB24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_i420_to_rgb24(const uint8_t* src_y, int src_y_stride,
                                const uint8_t* src_u, int src_u_stride,
                                const uint8_t* src_v, int src_v_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert I420 to BGRA32
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_u U plane data
 * @param src_u_stride U plane stride in bytes
 * @param src_v V plane data
 * @param src_v_stride V plane stride in bytes
 * @param dst Destination BGRA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_i420_to_bgra32(const uint8_t* src_y, int src_y_stride,
                                 const uint8_t* src_u, int src_u_stride,
                                 const uint8_t* src_v, int src_v_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert I420 to RGBA32
 * @param src_y Y plane data
 * @param src_y_stride Y plane stride in bytes
 * @param src_u U plane data
 * @param src_u_stride U plane stride in bytes
 * @param src_v V plane data
 * @param src_v_stride V plane stride in bytes
 * @param dst Destination RGBA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_i420_to_rgba32(const uint8_t* src_y, int src_y_stride,
                                 const uint8_t* src_u, int src_u_stride,
                                 const uint8_t* src_v, int src_v_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/* ========== YUYV (YUV 4:2:2 packed) Conversions ========== */

/**
 * @brief Convert YUYV to BGR24
 * @param src Source YUYV data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGR24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_yuyv_to_bgr24(const uint8_t* src, int src_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert YUYV to RGB24
 * @param src Source YUYV data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGB24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_yuyv_to_rgb24(const uint8_t* src, int src_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert YUYV to BGRA32
 * @param src Source YUYV data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGRA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_yuyv_to_bgra32(const uint8_t* src, int src_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert YUYV to RGBA32
 * @param src Source YUYV data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGBA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_yuyv_to_rgba32(const uint8_t* src, int src_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/* ========== UYVY (YUV 4:2:2 packed) Conversions ========== */

/**
 * @brief Convert UYVY to BGR24
 * @param src Source UYVY data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGR24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_uyvy_to_bgr24(const uint8_t* src, int src_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert UYVY to RGB24
 * @param src Source UYVY data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGB24 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_uyvy_to_rgb24(const uint8_t* src, int src_stride,
                                uint8_t* dst, int dst_stride,
                                int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert UYVY to BGRA32
 * @param src Source UYVY data
 * @param src_stride Source stride in bytes
 * @param dst Destination BGRA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_uyvy_to_bgra32(const uint8_t* src, int src_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

/**
 * @brief Convert UYVY to RGBA32
 * @param src Source UYVY data
 * @param src_stride Source stride in bytes
 * @param dst Destination RGBA32 data
 * @param dst_stride Destination stride in bytes
 * @param width Image width in pixels
 * @param height Image height in pixels (negative for vertical flip)
 * @param flag Conversion flags (color space and range)
 */
CCAP_EXPORT void ccap_convert_uyvy_to_rgba32(const uint8_t* src, int src_stride,
                                 uint8_t* dst, int dst_stride,
                                 int width, int height, CcapConvertFlag flag);

#ifdef __cplusplus
}
#endif

#endif /* CCAP_CONVERT_C_H */