-local main_chain = EffectChain.new(16, 9)
-local input0 = main_chain:add_live_input()
-input0:connect_signal(0)
-local input1 = main_chain:add_live_input()
-input1:connect_signal(1)
-local resample_effect = main_chain:add_effect(ResampleEffect.new(), input0)
-local padding_effect = main_chain:add_effect(IntegralPaddingEffect.new())
-padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0)
-
-local resample2_effect = main_chain:add_effect(ResampleEffect.new(), input1)
--- Effect *saturation_effect = main_chain->add_effect(new SaturationEffect())
--- CHECK(saturation_effect->set_float("saturation", 0.3f))
-local wb_effect = main_chain:add_effect(WhiteBalanceEffect.new())
-wb_effect:set_float("output_color_temperature", 3500.0)
-local padding2_effect = main_chain:add_effect(IntegralPaddingEffect.new())
-
-main_chain:add_effect(OverlayEffect.new(), padding_effect, padding2_effect)
-main_chain:finalize(true)
+function make_sbs_chain(hq)
+ local chain = EffectChain.new(16, 9)
+ local input0 = chain:add_live_input(true)
+ input0:connect_signal(0)
+ local input0_wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+ local input1 = chain:add_live_input(true)
+ input1:connect_signal(1)
+ local input1_wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+
+ local resample_effect = nil
+ local resize_effect = nil
+ if (hq) then
+ resample_effect = chain:add_effect(ResampleEffect.new(), input0_wb_effect)
+ else
+ resize_effect = chain:add_effect(ResizeEffect.new(), input0_wb_effect)
+ end
+
+ local padding_effect = chain:add_effect(IntegralPaddingEffect.new())
+ padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0)
+
+ local resample2_effect = nil
+ local resize2_effect = nil
+ if (hq) then
+ resample2_effect = chain:add_effect(ResampleEffect.new(), input1_wb_effect)
+ else
+ resize2_effect = chain:add_effect(ResizeEffect.new(), input1_wb_effect)
+ end
+ local padding2_effect = chain:add_effect(IntegralPaddingEffect.new())
+
+ chain:add_effect(OverlayEffect.new(), padding_effect, padding2_effect)
+ chain:finalize(hq)
+
+ return {
+ chain = chain,
+ input0 = {
+ input = input0,
+ white_balance_effect = input0_wb_effect,
+ resample_effect = resample_effect,
+ resize_effect = resize_effect,
+ padding_effect = padding_effect
+ },
+ input1 = {
+ input = input1,
+ white_balance_effect = input1_wb_effect,
+ resample_effect = resample2_effect,
+ resize_effect = resize2_effect,
+ padding_effect = padding2_effect
+ }
+ }
+end
+
+local main_chain_hq = make_sbs_chain(true)
+local main_chain_lq = make_sbs_chain(false)
+
+-- A chain to fade between two inputs (live chain only)
+local fade_vtv_chain_hq = EffectChain.new(16, 9)
+local fade_vtv_chain_hq_input0 = fade_vtv_chain_hq:add_live_input(true)
+local fade_vtv_chain_hq_wb0_effect = fade_vtv_chain_hq:add_effect(WhiteBalanceEffect.new())
+local fade_vtv_chain_hq_input1 = fade_vtv_chain_hq:add_live_input(true)
+local fade_vtv_chain_hq_wb1_effect = fade_vtv_chain_hq:add_effect(WhiteBalanceEffect.new())
+fade_vtv_chain_hq_input0:connect_signal(0)
+fade_vtv_chain_hq_input1:connect_signal(1)
+local fade_vtv_chain_mix_effect = fade_vtv_chain_hq:add_effect(MixEffect.new(), fade_vtv_chain_hq_wb0_effect, fade_vtv_chain_hq_wb1_effect)
+fade_vtv_chain_hq:finalize(true)
+
+-- A chain to fade between an inputs and a picture (live chain only)
+local fade_vtp_chain_hq = EffectChain.new(16, 9)
+local fade_vtp_chain_hq_input0 = fade_vtp_chain_hq:add_live_input(true)
+local fade_vtp_chain_hq_wb0_effect = fade_vtp_chain_hq:add_effect(WhiteBalanceEffect.new())
+local fade_vtp_chain_hq_input1 = fade_vtp_chain_hq:add_effect(ImageInput.new("bg.jpeg"))
+fade_vtp_chain_hq_input0:connect_signal(0)
+local fade_vtp_chain_mix_effect = fade_vtp_chain_hq:add_effect(MixEffect.new(), fade_vtp_chain_hq_wb0_effect, fade_vtp_chain_hq_input1)
+fade_vtp_chain_hq:finalize(true)