encoder_JPEG.h (920B)
1 /* 2 * JPEG Encoder Header 3 * Baseline DCT JPEG encoder 4 */ 5 6 #ifndef ENCODER_JPEG_H 7 #define ENCODER_JPEG_H 8 9 #include <stdint.h> 10 #include <stddef.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * Encode BGRA image data to JPEG 18 * 19 * @param bgra_data Input image in BGRA format (4 bytes per pixel) 20 * @param width Image width in pixels 21 * @param height Image height in pixels 22 * @param quality JPEG quality (1-100, higher = better quality) 23 * @param out_size Output: size of encoded JPEG data 24 * @return Pointer to encoded JPEG data (caller must free), or NULL on error 25 */ 26 uint8_t* jpeg_encode(const uint8_t* bgra_data, int width, int height, int quality, size_t* out_size); 27 28 /** 29 * Free JPEG encoded data 30 */ 31 void jpeg_encode_free(uint8_t* data); 32 33 /* Lua bindings */ 34 struct lua_State; 35 int luaopen_jpegencoder(struct lua_State *L); 36 37 #ifdef __cplusplus 38 } 39 #endif 40 41 #endif /* ENCODER_JPEG_H */