diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-06-13 23:02:57 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-06-17 16:47:29 +0200 |
commit | 2d764069be3b4092dc986467660607d922023332 (patch) | |
tree | 1504ef9e286b8df559635e97d31ebe767a9e6426 /libavcodec/aacdec_template.c | |
parent | 97141ffeec803c448d81ee4a53cfa2355f79f7ec (diff) | |
download | ffmpeg-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/aacdec_template.c')
-rw-r--r-- | libavcodec/aacdec_template.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 94d694d16b..0135cb35df 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1221,8 +1221,8 @@ static void aacdec_init(AACContext *ac); static av_cold void aac_static_table_init(void) { - static VLC_TYPE vlc_buf[304 + 270 + 550 + 300 + 328 + - 294 + 306 + 268 + 510 + 366 + 462][2]; + static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 + + 294 + 306 + 268 + 510 + 366 + 462]; for (unsigned i = 0, offset = 0; i < 11; i++) { vlc_spectral[i].table = &vlc_buf[offset]; vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; @@ -1821,7 +1821,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024], #if !USE_FIXED const float *vq = ff_aac_codebook_vector_vals[cbt_m1]; #endif /* !USE_FIXED */ - VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table; + const VLCElem *vlc_tab = vlc_spectral[cbt_m1].table; OPEN_READER(re, gb); switch (cbt_m1 >> 1) { |