mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
u/sink: Add u_sink_create_to_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8
This commit is contained in:
parent
0dcc73d5cf
commit
8f792c9165
|
@ -1,9 +1,10 @@
|
||||||
// Copyright 2019, Collabora, Ltd.
|
// Copyright 2019-2022, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
* @brief @ref xrt_frame_sink converters and other helpers.
|
* @brief @ref xrt_frame_sink converters and other helpers.
|
||||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||||
|
* @author Moses Turner <moses@collabora.com>
|
||||||
* @ingroup aux_util
|
* @ingroup aux_util
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -81,6 +82,15 @@ void
|
||||||
u_sink_create_to_yuv_or_yuyv(struct xrt_frame_context *xfctx,
|
u_sink_create_to_yuv_or_yuyv(struct xrt_frame_context *xfctx,
|
||||||
struct xrt_frame_sink *downstream,
|
struct xrt_frame_sink *downstream,
|
||||||
struct xrt_frame_sink **out_xfs);
|
struct xrt_frame_sink **out_xfs);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @public @memberof xrt_frame_sink
|
||||||
|
* @see xrt_frame_context
|
||||||
|
*/
|
||||||
|
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);
|
||||||
/*!
|
/*!
|
||||||
* @public @memberof xrt_frame_sink
|
* @public @memberof xrt_frame_sink
|
||||||
* @see xrt_frame_context
|
* @see xrt_frame_context
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// Copyright 2019-2021, Collabora, Ltd.
|
// Copyright 2019-2022, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
* @brief @ref xrt_frame_sink converters and other helpers.
|
* @brief @ref xrt_frame_sink converters and other helpers.
|
||||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||||
|
* @author Moses Turner <moses@collabora.com>
|
||||||
* @ingroup aux_util
|
* @ingroup aux_util
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -519,6 +520,22 @@ convert_frame_r8g8b8_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf)
|
||||||
xrt_frame_reference(&converted, NULL);
|
xrt_frame_reference(&converted, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf)
|
||||||
|
{
|
||||||
|
SINK_TRACE_MARKER();
|
||||||
|
|
||||||
|
struct u_sink_converter *s = (struct u_sink_converter *)xs;
|
||||||
|
|
||||||
|
switch (xf->format) {
|
||||||
|
case XRT_FORMAT_L8:
|
||||||
|
case XRT_FORMAT_R8G8B8A8:
|
||||||
|
case XRT_FORMAT_R8G8B8X8:
|
||||||
|
case XRT_FORMAT_R8G8B8: s->downstream->push_frame(s->downstream, xf); return;
|
||||||
|
default: convert_frame_r8g8b8_or_l8(xs, xf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_frame_r8g8b8_bayer_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf)
|
convert_frame_r8g8b8_bayer_or_l8(struct xrt_frame_sink *xs, struct xrt_frame *xf)
|
||||||
{
|
{
|
||||||
|
@ -828,6 +845,26 @@ u_sink_create_to_r8g8b8_or_l8(struct xrt_frame_context *xfctx,
|
||||||
*out_xfs = &s->base;
|
*out_xfs = &s->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
struct u_sink_converter *s = U_TYPED_CALLOC(struct u_sink_converter);
|
||||||
|
s->base.push_frame = convert_frame_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8;
|
||||||
|
s->node.break_apart = break_apart;
|
||||||
|
s->node.destroy = destroy;
|
||||||
|
s->downstream = downstream;
|
||||||
|
|
||||||
|
#ifdef USE_TABLE
|
||||||
|
generate_lookup_YUV_to_RGBX();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
xrt_frame_context_add(xfctx, &s->node);
|
||||||
|
|
||||||
|
*out_xfs = &s->base;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
u_sink_create_to_r8g8b8_bayer_or_l8(struct xrt_frame_context *xfctx,
|
u_sink_create_to_r8g8b8_bayer_or_l8(struct xrt_frame_context *xfctx,
|
||||||
struct xrt_frame_sink *downstream,
|
struct xrt_frame_sink *downstream,
|
||||||
|
|
Loading…
Reference in a new issue