aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/jpeg-6b/transupp.c
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-20 13:20:35 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-20 13:20:35 +0100
commit09faeee21a7d72eea8fc56f9ac505f01005d6cb5 (patch)
tree449fe5fbc3f44f753a532e766a419ccc65d6a5e3 /test/monniaux/jpeg-6b/transupp.c
parent78d7b02570c4cd464dfb64994fd9f2eb69bec8a8 (diff)
downloadcompcert-kvx-09faeee21a7d72eea8fc56f9ac505f01005d6cb5.tar.gz
compcert-kvx-09faeee21a7d72eea8fc56f9ac505f01005d6cb5.zip
use the original source codes
Diffstat (limited to 'test/monniaux/jpeg-6b/transupp.c')
-rw-r--r--test/monniaux/jpeg-6b/transupp.c122
1 files changed, 11 insertions, 111 deletions
diff --git a/test/monniaux/jpeg-6b/transupp.c b/test/monniaux/jpeg-6b/transupp.c
index 9f6e57f4..e5ec5642 100644
--- a/test/monniaux/jpeg-6b/transupp.c
+++ b/test/monniaux/jpeg-6b/transupp.c
@@ -79,7 +79,7 @@ do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* mirroring by changing the signs of odd-numbered columns.
* Partial iMCUs at the right edge are left untouched.
*/
- MCU_cols = INT_DIV(dstinfo->image_width, (dstinfo->max_h_samp_factor * DCTSIZE));
+ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -131,7 +131,7 @@ do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* of odd-numbered rows.
* Partial iMCUs at the bottom edge are copied verbatim.
*/
- MCU_rows = INT_DIV(dstinfo->image_height, (dstinfo->max_v_samp_factor * DCTSIZE));
+ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -246,7 +246,7 @@ do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* at the (output) right edge properly. They just get transposed and
* not mirrored.
*/
- MCU_cols = INT_DIV(dstinfo->image_width, (dstinfo->max_h_samp_factor * DCTSIZE));
+ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -310,7 +310,7 @@ do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* at the (output) bottom edge properly. They just get transposed and
* not mirrored.
*/
- MCU_rows = INT_DIV(dstinfo->image_height, (dstinfo->max_v_samp_factor * DCTSIZE));
+ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -371,8 +371,8 @@ do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JCOEFPTR src_ptr, dst_ptr;
jpeg_component_info *compptr;
- MCU_cols = INT_DIV(dstinfo->image_width, (dstinfo->max_h_samp_factor * DCTSIZE));
- MCU_rows = INT_DIV(dstinfo->image_height, (dstinfo->max_v_samp_factor * DCTSIZE));
+ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -475,8 +475,8 @@ do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JCOEFPTR src_ptr, dst_ptr;
jpeg_component_info *compptr;
- MCU_cols = INT_DIV(dstinfo->image_width, (dstinfo->max_h_samp_factor * DCTSIZE));
- MCU_rows = INT_DIV(dstinfo->image_height, (dstinfo->max_v_samp_factor * DCTSIZE));
+ MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+ MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
@@ -582,52 +582,6 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
info->num_components = srcinfo->num_components;
}
-#ifdef NO_SWITCH
- int choice = info->transform;
- if (choice == JXFORM_NONE ||
- choice == JXFORM_FLIP_H) {
- } else if (choice == JXFORM_FLIP_V ||
- choice == JXFORM_ROT_180) {
- /* Need workspace arrays having same dimensions as source image.
- * Note that we allocate arrays padded out to the next iMCU boundary,
- * so that transform routines need not worry about missing edge blocks.
- */
- coef_arrays = (jvirt_barray_ptr *)
- (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
- SIZEOF(jvirt_barray_ptr) * info->num_components);
- for (ci = 0; ci < info->num_components; ci++) {
- compptr = srcinfo->comp_info + ci;
- coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
- ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) compptr->v_samp_factor);
- }
- } else if (choice == JXFORM_TRANSPOSE ||
- choice == JXFORM_TRANSVERSE ||
- choice == JXFORM_ROT_90 ||
- choice == JXFORM_ROT_270) {
- /* Need workspace arrays having transposed dimensions.
- * Note that we allocate arrays padded out to the next iMCU boundary,
- * so that transform routines need not worry about missing edge blocks.
- */
- coef_arrays = (jvirt_barray_ptr *)
- (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
- SIZEOF(jvirt_barray_ptr) * info->num_components);
- for (ci = 0; ci < info->num_components; ci++) {
- compptr = srcinfo->comp_info + ci;
- coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
- ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) compptr->h_samp_factor);
- }
- }
-#else
switch (info->transform) {
case JXFORM_NONE:
case JXFORM_FLIP_H:
@@ -676,7 +630,6 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
}
break;
}
-#endif
info->workspace_coef_arrays = coef_arrays;
}
@@ -738,7 +691,7 @@ trim_right_edge (j_compress_ptr dstinfo)
int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor;
max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor);
}
- MCU_cols = INT_DIV(dstinfo->image_width, (max_h_samp_factor * DCTSIZE));
+ MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE);
if (MCU_cols > 0) /* can't trim to 0 pixels */
dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE);
}
@@ -758,7 +711,7 @@ trim_bottom_edge (j_compress_ptr dstinfo)
int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor;
max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor);
}
- MCU_rows = INT_DIV(dstinfo->image_height, (max_v_samp_factor * DCTSIZE));
+ MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE);
if (MCU_rows > 0) /* can't trim to 0 pixels */
dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE);
}
@@ -805,39 +758,6 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
}
/* Correct the destination's image dimensions etc if necessary */
-#ifdef NO_SWITCH
- int choice = info->transform;
- if (choice == JXFORM_NONE) {
- } else if (choice == JXFORM_FLIP_H) {
- if (info->trim)
- trim_right_edge(dstinfo);
- } else if (choice == JXFORM_FLIP_V) {
- if (info->trim)
- trim_bottom_edge(dstinfo);
- } else if (choice == JXFORM_TRANSPOSE) {
- transpose_critical_parameters(dstinfo);
- /* transpose does NOT have to trim anything */
- } else if (choice == JXFORM_TRANSVERSE) {
- transpose_critical_parameters(dstinfo);
- if (info->trim) {
- trim_right_edge(dstinfo);
- trim_bottom_edge(dstinfo);
- }
- } else if (choice == JXFORM_ROT_90) {
- transpose_critical_parameters(dstinfo);
- if (info->trim)
- trim_right_edge(dstinfo);
- } else if (choice == JXFORM_ROT_180) {
- if (info->trim) {
- trim_right_edge(dstinfo);
- trim_bottom_edge(dstinfo);
- }
- } else if (choice == JXFORM_ROT_270) {
- transpose_critical_parameters(dstinfo);
- if (info->trim)
- trim_bottom_edge(dstinfo);
- }
-#else
switch (info->transform) {
case JXFORM_NONE:
/* Nothing to do */
@@ -878,7 +798,7 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
trim_bottom_edge(dstinfo);
break;
}
-#endif
+
/* Return the appropriate output data set */
if (info->workspace_coef_arrays != NULL)
return info->workspace_coef_arrays;
@@ -903,25 +823,6 @@ jtransform_execute_transformation (j_decompress_ptr srcinfo,
{
jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays;
-#ifdef NO_SWITCH
- int choice = info->transform;
- if (choice == JXFORM_NONE) {
- } else if (choice == JXFORM_FLIP_H) {
- do_flip_h(srcinfo, dstinfo, src_coef_arrays);
- } else if (choice == JXFORM_FLIP_V) {
- do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- } else if (choice == JXFORM_TRANSPOSE) {
- do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- } else if (choice == JXFORM_TRANSVERSE) {
- do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- } else if (choice == JXFORM_ROT_90) {
- do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- } else if (choice == JXFORM_ROT_180) {
- do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- } else if (choice == JXFORM_ROT_270) {
- do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
- }
-#else
switch (info->transform) {
case JXFORM_NONE:
break;
@@ -947,7 +848,6 @@ jtransform_execute_transformation (j_decompress_ptr srcinfo,
do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
break;
}
-#endif
}
#endif /* TRANSFORMS_SUPPORTED */