diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-30 04:11:47 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-04-02 00:21:59 +0200 |
commit | a8e518e3a7f7d5da969e7abba0f03f2ef0fd0203 (patch) | |
tree | 3ee56a8e34a72449b792d5fc22859d6c2c596722 /libavcodec/vlc.c | |
parent | 4ab82d2fb6361864521b41a5c8168902e534fa1a (diff) | |
download | ffmpeg-a8e518e3a7f7d5da969e7abba0f03f2ef0fd0203.tar.gz |
avcodec/vlc: Use union of uint8_t and uint16_t in VLC_MULTI_ELEM
It is more natural and simplifies writing these arrays.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/vlc.c')
-rw-r--r-- | libavcodec/vlc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index e01cc41689..ee09d96fd6 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -440,8 +440,8 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit, code = curcode + (buf[t].code >> curlen); newlimit = curlimit - l; l += curlen; - if (is16bit) AV_WN16(info.val+2*curlevel, sym); - else info.val[curlevel] = sym&0xFF; + if (is16bit) info.val16[curlevel] = sym; + else info.val8[curlevel] = sym&0xFF; if (curlevel) { // let's not add single entries uint32_t val = code >> (32 - numbits); @@ -468,7 +468,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, { int minbits, maxbits, max; unsigned count[VLC_MULTI_MAX_SYMBOLS-1] = { 0, }; - VLC_MULTI_ELEM info = { { 0, }, 0, 0, }; + VLC_MULTI_ELEM info = { 0 }; int count0 = 0; for (int j = 0; j < 1<<numbits; j++) { @@ -500,9 +500,9 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, table[j].len = single->table[j].len; table[j].num = single->table[j].len > 0 ? 1 : 0; if (is16bit) - AV_WN16(table[j].val, single->table[j].sym); + table[j].val16[0] = single->table[j].sym; else - table[j].val[0] = single->table[j].sym; + table[j].val8[0] = single->table[j].sym; } add_level(table, is16bit, nb_codes, numbits, buf, |