18 #define JPEG_INTERNALS 25 #if TRANSFORMS_SUPPORTED 82 MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor *
DCTSIZE);
84 for (ci = 0; ci < dstinfo->num_components; ci++) {
85 compptr = dstinfo->comp_info + ci;
89 buffer = (*srcinfo->mem->access_virt_barray)
92 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
93 for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) {
95 ptr2 = buffer[
offset_y][comp_width - blk_x - 1];
120 JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
141 dst_buffer = (*srcinfo->mem->access_virt_barray)
142 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
144 if (dst_blk_y < comp_height) {
146 src_buffer = (*srcinfo->mem->access_virt_barray)
152 src_buffer = (*srcinfo->mem->access_virt_barray)
153 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
156 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
157 if (dst_blk_y < comp_height) {
160 src_row_ptr = src_buffer[compptr->
v_samp_factor - offset_y - 1];
163 dst_ptr = dst_row_ptr[dst_blk_x];
164 src_ptr = src_row_ptr[dst_blk_x];
165 for (i = 0; i <
DCTSIZE; i += 2) {
168 *dst_ptr++ = *src_ptr++;
171 *dst_ptr++ = - *src_ptr++;
206 dst_buffer = (*srcinfo->mem->access_virt_barray)
207 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
209 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
212 src_buffer = (*srcinfo->mem->access_virt_barray)
213 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
215 for (offset_x = 0; offset_x < compptr->
h_samp_factor; offset_x++) {
220 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
239 JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
256 dst_buffer = (*srcinfo->mem->access_virt_barray)
257 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
259 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
262 src_buffer = (*srcinfo->mem->access_virt_barray)
263 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
265 for (offset_x = 0; offset_x < compptr->
h_samp_factor; offset_x++) {
267 if (dst_blk_x < comp_width) {
270 [comp_width - dst_blk_x - offset_x - 1];
271 for (i = 0; i <
DCTSIZE; i++) {
273 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
276 dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
283 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
303 JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
320 dst_buffer = (*srcinfo->mem->access_virt_barray)
321 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
323 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
326 src_buffer = (*srcinfo->mem->access_virt_barray)
327 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
329 for (offset_x = 0; offset_x < compptr->
h_samp_factor; offset_x++) {
331 if (dst_blk_y < comp_height) {
334 [comp_height - dst_blk_y - offset_y - 1];
335 for (i = 0; i <
DCTSIZE; i++) {
336 for (j = 0; j <
DCTSIZE; j++) {
337 dst_ptr[j*DCTSIZE+
i] = src_ptr[i*DCTSIZE+j];
339 dst_ptr[j*DCTSIZE+
i] = -src_ptr[i*DCTSIZE+j];
347 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
367 JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
383 dst_buffer = (*srcinfo->mem->access_virt_barray)
384 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
386 if (dst_blk_y < comp_height) {
388 src_buffer = (*srcinfo->mem->access_virt_barray)
394 src_buffer = (*srcinfo->mem->access_virt_barray)
395 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
398 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
399 if (dst_blk_y < comp_height) {
402 src_row_ptr = src_buffer[compptr->
v_samp_factor - offset_y - 1];
404 for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
405 dst_ptr = dst_row_ptr[dst_blk_x];
406 src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
407 for (i = 0; i <
DCTSIZE; i += 2) {
409 for (j = 0; j <
DCTSIZE; j += 2) {
410 *dst_ptr++ = *src_ptr++;
411 *dst_ptr++ = - *src_ptr++;
414 for (j = 0; j <
DCTSIZE; j += 2) {
415 *dst_ptr++ = - *src_ptr++;
416 *dst_ptr++ = *src_ptr++;
422 dst_ptr = dst_row_ptr[dst_blk_x];
423 src_ptr = src_row_ptr[dst_blk_x];
424 for (i = 0; i <
DCTSIZE; i += 2) {
426 *dst_ptr++ = *src_ptr++;
428 *dst_ptr++ = - *src_ptr++;
436 for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
437 dst_ptr = dst_row_ptr[dst_blk_x];
438 src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
440 *dst_ptr++ = *src_ptr++;
441 *dst_ptr++ = - *src_ptr++;
446 dst_ptr = dst_row_ptr[dst_blk_x];
447 src_ptr = src_row_ptr[dst_blk_x];
449 *dst_ptr++ = *src_ptr++;
472 JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
487 dst_buffer = (*srcinfo->mem->access_virt_barray)
488 ((
j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
490 for (offset_y = 0; offset_y < compptr->
v_samp_factor; offset_y++) {
493 src_buffer = (*srcinfo->mem->access_virt_barray)
494 ((
j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
496 for (offset_x = 0; offset_x < compptr->
h_samp_factor; offset_x++) {
497 if (dst_blk_y < comp_height) {
499 [comp_height - dst_blk_y - offset_y - 1];
500 if (dst_blk_x < comp_width) {
503 [comp_width - dst_blk_x - offset_x - 1];
504 for (i = 0; i <
DCTSIZE; i++) {
505 for (j = 0; j <
DCTSIZE; j++) {
506 dst_ptr[j*DCTSIZE+
i] = src_ptr[i*DCTSIZE+j];
508 dst_ptr[j*DCTSIZE+
i] = -src_ptr[i*DCTSIZE+j];
511 for (j = 0; j <
DCTSIZE; j++) {
512 dst_ptr[j*DCTSIZE+
i] = -src_ptr[i*DCTSIZE+j];
514 dst_ptr[j*DCTSIZE+
i] = src_ptr[i*DCTSIZE+j];
520 for (i = 0; i <
DCTSIZE; i++) {
521 for (j = 0; j <
DCTSIZE; j++) {
522 dst_ptr[j*DCTSIZE+
i] = src_ptr[i*DCTSIZE+j];
524 dst_ptr[j*DCTSIZE+
i] = -src_ptr[i*DCTSIZE+j];
530 if (dst_blk_x < comp_width) {
533 [comp_width - dst_blk_x - offset_x - 1];
534 for (i = 0; i <
DCTSIZE; i++) {
536 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
539 dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j];
546 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
601 coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
623 coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
664 if (qtblptr != NULL) {
665 for (i = 0; i <
DCTSIZE; i++) {
666 for (j = 0; j <
i; j++) {
667 qtemp = qtblptr->
quantval[i*DCTSIZE+j];
682 int ci, max_h_samp_factor;
689 max_h_samp_factor = 1;
692 max_h_samp_factor =
MAX(max_h_samp_factor, h_samp_factor);
702 int ci, max_v_samp_factor;
709 max_v_samp_factor = 1;
712 max_v_samp_factor =
MAX(max_v_samp_factor, v_samp_factor);
756 ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL);
767 trim_right_edge(dstinfo);
771 trim_bottom_edge(dstinfo);
774 transpose_critical_parameters(dstinfo);
778 transpose_critical_parameters(dstinfo);
780 trim_right_edge(dstinfo);
781 trim_bottom_edge(dstinfo);
785 transpose_critical_parameters(dstinfo);
787 trim_right_edge(dstinfo);
791 trim_right_edge(dstinfo);
792 trim_bottom_edge(dstinfo);
796 transpose_critical_parameters(dstinfo);
798 trim_bottom_edge(dstinfo);
805 return src_coef_arrays;
830 do_flip_h(srcinfo, dstinfo, src_coef_arrays);
833 do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
836 do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
839 do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
842 do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
845 do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
848 do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
863 #ifdef SAVE_MARKERS_SUPPORTED 872 for (m = 0; m < 16; m++)
899 marker->data_length >= 5 &&
908 marker->data_length >= 5 &&
915 #ifdef NEED_FAR_POINTERS 920 for (i = 0; i <
marker->data_length; i++)
boolean write_Adobe_marker
#define MAX(a, b)
Returns the max value between a and b.
J_COLOR_SPACE jpeg_color_space
jpeg_component_info * comp_info
struct jpeg_common_struct * j_common_ptr
UINT16 quantval[DCTSIZE2]
#define ERREXIT(cinfo, code)
png_infop png_int_32 png_int_32 * offset_y
struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr
png_infop png_int_32 * offset_x
jvirt_barray_ptr * coef_arrays
jpeg_save_markers(j_decompress_ptr cinfo, int marker_code, unsigned int length_limit)
boolean write_JFIF_header
jpeg_component_info * compptr
JDIMENSION width_in_blocks
jpeg_saved_marker_ptr marker_list
jcopy_markers_execute(j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOPY_OPTION option)
jround_up(long a, long b)
JDIMENSION height_in_blocks
jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen)
def j(str, encoding="cp932")
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]
jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
jcopy_markers_setup(j_decompress_ptr srcinfo, JCOPY_OPTION option)
png_infop png_bytep buffer
jpeg_write_m_byte(j_compress_ptr cinfo, int val)
jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks)
jpeg_write_m_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
jpeg_component_info * comp_info
J_COLOR_SPACE jpeg_color_space