+ if (deinterlace) {
+ vector<Effect *> reverse_inputs(rgba_inputs.rbegin(), rgba_inputs.rend());
+ chain->add_effect(deinterlace_effect, reverse_inputs);
+ }
+ } else {
+ assert(pixel_format == bmusb::PixelFormat_8BitYCbCr || pixel_format == bmusb::PixelFormat_10BitYCbCr);
+ // The Blackmagic driver docs claim that the device outputs Y'CbCr
+ // according to Rec. 601, but practical testing indicates it definitely
+ // is Rec. 709 (at least up to errors attributable to rounding errors).
+ // Perhaps 601 was only to indicate the subsampling positions, not the
+ // colorspace itself? Tested with a Lenovo X1 gen 3 as input.
+ YCbCrFormat input_ycbcr_format;
+ input_ycbcr_format.chroma_subsampling_x = (pixel_format == bmusb::PixelFormat_10BitYCbCr) ? 1 : 2;
+ input_ycbcr_format.chroma_subsampling_y = 1;
+ input_ycbcr_format.num_levels = (pixel_format == bmusb::PixelFormat_10BitYCbCr) ? 1024 : 256;
+ input_ycbcr_format.cb_x_position = 0.0;
+ input_ycbcr_format.cr_x_position = 0.0;
+ input_ycbcr_format.cb_y_position = 0.5;
+ input_ycbcr_format.cr_y_position = 0.5;
+ input_ycbcr_format.luma_coefficients = YCBCR_REC_709;
+ input_ycbcr_format.full_range = false;
+
+ for (unsigned i = 0; i < num_inputs; ++i) {
+ // When using 10-bit input, we're converting to interleaved through v210Converter.
+ YCbCrInputSplitting splitting = (pixel_format == bmusb::PixelFormat_10BitYCbCr) ? YCBCR_INPUT_INTERLEAVED : YCBCR_INPUT_SPLIT_Y_AND_CBCR;
+ if (override_bounce) {
+ ycbcr_inputs.push_back(new NonBouncingYCbCrInput(inout_format, input_ycbcr_format, global_flags.width, global_flags.height, splitting));
+ } else {
+ ycbcr_inputs.push_back(new YCbCrInput(inout_format, input_ycbcr_format, global_flags.width, global_flags.height, splitting));
+ }
+ chain->add_input(ycbcr_inputs.back());
+ }
+
+ if (deinterlace) {
+ vector<Effect *> reverse_inputs(ycbcr_inputs.rbegin(), ycbcr_inputs.rend());
+ chain->add_effect(deinterlace_effect, reverse_inputs);
+ }