sddparam.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (C) 1998, 1999 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: sddparam.c,v 1.2 2000/09/19 19:00:49 lpd Exp $ */
  16. /* DCTDecode filter parameter setting and reading */
  17. #include "std.h"
  18. #include "jpeglib_.h"
  19. #include "gserror.h"
  20. #include "gserrors.h"
  21. #include "gstypes.h"
  22. #include "gsmemory.h"
  23. #include "gsparam.h"
  24. #include "strimpl.h" /* sdct.h requires this */
  25. #include "sdct.h"
  26. #include "sdcparam.h"
  27. #include "sjpeg.h"
  28. /* ================ Get parameters ================ */
  29. stream_state_proc_get_params(s_DCTD_get_params, stream_DCT_state); /* check */
  30. int
  31. s_DCTD_get_params(gs_param_list * plist, const stream_DCT_state * ss, bool all)
  32. {
  33. stream_DCT_state dcts_defaults;
  34. const stream_DCT_state *defaults;
  35. if (all)
  36. defaults = 0;
  37. else {
  38. (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
  39. defaults = &dcts_defaults;
  40. }
  41. /****** NYI ******/
  42. return s_DCT_get_params(plist, ss, defaults);
  43. }
  44. /* ================ Put parameters ================ */
  45. stream_state_proc_put_params(s_DCTD_put_params, stream_DCT_state); /* check */
  46. int
  47. s_DCTD_put_params(gs_param_list * plist, stream_DCT_state * pdct)
  48. {
  49. int code;
  50. if ((code = s_DCT_put_params(plist, pdct)) < 0 ||
  51. /*
  52. * DCTDecode accepts quantization and huffman tables
  53. * in case these tables have been omitted from the datastream.
  54. */
  55. (code = s_DCT_put_huffman_tables(plist, pdct, false)) < 0 ||
  56. (code = s_DCT_put_quantization_tables(plist, pdct, false)) < 0
  57. )
  58. DO_NOTHING;
  59. return code;
  60. }