1 // ============================================================
3 // ============================================================
5 #ifndef TJE_HEADER_GUARD
6 #define TJE_HEADER_GUARD
7 #include "bsp_common.h"
8 #define TJEI_BUFFER_SIZE 1024
14 #define snprintf sprintf_s
16 // Not quite the same but it works for us. If I am not mistaken, it differs
17 // only in the return value.
38 #if defined(__GNUC__) || defined(__clang__)
39 #pragma GCC diagnostic push
40 #pragma GCC diagnostic ignored "-Wmissing-field-initializers" // We use {0}, which will zero-out the struct.
41 #pragma GCC diagnostic ignored "-Wmissing-braces"
42 #pragma GCC diagnostic ignored "-Wpadded"
45 // - tje_encode_with_func -
48 // Same as tje_encode_to_file_at_quality, but it takes a callback that knows
49 // how to handle (or ignore) `context`. The callback receives an array `data`
50 // of `size` bytes, which can be written directly to a file. There is no need
53 typedef void tje_write_func(void* context
, void* data
, int size
);
54 void *jpeg_encode_init(tje_write_func
* func
, void* context
, uint8_t quality
, uint32_t width
, uint32_t height
, uint8_t src_num_components
);
55 void jpeg_encode_run(void *ctx
, uint8_t *src_data
);
56 void jpeg_encode_end(void *ctx
);
57 // ============================================================
59 #if defined(__GNUC__) || defined(__clang__)
60 #pragma GCC diagnostic pop