Blender V5.0
sequencer_scopes.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_array.hh"
13#include "BLI_utility_mixins.hh"
14
17struct ImBuf;
18
19namespace blender::ed::vse {
20
22 /* LDR (0..1) range is covered by this many bins. */
23 static constexpr int BINS_01 = 256;
24 /* HDR images extend the range to 0..12 uniformly. */
25 static constexpr int BINS_HDR = BINS_01 * 12;
26 /* R,G,B counts for each bin. */
28 /* Maximum R,G,B counts across all bins. */
30 /* Maximum R,G,B bins used. */
32
33 void calc_from_ibuf(const ImBuf *ibuf,
34 const ColorManagedViewSettings &view_settings,
35 const ColorManagedDisplaySettings &display_settings);
36
37 static int float_to_bin(float f)
38 {
39 int bin = int(f * BINS_01);
40 return math::clamp(bin, 0, BINS_HDR - 1);
41 }
42
43 static float bin_to_float(int bin)
44 {
45 return float(bin) / (BINS_01 - 1);
46 }
47};
48
49struct SeqScopes : public NonCopyable {
50 /* Multiplier to map YUV U,V range (+-0.436, +-0.615) to +-0.5 on both axes. */
51 static constexpr float VECSCOPE_U_SCALE = 0.5f / 0.436f;
52 static constexpr float VECSCOPE_V_SCALE = 0.5f / 0.615f;
53
54 const ImBuf *last_ibuf = nullptr;
56 bool last_ibuf_float = false;
58
59 SeqScopes() = default;
60 ~SeqScopes();
61
62 void cleanup();
63};
64
65} // namespace blender::ed::vse
NonCopyable(const NonCopyable &other)=delete
nullptr float
T clamp(const T &a, const T &min, const T &max)
VecBase< uint32_t, 3 > uint3
void calc_from_ibuf(const ImBuf *ibuf, const ColorManagedViewSettings &view_settings, const ColorManagedDisplaySettings &display_settings)
static constexpr float VECSCOPE_V_SCALE
static constexpr float VECSCOPE_U_SCALE