lv_sjpg.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * @file lv_sjpg.h
  3. *
  4. */
  5. #ifndef _LV_SJPEG_
  6. #define _LV_SJPEG_
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /*********************
  11. * INCLUDES
  12. *********************/
  13. #include <stdio.h>
  14. #include "lv_tjpgd.h"
  15. #define LV_LVGL_H_INCLUDE_SIMPLE
  16. #ifdef LV_LVGL_H_INCLUDE_SIMPLE
  17. #include <lvgl.h>
  18. #else
  19. #include <lvgl/lvgl.h>
  20. #endif
  21. /*********************
  22. * DEFINES
  23. *********************/
  24. /**********************
  25. * TYPEDEFS
  26. **********************/
  27. enum io_source_type {
  28. SJPEG_IO_SOURCE_C_ARRAY,
  29. SJPEG_IO_SOURCE_DISK,
  30. };
  31. typedef struct {
  32. enum io_source_type type;
  33. #if LV_USE_FILESYSTEM
  34. lv_fs_file_t lv_file;
  35. #endif
  36. uint8_t* img_cache_buff;
  37. int img_cache_x_res;
  38. int img_cache_y_res;
  39. uint8_t *raw_sjpg_data; //Used when type==SJPEG_IO_SOURCE_C_ARRAY.
  40. uint32_t raw_sjpg_data_size; //Num bytes pointed to by raw_sjpg_data.
  41. uint32_t raw_sjpg_data_next_read_pos; //Used for all types.
  42. } io_source_t;
  43. typedef struct {
  44. uint8_t *sjpeg_data;
  45. uint32_t sjpeg_data_size;
  46. int sjpeg_x_res;
  47. int sjpeg_y_res;
  48. int sjpeg_total_frames;
  49. int sjpeg_single_frame_height;
  50. int sjpeg_cache_frame_index;
  51. uint8_t **frame_base_array; //to save base address of each split frames upto sjpeg_total_frames.
  52. int *frame_base_offset; //to save base offset for fseek
  53. uint8_t *frame_cache;
  54. uint8_t* workb; //JPG work buffer for jpeg library
  55. JDEC *tjpeg_jd;
  56. io_source_t io;
  57. } SJPEG;
  58. /**********************
  59. * GLOBAL PROTOTYPES
  60. **********************/
  61. void lv_split_jpeg_init(void);
  62. /**********************
  63. * MACROS
  64. **********************/
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif /* _LV_JPEG_WRAPPER */