+ return {
+ chain = chain,
+ input = input,
+ wb_effect = wb_effect,
+ resample_effect = resample_effect,
+ resize_effect = resize_effect
+ }
+end
+
+-- Make all possible combinations of single-input chains.
+local simple_chains = make_cartesian_product({
+ {"live", "livedeint"}, -- input_type
+ {true, false}, -- input_scale
+ {true, false} -- hq
+}, function(input_type, input_scale, hq)
+ local input_deint = (input_type == "livedeint")
+ return make_simple_chain(input_deint, input_scale, hq)
+end)
+
+-- A chain to show a single static picture on screen (HQ version).
+local static_chain_hq = EffectChain.new(16, 9)
+local static_chain_hq_input = static_chain_hq:add_effect(ImageInput.new("bg.jpeg"))
+static_chain_hq:finalize(true)
+
+-- A chain to show a single static picture on screen (LQ version).
+local static_chain_lq = EffectChain.new(16, 9)
+local static_chain_lq_input = static_chain_lq:add_effect(ImageInput.new("bg.jpeg"))
+static_chain_lq:finalize(false)
+
+-- Used for indexing into the tables of chains.
+function get_input_type(signals, signal_num)
+ if signal_num == STATIC_SIGNAL_NUM then
+ return "static"
+ elseif signals:get_interlaced(signal_num) then
+ return "livedeint"
+ else
+ return "live"
+ end
+end
+
+function needs_scale(signals, signal_num, width, height)
+ if signal_num == STATIC_SIGNAL_NUM then
+ -- We assume this is already correctly scaled at load time.
+ return false
+ end
+ assert(signal_num == INPUT0_SIGNAL_NUM or signal_num == INPUT1_SIGNAL_NUM)
+ return (signals:get_width(signal_num) ~= width or signals:get_height(signal_num) ~= height)
+end
+
+function set_scale_parameters_if_needed(chain_or_input, width, height)
+ if chain_or_input.resample_effect then
+ chain_or_input.resample_effect:set_int("width", width)
+ chain_or_input.resample_effect:set_int("height", height)
+ elseif chain_or_input.resize_effect then
+ chain_or_input.resize_effect:set_int("width", width)
+ chain_or_input.resize_effect:set_int("height", height)
+ end
+end
+
+-- API ENTRY POINT