1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* DCTDecode filter parameter setting and reading */
18 #include "std.h"
19 #include "jpeglib_.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 
29 /* ================ Get parameters ================ */
30 
31 stream_state_proc_get_params(s_DCTD_get_params, stream_DCT_state);	/* check */
32 
33 int
s_DCTD_get_params(gs_param_list * plist,const stream_DCT_state * ss,bool all)34 s_DCTD_get_params(gs_param_list * plist, const stream_DCT_state * ss, bool all)
35 {
36     stream_DCT_state dcts_defaults;
37     const stream_DCT_state *defaults;
38 
39     if (all)
40         defaults = 0;
41     else {
42         (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
43         defaults = &dcts_defaults;
44     }
45 /****** NYI ******/
46     return s_DCT_get_params(plist, ss, defaults);
47 }
48 
49 /* ================ Put parameters ================ */
50 
51 stream_state_proc_put_params(s_DCTD_put_params, stream_DCT_state);	/* check */
52 
53 int
s_DCTD_put_params(gs_param_list * plist,stream_DCT_state * pdct)54 s_DCTD_put_params(gs_param_list * plist, stream_DCT_state * pdct)
55 {
56     int code;
57 
58     if ((code = s_DCT_put_params(plist, pdct)) < 0 ||
59     /*
60      * DCTDecode accepts quantization and huffman tables
61      * in case these tables have been omitted from the datastream.
62      */
63         (code = s_DCT_put_huffman_tables(plist, pdct, false)) < 0 ||
64         (code = s_DCT_put_quantization_tables(plist, pdct, false)) < 0
65         )
66         DO_NOTHING;
67     return code;
68 }
69