Blender V4.3
node_composite_sepcomb_ycca.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "BLI_assert.h"
10
11#include "GPU_material.hh"
12
13#include "COM_shader_node.hh"
14
16
17/* **************** SEPARATE YCCA ******************** */
18
20
22{
23 b.add_input<decl::Color>("Image")
24 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
25 .compositor_domain_priority(0);
26 b.add_output<decl::Float>("Y").translation_context(BLT_I18NCONTEXT_COLOR);
27 b.add_output<decl::Float>("Cb");
28 b.add_output<decl::Float>("Cr");
29 b.add_output<decl::Float>("A").translation_context(BLT_I18NCONTEXT_COLOR);
30}
31
32static void node_composit_init_mode_sepycca(bNodeTree * /*ntree*/, bNode *node)
33{
34 node->custom1 = 1; /* BLI_YCC_ITU_BT709 */
35}
36
37using namespace blender::realtime_compositor;
38
40 public:
42
43 void compile(GPUMaterial *material) override
44 {
47
48 GPU_stack_link(material, &bnode(), get_shader_function_name(), inputs, outputs);
49 }
50
52 {
53 return bnode().custom1;
54 }
55
57 {
58 switch (get_mode()) {
60 return "node_composite_separate_ycca_itu_601";
62 return "node_composite_separate_ycca_itu_709";
64 return "node_composite_separate_ycca_jpeg";
65 }
66
68 return nullptr;
69 }
70};
71
73{
74 return new SeparateYCCAShaderNode(node);
75}
76
77} // namespace blender::nodes::node_composite_separate_ycca_cc
78
80{
82
83 static blender::bke::bNodeType ntype;
84
86 &ntype, CMP_NODE_SEPYCCA_LEGACY, "Separate YCbCrA (Legacy)", NODE_CLASS_CONVERTER);
87 ntype.declare = file_ns::cmp_node_sepycca_declare;
88 ntype.initfunc = file_ns::node_composit_init_mode_sepycca;
89 ntype.gather_link_search_ops = nullptr;
90 ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
91
93}
94
95/* **************** COMBINE YCCA ******************** */
96
98
100{
101 b.add_input<decl::Float>("Y")
102 .min(0.0f)
103 .max(1.0f)
105 .translation_context(BLT_I18NCONTEXT_COLOR);
106 b.add_input<decl::Float>("Cb")
107 .default_value(0.5f)
108 .min(0.0f)
109 .max(1.0f)
111 b.add_input<decl::Float>("Cr")
112 .default_value(0.5f)
113 .min(0.0f)
114 .max(1.0f)
116 b.add_input<decl::Float>("A")
117 .default_value(1.0f)
118 .min(0.0f)
119 .max(1.0f)
121 .translation_context(BLT_I18NCONTEXT_COLOR);
122 b.add_output<decl::Color>("Image");
123}
124
125static void node_composit_init_mode_combycca(bNodeTree * /*ntree*/, bNode *node)
126{
127 node->custom1 = 1; /* BLI_YCC_ITU_BT709 */
128}
129
130using namespace blender::realtime_compositor;
131
133 public:
135
136 void compile(GPUMaterial *material) override
137 {
138 GPUNodeStack *inputs = get_inputs_array();
139 GPUNodeStack *outputs = get_outputs_array();
140
141 GPU_stack_link(material, &bnode(), get_shader_function_name(), inputs, outputs);
142 }
143
145 {
146 return bnode().custom1;
147 }
148
150 {
151 switch (get_mode()) {
153 return "node_composite_combine_ycca_itu_601";
155 return "node_composite_combine_ycca_itu_709";
157 return "node_composite_combine_ycca_jpeg";
158 }
159
161 return nullptr;
162 }
163};
164
166{
167 return new CombineYCCAShaderNode(node);
168}
169
170} // namespace blender::nodes::node_composite_combine_ycca_cc
171
173{
175
176 static blender::bke::bNodeType ntype;
177
179 &ntype, CMP_NODE_COMBYCCA_LEGACY, "Combine YCbCrA (Legacy)", NODE_CLASS_CONVERTER);
180 ntype.declare = file_ns::cmp_node_combycca_declare;
181 ntype.initfunc = file_ns::node_composit_init_mode_combycca;
182 ntype.gather_link_search_ops = nullptr;
183 ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
184
186}
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
#define BLI_assert_unreachable()
Definition BLI_assert.h:97
#define BLI_YCC_JFIF_0_255
#define BLI_YCC_ITU_BT601
#define BLI_YCC_ITU_BT709
#define BLT_I18NCONTEXT_COLOR
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_composit_init_mode_combycca(bNodeTree *, bNode *node)
static void cmp_node_combycca_declare(NodeDeclarationBuilder &b)
static void node_composit_init_mode_sepycca(bNodeTree *, bNode *node)
static void cmp_node_sepycca_declare(NodeDeclarationBuilder &b)
void register_node_type_cmp_sepycca()
void register_node_type_cmp_combycca()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
#define min(a, b)
Definition sort.c:32
int16_t custom1
Defines a node type.
Definition BKE_node.hh:218
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:363
NodeDeclareFunction declare
Definition BKE_node.hh:347
NodeGetCompositorShaderNodeFunction get_compositor_shader_node
Definition BKE_node.hh:328