summaryrefslogtreecommitdiff
path: root/libavcodec/rl.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-06-13 23:02:57 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-06-17 16:47:29 +0200
commit2d764069be3b4092dc986467660607d922023332 (patch)
tree1504ef9e286b8df559635e97d31ebe767a9e6426 /libavcodec/rl.c
parent97141ffeec803c448d81ee4a53cfa2355f79f7ec (diff)
avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element
In C, qualifiers for arrays are broken: const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE elements and unfortunately this is not compatible with a pointer to a const array of two VLC_TYPE, because the latter does not exist as array types are never qualified (the qualifier applies to the base type instead). This is the reason why get_vlc2() doesn't accept a const VLC table despite not modifying the table at all, as there is no automatic conversion from VLC_TYPE (*)[2] to const VLC_TYPE (*)[2]. Fix this by using a structure VLCElem for the VLC table. This also has the advantage of making it clear which element is which. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/rl.c')
-rw-r--r--libavcodec/rl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index 4ce003ccf4..645a5362f7 100644
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -62,7 +62,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{
int i, q;
- VLC_TYPE table[1500][2] = {{0}};
+ VLCElem table[1500] = { 0 };
VLC vlc = { .table = table, .table_allocated = static_size };
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -79,8 +79,8 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
qadd = 0;
}
for (i = 0; i < vlc.table_size; i++) {
- int code = vlc.table[i][0];
- int len = vlc.table[i][1];
+ int code = vlc.table[i].sym;
+ int len = vlc.table[i].len;
int level, run;
if (len == 0) { // illegal code