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
/**
* @file ccap_convert_frame.h
* @author wysaid (this@wysaid.org)
* @brief pixel convert functions for ccap.
* @date 2025-05
*
*/
/// @brief Inplace frame conversion functions
///
/// IMPORTANT CONSTRAINTS:
/// - These methods require that frame->data[0] points to EXTERNAL memory (e.g., camera buffer)
/// and NOT to frame->allocator->data()
/// - Each VideoFrame should only be converted ONCE using these functions
/// - The functions will allocate new memory via frame->allocator and update frame->data[0]
///
/// TYPICAL USAGE:
/// 1. Capture frame from camera: frame->data[0] points to camera's buffer
/// 2. Call inplaceConvertFrame*() ONCE: converts and moves data to allocator
/// 3. After conversion: frame->data[0] == frame->allocator->data()
///
/// VIOLATION will cause:
/// - Data corruption (reading freed memory)
/// - Assertion failure in debug builds
/// - Undefined behavior
// Export internal functions only when building tests
namespace ccap // namespace ccap
// CCAP_CONVERT_FRAME_H