Monado OpenXR Runtime
u_sink_converter.c File Reference

xrt_frame_sink converters and other helpers. More...

#include "xrt/xrt_config_have.h"
#include "util/u_logging.h"
#include "util/u_misc.h"
#include "util/u_sink.h"
#include "util/u_frame.h"
#include "util/u_format.h"
#include "util/u_trace_marker.h"
#include <stdio.h>
#include "jpeglib.h"
Include dependency graph for u_sink_converter.c:

Data Structures

struct  u_sink_converter
 An xrt_frame_sink that converts frames. More...
 

Functions

static void from_L8_to_R8G8B8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static int clamp_to_byte (int v)
 
static uint32_t YUV444_to_RGBX8888 (int y, int u, int v)
 
static XRT_MAYBE_UNUSED void YUYV422_to_R8G8B8X8 (const uint8_t *input, uint32_t *rgb1, uint32_t *rgb2)
 
static void YUYV422_to_R8G8B8 (const uint8_t *input, uint8_t *dst)
 
static void UYVY422_to_R8G8B8 (const uint8_t *input, uint8_t *dst)
 
static void YUV444_to_R8G8B8 (const uint8_t *input, uint8_t *dst)
 
static void from_YUYV422_to_R8G8B8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static void from_YUYV422_to_L8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static void from_UYVY422_to_R8G8B8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static void from_YUV888_to_R8G8B8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static bool check_header (size_t size, const uint8_t *data)
 
static bool from_MJPEG_to_R8G8B8 (struct xrt_frame *dst_frame, size_t size, const uint8_t *data)
 
static bool from_MJPEG_to_YUV888 (struct xrt_frame *dst_frame, size_t size, const uint8_t *data)
 
static void from_BAYER_GR8_to_R8G8B8 (struct xrt_frame *dst_frame, uint32_t w, uint32_t h, size_t stride, const uint8_t *data)
 
static bool create_frame_with_format_of_size (struct xrt_frame *xf, uint32_t w, uint32_t h, enum xrt_format format, struct xrt_frame **out_frame)
 Creates a frame that the conversion should happen to, allows to set the size. More...
 
static bool create_frame_with_format (struct xrt_frame *xf, enum xrt_format format, struct xrt_frame **out_frame)
 Creates a frame that the conversion should happen to. More...
 
static void convert_frame_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_r8g8b8_or_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_r8g8b8_bayer_or_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_r8g8b8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_rgb_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void convert_frame_yuv_or_yuyv (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static XRT_MAYBE_UNUSED void convert_frame_bayer (struct xrt_frame_sink *xs, struct xrt_frame *xf)
 
static void break_apart (struct xrt_frame_node *node)
 
static void destroy (struct xrt_frame_node *node)
 
void u_sink_create_format_converter (struct xrt_frame_context *xfctx, enum xrt_format format, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_bayer_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_rgb_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_yuv_or_yuyv (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 

Detailed Description

Function Documentation

◆ create_frame_with_format()

static bool create_frame_with_format ( struct xrt_frame xf,
enum xrt_format  format,
struct xrt_frame **  out_frame 
)
static

Creates a frame that the conversion should happen to.

References create_frame_with_format_of_size().

◆ create_frame_with_format_of_size()

static bool create_frame_with_format_of_size ( struct xrt_frame xf,
uint32_t  w,
uint32_t  h,
enum xrt_format  format,
struct xrt_frame **  out_frame 
)
static

Creates a frame that the conversion should happen to, allows to set the size.

Todo:
Allocate from a pool of frames.

References xrt_frame::source_id, xrt_frame::source_sequence, u_frame_create_one_off(), and U_LOG_E.

Referenced by create_frame_with_format().