// // Created by marcsello on 03/11/2020. // #ifndef CAFF_PREVIEWER_CIFF_TOOLS_H #define CAFF_PREVIEWER_CIFF_TOOLS_H #include #include "magic_memory.h" #define CIFF_PARSE_UNKNOWN_ERROR 1 #define CIFF_PARSE_HEADER_LENGTHS_INCORRECT 2 #define CIFF_PARSE_HEADER_DIMENSIONS_INCORRECT 3 #define CIFF_PARSE_HEADER_TOO_SHORT 4 #define CIFF_PARSE_HEADER_BAD_MAGIC 5 #define CIFF_PARSE_SUCCESS 0 typedef struct __attribute__ ((packed)) ciff_static_header_t { uint32_t magic; // should be equal to 0x43494646 uint64_t header_size; uint64_t content_size; uint64_t width; uint64_t height; } ciff_static_header_t; uint8_t parse_ciff_from_mem(const uint8_t* data, uint64_t data_len, uint64_t* width, uint64_t* height, uint64_t* pixel_data_starts); #endif //CAFF_PREVIEWER_CIFF_TOOLS_H