summaryrefslogtreecommitdiff
path: root/libavcodec/cabac_functions.h
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2013-08-11 09:02:07 +0200
committerAnton Khirnov <anton@khirnov.net>2013-10-31 20:19:59 +0100
commit064698d381e1e7790f21b0199a8930ea04e2e942 (patch)
tree2ed95cea3a92d26a1c757a6c5f7e881eba3d9cf2 /libavcodec/cabac_functions.h
parent0a9e94bba8f8a40156438a43e4fe0e9ae36236cb (diff)
Add HEVC decoder
Initially written by Guillaume Martres <smarter@ubuntu.com> as a GSoC project. Further contributions by the OpenHEVC project and other developers, namely: Mickaël Raulet <mraulet@insa-rennes.fr> Seppo Tomperi <seppo.tomperi@vtt.fi> Gildas Cocherel <gildas.cocherel@laposte.net> Khaled Jerbi <khaled_jerbi@yahoo.fr> Wassim Hamidouche <wassim.hamidouche@insa-rennes.fr> Vittorio Giovara <vittorio.giovara@gmail.com> Jan Ekström <jeebjp@gmail.com> Anton Khirnov <anton@khirnov.net> Martin Storsjö <martin@martin.st> Luca Barbato <lu_zero@gentoo.org> Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> Reimar Döffinger <Reimar.Doeffinger@gmx.de> Diego Biurrun <diego@biurrun.de> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/cabac_functions.h')
-rw-r--r--libavcodec/cabac_functions.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index afc7c98358..11c9646742 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -162,4 +162,24 @@ static int av_unused get_cabac_terminate(CABACContext *c){
}
}
+/**
+ * Skip @p n bytes and reset the decoder.
+ * @return the address of the first skipped byte or NULL if there's less than @p n bytes left
+ */
+static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
+ const uint8_t *ptr = c->bytestream;
+
+ if (c->low & 0x1)
+ ptr--;
+#if CABAC_BITS == 16
+ if (c->low & 0x1FF)
+ ptr--;
+#endif
+ if ((int) (c->bytestream_end - ptr) < n)
+ return NULL;
+ ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n);
+
+ return ptr;
+}
+
#endif /* AVCODEC_CABAC_FUNCTIONS_H */