From 2a293ec7ac72723b5f07aa804bb981ce1de35b82 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 8 Jan 2017 12:07:09 +0100 Subject: avcodec: add Newtek SpeedHQ decoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- libavcodec/mpeg12.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'libavcodec/mpeg12.c') 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); } } -- cgit v1.2.3