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.

47 lines
1.3KB

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