summaryrefslogtreecommitdiff
path: root/libavcodec/dirac_vlc.h
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2020-03-01 11:23:53 +0000
committerLynne <dev@lynne.ee>2020-03-12 20:26:48 +0000
commit675bb1f4f9de76f2c0eb1c8b1be6781a2cd52d29 (patch)
tree482aee9776d2e790c5b18bc11cd51cee300b1bd7 /libavcodec/dirac_vlc.h
parentd778be6e4a0565e9a96adec57339e4c8a2464664 (diff)
diracdec: rewrite golomb reader
This version is able to output multiple coefficients at a time and is able to altogether remove actual golomb code parsing. Its also able to partially recover the last coefficient in case the packet is incomplete. Total decoder performance gain for 8bit 420 1080p lossless: 40%. Total decoder performance gain for 10bit 420 1080p lossless: 40%. clang was able to vectorize the loop much better than my handwritten assembly, but gcc was very naive and didn't. Lookup table is a rewritten version of vc2hqdecode.
Diffstat (limited to 'libavcodec/dirac_vlc.h')
-rw-r--r--libavcodec/dirac_vlc.h30
1 files changed, 4 insertions, 26 deletions
diff --git a/libavcodec/dirac_vlc.h b/libavcodec/dirac_vlc.h
index 42ae41b00a..bfcfa136a1 100644
--- a/libavcodec/dirac_vlc.h
+++ b/libavcodec/dirac_vlc.h
@@ -1,7 +1,4 @@
/*
- * Copyright (C) 2016 Open Broadcast Systems Ltd.
- * Author 2016 Rostislav Pehlivanov <rpehlivanov@obe.tv>
- *
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@@ -24,28 +21,9 @@
#include "libavutil/avutil.h"
-/* Can be 32 bits wide for some performance gain on some machines, but it will
- * incorrectly decode very long coefficients (usually only 1 or 2 per frame) */
-typedef uint64_t residual;
-
-#define LUT_BITS 8
-
-/* Exactly 64 bytes */
-typedef struct DiracGolombLUT {
- residual preamble, leftover;
- int32_t ready[LUT_BITS];
- int32_t preamble_bits, leftover_bits, ready_num;
- int8_t need_s, sign;
-} DiracGolombLUT;
-
-av_cold int ff_dirac_golomb_reader_init(DiracGolombLUT **lut_ctx);
-
-int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
- int bytes, uint8_t *dst, int coeffs);
-
-int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
- int bytes, uint8_t *_dst, int coeffs);
-
-av_cold void ff_dirac_golomb_reader_end(DiracGolombLUT **lut_ctx);
+int ff_dirac_golomb_read_16bit(const uint8_t *buf, int bytes,
+ uint8_t *_dst, int coeffs);
+int ff_dirac_golomb_read_32bit(const uint8_t *buf, int bytes,
+ uint8_t *_dst, int coeffs);
#endif /* AVCODEC_DIRAC_VLC_H */