summaryrefslogtreecommitdiffstats
path: root/common/jpeg/jdcoefct.c
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2009-03-09 13:29:37 +0000
committerPierre Ossman <ossman@cendio.se>2009-03-09 13:29:37 +0000
commit33f9019f77cd7417cc0d231e6dff3862177b6362 (patch)
tree3cc0e69a669a19a12e6efc2b01c6a2f61cb4f2c3 /common/jpeg/jdcoefct.c
parent2c2e54bd6828dc8df72ac91f4dc69e9b7bc767b1 (diff)
downloadtigervnc-33f9019f77cd7417cc0d231e6dff3862177b6362.tar.gz
tigervnc-33f9019f77cd7417cc0d231e6dff3862177b6362.zip
Make sure the work space memory is properly aligned
We use the heap allocators to avoid having more than one implementation of the alignment logic. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3650 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/jpeg/jdcoefct.c')
-rw-r--r--common/jpeg/jdcoefct.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/jpeg/jdcoefct.c b/common/jpeg/jdcoefct.c
index 4938d20f..f56af5fc 100644
--- a/common/jpeg/jdcoefct.c
+++ b/common/jpeg/jdcoefct.c
@@ -47,6 +47,9 @@ typedef struct {
*/
JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];
+ /* Temporary workspace for one MCU */
+ JCOEF * workspace;
+
#ifdef D_MULTISCAN_FILES_SUPPORTED
/* In multi-pass modes, we need a virtual block array for each component. */
jvirt_barray_ptr whole_image[MAX_COMPONENTS];
@@ -471,13 +474,16 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
jpeg_component_info *compptr;
inverse_DCT_method_ptr inverse_DCT;
boolean first_row, last_row;
- JBLOCK workspace;
+ JCOEF * workspace;
int *coef_bits;
JQUANT_TBL *quanttbl;
INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;
int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
int Al, pred;
+ /* Keep a local variable to avoid looking it up more than once */
+ workspace = coef->workspace;
+
/* Force some input to be done if we are getting ahead of the input. */
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
! cinfo->inputctl->eoi_reached) {
@@ -733,4 +739,9 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
coef->pub.decompress_data = decompress_onepass;
coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
}
+
+ /* Allocate the workspace buffer */
+ coef->workspace = (JCOEF *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ SIZEOF(JCOEF) * DCTSIZE2);
}