Jpeg2K.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * The Python Imaging Library
  3. * $Id$
  4. *
  5. * declarations for the OpenJPEG codec interface.
  6. *
  7. * Copyright (c) 2014 by Coriolis Systems Limited
  8. * Copyright (c) 2014 by Alastair Houghton
  9. */
  10. #include <openjpeg.h>
  11. /* 1MB for now */
  12. #define BUFFER_SIZE OPJ_J2K_STREAM_CHUNK_SIZE
  13. /* -------------------------------------------------------------------- */
  14. /* Decoder */
  15. /* -------------------------------------------------------------------- */
  16. typedef struct {
  17. /* CONFIGURATION */
  18. /* File descriptor, if available; otherwise, -1 */
  19. int fd;
  20. /* File pointer, when opened */
  21. FILE * pfile;
  22. /* Length of data, if available; otherwise, -1 */
  23. off_t length;
  24. /* Specify the desired format */
  25. OPJ_CODEC_FORMAT format;
  26. /* Set to divide image resolution by 2**reduce. */
  27. int reduce;
  28. /* Set to limit the number of quality layers to decode (0 = all layers) */
  29. int layers;
  30. /* PRIVATE CONTEXT (set by decoder) */
  31. const char *error_msg;
  32. } JPEG2KDECODESTATE;
  33. /* -------------------------------------------------------------------- */
  34. /* Encoder */
  35. /* -------------------------------------------------------------------- */
  36. typedef struct {
  37. /* CONFIGURATION */
  38. /* File descriptor, if available; otherwise, -1 */
  39. int fd;
  40. /* File pointer, when opened */
  41. FILE * pfile;
  42. /* Specify the desired format */
  43. OPJ_CODEC_FORMAT format;
  44. /* Image offset */
  45. int offset_x, offset_y;
  46. /* Tile information */
  47. int tile_offset_x, tile_offset_y;
  48. int tile_size_x, tile_size_y;
  49. /* Quality layers (a sequence of numbers giving *either* rates or dB) */
  50. int quality_is_in_db;
  51. PyObject *quality_layers;
  52. /* Number of resolutions (DWT decompositions + 1 */
  53. int num_resolutions;
  54. /* Code block size */
  55. int cblk_width, cblk_height;
  56. /* Precinct size */
  57. int precinct_width, precinct_height;
  58. /* Compression style */
  59. int irreversible;
  60. /* Progression order (LRCP/RLCP/RPCL/PCRL/CPRL) */
  61. OPJ_PROG_ORDER progression;
  62. /* Cinema mode */
  63. OPJ_CINEMA_MODE cinema_mode;
  64. /* PRIVATE CONTEXT (set by decoder) */
  65. const char *error_msg;
  66. } JPEG2KENCODESTATE;
  67. /*
  68. * Local Variables:
  69. * c-basic-offset: 4
  70. * End:
  71. *
  72. */