+ return {
+ input = input,
+ wb_effect = wb_effect,
+ resample_effect = resample_effect,
+ resize_effect = resize_effect,
+ padding_effect = padding_effect
+ }
+end
+
+-- The main live chain.
+function make_sbs_chain(input0_deint, input1_deint, hq)
+ local chain = EffectChain.new(16, 9)
+
+ local input0 = make_sbs_input(chain, INPUT0_SIGNAL_NUM, input0_deint, hq)
+ local input1 = make_sbs_input(chain, INPUT1_SIGNAL_NUM, input1_deint, hq)
+
+ input0.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0)
+ input1.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 0.0)
+
+ chain:add_effect(OverlayEffect.new(), input0.padding_effect, input1.padding_effect)
+ chain:finalize(hq)
+
+ return {
+ chain = chain,
+ input0 = input0,
+ input1 = input1
+ }
+end
+
+-- Make all possible combinations of side-by-side chains.
+local sbs_chains = make_cartesian_product({
+ {"live", "livedeint"}, -- input0_type
+ {"live", "livedeint"}, -- input1_type
+ {true, false} -- hq
+}, function(input0_type, input1_type, hq)
+ local input0_deint = (input0_type == "livedeint")
+ local input1_deint = (input1_type == "livedeint")
+ return make_sbs_chain(input0_deint, input1_deint, hq)
+end)
+
+function make_fade_input(chain, signal, live, deint, scale)
+ local input, wb_effect, resample_effect, last
+ if live then
+ input = chain:add_live_input(false, deint)
+ wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+ input:connect_signal(signal)
+ last = wb_effect