Banuba SDK
yuv_conversion.hpp
1 #pragma once
2 
3 #include <bnb/types/full_image.hpp>
4 
5 namespace bnb::player_api
6 {
7 
8  constexpr uint32_t yuv_offset_to_y_coeffs = 0;
9  constexpr uint32_t yuv_offset_to_u_coeffs = 8;
10  constexpr uint32_t yuv_offset_to_v_coeffs = 4;
11 
12  constexpr uint32_t yuv_offset_to_r_coeffs = 0;
13  constexpr uint32_t yuv_offset_to_g_coeffs = 4;
14  constexpr uint32_t yuv_offset_to_b_coeffs = 8;
15 
16  const float* const get_conversion_matrix_from_rgb_to_yuv(pixel_buffer_format to_yuv_format, bnb::color_std std, bnb::color_range rng);
17 
18  const float* const get_conversion_matrix_from_yuv_to_rgb(pixel_buffer_format from_yuv_format, bnb::color_std std, bnb::color_range rng);
19 
20  [[nodiscard]] inline int32_t uv_plane_width(int32_t width)
21  {
22  return (width + 1) / 2;
23  }
24 
25  [[nodiscard]] inline int32_t uv_plane_height(int32_t height)
26  {
27  return (height + 1) / 2;
28  }
29 
30 } // namespace bnb::player_api
bnb::pixel_buffer_format
pixel_buffer_format
bt601 and bt709 - two standards for representing color space that use the same image encoding/decodin...
Definition: full_image.hpp:28
bnb::color_std
color_std
Enum class represents suppotred color standarts.
Definition: full_image.hpp:281
bnb::color_range
color_range
Enum class represents color range.
Definition: full_image.hpp:271