MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / alloc_table

Function alloc_table

libavcodec/vlc.c:60–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60static 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

Callers 1

build_tableFunction · 0.85

Calls 1

av_realloc_fFunction · 0.85

Tested by

no test coverage detected