Files
test/source/blender/editors/space_sequencer/sequencer_scopes.hh
Aras Pranckevicius 4275d85158 Fix #133214: image vectorscope has incorrect horizontal scale
Both Image and Sequencer vectorscopes used YUV U,V coordinates
as-is, but their possible ranges are different: +-0.436 and
+-0.615 respectively.

It looks like more other software (ffmpeg, shotcut, etc.)
re-scales the vectorscope UV to fill up a square, i.e. streches
out the horizontal values, so do the same.

This fixes the "skin tone indicator" line, which at 123 degrees
(90 + 33 degrees to match positive I axis of YIQ color space) was
placed assuming the UV values fill up a square. So it was at the
wrong angle before.

The vectorscope horizontal scaling and skin tone indicator line now
matches other open source (ffmpeg, shotcut) and commercial (davinci
resolve, final cut pro) software packages.

Images in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/133316
2025-01-21 13:55:15 +01:00

60 lines
1.5 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 ImBuf;
namespace blender::ed::seq {
struct ScopeHistogram {
/* Byte images just have bins for the 0..255 range. */
static constexpr int BINS_BYTE = 256;
/* Float images spread -0.25..+1.25 range over 512 bins. */
static constexpr int BINS_FLOAT = 512;
static constexpr float FLOAT_VAL_MIN = -0.25f;
static constexpr float FLOAT_VAL_MAX = 1.25f;
Array<uint3> data;
uint3 max_value;
void calc_from_ibuf(const ImBuf *ibuf);
bool is_float_hist() const
{
return data.size() == BINS_FLOAT;
}
};
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;
ImBuf *reference_ibuf = nullptr;
ImBuf *zebra_ibuf = nullptr;
ImBuf *waveform_ibuf = nullptr;
ImBuf *sep_waveform_ibuf = nullptr;
ImBuf *vector_ibuf = nullptr;
ScopeHistogram histogram;
SeqScopes() = default;
~SeqScopes();
void cleanup();
};
ImBuf *make_waveform_view_from_ibuf(const ImBuf *ibuf);
ImBuf *make_sep_waveform_view_from_ibuf(const ImBuf *ibuf);
ImBuf *make_vectorscope_view_from_ibuf(const ImBuf *ibuf);
ImBuf *make_zebra_view_from_ibuf(const ImBuf *ibuf, float perc);
} // namespace blender::ed::seq