diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-08 15:18:12 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-11 00:27:45 +0200 |
commit | 9cdf82c2c2f0cec6d3963737bfdf3b3f3112ff20 (patch) | |
tree | 74f8ed5b6a51ced9f8dd0821da4dd00c8efa5944 /libavcodec/vlc.c | |
parent | 95e876f069e9c5ed268ddcdeb06cc5e056c5e63c (diff) | |
download | ffmpeg-9cdf82c2c2f0cec6d3963737bfdf3b3f3112ff20.tar.gz |
avcodec/vlc: Use proper namespace
Therefore use a proper prefix for this API, e.g.
ff_init_vlc_sparse -> ff_vlc_init_sparse
ff_free_vlc -> ff_vlc_free
INIT_VLC_LE -> VLC_INIT_LE
INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC
(The ancient INIT_VLC_USE_STATIC has been removed
in 595324e143b57a52e2329eb47b84395c70f93087, so that
the NEW has been dropped.)
Finally, reorder the flags and change their values
accordingly.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/vlc.c')
-rw-r--r-- | libavcodec/vlc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index 1740b2f80f..b353d2e86c 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -64,7 +64,7 @@ static int alloc_table(VLC *vlc, int size, int use_static) vlc->table_size += size; if (vlc->table_size > vlc->table_allocated) { if (use_static) - abort(); // cannot do anything, init_vlc() is used with too little memory + abort(); // cannot do anything, vlc_init() is used with too little memory vlc->table_allocated += (1 << vlc->bits); vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table)); if (!vlc->table) { @@ -100,7 +100,7 @@ static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes, { vlc->bits = nb_bits; vlc->table_size = 0; - if (flags & INIT_VLC_USE_NEW_STATIC) { + if (flags & VLC_INIT_USE_STATIC) { av_assert0(nb_codes <= LOCALBUF_ELEMS); } else { vlc->table = NULL; @@ -144,7 +144,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, if (table_nb_bits > 30) return AVERROR(EINVAL); table_size = 1 << table_nb_bits; - table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); + table_index = alloc_table(vlc, table_size, flags & VLC_INIT_USE_STATIC); ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); if (table_index < 0) return table_index; @@ -162,7 +162,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, int nb = 1 << (table_nb_bits - n); int inc = 1; - if (flags & INIT_VLC_OUTPUT_LE) { + if (flags & VLC_INIT_OUTPUT_LE) { j = bitswap_32(code); inc = 1 << n; } @@ -200,7 +200,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, subtable_bits = FFMAX(subtable_bits, n); } subtable_bits = FFMIN(subtable_bits, table_nb_bits); - j = (flags & INIT_VLC_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; + j = (flags & VLC_INIT_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; table[j].len = -subtable_bits; ff_dlog(NULL, "%4x: n=%d (subtable)\n", j, codes[i].bits + table_nb_bits); @@ -231,9 +231,9 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes, { int ret = build_table(vlc, nb_bits, nb_codes, codes, flags); - if (flags & INIT_VLC_USE_NEW_STATIC) { + if (flags & VLC_INIT_USE_STATIC) { if (vlc->table_size != vlc->table_allocated && - !(flags & (INIT_VLC_STATIC_OVERLONG & ~INIT_VLC_USE_NEW_STATIC))) + !(flags & (VLC_INIT_STATIC_OVERLONG & ~VLC_INIT_USE_STATIC))) av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); av_assert0(ret >= 0); } else { @@ -247,7 +247,7 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes, return 0; } -int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, +int ff_vlc_init_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, @@ -269,7 +269,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, if (!(condition)) \ continue; \ if (len > 3*nb_bits || len > 32) { \ - av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in init_vlc\n", len);\ + av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in vlc_init\n", len);\ if (buf != localbuf) \ av_free(buf); \ return AVERROR(EINVAL); \ @@ -278,12 +278,12 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \ if (buf[j].code >= (1LL<<buf[j].bits)) { \ av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in " \ - "init_vlc\n", buf[j].code, i); \ + "vlc_init\n", buf[j].code, i); \ if (buf != localbuf) \ av_free(buf); \ return AVERROR(EINVAL); \ } \ - if (flags & INIT_VLC_INPUT_LE) \ + if (flags & VLC_INIT_INPUT_LE) \ buf[j].code = bitswap_32(buf[j].code); \ else \ buf[j].code <<= 32 - buf[j].bits; \ @@ -294,7 +294,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, j++; \ } COPY(len > nb_bits); - // qsort is the slowest part of init_vlc, and could probably be improved or avoided + // qsort is the slowest part of vlc_init, and could probably be improved or avoided AV_QSORT(buf, j, struct VLCcode, compare_vlcspec); COPY(len && len <= nb_bits); nb_codes = j; @@ -303,7 +303,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, flags, localbuf); } -int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes, +int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx) @@ -427,7 +427,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, return 0; } -int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, +int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx) @@ -481,12 +481,12 @@ fail: return AVERROR_INVALIDDATA; } -void ff_free_vlc_multi(VLC_MULTI *vlc) +void ff_vlc_free_multi(VLC_MULTI *vlc) { av_freep(&vlc->table); } -void ff_free_vlc(VLC *vlc) +void ff_vlc_free(VLC *vlc) { av_freep(&vlc->table); } |