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