- YCbCrFormat input_ycbcr_format;
- input_ycbcr_format.chroma_subsampling_x = 2;
- input_ycbcr_format.chroma_subsampling_y = 1;
- 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_601;
- input_ycbcr_format.full_range = false;
-
- YCbCrFormat output_ycbcr_format;
- output_ycbcr_format.chroma_subsampling_x = 1;
- output_ycbcr_format.chroma_subsampling_y = 1;
- output_ycbcr_format.luma_coefficients = YCBCR_REC_601;
- output_ycbcr_format.full_range = false;
-
- // Main chain.
- chain.reset(new EffectChain(WIDTH, HEIGHT, resource_pool.get()));
- check_error();
- input[0] = new YCbCrInput(inout_format, input_ycbcr_format, WIDTH, HEIGHT, YCBCR_INPUT_SPLIT_Y_AND_CBCR);
- chain->add_input(input[0]);
- input[1] = new YCbCrInput(inout_format, input_ycbcr_format, WIDTH, HEIGHT, YCBCR_INPUT_SPLIT_Y_AND_CBCR);
- chain->add_input(input[1]);
- resample_effect = chain->add_effect(new ResampleEffect(), input[0]);
- padding_effect = chain->add_effect(new IntegralPaddingEffect());
- float border_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
- CHECK(padding_effect->set_vec4("border_color", border_color));
-
- resample2_effect = chain->add_effect(new ResampleEffect(), input[1]);
- Effect *saturation_effect = chain->add_effect(new SaturationEffect());
- CHECK(saturation_effect->set_float("saturation", 0.3f));
- Effect *wb_effect = chain->add_effect(new WhiteBalanceEffect());
- CHECK(wb_effect->set_float("output_color_temperature", 3500.0));
- padding2_effect = chain->add_effect(new IntegralPaddingEffect());
-
- chain->add_effect(new OverlayEffect(), padding_effect, padding2_effect);
-
- chain->add_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
- chain->add_ycbcr_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED, output_ycbcr_format, YCBCR_OUTPUT_SPLIT_Y_AND_CBCR);
- chain->set_dither_bits(8);
- chain->set_output_origin(OUTPUT_ORIGIN_TOP_LEFT);
- chain->finalize();
-