| 58 | |
| 59 | |
| 60 | static int alloc_table(VLC *vlc, int size, int use_static) |
| 61 | { |
| 62 | int index = vlc->table_size; |
| 63 | |
| 64 | vlc->table_size += size; |
| 65 | if (vlc->table_size > vlc->table_allocated) { |
| 66 | if (use_static) |
| 67 | abort(); // cannot do anything, vlc_init() is used with too little memory |
| 68 | vlc->table_allocated += (1 << vlc->bits); |
| 69 | vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table)); |
| 70 | if (!vlc->table) { |
| 71 | vlc->table_allocated = 0; |
| 72 | vlc->table_size = 0; |
| 73 | return AVERROR(ENOMEM); |
| 74 | } |
| 75 | memset(vlc->table + vlc->table_allocated - (1 << vlc->bits), 0, sizeof(*vlc->table) << vlc->bits); |
| 76 | } |
| 77 | return index; |
| 78 | } |
| 79 | |
| 80 | #define LOCALBUF_ELEMS 1500 // the maximum currently needed is 1296 by rv34 |
| 81 |
no test coverage detected