Lines Matching refs:cinfo
235 auto cinfo = std::make_unique<jpeg_compress_struct>(); in CompressYUV420Frame() local
236 cinfo->err = jpeg_std_error(&jerr); in CompressYUV420Frame()
237 cinfo->err->error_exit = [](j_common_ptr cinfo) { in CompressYUV420Frame() argument
238 (*cinfo->err->output_message)(cinfo); in CompressYUV420Frame()
239 if (cinfo->client_data) { in CompressYUV420Frame()
240 auto& dmgr = *static_cast<CustomJpegDestMgr*>(cinfo->client_data); in CompressYUV420Frame()
245 jpeg_create_compress(cinfo.get()); in CompressYUV420Frame()
254 cinfo->client_data = static_cast<void*>(&dmgr); in CompressYUV420Frame()
255 dmgr.init_destination = [](j_compress_ptr cinfo) { in CompressYUV420Frame() argument
256 auto& dmgr = static_cast<CustomJpegDestMgr&>(*cinfo->dest); in CompressYUV420Frame()
263 dmgr.empty_output_buffer = [](j_compress_ptr cinfo __unused) { in CompressYUV420Frame()
268 dmgr.term_destination = [](j_compress_ptr cinfo) { in CompressYUV420Frame() argument
269 auto& dmgr = static_cast<CustomJpegDestMgr&>(*cinfo->dest); in CompressYUV420Frame()
275 cinfo->dest = reinterpret_cast<struct jpeg_destination_mgr*>(&dmgr); in CompressYUV420Frame()
278 cinfo->image_width = frame.width; in CompressYUV420Frame()
279 cinfo->image_height = frame.height; in CompressYUV420Frame()
280 cinfo->input_components = 3; in CompressYUV420Frame()
281 cinfo->in_color_space = JCS_YCbCr; in CompressYUV420Frame()
283 jpeg_set_defaults(cinfo.get()); in CompressYUV420Frame()
288 jpeg_set_colorspace(cinfo.get(), JCS_YCbCr); in CompressYUV420Frame()
293 cinfo->raw_data_in = 1; in CompressYUV420Frame()
295 cinfo->comp_info[0].h_samp_factor = 2; in CompressYUV420Frame()
296 cinfo->comp_info[0].v_samp_factor = 2; in CompressYUV420Frame()
297 cinfo->comp_info[1].h_samp_factor = 1; in CompressYUV420Frame()
298 cinfo->comp_info[1].v_samp_factor = 1; in CompressYUV420Frame()
299 cinfo->comp_info[2].h_samp_factor = 1; in CompressYUV420Frame()
300 cinfo->comp_info[2].v_samp_factor = 1; in CompressYUV420Frame()
302 int max_vsamp_factor = std::max({cinfo->comp_info[0].v_samp_factor, in CompressYUV420Frame()
303 cinfo->comp_info[1].v_samp_factor, in CompressYUV420Frame()
304 cinfo->comp_info[2].v_samp_factor}); in CompressYUV420Frame()
306 cinfo->comp_info[0].v_samp_factor / cinfo->comp_info[1].v_samp_factor; in CompressYUV420Frame()
309 jpeg_start_compress(cinfo.get(), TRUE); in CompressYUV420Frame()
315 jpeg_write_marker(cinfo.get(), JPEG_APP0 + 1, in CompressYUV420Frame()
324 size_t padded_height = mcu_v * ((cinfo->image_height + mcu_v - 1) / mcu_v); in CompressYUV420Frame()
337 int li = std::min(i, cinfo->image_height - 1); in CompressYUV420Frame()
340 li = std::min(i, (cinfo->image_height - 1) / c_vsub_sampling); in CompressYUV420Frame()
349 while (cinfo->next_scanline < cinfo->image_height) { in CompressYUV420Frame()
350 JSAMPARRAY planes[3]{&y_lines[cinfo->next_scanline], in CompressYUV420Frame()
351 &cb_lines[cinfo->next_scanline / c_vsub_sampling], in CompressYUV420Frame()
352 &cr_lines[cinfo->next_scanline / c_vsub_sampling]}; in CompressYUV420Frame()
354 jpeg_write_raw_data(cinfo.get(), planes, batch_size); in CompressYUV420Frame()
361 jpeg_finish_compress(cinfo.get()); in CompressYUV420Frame()
366 jpeg_finish_compress(cinfo.get()); in CompressYUV420Frame()