mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 16:53:13 +00:00
Fixed JPEG chroma subsampling on TurboLibJPEG
This commit is contained in:
@@ -98,14 +98,22 @@ int write_JPEG_buffer (JSAMPLE * image_buffer, int image_width, int image_height
|
|||||||
cinfo.dest->init_destination = &init_destination;
|
cinfo.dest->init_destination = &init_destination;
|
||||||
cinfo.dest->empty_output_buffer = &empty_output_buffer;
|
cinfo.dest->empty_output_buffer = &empty_output_buffer;
|
||||||
cinfo.dest->term_destination = &term_destination;
|
cinfo.dest->term_destination = &term_destination;
|
||||||
cinfo.comp_info[0].v_samp_factor = 1;
|
|
||||||
cinfo.comp_info[0].h_samp_factor = 1;
|
|
||||||
|
|
||||||
cinfo.image_width = image_width;
|
cinfo.image_width = image_width;
|
||||||
cinfo.image_height = image_height;
|
cinfo.image_height = image_height;
|
||||||
cinfo.input_components = 3;
|
cinfo.input_components = 3;
|
||||||
cinfo.in_color_space = JCS_RGB;
|
cinfo.in_color_space = JCS_RGB;
|
||||||
jpeg_set_defaults(&cinfo);
|
jpeg_set_defaults(&cinfo);
|
||||||
|
|
||||||
|
// 4:4:4, 1x1 (no subsampling)
|
||||||
|
// The resolution of chrominance information (Cb & Cr) is preserved at the same rate as the luminance (Y) information
|
||||||
|
cinfo.comp_info[0].v_samp_factor = 1;
|
||||||
|
cinfo.comp_info[0].h_samp_factor = 1;
|
||||||
|
cinfo.comp_info[1].v_samp_factor = 1;
|
||||||
|
cinfo.comp_info[1].h_samp_factor = 1;
|
||||||
|
cinfo.comp_info[2].v_samp_factor = 1;
|
||||||
|
cinfo.comp_info[2].h_samp_factor = 1;
|
||||||
|
|
||||||
jpeg_set_quality(&cinfo, quality, TRUE);
|
jpeg_set_quality(&cinfo, quality, TRUE);
|
||||||
jpeg_start_compress(&cinfo, TRUE);
|
jpeg_start_compress(&cinfo, TRUE);
|
||||||
row_stride = image_width * 3;
|
row_stride = image_width * 3;
|
||||||
@@ -124,4 +132,3 @@ int write_JPEG_buffer (JSAMPLE * image_buffer, int image_width, int image_height
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user