xref: /libtiff-4.0.7/libtiff/tif_jpeg_12.c (revision 1874d4e8)
1 
2 #include "tiffiop.h"
3 
4 #if defined(JPEG_DUAL_MODE_8_12)
5 
6 #  define TIFFInitJPEG TIFFInitJPEG_12
7 
8 int
9 TIFFInitJPEG_12(TIFF* tif, int scheme);
10 
11 #  include LIBJPEG_12_PATH
12 
13 #  include "tif_jpeg.c"
14 
TIFFReInitJPEG_12(TIFF * tif,int scheme,int is_encode)15 int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode )
16 
17 {
18     JPEGState* sp;
19 
20     assert(scheme == COMPRESSION_JPEG);
21 
22     sp = JState(tif);
23     sp->tif = tif;				/* back link */
24 
25     /*
26      * Override parent get/set field methods.
27      */
28     tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
29     tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
30     tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
31 
32     /*
33      * Install codec methods.
34      */
35     tif->tif_fixuptags = JPEGFixupTags;
36     tif->tif_setupdecode = JPEGSetupDecode;
37     tif->tif_predecode = JPEGPreDecode;
38     tif->tif_decoderow = JPEGDecode;
39     tif->tif_decodestrip = JPEGDecode;
40     tif->tif_decodetile = JPEGDecode;
41     tif->tif_setupencode = JPEGSetupEncode;
42     tif->tif_preencode = JPEGPreEncode;
43     tif->tif_postencode = JPEGPostEncode;
44     tif->tif_encoderow = JPEGEncode;
45     tif->tif_encodestrip = JPEGEncode;
46     tif->tif_encodetile = JPEGEncode;
47     tif->tif_cleanup = JPEGCleanup;
48     tif->tif_defstripsize = JPEGDefaultStripSize;
49     tif->tif_deftilesize = JPEGDefaultTileSize;
50     tif->tif_flags |= TIFF_NOBITREV;	/* no bit reversal, please */
51 
52     sp->cinfo_initialized = FALSE;
53 
54     if( is_encode )
55         return JPEGSetupEncode(tif);
56     else
57         return JPEGSetupDecode(tif);
58 }
59 
60 #endif /* defined(JPEG_DUAL_MODE_8_12) */
61 
62 /*
63  * Local Variables:
64  * mode: c
65  * c-basic-offset: 8
66  * fill-column: 78
67  * End:
68  */
69