huffman-decode.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * =====================================================================================
  3. *
  4. * ________ .__ __ ________ ____ ________
  5. * \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
  6. * / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
  7. * / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
  8. * \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
  9. * \__> \/ \/ \/ \/ \/
  10. *
  11. * www.optixx.org
  12. *
  13. *
  14. * Version: 1.0
  15. * Created: 07/21/2009 03:32:16 PM
  16. *
  17. * =====================================================================================
  18. */
  19. #ifndef AVR_HUFFMAN_DECODE_H_
  20. #define AVR_HUFFMAN_DECODE_H_
  21. #include <stdint.h>
  22. #define HUFFMAN_USE_ADDR_16 1
  23. typedef struct {
  24. void* tree;
  25. uint8_t rbuffer;
  26. uint8_t rbuffer_index;
  27. #if HUFFMAN_USE_ADDR_16
  28. uint16_t(*read_byte)(uint16_t addr);
  29. uint16_t addr;
  30. #else
  31. uint16_t(*read_byte)(uint32_t addr);
  32. uint32_t addr;
  33. #endif
  34. } huffman_dec_ctx_t;
  35. #if HUFFMAN_USE_ADDR_16
  36. void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint16_t));
  37. void huffman_dec_set_addr(huffman_dec_ctx_t* ctx,uint16_t addr);
  38. #else
  39. void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint32_t));
  40. void huffman_dec_set_addr(huffman_dec_ctx_t* ctx,uint32_t addr);
  41. #endif
  42. uint16_t huffman_dec_byte(huffman_dec_ctx_t* ctx);
  43. #endif /* AVR_HUFFMAN_DECODE_H_ */