zfjpx.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright (C) 2003 artofcode LLC. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: zfjpx.c,v 1.2 2004/08/11 14:33:02 stefan Exp $ */
  14. /* this is the ps interpreter interface to the jbig2decode filter
  15. used for (1bpp) scanned image compression. PDF only specifies
  16. a decoder filter, and we don't currently implement anything else */
  17. #include "memory_.h"
  18. #include "ghost.h"
  19. #include "oper.h"
  20. #include "gsstruct.h"
  21. #include "gstypes.h"
  22. #include "ialloc.h"
  23. #include "idict.h"
  24. #include "store.h"
  25. #include "stream.h"
  26. #include "strimpl.h"
  27. #include "ifilter.h"
  28. #include "sjpx.h"
  29. /* <source> /JPXDecode <file> */
  30. /* <source> <dict> /JPXDecode <file> */
  31. private int
  32. z_jpx_decode(i_ctx_t * i_ctx_p)
  33. {
  34. os_ptr op = osp;
  35. ref *sop = NULL;
  36. stream_jpxd_state state;
  37. state.jpx_memory = imemory->non_gc_memory;
  38. if (r_has_type(op, t_dictionary)) {
  39. check_dict_read(*op);
  40. if ( dict_find_string(op, "Colorspace", &sop) > 0) {
  41. dlprintf("found Colorspace parameter (NYI)\n");
  42. }
  43. }
  44. /* we pass npop=0, since we've no arguments left to consume */
  45. /* we pass 0 instead of the usual rspace(sop) which will allocate storage
  46. for filter state from the same memory pool as the stream it's coding.
  47. this causes no trouble because we maintain no pointers */
  48. return filter_read(i_ctx_p, 0, &s_jpxd_template,
  49. (stream_state *) & state, 0);
  50. }
  51. /* match the above routine to the corresponding filter name
  52. this is how our 'private' routines get called externally */
  53. const op_def zfjpx_op_defs[] = {
  54. op_def_begin_filter(),
  55. {"2JPXDecode", z_jpx_decode},
  56. op_def_end(0)
  57. };