The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/sink: Add conversion from L8 to R8G8B8

+30
+30
src/xrt/auxiliary/util/u_sink_converter.c
··· 47 47 48 48 /* 49 49 * 50 + * L8 functions. 51 + * 52 + */ 53 + 54 + static void 55 + from_L8_to_R8G8B8(struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data) 56 + { 57 + SINK_TRACE_MARKER(); 58 + 59 + for (uint32_t y = 0; y < h; y++) { 60 + for (uint32_t x = 0; x < w; x += 1) { 61 + const uint8_t *src = data; 62 + uint8_t *dst = dst_frame->data; 63 + 64 + src = src + (y * stride) + x; 65 + dst = dst + (y * dst_frame->stride) + (x * 3); 66 + dst[2] = dst[1] = dst[0] = src[0]; 67 + } 68 + } 69 + } 70 + 71 + 72 + /* 73 + * 50 74 * YUV functions. 51 75 * 52 76 */ ··· 558 582 559 583 switch (xf->format) { 560 584 case XRT_FORMAT_R8G8B8: s->downstream->push_frame(s->downstream, xf); return; 585 + case XRT_FORMAT_L8: 586 + if (!create_frame_with_format(xf, XRT_FORMAT_R8G8B8, &converted)) { 587 + return; 588 + } 589 + from_L8_to_R8G8B8(converted, xf->width, xf->height, xf->stride, xf->data); 590 + break; 561 591 case XRT_FORMAT_BAYER_GR8:; 562 592 uint32_t w = xf->width / 2; 563 593 uint32_t h = xf->height / 2;