Move tiffread definitions to separate header files
This commit is contained in:
parent
7584f926e0
commit
5c1f80ffb6
87
src/tiffread.h
Normal file
87
src/tiffread.h
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef TIFFREAD_H
|
||||
#define TIFFREAD_H
|
||||
|
||||
#include "aliases.h"
|
||||
|
||||
#define TAG_MAX_COUNT (UINT16_MAX * sizeof(const char *))
|
||||
// Technically, the type parameter is 2-bytes long, but there aren't so many
|
||||
// types specified in the spec, so UINT8_MAX should be sufficient
|
||||
#define TYPE_MAX_COUNT (UINT8_MAX * sizeof(const char *))
|
||||
|
||||
// clang-format off
|
||||
enum {
|
||||
TIFF_ORDER_LITTLE_ENDIAN = 0x4949,
|
||||
TIFF_ORDER_BIG_ENDIAN = 0x4d4d,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
typedef struct hdr TiffHdr;
|
||||
struct hdr {
|
||||
u16 order;
|
||||
u16 magic;
|
||||
u32 first_ifd_offset;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
enum tiff_public_tags {
|
||||
#include "tiff_public_tags.inc"
|
||||
};
|
||||
|
||||
const char *tag_names[TAG_MAX_COUNT] = {
|
||||
#define TIFF_TAG_LOOKUP
|
||||
#include "tiff_public_tags.inc"
|
||||
#undef TIFF_TAG_LOOKUP
|
||||
};
|
||||
|
||||
enum tiff_field_types {
|
||||
#include "tiff_field_types.inc"
|
||||
};
|
||||
|
||||
const char *filed_type_names[TYPE_MAX_COUNT] = {
|
||||
#define TIFF_TYPE_LOOKUP
|
||||
#include "tiff_field_types.inc"
|
||||
#undef TIFF_TYPE_LOOKUP
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
typedef struct field TiffField;
|
||||
struct field {
|
||||
u16 tag;
|
||||
u16 type;
|
||||
u32 count;
|
||||
u32 value_offset;
|
||||
};
|
||||
|
||||
typedef struct IFD TiffIFD;
|
||||
struct IFD {
|
||||
u16 count;
|
||||
TiffField *fields;
|
||||
u32 next_ifd;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
enum tiff_compression {
|
||||
TIFF_COMPRESSION_UNCOMPRESSED = 0x0001,
|
||||
TIFF_COMPRESSION_CCITT_1D = 0x0002,
|
||||
TIFF_COMPRESSION_GROUP_3_FAX = 0x0003,
|
||||
TIFF_COMPRESSION_GROUP_4_FAX = 0x0004,
|
||||
TIFF_COMPRESSION_LZW = 0x0005,
|
||||
TIFF_COMPRESSION_JPEG = 0x0006,
|
||||
TIFF_COMPRESSION_PACK_BITS = 0x8005,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
enum tiff_photometric_interpretation {
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO = 0x0000,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO = 0x0001,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_RGB = 0x0002,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_RGB_PALETTE = 0x0003,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_TRANSPARENCY_MASK = 0x0004,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_CMYK = 0x0005,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_YCbCr = 0x0006,
|
||||
TIFF_PHOTOMETRIC_INTERPRETATION_CIELab = 0x0008,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#endif // !TIFFREAD_H
|
Loading…
Reference in New Issue
Block a user