Sunshine master
Self-hosted game stream host for Moonlight.
video_colorspace.h
Go to the documentation of this file.
1
5#pragma once
6
7extern "C" {
8#include <libavutil/pixfmt.h>
9}
10
11namespace video {
12
16 enum class colorspace_e {
17 rec601,
18 rec709,
19 bt2020sdr,
20 bt2020,
21 };
22
31
38 bool colorspace_is_hdr(const sunshine_colorspace_t &colorspace);
39
40 // Declared in video.h
41 struct config_t;
42
50 sunshine_colorspace_t colorspace_from_client_config(const config_t &config, bool hdr_display);
51
56 AVColorPrimaries primaries;
57 AVColorTransferCharacteristic transfer_function;
58 AVColorSpace matrix;
59 AVColorRange range;
61 };
62
70
74 struct alignas(16) color_t {
75 float color_vec_y[4];
76 float color_vec_u[4];
77 float color_vec_v[4];
78 float range_y[2];
79 float range_uv[2];
80 };
81
92 const color_t *color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace, bool unorm_output);
93} // namespace video
video_t video
Default video configuration values used before file and CLI overrides.
Definition config.cpp:623
FFmpeg colorimetry values used by AVCodec encoders.
Definition video_colorspace.h:55
AVColorRange range
FFmpeg full-range or limited-range flag selected for the encoded stream.
Definition video_colorspace.h:59
AVColorPrimaries primaries
FFmpeg color primaries selected for the encoded stream.
Definition video_colorspace.h:56
AVColorTransferCharacteristic transfer_function
FFmpeg transfer function selected for the encoded stream.
Definition video_colorspace.h:57
int software_format
FFmpeg software pixel format used when hardware frames are not supplied.
Definition video_colorspace.h:60
AVColorSpace matrix
FFmpeg YUV matrix coefficients selected for the encoded stream.
Definition video_colorspace.h:58
Pair of Sunshine and AVCodec colorimetry descriptions.
Definition video_colorspace.h:74
float color_vec_v[4]
Color vec v.
Definition video_colorspace.h:77
float range_uv[2]
Range uv.
Definition video_colorspace.h:79
float color_vec_y[4]
Color vec y.
Definition video_colorspace.h:75
float range_y[2]
Range y.
Definition video_colorspace.h:78
float color_vec_u[4]
Color vec u.
Definition video_colorspace.h:76
Encoding configuration requested by a remote client.
Definition video.h:28
Sunshine colorimetry values derived from stream configuration.
Definition video_colorspace.h:26
unsigned bit_depth
Bit depth.
Definition video_colorspace.h:29
bool full_range
Whether the video range is full-range instead of limited.
Definition video_colorspace.h:28
colorspace_e colorspace
Colorspace.
Definition video_colorspace.h:27
sunshine_colorspace_t colorspace_from_client_config(const config_t &config, bool hdr_display)
Derive Sunshine colorspace metadata from client stream configuration.
Definition video_colorspace.cpp:28
const color_t * color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace, bool unorm_output)
Get static RGB->YUV color conversion matrix. This matrix expects RGB input in UNORM (0....
Definition video_colorspace.cpp:132
avcodec_colorspace_t avcodec_colorspace_from_sunshine_colorspace(const sunshine_colorspace_t &sunshine_colorspace)
Convert Sunshine colorspace metadata to FFmpeg AVCodec fields.
Definition video_colorspace.cpp:88
bool colorspace_is_hdr(const sunshine_colorspace_t &colorspace)
Check whether a Sunshine colorspace represents HDR video.
Definition video_colorspace.cpp:21
colorspace_e
Enumerates supported colorspace options.
Definition video_colorspace.h:16
@ bt2020
Rec. 2020 HDR.
@ bt2020sdr
Rec. 2020 SDR.