On 06/02/15 10:22, Anton Khirnov wrote:
Quoting Vittorio Giovara (2015-02-05 14:50:11)
Based on work by Kostya Shishkov <[email protected]>.
---
  Changelog                      |    1 +
  doc/general.texi               |    1 +
  libavcodec/Makefile            |    1 +
  libavcodec/allcodecs.c         |    1 +
  libavcodec/avcodec.h           |    1 +
  libavcodec/codec_desc.c        |    7 +
  libavcodec/hqx.c               |  627 ++++++++++++
  libavcodec/hqxvlc.c            | 2182 ++++++++++++++++++++++++++++++++++++++++
  libavcodec/hqxvlc.h            |   55 +
  libavcodec/version.h           |    2 +-
  libavformat/riff.c             |    1 +
  tests/fate/video.mak           |    9 +
  tests/ref/fate/canopus-hqx422  |    2 +
  tests/ref/fate/canopus-hqx422a |    2 +
  14 files changed, 2891 insertions(+), 1 deletion(-)
  create mode 100644 libavcodec/hqx.c
  create mode 100644 libavcodec/hqxvlc.c
  create mode 100644 libavcodec/hqxvlc.h
  create mode 100644 tests/ref/fate/canopus-hqx422
  create mode 100644 tests/ref/fate/canopus-hqx422a

+static int hqx_decode_frame(AVCodecContext *avctx, void *data,
+                            int *got_picture_ptr, AVPacket *avpkt)
+{
+    HQXContext *ctx = avctx->priv_data;
+    AVFrame *pic = data;
+    uint8_t *src = avpkt->data;
+    uint32_t info_tag, info_offset;
+    int data_start;
+    unsigned data_size;
+    GetBitContext gb;
+    int i, ret;
+    int slice;
+    uint32_t slice_off[17];
+    mb_decode_func decode_func = 0;
+
+    /* Skip the INFO header if present */
+    info_offset = 0;
+    info_tag    = AV_RL32(src);
+    if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
+        info_offset = AV_RL32(src + 4);

This read and the one above it are unchecked.

+av_cold void ff_hqx_init_vlcs(void)
+{
+    static int initialised = 0;
+    int vlc_idx = 0;
+
+    if (initialised)
+        return;

Could this be easily done without global state? I know every other codec
does it like this, but we should really stop doing that.

We should have a callback for it already...

lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to