Sunshine/src/video_colorspace.h
ns6089 bfdfcebc80
Some checks failed
CI / GitHub Env Debug (push) Waiting to run
CI / Setup Release (push) Waiting to run
CI / Setup Flatpak Matrix (push) Waiting to run
CI / Linux Flatpak (push) Blocked by required conditions
CI / Linux ${{ matrix.type }} (--appimage-build, 22.04, AppImage) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 12) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 13) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 14) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (12, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (13) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (14) (push) Blocked by required conditions
CI / Windows (push) Blocked by required conditions
CI Docker / Check Dockerfiles (push) Waiting to run
CI Docker / Setup Release (push) Blocked by required conditions
CI Docker / Lint Dockerfile${{ matrix.tag }} (push) Blocked by required conditions
CI Docker / Docker${{ matrix.tag }} (push) Blocked by required conditions
CodeQL / Get language matrix (push) Waiting to run
CodeQL / Analyze (${{ matrix.name }}) (push) Blocked by required conditions
Build GH-Pages / update_pages (push) Waiting to run
localize / Update Localization (push) Has been cancelled
feat(win/video): support native YUV 4:4:4 encoding (#2533)
2024-08-16 13:41:27 -04:00

74 lines
2.1 KiB
C++

/**
* @file src/video_colorspace.h
* @brief Declarations for colorspace functions.
*/
#pragma once
extern "C" {
#include <libavutil/pixfmt.h>
}
namespace video {
enum class colorspace_e {
rec601, ///< Rec. 601
rec709, ///< Rec. 709
bt2020sdr, ///< Rec. 2020 SDR
bt2020, ///< Rec. 2020 HDR
};
struct sunshine_colorspace_t {
colorspace_e colorspace;
bool full_range;
unsigned bit_depth;
};
bool
colorspace_is_hdr(const sunshine_colorspace_t &colorspace);
// Declared in video.h
struct config_t;
sunshine_colorspace_t
colorspace_from_client_config(const config_t &config, bool hdr_display);
struct avcodec_colorspace_t {
AVColorPrimaries primaries;
AVColorTransferCharacteristic transfer_function;
AVColorSpace matrix;
AVColorRange range;
int software_format;
};
avcodec_colorspace_t
avcodec_colorspace_from_sunshine_colorspace(const sunshine_colorspace_t &sunshine_colorspace);
struct alignas(16) color_t {
float color_vec_y[4];
float color_vec_u[4];
float color_vec_v[4];
float range_y[2];
float range_uv[2];
};
const color_t *
color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace);
const color_t *
color_vectors_from_colorspace(colorspace_e colorspace, bool full_range);
/**
* @brief New version of `color_vectors_from_colorspace()` function that better adheres to the standards.
* Returned vectors are used to perform RGB->YUV conversion.
* Unlike its predecessor, color vectors will produce output in `UINT` range, not `UNORM` range.
* Input is still in `UNORM` range. Returned vectors won't modify color primaries and color
* transfer function.
* @param colorspace Targeted YUV colorspace.
* @return `const color_t*` that contains RGB->YUV transformation vectors.
* Components `range_y` and `range_uv` are there for backwards compatibility
* and can be ignored in the computation.
*/
const color_t *
new_color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace);
} // namespace video