summaryrefslogtreecommitdiff
path: root/libavcodec/rv10.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/rv10.c
parent97141ffeec803c448d81ee4a53cfa2355f79f7ec (diff)
downloadffmpeg-2d764069be3b4092dc986467660607d922023332.tar.gz
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/rv10.c')
-rw-r--r--libavcodec/rv10.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 8f8a755ac3..e394a63a2b 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -340,7 +340,7 @@ static av_cold void rv10_build_vlc(VLC *vlc, const uint16_t len_count[15],
static av_cold void rv10_init_static(void)
{
- static VLC_TYPE table[1472 + 992][2];
+ static VLCElem table[1472 + 992];
rv_dc_lum.table = table;
rv_dc_lum.table_allocated = 1472;
@@ -349,8 +349,8 @@ static av_cold void rv10_init_static(void)
for (int i = 0; i < 1 << (DC_VLC_BITS - 7 /* Length of skip prefix */); i++) {
/* All codes beginning with 0x7F have the same length and value.
* Modifying the table directly saves us the useless subtables. */
- rv_dc_lum.table[(0x7F << (DC_VLC_BITS - 7)) + i][0] = 255;
- rv_dc_lum.table[(0x7F << (DC_VLC_BITS - 7)) + i][1] = 18;
+ rv_dc_lum.table[(0x7F << (DC_VLC_BITS - 7)) + i].sym = 255;
+ rv_dc_lum.table[(0x7F << (DC_VLC_BITS - 7)) + i].len = 18;
}
rv_dc_chrom.table = &table[1472];
rv_dc_chrom.table_allocated = 992;
@@ -358,8 +358,8 @@ static av_cold void rv10_init_static(void)
rv_sym_run_len, FF_ARRAY_ELEMS(rv_sym_run_len) - 2);
for (int i = 0; i < 1 << (DC_VLC_BITS - 9 /* Length of skip prefix */); i++) {
/* Same as above. */
- rv_dc_chrom.table[(0x1FE << (DC_VLC_BITS - 9)) + i][0] = 255;
- rv_dc_chrom.table[(0x1FE << (DC_VLC_BITS - 9)) + i][1] = 18;
+ rv_dc_chrom.table[(0x1FE << (DC_VLC_BITS - 9)) + i].sym = 255;
+ rv_dc_chrom.table[(0x1FE << (DC_VLC_BITS - 9)) + i].len = 18;
}
ff_h263_decode_init_vlc();
}