| 1 | // Copyright 2019-2022, Collabora, Ltd.cxx . . $ `<file>/src/xrt/auxiliary/util/u_sink_converter.c`/ |
| 2 | // SPDX-License-Identifier: BSL-1.0 |
| 3 | /*! |
| 4 | * @file |
| 5 | * @brief @ref xrt_frame_sink converters and other helpers. |
| 6 | * @author Jakob Bornecrantz <[email protected]> |
| 7 | * @author Moshi Turner <[email protected]> |
| 8 | * @ingroup aux_util |
| 9 | */ |
| 10 | |
| 11 | #include "xrt/xrt_config_have.h"cxx . . $ `<file>/build/src/xrt/include/xrt/xrt_config_have.h`/ |
| 12 | #include "util/u_logging.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_logging.h`/ |
| 13 | #include "util/u_misc.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_misc.h`/ |
| 14 | #include "util/u_sink.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_sink.h`/ |
| 15 | #include "util/u_frame.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_frame.h`/ |
| 16 | #include "util/u_format.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_format.h`/ |
| 17 | #include "util/u_trace_marker.h"cxx . . $ `<file>/src/xrt/auxiliary/util/u_trace_marker.h`/ |
| 18 | |
| 19 | #include <stdio.h> |
| 20 | |
| 21 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 22 | #include "jpeglib.h" |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | /* |
| 27 | * |
| 28 | * Structs |
| 29 | * |
| 30 | */ |
| 31 | |
| 32 | /*! |
| 33 | * An @ref xrt_frame_sink that converts frames. |
| 34 | * @implements xrt_frame_sink |
| 35 | * @implements xrt_frame_node |
| 36 | */ |
| 37 | struct u_sink_convertercxx . . $ u_sink_converter# |
| 38 | { |
| 39 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# basecxx . . $ u_sink_converter#base.; |
| 40 | struct xrt_frame_nodecxx . . $ xrt_frame_node# nodecxx . . $ u_sink_converter#node.; |
| 41 | |
| 42 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstreamcxx . . $ u_sink_converter#downstream.; |
| 43 | |
| 44 | enum xrt_formatcxx . . $ xrt_format# formatcxx . . $ u_sink_converter#format.; |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | /* |
| 49 | * |
| 50 | * L8 functions. |
| 51 | * |
| 52 | */ |
| 53 | |
| 54 | static void |
| 55 | from_L8_to_R8G8B8cxx . . $ from_L8_to_R8G8B8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 56 | { |
| 57 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 58 | |
| 59 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 60 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x += 1) { |
| 61 | const uint8_tcxx . . $ uint8_t# *src = data; |
| 62 | uint8_tcxx . . $ uint8_t# *dst = dst_frame->datacxx . . $ xrt_frame#data.; |
| 63 | |
| 64 | src = src + (y * stride) + x; |
| 65 | dst = dst + (y * dst_frame->stridecxx . . $ xrt_frame#stride.) + (x * 3); |
| 66 | dst[2] = dst[1] = dst[0] = src[0]; |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /* |
| 73 | * |
| 74 | * YUV functions. |
| 75 | * |
| 76 | */ |
| 77 | |
| 78 | static inline int |
| 79 | clamp_to_bytecxx . . $ clamp_to_byte(7864480464b09eea).(int v) |
| 80 | { |
| 81 | if (v < 0) { |
| 82 | return 0; |
| 83 | } |
| 84 | if (v >= 255) { |
| 85 | return 255; |
| 86 | } |
| 87 | return v; |
| 88 | } |
| 89 | |
| 90 | static inline uint32_tcxx . . $ uint32_t# |
| 91 | YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(int y, int u, int v) |
| 92 | { |
| 93 | int C = y - 16; |
| 94 | int D = u - 128; |
| 95 | int E = v - 128; |
| 96 | |
| 97 | int R = clamp_to_bytecxx . . $ clamp_to_byte(7864480464b09eea).((298 * C + 409 * E + 128) >> 8); |
| 98 | int G = clamp_to_bytecxx . . $ clamp_to_byte(7864480464b09eea).((298 * C - 100 * D - 209 * E + 128) >> 8); |
| 99 | int B = clamp_to_bytecxx . . $ clamp_to_byte(7864480464b09eea).((298 * C + 516 * D + 128) >> 8); |
| 100 | |
| 101 | return B << 16 | G << 8 | R; |
| 102 | } |
| 103 | |
| 104 | #undef USE_TABLE |
| 105 | #ifdef USE_TABLE |
| 106 | static uint32_t lookup_YUV_to_RGBX[256][256][256] = {0}; |
| 107 | |
| 108 | static void |
| 109 | generate_lookup_YUV_to_RGBX() |
| 110 | { |
| 111 | if (lookup_YUV_to_RGBX[255][255][255] != 0) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | int y; |
| 116 | int u; |
| 117 | int v; |
| 118 | |
| 119 | for (y = 0; y < 256; y++) { |
| 120 | for (u = 0; u < 256; u++) { |
| 121 | for (v = 0; v < 256; v++) { |
| 122 | lookup_YUV_to_RGBX[y][u][v] = YUV444_to_RGBX8888(y, u, v); |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | #endif |
| 128 | |
| 129 | XRT_MAYBE_UNUSEDcxx . . $ `src/xrt/include/xrt/xrt_compiler.h:53:9`! inline static void |
| 130 | YUYV422_to_R8G8B8X8cxx . . $ YUYV422_to_R8G8B8X8(86c29635c4a77c81).(const uint8_tcxx . . $ uint8_t# *input, uint32_tcxx . . $ uint32_t# *rgb1, uint32_tcxx . . $ uint32_t# *rgb2) |
| 131 | { |
| 132 | uint8_tcxx . . $ uint8_t# y0 = input[0]; |
| 133 | uint8_tcxx . . $ uint8_t# u = input[1]; |
| 134 | uint8_tcxx . . $ uint8_t# y1 = input[2]; |
| 135 | uint8_tcxx . . $ uint8_t# v = input[3]; |
| 136 | |
| 137 | #ifdef USE_TABLE |
| 138 | *rgb1 = lookup_YUV_to_RGBX[y0][u][v]; |
| 139 | *rgb2 = lookup_YUV_to_RGBX[y1][u][v]; |
| 140 | #else |
| 141 | *rgb1 = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y0, u, v); |
| 142 | *rgb2 = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y1, u, v); |
| 143 | #endif |
| 144 | } |
| 145 | |
| 146 | inline static void |
| 147 | YUYV422_to_R8G8B8cxx . . $ YUYV422_to_R8G8B8(b1fdb6ced7ea43e9).(const uint8_tcxx . . $ uint8_t# *input, uint8_tcxx . . $ uint8_t# *dst) |
| 148 | { |
| 149 | uint8_tcxx . . $ uint8_t# y0 = input[0]; |
| 150 | uint8_tcxx . . $ uint8_t# u = input[1]; |
| 151 | uint8_tcxx . . $ uint8_t# y1 = input[2]; |
| 152 | uint8_tcxx . . $ uint8_t# v = input[3]; |
| 153 | |
| 154 | #ifdef USE_TABLE |
| 155 | uint8_t *rgb1 = (uint8_t *)&lookup_YUV_to_RGBX[y0][u][v]; |
| 156 | uint8_t *rgb2 = (uint8_t *)&lookup_YUV_to_RGBX[y1][u][v]; |
| 157 | #else |
| 158 | uint32_tcxx . . $ uint32_t# rgb1v = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y0, u, v); |
| 159 | uint32_tcxx . . $ uint32_t# rgb2v = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y1, u, v); |
| 160 | uint8_tcxx . . $ uint8_t# *rgb1 = (uint8_tcxx . . $ uint8_t# *)&rgb1v; |
| 161 | uint8_tcxx . . $ uint8_t# *rgb2 = (uint8_tcxx . . $ uint8_t# *)&rgb2v; |
| 162 | #endif |
| 163 | |
| 164 | dst[0] = rgb1[0]; |
| 165 | dst[1] = rgb1[1]; |
| 166 | dst[2] = rgb1[2]; |
| 167 | dst[3] = rgb2[0]; |
| 168 | dst[4] = rgb2[1]; |
| 169 | dst[5] = rgb2[2]; |
| 170 | } |
| 171 | |
| 172 | inline static void |
| 173 | UYVY422_to_R8G8B8cxx . . $ UYVY422_to_R8G8B8(b1fdb6ced7ea43e9).(const uint8_tcxx . . $ uint8_t# *input, uint8_tcxx . . $ uint8_t# *dst) |
| 174 | { |
| 175 | uint8_tcxx . . $ uint8_t# u = input[0]; |
| 176 | uint8_tcxx . . $ uint8_t# y0 = input[1]; |
| 177 | uint8_tcxx . . $ uint8_t# v = input[2]; |
| 178 | uint8_tcxx . . $ uint8_t# y1 = input[3]; |
| 179 | |
| 180 | #ifdef USE_TABLE |
| 181 | uint8_t *rgb1 = (uint8_t *)&lookup_YUV_to_RGBX[y0][u][v]; |
| 182 | uint8_t *rgb2 = (uint8_t *)&lookup_YUV_to_RGBX[y1][u][v]; |
| 183 | #else |
| 184 | uint32_tcxx . . $ uint32_t# rgb1v = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y0, u, v); |
| 185 | uint32_tcxx . . $ uint32_t# rgb2v = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y1, u, v); |
| 186 | uint8_tcxx . . $ uint8_t# *rgb1 = (uint8_tcxx . . $ uint8_t# *)&rgb1v; |
| 187 | uint8_tcxx . . $ uint8_t# *rgb2 = (uint8_tcxx . . $ uint8_t# *)&rgb2v; |
| 188 | #endif |
| 189 | |
| 190 | dst[0] = rgb1[0]; |
| 191 | dst[1] = rgb1[1]; |
| 192 | dst[2] = rgb1[2]; |
| 193 | dst[3] = rgb2[0]; |
| 194 | dst[4] = rgb2[1]; |
| 195 | dst[5] = rgb2[2]; |
| 196 | } |
| 197 | |
| 198 | inline static void |
| 199 | YUV444_to_R8G8B8cxx . . $ YUV444_to_R8G8B8(b1fdb6ced7ea43e9).(const uint8_tcxx . . $ uint8_t# *input, uint8_tcxx . . $ uint8_t# *dst) |
| 200 | { |
| 201 | uint8_tcxx . . $ uint8_t# y = input[0]; |
| 202 | uint8_tcxx . . $ uint8_t# u = input[1]; |
| 203 | uint8_tcxx . . $ uint8_t# v = input[2]; |
| 204 | |
| 205 | #ifdef USE_TABLE |
| 206 | uint8_t *rgb = (uint8_t *)&lookup_YUV_to_RGBX[y][u][v]; |
| 207 | #else |
| 208 | uint32_tcxx . . $ uint32_t# rgbv = YUV444_to_RGBX8888cxx . . $ YUV444_to_RGBX8888(530956271a9518a5).(y, u, v); |
| 209 | uint8_tcxx . . $ uint8_t# *rgb = (uint8_tcxx . . $ uint8_t# *)&rgbv; |
| 210 | #endif |
| 211 | |
| 212 | dst[0] = rgb[0]; |
| 213 | dst[1] = rgb[1]; |
| 214 | dst[2] = rgb[2]; |
| 215 | } |
| 216 | |
| 217 | static void |
| 218 | from_YUYV422_to_R8G8B8cxx . . $ from_YUYV422_to_R8G8B8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 219 | { |
| 220 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 221 | |
| 222 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 223 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x += 2) { |
| 224 | const uint8_tcxx . . $ uint8_t# *src = data; |
| 225 | uint8_tcxx . . $ uint8_t# *dst = dst_frame->datacxx . . $ xrt_frame#data.; |
| 226 | |
| 227 | src = src + (y * stride) + (x * 2); |
| 228 | dst = dst + (y * dst_frame->stridecxx . . $ xrt_frame#stride.) + (x * 3); |
| 229 | YUYV422_to_R8G8B8cxx . . $ YUYV422_to_R8G8B8(b1fdb6ced7ea43e9).(src, dst); |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | static void |
| 235 | from_YUYV422_to_L8cxx . . $ from_YUYV422_to_L8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 236 | { |
| 237 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 238 | |
| 239 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 240 | const uint8_tcxx . . $ uint8_t# *src = data + (y * stride); |
| 241 | uint8_tcxx . . $ uint8_t# *dst = dst_frame->datacxx . . $ xrt_frame#data. + (y * dst_frame->stridecxx . . $ xrt_frame#stride.); |
| 242 | |
| 243 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x++) { |
| 244 | dst[x] = src[x * 2]; |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | static void |
| 250 | from_UYVY422_to_R8G8B8cxx . . $ from_UYVY422_to_R8G8B8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 251 | { |
| 252 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 253 | |
| 254 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 255 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x += 2) { |
| 256 | const uint8_tcxx . . $ uint8_t# *src = data; |
| 257 | uint8_tcxx . . $ uint8_t# *dst = dst_frame->datacxx . . $ xrt_frame#data.; |
| 258 | |
| 259 | src = src + (y * stride) + (x * 2); |
| 260 | dst = dst + (y * dst_frame->stridecxx . . $ xrt_frame#stride.) + (x * 3); |
| 261 | UYVY422_to_R8G8B8cxx . . $ UYVY422_to_R8G8B8(b1fdb6ced7ea43e9).(src, dst); |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 267 | static void |
| 268 | from_YUV888_to_R8G8B8cxx . . $ from_YUV888_to_R8G8B8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 269 | { |
| 270 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 271 | |
| 272 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 273 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x++) { |
| 274 | const uint8_tcxx . . $ uint8_t# *src = data; |
| 275 | uint8_tcxx . . $ uint8_t# *dst = dst_frame->datacxx . . $ xrt_frame#data.; |
| 276 | |
| 277 | src = src + (y * stride) + (x * 3); |
| 278 | dst = dst + (y * dst_frame->stridecxx . . $ xrt_frame#stride.) + (x * 3); |
| 279 | YUV444_to_R8G8B8cxx . . $ YUV444_to_R8G8B8(b1fdb6ced7ea43e9).(src, dst); |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | |
| 285 | /* |
| 286 | * |
| 287 | * MJPEG |
| 288 | * |
| 289 | */ |
| 290 | |
| 291 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 292 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 293 | check_headercxx . . $ check_header(3e5ddce1f44aa256).(size_t size, const uint8_tcxx . . $ uint8_t# *data) |
| 294 | { |
| 295 | if (size < 16) { |
| 296 | U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Invalid JPEG file size! %u", (uint32_t)size); |
| 297 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 298 | } |
| 299 | |
| 300 | if (data[0] != 0xFF || data[1] != 0xD8) { |
| 301 | U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Invalid file header! 0x%02X 0x%02X", data[0], data[1]); |
| 302 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 303 | } |
| 304 | |
| 305 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 306 | } |
| 307 | |
| 308 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 309 | from_MJPEG_to_R8G8B8cxx . . $ from_MJPEG_to_R8G8B8(91df8a3159f5e0d8).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, size_t size, const uint8_tcxx . . $ uint8_t# *data) |
| 310 | { |
| 311 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 312 | |
| 313 | if (!check_headercxx . . $ check_header(3e5ddce1f44aa256).(size, data)) { |
| 314 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 315 | } |
| 316 | |
| 317 | struct jpeg_decompress_structcxx . . $ jpeg_decompress_struct# cinfo = {0}; |
| 318 | struct jpeg_error_mgrcxx . . $ jpeg_error_mgr# jerr = {0}; |
| 319 | |
| 320 | cinfo.errcxx . . $ jpeg_decompress_struct#err. = jpeg_std_errorcxx . . $ jpeg_std_error(273a809c33617b39).(&jerr); |
| 321 | jerr.trace_levelcxx . . $ jpeg_error_mgr#trace_level. = 0; |
| 322 | |
| 323 | jpeg_create_decompresscxx . . $ `<external>/1675768649605662117/jpeglib.h:971:9`!(&cinfo); |
| 324 | jpeg_mem_srccxx . . $ jpeg_mem_src(f6cf7eae7f982f9e).(&cinfo, data, size); |
| 325 | |
| 326 | int ret = jpeg_read_headercxx . . $ jpeg_read_header(bf3d83fff01a00a4).(&cinfo, TRUEcxx . . $ `<external>/1616199899135680617/jmorecfg.h:209:9`!); |
| 327 | if (ret != JPEG_HEADER_OKcxx . . $ `<external>/1675768649605662117/jpeglib.h:1066:9`!) { |
| 328 | jpeg_destroy_decompresscxx . . $ jpeg_destroy_decompress(1570c40927b68222).(&cinfo); |
| 329 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 330 | } |
| 331 | |
| 332 | cinfo.out_color_spacecxx . . $ jpeg_decompress_struct#out_color_space. = JCS_RGBcxx . . $ JCS_RGB.; |
| 333 | jpeg_start_decompresscxx . . $ jpeg_start_decompress(e4eedf63cba3c0a9).(&cinfo); |
| 334 | |
| 335 | uint8_tcxx . . $ uint8_t# *moving_ptr = dst_frame->datacxx . . $ xrt_frame#data.; |
| 336 | |
| 337 | uint32_tcxx . . $ uint32_t# scanlines_read = 0; |
| 338 | while (scanlines_read < cinfo.image_heightcxx . . $ jpeg_decompress_struct#image_height.) { |
| 339 | int read_count = jpeg_read_scanlinescxx . . $ jpeg_read_scanlines(4f392c072ce4dc53).(&cinfo, &moving_ptr, 16); |
| 340 | moving_ptr += read_count * dst_frame->stridecxx . . $ xrt_frame#stride.; |
| 341 | scanlines_read += read_count; |
| 342 | } |
| 343 | |
| 344 | jpeg_finish_decompresscxx . . $ jpeg_finish_decompress(e4eedf63cba3c0a9).(&cinfo); |
| 345 | jpeg_destroy_decompresscxx . . $ jpeg_destroy_decompress(1570c40927b68222).(&cinfo); |
| 346 | |
| 347 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 348 | } |
| 349 | |
| 350 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 351 | from_MJPEG_to_YUV888cxx . . $ from_MJPEG_to_YUV888(91df8a3159f5e0d8).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, size_t size, const uint8_tcxx . . $ uint8_t# *data) |
| 352 | { |
| 353 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 354 | |
| 355 | if (!check_headercxx . . $ check_header(3e5ddce1f44aa256).(size, data)) { |
| 356 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 357 | } |
| 358 | |
| 359 | struct jpeg_decompress_structcxx . . $ jpeg_decompress_struct# cinfo = {0}; |
| 360 | struct jpeg_error_mgrcxx . . $ jpeg_error_mgr# jerr = {0}; |
| 361 | |
| 362 | cinfo.errcxx . . $ jpeg_decompress_struct#err. = jpeg_std_errorcxx . . $ jpeg_std_error(273a809c33617b39).(&jerr); |
| 363 | jerr.trace_levelcxx . . $ jpeg_error_mgr#trace_level. = 0; |
| 364 | |
| 365 | jpeg_create_decompresscxx . . $ `<external>/1675768649605662117/jpeglib.h:971:9`!(&cinfo); |
| 366 | jpeg_mem_srccxx . . $ jpeg_mem_src(f6cf7eae7f982f9e).(&cinfo, data, size); |
| 367 | |
| 368 | int ret = jpeg_read_headercxx . . $ jpeg_read_header(bf3d83fff01a00a4).(&cinfo, TRUEcxx . . $ `<external>/1616199899135680617/jmorecfg.h:209:9`!); |
| 369 | if (ret != JPEG_HEADER_OKcxx . . $ `<external>/1675768649605662117/jpeglib.h:1066:9`!) { |
| 370 | jpeg_destroy_decompresscxx . . $ jpeg_destroy_decompress(1570c40927b68222).(&cinfo); |
| 371 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 372 | } |
| 373 | |
| 374 | cinfo.out_color_spacecxx . . $ jpeg_decompress_struct#out_color_space. = JCS_YCbCrcxx . . $ JCS_YCbCr.; |
| 375 | jpeg_start_decompresscxx . . $ jpeg_start_decompress(e4eedf63cba3c0a9).(&cinfo); |
| 376 | |
| 377 | uint8_tcxx . . $ uint8_t# *moving_ptr = dst_frame->datacxx . . $ xrt_frame#data.; |
| 378 | |
| 379 | uint32_tcxx . . $ uint32_t# scanlines_read = 0; |
| 380 | while (scanlines_read < cinfo.image_heightcxx . . $ jpeg_decompress_struct#image_height.) { |
| 381 | int read_count = jpeg_read_scanlinescxx . . $ jpeg_read_scanlines(4f392c072ce4dc53).(&cinfo, &moving_ptr, 16); |
| 382 | moving_ptr += read_count * dst_frame->stridecxx . . $ xrt_frame#stride.; |
| 383 | scanlines_read += read_count; |
| 384 | } |
| 385 | |
| 386 | jpeg_finish_decompresscxx . . $ jpeg_finish_decompress(e4eedf63cba3c0a9).(&cinfo); |
| 387 | jpeg_destroy_decompresscxx . . $ jpeg_destroy_decompress(1570c40927b68222).(&cinfo); |
| 388 | |
| 389 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 390 | } |
| 391 | #endif |
| 392 | |
| 393 | |
| 394 | /* |
| 395 | * |
| 396 | * Bayer |
| 397 | * |
| 398 | */ |
| 399 | |
| 400 | static void |
| 401 | from_BAYER_GR8_to_R8G8B8cxx . . $ from_BAYER_GR8_to_R8G8B8(47dbc3f07c44e488).(struct xrt_framecxx . . $ xrt_frame# *dst_frame, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, size_t stride, const uint8_tcxx . . $ uint8_t# *data) |
| 402 | { |
| 403 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 404 | |
| 405 | const uint8_tcxx . . $ uint8_t# *src_data = data; |
| 406 | size_t src_stride = stride; |
| 407 | |
| 408 | uint8_tcxx . . $ uint8_t# *dst_data = dst_frame->datacxx . . $ xrt_frame#data.; |
| 409 | size_t dst_stride = dst_frame->stridecxx . . $ xrt_frame#stride.; |
| 410 | |
| 411 | for (uint32_tcxx . . $ uint32_t# y = 0; y < h; y++) { |
| 412 | const uint8_tcxx . . $ uint8_t# *src0 = src_data + (y * 2) * src_stride; |
| 413 | const uint8_tcxx . . $ uint8_t# *src1 = src_data + (y * 2 + 1) * src_stride; |
| 414 | uint8_tcxx . . $ uint8_t# *dst = dst_data + (y * dst_stride); |
| 415 | |
| 416 | for (uint32_tcxx . . $ uint32_t# x = 0; x < w; x++) { |
| 417 | uint8_tcxx . . $ uint8_t# g0 = src0[0]; |
| 418 | uint8_tcxx . . $ uint8_t# r = src0[1]; |
| 419 | uint8_tcxx . . $ uint8_t# b = src1[0]; |
| 420 | uint8_tcxx . . $ uint8_t# g1 = src1[1]; |
| 421 | |
| 422 | dst[0] = r; |
| 423 | dst[1] = (g0 + g1) / 2; |
| 424 | dst[2] = b; |
| 425 | |
| 426 | src0 += 2; |
| 427 | src1 += 2; |
| 428 | dst += 3; |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | |
| 434 | /* |
| 435 | * |
| 436 | * Misc functions. |
| 437 | * |
| 438 | */ |
| 439 | |
| 440 | |
| 441 | /*! |
| 442 | * Creates a frame that the conversion should happen to, allows to set the size. |
| 443 | * |
| 444 | * @todo Allocate from a pool of frames. |
| 445 | */ |
| 446 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 447 | create_frame_with_format_of_sizecxx . . $ create_frame_with_format_of_size(58570909f07a4ed8).( |
| 448 | struct xrt_framecxx . . $ xrt_frame# *xf, uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, enum xrt_formatcxx . . $ xrt_format# format, struct xrt_framecxx . . $ xrt_frame# **out_frame) |
| 449 | { |
| 450 | struct xrt_framecxx . . $ xrt_frame# *frame = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 451 | u_frame_create_one_offcxx . . $ u_frame_create_one_off(c137bc5da3ab1e89).(format, w, h, &frame); |
| 452 | if (frame == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 453 | U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Failed to create target frame!"); |
| 454 | *out_frame = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 455 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 456 | } |
| 457 | |
| 458 | frame->timestampcxx . . $ xrt_frame#timestamp. = xf->timestampcxx . . $ xrt_frame#timestamp.; |
| 459 | frame->source_timestampcxx . . $ xrt_frame#source_timestamp. = xf->source_timestampcxx . . $ xrt_frame#source_timestamp.; |
| 460 | frame->source_sequencecxx . . $ xrt_frame#source_sequence. = xf->source_sequencecxx . . $ xrt_frame#source_sequence.; |
| 461 | frame->source_idcxx . . $ xrt_frame#source_id. = xf->source_idcxx . . $ xrt_frame#source_id.; |
| 462 | frame->stereo_formatcxx . . $ xrt_frame#stereo_format. = xf->stereo_formatcxx . . $ xrt_frame#stereo_format.; |
| 463 | |
| 464 | *out_frame = frame; |
| 465 | |
| 466 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 467 | } |
| 468 | |
| 469 | /*! |
| 470 | * Creates a frame that the conversion should happen to. |
| 471 | */ |
| 472 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 473 | create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(struct xrt_framecxx . . $ xrt_frame# *xf, enum xrt_formatcxx . . $ xrt_format# format, struct xrt_framecxx . . $ xrt_frame# **out_frame) |
| 474 | { |
| 475 | return create_frame_with_format_of_sizecxx . . $ create_frame_with_format_of_size(58570909f07a4ed8).(xf, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., format, out_frame); |
| 476 | } |
| 477 | |
| 478 | static void |
| 479 | convert_frame_l8cxx . . $ convert_frame_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 480 | { |
| 481 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 482 | |
| 483 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 484 | |
| 485 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 486 | |
| 487 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 488 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 489 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 490 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8., &converted)) { |
| 491 | return; |
| 492 | } |
| 493 | from_YUYV422_to_L8cxx . . $ from_YUYV422_to_L8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 494 | break; |
| 495 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to L8!", u_format_str(xf->format)); return; |
| 496 | } |
| 497 | |
| 498 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 499 | |
| 500 | // Refcount in case it's being held downstream. |
| 501 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 502 | } |
| 503 | |
| 504 | static void |
| 505 | convert_frame_r8g8b8_or_l8cxx . . $ convert_frame_r8g8b8_or_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 506 | { |
| 507 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 508 | |
| 509 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 510 | |
| 511 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 512 | |
| 513 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 514 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 515 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 516 | case XRT_FORMAT_BAYER_GR8cxx . . $ XRT_FORMAT_BAYER_GR8.:; |
| 517 | uint32_tcxx . . $ uint32_t# w = xf->widthcxx . . $ xrt_frame#width. / 2; |
| 518 | uint32_tcxx . . $ uint32_t# h = xf->heightcxx . . $ xrt_frame#height. / 2; |
| 519 | if (!create_frame_with_format_of_sizecxx . . $ create_frame_with_format_of_size(58570909f07a4ed8).(xf, w, h, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 520 | return; |
| 521 | } |
| 522 | from_BAYER_GR8_to_R8G8B8cxx . . $ from_BAYER_GR8_to_R8G8B8(47dbc3f07c44e488).(converted, w, h, xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 523 | break; |
| 524 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 525 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 526 | return; |
| 527 | } |
| 528 | from_YUYV422_to_R8G8B8cxx . . $ from_YUYV422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 529 | break; |
| 530 | case XRT_FORMAT_UYVY422cxx . . $ XRT_FORMAT_UYVY422.: |
| 531 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 532 | return; |
| 533 | } |
| 534 | from_UYVY422_to_R8G8B8cxx . . $ from_UYVY422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 535 | break; |
| 536 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: |
| 537 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 538 | return; |
| 539 | } |
| 540 | from_YUV888_to_R8G8B8cxx . . $ from_YUV888_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 541 | break; |
| 542 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 543 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 544 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 545 | return; |
| 546 | } |
| 547 | if (!from_MJPEG_to_R8G8B8cxx . . $ from_MJPEG_to_R8G8B8(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 548 | // Make sure to free frame when we fail to decode. |
| 549 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 550 | return; |
| 551 | } |
| 552 | break; |
| 553 | #endif |
| 554 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to R8G8B8 or L8!", u_format_str(xf->format)); return; |
| 555 | } |
| 556 | |
| 557 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 558 | |
| 559 | // Refcount in case it's being held downstream. |
| 560 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 561 | } |
| 562 | |
| 563 | static void |
| 564 | convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8cxx . . $ convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 565 | { |
| 566 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 567 | |
| 568 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 569 | |
| 570 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 571 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 572 | case XRT_FORMAT_R8G8B8A8cxx . . $ XRT_FORMAT_R8G8B8A8.: |
| 573 | case XRT_FORMAT_R8G8B8X8cxx . . $ XRT_FORMAT_R8G8B8X8.: |
| 574 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 575 | default: convert_frame_r8g8b8_or_l8cxx . . $ convert_frame_r8g8b8_or_l8(1e8c9dd18059651).(xs, xf); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | static void |
| 580 | convert_frame_r8g8b8_bayer_or_l8cxx . . $ convert_frame_r8g8b8_bayer_or_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 581 | { |
| 582 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 583 | |
| 584 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 585 | |
| 586 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 587 | |
| 588 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 589 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 590 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: |
| 591 | case XRT_FORMAT_BAYER_GR8cxx . . $ XRT_FORMAT_BAYER_GR8.:; s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 592 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 593 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 594 | return; |
| 595 | } |
| 596 | from_YUYV422_to_R8G8B8cxx . . $ from_YUYV422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 597 | break; |
| 598 | case XRT_FORMAT_UYVY422cxx . . $ XRT_FORMAT_UYVY422.: |
| 599 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 600 | return; |
| 601 | } |
| 602 | from_UYVY422_to_R8G8B8cxx . . $ from_UYVY422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 603 | break; |
| 604 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: |
| 605 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 606 | return; |
| 607 | } |
| 608 | from_YUV888_to_R8G8B8cxx . . $ from_YUV888_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 609 | break; |
| 610 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 611 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 612 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 613 | return; |
| 614 | } |
| 615 | if (!from_MJPEG_to_R8G8B8cxx . . $ from_MJPEG_to_R8G8B8(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 616 | // Make sure to free frame when we fail to decode. |
| 617 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 618 | return; |
| 619 | } |
| 620 | break; |
| 621 | #endif |
| 622 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to R8G8B8 or L8!", u_format_str(xf->format)); return; |
| 623 | } |
| 624 | |
| 625 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 626 | |
| 627 | // Refcount in case it's being held downstream. |
| 628 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 629 | } |
| 630 | |
| 631 | static void |
| 632 | convert_frame_r8g8b8cxx . . $ convert_frame_r8g8b8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 633 | { |
| 634 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 635 | |
| 636 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 637 | |
| 638 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 639 | |
| 640 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 641 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 642 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 643 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 644 | return; |
| 645 | } |
| 646 | from_L8_to_R8G8B8cxx . . $ from_L8_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 647 | break; |
| 648 | case XRT_FORMAT_BAYER_GR8cxx . . $ XRT_FORMAT_BAYER_GR8.:; |
| 649 | uint32_tcxx . . $ uint32_t# w = xf->widthcxx . . $ xrt_frame#width. / 2; |
| 650 | uint32_tcxx . . $ uint32_t# h = xf->heightcxx . . $ xrt_frame#height. / 2; |
| 651 | if (!create_frame_with_format_of_sizecxx . . $ create_frame_with_format_of_size(58570909f07a4ed8).(xf, w, h, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 652 | return; |
| 653 | } |
| 654 | from_BAYER_GR8_to_R8G8B8cxx . . $ from_BAYER_GR8_to_R8G8B8(47dbc3f07c44e488).(converted, w, h, xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 655 | break; |
| 656 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 657 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 658 | return; |
| 659 | } |
| 660 | from_YUYV422_to_R8G8B8cxx . . $ from_YUYV422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 661 | break; |
| 662 | case XRT_FORMAT_UYVY422cxx . . $ XRT_FORMAT_UYVY422.: |
| 663 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 664 | return; |
| 665 | } |
| 666 | from_UYVY422_to_R8G8B8cxx . . $ from_UYVY422_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 667 | break; |
| 668 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: |
| 669 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 670 | return; |
| 671 | } |
| 672 | from_YUV888_to_R8G8B8cxx . . $ from_YUV888_to_R8G8B8(47dbc3f07c44e488).(converted, xf->widthcxx . . $ xrt_frame#width., xf->heightcxx . . $ xrt_frame#height., xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 673 | break; |
| 674 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 675 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 676 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 677 | return; |
| 678 | } |
| 679 | if (!from_MJPEG_to_R8G8B8cxx . . $ from_MJPEG_to_R8G8B8(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 680 | // Make sure to free frame when we fail to decode. |
| 681 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 682 | return; |
| 683 | } |
| 684 | break; |
| 685 | #endif |
| 686 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to R8G8B8!", u_format_str(xf->format)); return; |
| 687 | } |
| 688 | |
| 689 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 690 | |
| 691 | // Refcount in case it's being held downstream. |
| 692 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 693 | } |
| 694 | |
| 695 | static void |
| 696 | convert_frame_rgb_yuv_yuyv_uyvy_or_l8cxx . . $ convert_frame_rgb_yuv_yuyv_uyvy_or_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 697 | { |
| 698 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 699 | |
| 700 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 701 | |
| 702 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 703 | |
| 704 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 705 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: |
| 706 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 707 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 708 | case XRT_FORMAT_UYVY422cxx . . $ XRT_FORMAT_UYVY422.: |
| 709 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 710 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 711 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 712 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888., &converted)) { |
| 713 | return; |
| 714 | } |
| 715 | if (!from_MJPEG_to_YUV888cxx . . $ from_MJPEG_to_YUV888(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 716 | return; |
| 717 | } |
| 718 | break; |
| 719 | #endif |
| 720 | default: |
| 721 | U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to either R8G8B8, YUV, YUYV, UYVY or L8!", u_format_str(xf->format)); |
| 722 | return; |
| 723 | } |
| 724 | |
| 725 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 726 | |
| 727 | // Refcount in case it's being held downstream. |
| 728 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 729 | } |
| 730 | |
| 731 | static void |
| 732 | convert_frame_yuv_yuyv_uyvy_or_l8cxx . . $ convert_frame_yuv_yuyv_uyvy_or_l8(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 733 | { |
| 734 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 735 | |
| 736 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 737 | |
| 738 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 739 | |
| 740 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 741 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: |
| 742 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 743 | case XRT_FORMAT_UYVY422cxx . . $ XRT_FORMAT_UYVY422.: |
| 744 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 745 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 746 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 747 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888., &converted)) { |
| 748 | return; |
| 749 | } |
| 750 | if (!from_MJPEG_to_YUV888cxx . . $ from_MJPEG_to_YUV888(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 751 | return; |
| 752 | } |
| 753 | break; |
| 754 | #endif |
| 755 | default: |
| 756 | U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!( |
| 757 | "Cannot convert from '%s' to either YUV, YUYV, UYVY or " |
| 758 | "L8!", |
| 759 | u_format_str(xf->format)); |
| 760 | return; |
| 761 | } |
| 762 | |
| 763 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 764 | |
| 765 | // Refcount in case it's being held downstream. |
| 766 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 767 | } |
| 768 | |
| 769 | static void |
| 770 | convert_frame_yuv_or_yuyvcxx . . $ convert_frame_yuv_or_yuyv(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 771 | { |
| 772 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 773 | |
| 774 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 775 | |
| 776 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 777 | |
| 778 | switch (xf->formatcxx . . $ xrt_frame#format.) { |
| 779 | case XRT_FORMAT_YUYV422cxx . . $ XRT_FORMAT_YUYV422.: |
| 780 | case XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888.: s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., xf); return; |
| 781 | #ifdef XRT_HAVE_JPEGcxx . . $ `build/src/xrt/include/xrt/xrt_config_have.h:22:9`! |
| 782 | case XRT_FORMAT_MJPEGcxx . . $ XRT_FORMAT_MJPEG.: |
| 783 | if (!create_frame_with_formatcxx . . $ create_frame_with_format(4f0df91d1db17ca2).(xf, XRT_FORMAT_YUV888cxx . . $ XRT_FORMAT_YUV888., &converted)) { |
| 784 | return; |
| 785 | } |
| 786 | if (!from_MJPEG_to_YUV888cxx . . $ from_MJPEG_to_YUV888(91df8a3159f5e0d8).(converted, xf->sizecxx . . $ xrt_frame#size., xf->datacxx . . $ xrt_frame#data.)) { |
| 787 | return; |
| 788 | } |
| 789 | break; |
| 790 | #endif |
| 791 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Cannot convert from '%s' to either YUV or YUYV!", u_format_str(xf->format)); return; |
| 792 | } |
| 793 | |
| 794 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 795 | |
| 796 | // Refcount in case it's being held downstream. |
| 797 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 798 | } |
| 799 | |
| 800 | XRT_MAYBE_UNUSEDcxx . . $ `src/xrt/include/xrt/xrt_compiler.h:53:9`! static void |
| 801 | convert_frame_bayercxx . . $ convert_frame_bayer(1e8c9dd18059651).(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *xs, struct xrt_framecxx . . $ xrt_frame# *xf) |
| 802 | { |
| 803 | SINK_TRACE_MARKERcxx . . $ `src/xrt/auxiliary/util/u_trace_marker.h:116:9`!(); |
| 804 | |
| 805 | struct u_sink_convertercxx . . $ u_sink_converter# *s = (struct u_sink_convertercxx . . $ u_sink_converter# *)xs; |
| 806 | |
| 807 | uint32_tcxx . . $ uint32_t# w = xf->widthcxx . . $ xrt_frame#width. / 2; |
| 808 | uint32_tcxx . . $ uint32_t# h = xf->heightcxx . . $ xrt_frame#height. / 2; |
| 809 | struct xrt_framecxx . . $ xrt_frame# *converted = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 810 | |
| 811 | if (!create_frame_with_format_of_sizecxx . . $ create_frame_with_format_of_size(58570909f07a4ed8).(xf, w, h, XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8., &converted)) { |
| 812 | return; |
| 813 | } |
| 814 | |
| 815 | from_BAYER_GR8_to_R8G8B8cxx . . $ from_BAYER_GR8_to_R8G8B8(47dbc3f07c44e488).(converted, w, h, xf->stridecxx . . $ xrt_frame#stride., xf->datacxx . . $ xrt_frame#data.); |
| 816 | |
| 817 | s->downstreamcxx . . $ u_sink_converter#downstream.->push_framecxx . . $ xrt_frame_sink#push_frame.(s->downstreamcxx . . $ u_sink_converter#downstream., converted); |
| 818 | |
| 819 | // Refcount in case it's being held downstream. |
| 820 | xrt_frame_referencecxx . . $ xrt_frame_reference(fce10333cf069560).(&converted, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 821 | } |
| 822 | |
| 823 | static void |
| 824 | break_apartcxx . . $ break_apart(4381388d16accfed).(struct xrt_frame_nodecxx . . $ xrt_frame_node# *node) |
| 825 | {} |
| 826 | |
| 827 | static void |
| 828 | destroycxx . . $ destroy(4381388d16accfed).(struct xrt_frame_nodecxx . . $ xrt_frame_node# *node) |
| 829 | { |
| 830 | struct u_sink_convertercxx . . $ u_sink_converter# *s = container_ofcxx . . $ `src/xrt/include/xrt/xrt_compiler.h:149:9`!(node, struct u_sink_converter, node); |
| 831 | |
| 832 | freecxx . . $ free(5d22bdacc48458e8).(s); |
| 833 | } |
| 834 | |
| 835 | |
| 836 | /* |
| 837 | * |
| 838 | * "Exported" functions. |
| 839 | * |
| 840 | */ |
| 841 | |
| 842 | void |
| 843 | u_sink_create_format_convertercxx . . $ u_sink_create_format_converter(ae021d398251cf8a).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 844 | enum xrt_formatcxx . . $ xrt_format# format, |
| 845 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 846 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 847 | { |
| 848 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 849 | |
| 850 | void (*func)(struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *, struct xrt_framecxx . . $ xrt_frame# *); |
| 851 | |
| 852 | switch (format) { |
| 853 | case XRT_FORMAT_R8G8B8cxx . . $ XRT_FORMAT_R8G8B8.: func = convert_frame_r8g8b8cxx . . $ convert_frame_r8g8b8(1e8c9dd18059651).; break; |
| 854 | case XRT_FORMAT_L8cxx . . $ XRT_FORMAT_L8.: func = convert_frame_l8cxx . . $ convert_frame_l8(1e8c9dd18059651).; break; |
| 855 | default: U_LOG_Ecxx . . $ `src/xrt/auxiliary/util/u_logging.h:304:9`!("Format '%s' not supported", u_format_str(format)); return; |
| 856 | } |
| 857 | |
| 858 | #ifdef USE_TABLE |
| 859 | generate_lookup_YUV_to_RGBX(); |
| 860 | #endif |
| 861 | |
| 862 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 863 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = func; |
| 864 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 865 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 866 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 867 | |
| 868 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 869 | |
| 870 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 871 | } |
| 872 | |
| 873 | void |
| 874 | u_sink_create_to_r8g8b8_or_l8cxx . . $ u_sink_create_to_r8g8b8_or_l8(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 875 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 876 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 877 | { |
| 878 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 879 | |
| 880 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 881 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_r8g8b8_or_l8cxx . . $ convert_frame_r8g8b8_or_l8(1e8c9dd18059651).; |
| 882 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 883 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 884 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 885 | |
| 886 | #ifdef USE_TABLE |
| 887 | generate_lookup_YUV_to_RGBX(); |
| 888 | #endif |
| 889 | |
| 890 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 891 | |
| 892 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 893 | } |
| 894 | |
| 895 | void |
| 896 | u_sink_create_to_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8cxx . . $ u_sink_create_to_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 897 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 898 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 899 | { |
| 900 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 901 | |
| 902 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 903 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8cxx . . $ convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8(1e8c9dd18059651).; |
| 904 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 905 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 906 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 907 | |
| 908 | #ifdef USE_TABLE |
| 909 | generate_lookup_YUV_to_RGBX(); |
| 910 | #endif |
| 911 | |
| 912 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 913 | |
| 914 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 915 | } |
| 916 | |
| 917 | void |
| 918 | u_sink_create_to_r8g8b8_bayer_or_l8cxx . . $ u_sink_create_to_r8g8b8_bayer_or_l8(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 919 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 920 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 921 | { |
| 922 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 923 | |
| 924 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 925 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_r8g8b8_bayer_or_l8cxx . . $ convert_frame_r8g8b8_bayer_or_l8(1e8c9dd18059651).; |
| 926 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 927 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 928 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 929 | |
| 930 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 931 | |
| 932 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 933 | } |
| 934 | |
| 935 | void |
| 936 | u_sink_create_to_rgb_yuv_yuyv_uyvy_or_l8cxx . . $ u_sink_create_to_rgb_yuv_yuyv_uyvy_or_l8(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 937 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 938 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 939 | { |
| 940 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 941 | |
| 942 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 943 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_rgb_yuv_yuyv_uyvy_or_l8cxx . . $ convert_frame_rgb_yuv_yuyv_uyvy_or_l8(1e8c9dd18059651).; |
| 944 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 945 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 946 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 947 | |
| 948 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 949 | |
| 950 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 951 | } |
| 952 | |
| 953 | void |
| 954 | u_sink_create_to_yuv_yuyv_uyvy_or_l8cxx . . $ u_sink_create_to_yuv_yuyv_uyvy_or_l8(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 955 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 956 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 957 | { |
| 958 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 959 | |
| 960 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 961 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_yuv_yuyv_uyvy_or_l8cxx . . $ convert_frame_yuv_yuyv_uyvy_or_l8(1e8c9dd18059651).; |
| 962 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 963 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 964 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 965 | |
| 966 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 967 | |
| 968 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 969 | } |
| 970 | |
| 971 | void |
| 972 | u_sink_create_to_yuv_or_yuyvcxx . . $ u_sink_create_to_yuv_or_yuyv(61d839300b81b508).(struct xrt_frame_contextcxx . . $ xrt_frame_context# *xfctx, |
| 973 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# *downstream, |
| 974 | struct xrt_frame_sinkcxx . . $ xrt_frame_sink# **out_xfs) |
| 975 | { |
| 976 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(downstream != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 977 | |
| 978 | struct u_sink_convertercxx . . $ u_sink_converter# *s = U_TYPED_CALLOCcxx . . $ `src/xrt/auxiliary/util/u_misc.h:47:9`!(struct u_sink_converter); |
| 979 | s->basecxx . . $ u_sink_converter#base..push_framecxx . . $ xrt_frame_sink#push_frame. = convert_frame_yuv_or_yuyvcxx . . $ convert_frame_yuv_or_yuyv(1e8c9dd18059651).; |
| 980 | s->nodecxx . . $ u_sink_converter#node..break_apartcxx . . $ xrt_frame_node#break_apart. = break_apartcxx . . $ break_apart(4381388d16accfed).; |
| 981 | s->nodecxx . . $ u_sink_converter#node..destroycxx . . $ xrt_frame_node#destroy. = destroycxx . . $ destroy(4381388d16accfed).; |
| 982 | s->downstreamcxx . . $ u_sink_converter#downstream. = downstream; |
| 983 | |
| 984 | xrt_frame_context_addcxx . . $ xrt_frame_context_add(cc43192741dca22).(xfctx, &s->nodecxx . . $ u_sink_converter#node.); |
| 985 | |
| 986 | *out_xfs = &s->basecxx . . $ u_sink_converter#base.; |
| 987 | } |