- using namespace movit;
- // TODO: deduplicate code against JPEGFrameView?
- ycbcr_convert_chain.reset(new EffectChain(1280, 720));
- ImageFormat image_format;
- image_format.color_space = COLORSPACE_sRGB;
- image_format.gamma_curve = GAMMA_sRGB;
- ycbcr_format.luma_coefficients = YCBCR_REC_709;
- ycbcr_format.full_range = true; // JPEG.
- ycbcr_format.num_levels = 256;
- ycbcr_format.chroma_subsampling_x = 2;
- ycbcr_format.chroma_subsampling_y = 1;
- ycbcr_format.cb_x_position = 0.0f; // H.264 -- _not_ JPEG, even though our input is MJPEG-encoded
- ycbcr_format.cb_y_position = 0.5f; // Irrelevant.
- ycbcr_format.cr_x_position = 0.0f;
- ycbcr_format.cr_y_position = 0.5f;
- ycbcr_input = (movit::YCbCrInput *)ycbcr_convert_chain->add_input(new YCbCrInput(image_format, ycbcr_format, 1280, 720));
-
- ImageFormat inout_format;
- inout_format.color_space = COLORSPACE_sRGB;
- inout_format.gamma_curve = GAMMA_sRGB;
-
- check_error();
- ycbcr_convert_chain->add_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
- check_error();
- ycbcr_convert_chain->set_dither_bits(8);
- check_error();
- ycbcr_convert_chain->finalize();
- check_error();