Files
test2/source/blender/editors/space_sequencer/sequencer_scopes.hh
Aras Pranckevicius a52bed7786 VSE: Do Scopes on the GPU, improve their look, HDR for waveform/parade
Faster and better looking VSE scopes & "show overexposed". Waveform &
RGB Parade now can also show HDR color intensities. (Note: this is
only about VSE scopes; Image Space scopes are to be improved separately)

- Waveform, RGB Parade, Vectorscope scopes are done on the GPU now, by
  drawing points for each input pixel, and placing them according to
  scope logic. The point drawing is implemented in a compute shader,
  with a fragment shader resolve pass; this is because drawing lots of
  points in the same location is very slow on some GPUs (e.g. Apple).
  The compute shader rasterizer is several times faster on regular
  desktop GPU as well.
- If a non-default color management is needed (e.g. VSE colorspace is
  not the same as display colorspace, or a custom look transform is used
  etc. etc.), then transform the VSE preview texture into display space
  RGBA 16F texture using OCIO GPU machinery, and calculate scopes
  from that.
- The "show overexposed" (zebra) preview option is also done on the
  GPU now.
- Waveform/Parade scopes unlock zoom X/Y aspect for viewing HDR scope,
  similar to how it was done for HDR histograms recently.
- Added SEQ_preview_cache.hh that holds GPU textures of VSE preview,
  this is so that when you have a preview and several scopes, each of
  them does not have to create/upload their own GPU texture (that would
  both waste memory, and be slow).

Screenshots and performance details in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/144867
2025-08-26 12:25:43 +02:00

66 lines
1.6 KiB
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup spseq
*/
#pragma once
#include "BLI_array.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_utility_mixins.hh"
struct ColorManagedViewSettings;
struct ColorManagedDisplaySettings;
struct ImBuf;
namespace blender::ed::vse {
struct ScopeHistogram {
/* LDR (0..1) range is covered by this many bins. */
static constexpr int BINS_01 = 256;
/* HDR images extend the range to 0..12 uniformly. */
static constexpr int BINS_HDR = BINS_01 * 12;
/* R,G,B counts for each bin. */
Array<uint3> data;
/* Maximum R,G,B counts across all bins. */
uint3 max_value = uint3(0);
/* Maximum R,G,B bins used. */
uint3 max_bin = uint3(0);
void calc_from_ibuf(const ImBuf *ibuf,
const ColorManagedViewSettings &view_settings,
const ColorManagedDisplaySettings &display_settings);
static int float_to_bin(float f)
{
int bin = int(f * BINS_01);
return math::clamp(bin, 0, BINS_HDR - 1);
}
static float bin_to_float(int bin)
{
return float(bin) / (BINS_01 - 1);
}
};
struct SeqScopes : public NonCopyable {
/* Multiplier to map YUV U,V range (+-0.436, +-0.615) to +-0.5 on both axes. */
static constexpr float VECSCOPE_U_SCALE = 0.5f / 0.436f;
static constexpr float VECSCOPE_V_SCALE = 0.5f / 0.615f;
const ImBuf *last_ibuf = nullptr;
int last_timeline_frame = 0;
bool last_ibuf_float = false;
ScopeHistogram histogram;
SeqScopes() = default;
~SeqScopes();
void cleanup();
};
} // namespace blender::ed::vse