Blender V5.0
COM_keying_screen.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <cstdint>
8#include <memory>
9#include <string>
10
11#include "BLI_map.hh"
13
14#include "DNA_movieclip_types.h"
15#include "DNA_tracking_types.h"
16
18#include "COM_result.hh"
19
20namespace blender::compositor {
21
22class Context;
23
24/* ------------------------------------------------------------------------------------------------
25 * Keying Screen Key.
26 */
28 public:
31
33
34 uint64_t hash() const;
35};
36
37bool operator==(const KeyingScreenKey &a, const KeyingScreenKey &b);
38
39/* -------------------------------------------------------------------------------------------------
40 * Keying Screen.
41 *
42 * A cached resource that computes and caches a result containing the keying screen computed by
43 * interpolating the markers of the given movie tracking object in the given movie clip. */
45 public:
47
48 KeyingScreen(Context &context,
49 MovieClip *movie_clip,
50 MovieTrackingObject *movie_tracking_object,
51 const float smoothness);
52
54
55 private:
56 void compute_gpu(Context &context,
57 const float smoothness,
58 Vector<float2> &marker_positions,
59 const Vector<float4> &marker_colors);
60
61 void compute_cpu(const float smoothness,
62 const Vector<float2> &marker_positions,
63 const Vector<float4> &marker_colors);
64};
65
66/* ------------------------------------------------------------------------------------------------
67 * Keying Screen Container.
68 */
70 private:
72
73 /* A map that stores the update counts of the keying screens at the moment they were cached. */
74 Map<std::string, uint64_t> update_counts_;
75
76 public:
77 void reset() override;
78
79 /* Check if the given movie clip ID has changed since the last time it was retrieved through its
80 * recalculate flag, and if so, invalidate its corresponding cached keying screens and reset the
81 * recalculate flag to ready it to track the next change. Then, check if there is an available
82 * KeyingScreen cached resource with the given parameters in the container, if one exists, return
83 * it, otherwise, return a newly created one and add it to the container. In both cases, tag the
84 * cached resource as needed to keep it cached for the next evaluation. */
85 Result &get(Context &context,
86 MovieClip *movie_clip,
87 MovieTrackingObject *movie_tracking_object,
88 float smoothness);
89};
90
91} // namespace blender::compositor
unsigned long long int uint64_t
Result & get(Context &context, MovieClip *movie_clip, MovieTrackingObject *movie_tracking_object, float smoothness)
KeyingScreenKey(int frame, float smoothness)
KeyingScreen(Context &context, MovieClip *movie_clip, MovieTrackingObject *movie_tracking_object, const float smoothness)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
VecBase< int32_t, 2 > int2