jpeg2k.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef JPEG2000_H
  2. #define JPEG2000_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "bizchan.h"
  7. /** wrap jpeg2000 compress and decompress function */
  8. /** only accept rgb24 color space now */
  9. typedef struct jpeg2k_raw_image {
  10. unsigned char *data;
  11. int len;
  12. int width;
  13. int height;
  14. }jpeg2k_raw_image;
  15. typedef struct jpeg2k_coded_image {
  16. unsigned char *data;
  17. int len;
  18. int width;
  19. int height;
  20. }jpeg2k_coded_image;
  21. /**
  22. * encoding to jpeg2000 codec stream from raw rgb24 picture
  23. * @param raw rgb24 picture that provided by user
  24. * @param coded result image, all things in codec must be zero, memory will allocated by this function
  25. * @param ratio compress ration from 0 to 100, 0 means no compress, 100 full compress
  26. * @return return 0 on success
  27. */
  28. BIZCHAN_API(int) jpeg2k_encode(jpeg2k_raw_image *raw, jpeg2k_coded_image * coded, int ratio);
  29. /**
  30. * free jpeg2k_encode coded image
  31. */
  32. BIZCHAN_API(void) jpeg2k_encode_free(jpeg2k_coded_image * coded);
  33. /**
  34. * decoding to raw rgb24 picture from jpeg2000 codec stream
  35. * @param raw rgb24 picture that must be zero, memory will allocated by this function
  36. * @param coded result image, all things in codec must be zero
  37. * @return return 0 on success
  38. */
  39. BIZCHAN_API(int) jpeg2k_decode(jpeg2k_raw_image *raw, jpeg2k_coded_image * codec);
  40. /**
  41. * free jpeg2k_decode raw image
  42. */
  43. BIZCHAN_API(void) jpeg2k_decode_free(jpeg2k_raw_image *raw);
  44. #ifdef __cplusplus
  45. }//extern "C" {
  46. #endif
  47. #endif // JPEG2000_H