On Sun, Jan 08, 2017 at 12:07:09PM +0100, Steinar H. Gunderson wrote: > 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. > --- [...]
> +static av_cold int speedhq_decode_init(AVCodecContext *avctx) > +{ > + static int done = 0; > + uint16_t ff_mpeg12_vlc_dc_lum_code_reversed[12]; > + uint16_t ff_mpeg12_vlc_dc_chroma_code_reversed[12]; > + SHQContext * const s = avctx->priv_data; > + > + s->avctx = avctx; > + > + if (!done) { > + int i; > + > + /* Exactly the same as MPEG-2, except little-endian. */ > + reverse_code(ff_mpeg12_vlc_dc_lum_code, > + ff_mpeg12_vlc_dc_lum_bits, > + ff_mpeg12_vlc_dc_lum_code_reversed, > + 12); > + INIT_LE_VLC_STATIC(&ff_dc_lum_vlc_le, DC_VLC_BITS, 12, > + ff_mpeg12_vlc_dc_lum_bits, 1, 1, > + ff_mpeg12_vlc_dc_lum_code_reversed, 2, 2, 512); > + reverse_code(ff_mpeg12_vlc_dc_chroma_code, > + ff_mpeg12_vlc_dc_chroma_bits, > + ff_mpeg12_vlc_dc_chroma_code_reversed, > + 12); > + INIT_LE_VLC_STATIC(&ff_dc_chroma_vlc_le, DC_VLC_BITS, 12, > + ff_mpeg12_vlc_dc_chroma_bits, 1, 1, > + ff_mpeg12_vlc_dc_chroma_code_reversed, 2, 2, 514); > + > + /* Reverse the AC VLC, because INIT_VLC_LE wants it in that order. */ > + for (i = 0; i < FF_ARRAY_ELEMS(speedhq_vlc); ++i) { > + speedhq_vlc[i][0] = reverse(speedhq_vlc[i][0], > speedhq_vlc[i][1]); > + } This makes the init thread unsafe it would be better if the table was const and this wasnt done at runtime [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel