summaryrefslogtreecommitdiff
path: root/libavcodec/dv.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-29 16:31:43 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-05-06 06:13:54 +0200
commitfbb9e0dbc8a685917e25837d01f4d159e84152d7 (patch)
tree21e8cedf768a03759dc277ec6b492c24ec5d5011 /libavcodec/dv.c
parent869b204cbc64981e23cc59acca496a1e69b2f67c (diff)
avcodec/dv: Don't pretend VLC allocation can't fail
It can and therefore we switch from a heap allocated VLC table to a VLC initialized via the mechanism for static VLCs, but without an actual static VLC. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r--libavcodec/dv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 9c75cfd877..7c1ec6e0b2 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -202,7 +202,8 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
int i, j;
if (!done) {
- VLC dv_vlc;
+ VLC_TYPE vlc_buf[FF_ARRAY_ELEMS(ff_dv_rl_vlc)][2] = { 0 };
+ VLC dv_vlc = { .table = vlc_buf, .table_allocated = FF_ARRAY_ELEMS(vlc_buf) };
uint16_t new_dv_vlc_bits[NB_DV_VLC * 2];
uint8_t new_dv_vlc_len[NB_DV_VLC * 2];
uint8_t new_dv_vlc_run[NB_DV_VLC * 2];
@@ -232,7 +233,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
/* NOTE: as a trick, we use the fact the no codes are unused
* to accelerate the parsing of partial codes */
init_vlc(&dv_vlc, TEX_VLC_BITS, j, new_dv_vlc_len,
- 1, 1, new_dv_vlc_bits, 2, 2, 0);
+ 1, 1, new_dv_vlc_bits, 2, 2, INIT_VLC_USE_NEW_STATIC);
av_assert1(dv_vlc.table_size == 1664);
for (i = 0; i < dv_vlc.table_size; i++) {
@@ -251,7 +252,6 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
ff_dv_rl_vlc[i].level = level;
ff_dv_rl_vlc[i].run = run;
}
- ff_free_vlc(&dv_vlc);
}
s->avctx = avctx;