huffman-decode.h 1.7 KB

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