#include "cabac.h"
#include "config.h"
+#if ARCH_AARCH64
+# include "aarch64/cabac.h"
+#endif
+#if ARCH_ARM
+# include "arm/cabac.h"
+#endif
#if ARCH_X86
# include "x86/cabac.h"
#endif
-extern uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63];
-static uint8_t * const ff_h264_norm_shift = ff_h264_cabac_tables + H264_NORM_SHIFT_OFFSET;
-static uint8_t * const ff_h264_lps_range = ff_h264_cabac_tables + H264_LPS_RANGE_OFFSET;
-static uint8_t * const ff_h264_mlps_state = ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET;
-static uint8_t * const ff_h264_last_coeff_flag_offset_8x8 = ff_h264_cabac_tables + H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET;
+static const uint8_t * const ff_h264_norm_shift = ff_h264_cabac_tables + H264_NORM_SHIFT_OFFSET;
+static const uint8_t * const ff_h264_lps_range = ff_h264_cabac_tables + H264_LPS_RANGE_OFFSET;
+static const uint8_t * const ff_h264_mlps_state = ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET;
+static const uint8_t * const ff_h264_last_coeff_flag_offset_8x8 = ff_h264_cabac_tables + H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET;
static void refill(CABACContext *c){
#if CABAC_BITS == 16
return get_cabac_inline(c,state);
}
+#ifndef get_cabac_bypass
static int av_unused get_cabac_bypass(CABACContext *c){
int range;
c->low += c->low;
return 1;
}
}
-
+#endif
#ifndef get_cabac_bypass_sign
static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
#endif
/**
- *
* @return the number of bytes read or 0 if no end
*/
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 */