summaryrefslogtreecommitdiffstats
path: root/libavcodec/cabac_functions.h
diff options
context:
space:
mode:
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 8a7275d..b84258b 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -160,4 +160,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 */
OpenPOWER on IntegriCloud