~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/sjpx.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/* $Id: sjpx.c 8022 2007-06-05 22:23:38Z giles $ */
 
14
/* $Id: sjpx.c 8295 2007-10-16 00:36:28Z giles $ */
15
15
/* JPXDecode filter implementation -- hooks in libjasper */
16
16
 
17
17
#include "memory_.h"
22
22
#include "gsmalloc.h"
23
23
#include "sjpx.h"
24
24
 
25
 
private void s_jpxd_set_defaults(stream_state *ss);
 
25
static void s_jpxd_set_defaults(stream_state *ss);
26
26
 
27
27
/* stream implementation */
28
28
 
35
35
                            defined in sjpx.h */
36
36
 
37
37
/* error reporting callback for the jpx library */
38
 
private void
 
38
static void
39
39
s_jpx_jas_error_cb(jas_error_t err, char *msg)
40
40
{
41
41
  dprintf2("jasper (code %d) %s", (int)err, msg);
46
46
   this involves allocating the stream and image structures, and
47
47
   initializing the decoder.
48
48
 */
49
 
private int
 
49
static int
50
50
s_jpxd_init(stream_state * ss)
51
51
{
52
52
    stream_jpxd_state *const state = (stream_jpxd_state *) ss;
53
53
    int status = 0;
54
54
 
55
 
    s_jpxd_set_defaults(ss);
56
 
    state->jpx_memory = ss->memory ? ss->memory->non_gc_memory : gs_lib_ctx_get_non_gc_memory_t();
57
 
            
 
55
    if (state->jpx_memory == NULL) {
 
56
      state->jpx_memory = ss->memory ?
 
57
                ss->memory->non_gc_memory : 
 
58
                gs_lib_ctx_get_non_gc_memory_t();
 
59
    }
 
60
 
58
61
    status = jas_init();
59
62
    jas_set_error_cb(s_jpx_jas_error_cb);
60
63
#ifdef JPX_DEBUG
74
77
 
75
78
#ifdef DEBUG
76
79
/* dump information from a jasper image struct for debugging */
77
 
private int
 
80
static int
78
81
dump_jas_image(jas_image_t *image)
79
82
{
80
83
    int i, numcmpts = jas_image_numcmpts(image);
139
142
}
140
143
#endif /* DEBUG */
141
144
 
142
 
private int
 
145
static int
143
146
copy_row_gray(unsigned char *dest, jas_image_t *image,
144
147
        int x, int y, int bytes)
145
148
{
155
158
    return bytes;
156
159
}
157
160
 
158
 
private int
 
161
static int
159
162
copy_row_rgb(unsigned char *dest, jas_image_t *image,
160
163
        int x, int y, int bytes)
161
164
{
179
182
    return count;
180
183
}
181
184
 
182
 
private int
 
185
static int
183
186
copy_row_yuv(unsigned char *dest, jas_image_t *image,
184
187
        int x, int y, int bytes)
185
188
{
236
239
    return count;
237
240
}
238
241
 
239
 
private int
 
242
static int
240
243
copy_row_default(unsigned char *dest, jas_image_t *image,
241
244
        int x, int y, int bytes)
242
245
{
255
258
}
256
259
 
257
260
/* buffer the input stream into our state */
258
 
private int
 
261
static int
259
262
s_jpxd_buffer_input(stream_jpxd_state *const state, stream_cursor_read *pr,
260
263
                       long bytes)
261
264
{
283
286
}
284
287
 
285
288
/* decode the compressed image data saved in our state */
286
 
private int
 
289
static int
287
290
s_jpxd_decode_image(stream_jpxd_state * state)
288
291
{
289
292
    jas_stream_t *stream = state->stream;
335
338
/* process a secton of the input and return any decoded data.
336
339
   see strimpl.h for return codes.
337
340
 */
338
 
private int
 
341
static int
339
342
s_jpxd_process(stream_state * ss, stream_cursor_read * pr,
340
343
                 stream_cursor_write * pw, bool last)
341
344
{
416
419
/* stream release.
417
420
   free all our decoder state.
418
421
 */
419
 
private void
 
422
static void
420
423
s_jpxd_release(stream_state *ss)
421
424
{
422
425
    stream_jpxd_state *const state = (stream_jpxd_state *) ss;
430
433
}
431
434
 
432
435
/* set stream defaults.
433
 
   this hook exists to avoid confusing the gc with bogus
434
 
   pointers. we use it similarly just to NULL all the pointers.
435
 
   (could just be done in _init?)
 
436
   This hook exists to avoid confusing the gc with bogus
 
437
   pointers. We also set a default for client-settable 
 
438
   parameters like the requested output colorspace.
436
439
 */
437
 
private void
 
440
static void
438
441
s_jpxd_set_defaults(stream_state *ss)
439
442
{
440
443
    stream_jpxd_state *const state = (stream_jpxd_state *) ss;
441
 
    
 
444
 
442
445
    state->stream = NULL;
443
446
    state->image = NULL;
444
447
    state->offset = 0;
445
448
    state->buffer = NULL;
446
449
    state->bufsize = 0;
447
450
    state->buffill = 0;
 
451
    /* the following can be set by the client before calling init() */
448
452
    state->colorspace = gs_jpx_cs_unset;
449
453
}
450
454