tif_jpeg_12.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "tiffiop.h"
  2. #if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
  3. #define JPEG_DUAL_MODE_8_12
  4. #endif
  5. #if defined(JPEG_DUAL_MODE_8_12)
  6. #define FROM_TIF_JPEG_12
  7. #ifdef TIFFInitJPEG
  8. #undef TIFFInitJPEG
  9. #endif
  10. #define TIFFInitJPEG TIFFInitJPEG_12
  11. #ifdef TIFFJPEGIsFullStripRequired
  12. #undef TIFFJPEGIsFullStripRequired
  13. #endif
  14. #define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12
  15. int TIFFInitJPEG_12(TIFF *tif, int scheme);
  16. #if !defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
  17. #error #include LIBJPEG_12_PATH
  18. #endif
  19. #include "tif_jpeg.c"
  20. int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings,
  21. int scheme, int is_encode)
  22. {
  23. JPEGState *sp;
  24. uint8_t *new_tif_data;
  25. (void)scheme;
  26. assert(scheme == COMPRESSION_JPEG);
  27. new_tif_data =
  28. (uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState));
  29. if (new_tif_data == NULL)
  30. {
  31. TIFFErrorExtR(tif, "TIFFReInitJPEG_12",
  32. "No space for JPEG state block");
  33. return 0;
  34. }
  35. tif->tif_data = new_tif_data;
  36. _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
  37. TIFFInitJPEGCommon(tif);
  38. sp = JState(tif);
  39. sp->otherSettings = *otherSettings;
  40. if (is_encode)
  41. return JPEGSetupEncode(tif);
  42. else
  43. return JPEGSetupDecode(tif);
  44. }
  45. #endif /* defined(JPEG_DUAL_MODE_8_12) */