aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorSteinar H. Gunderson <steinar+ffmpeg@gunderson.no>2017-01-08 12:07:09 +0100
committerPaul B Mahol <onemda@gmail.com>2017-01-11 16:02:10 +0100
commit2a293ec7ac72723b5f07aa804bb981ce1de35b82 (patch)
tree03280e07e6e6eb483974a55384adafc458c62dff /libavcodec/mpeg12.c
parenteaff1aa09e90e2711207c9463db8bf8e8dec8178 (diff)
downloadffmpeg-2a293ec7ac72723b5f07aa804bb981ce1de35b82.tar.gz
avcodec: add Newtek SpeedHQ decoder
This decoder can decode all existing SpeedHQ formats (SHQ0–5, 7, and 9), including correct decoding of the alpha channel. 1080p is decoded in 142 fps on one core of my i7-4600U (2.1 GHz Haswell), about evenly split between bitstream reader and IDCT. There is currently no attempt at slice or frame threading, even though the format trivially supports both. NewTek very helpfully provided a full set of SHQ samples, as well as source code for an SHQ2 encoder (not included) and assistance with understanding some details of the format.
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index a61d45b39a..ab6c19c615 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -67,20 +67,13 @@ static const uint8_t table_mb_btype[11][2] = {
{ 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
};
-#define INIT_2D_VLC_RL(rl, static_size)\
-{\
- static RL_VLC_ELEM rl_vlc_table[static_size];\
- rl.rl_vlc[0] = rl_vlc_table;\
- init_2d_vlc_rl(&rl, static_size);\
-}
-
-static av_cold void init_2d_vlc_rl(RLTable *rl, unsigned static_size)
+av_cold void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags)
{
int i;
VLC_TYPE table[680][2] = {{0}};
VLC vlc = { .table = table, .table_allocated = static_size };
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
- init_vlc(&vlc, TEX_VLC_BITS, rl->n + 2, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
+ init_vlc(&vlc, TEX_VLC_BITS, rl->n + 2, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | flags);
for (i = 0; i < vlc.table_size; i++) {
int code = vlc.table[i][0];
@@ -173,8 +166,8 @@ av_cold void ff_mpeg12_init_vlcs(void)
ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
- INIT_2D_VLC_RL(ff_rl_mpeg1, 680);
- INIT_2D_VLC_RL(ff_rl_mpeg2, 674);
+ INIT_2D_VLC_RL(ff_rl_mpeg1, 680, 0);
+ INIT_2D_VLC_RL(ff_rl_mpeg2, 674, 0);
}
}