You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3KB

  1. /**
  2. * @file rl.h
  3. * rl header.
  4. */
  5. #ifndef AVCODEC_RL_H
  6. #define AVCODEC_RL_H
  7. /** RLTable. */
  8. typedef struct RLTable {
  9. int n; ///< number of entries of table_vlc minus 1
  10. int last; ///< number of values for last = 0
  11. const uint16_t (*table_vlc)[2];
  12. const int8_t *table_run;
  13. const int8_t *table_level;
  14. uint8_t *index_run[2]; ///< encoding only
  15. int8_t *max_level[2]; ///< encoding & decoding
  16. int8_t *max_run[2]; ///< encoding & decoding
  17. VLC vlc; ///< decoding only deprected FIXME remove
  18. RL_VLC_ELEM *rl_vlc[32]; ///< decoding only
  19. } RLTable;
  20. /**
  21. *
  22. * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold
  23. * the level and run tables, if this is NULL av_malloc() will be used
  24. */
  25. void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
  26. void init_vlc_rl(RLTable *rl, int use_static);
  27. static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
  28. {
  29. int index;
  30. index = rl->index_run[last][run];
  31. if (index >= rl->n)
  32. return rl->n;
  33. if (level > rl->max_level[last][run])
  34. return rl->n;
  35. return index + level - 1;
  36. }
  37. #endif