Commit a8956eca authored by Anton Khirnov's avatar Anton Khirnov Committed by Luca Barbato

cabac: Make CABAC states hardcoded

There is not much reason to generate such a small table at runtime.
Signed-off-by: 's avatarDerek Buitenhuis <derekb@vimeo.com>
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 2830bce4
This diff is collapsed.
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "put_bits.h" #include "put_bits.h"
extern uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63]; extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63];
#define H264_NORM_SHIFT_OFFSET 0 #define H264_NORM_SHIFT_OFFSET 0
#define H264_LPS_RANGE_OFFSET 512 #define H264_LPS_RANGE_OFFSET 512
#define H264_MLPS_STATE_OFFSET 1024 #define H264_MLPS_STATE_OFFSET 1024
...@@ -49,6 +49,5 @@ typedef struct CABACContext{ ...@@ -49,6 +49,5 @@ typedef struct CABACContext{
}CABACContext; }CABACContext;
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size); void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
void ff_init_cabac_states(void);
#endif /* AVCODEC_CABAC_H */ #endif /* AVCODEC_CABAC_H */
...@@ -42,10 +42,10 @@ ...@@ -42,10 +42,10 @@
# include "x86/cabac.h" # include "x86/cabac.h"
#endif #endif
static uint8_t * const ff_h264_norm_shift = ff_h264_cabac_tables + H264_NORM_SHIFT_OFFSET; static const 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 const 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 const 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_last_coeff_flag_offset_8x8 = ff_h264_cabac_tables + H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET;
static void refill(CABACContext *c){ static void refill(CABACContext *c){
#if CABAC_BITS == 16 #if CABAC_BITS == 16
......
...@@ -621,8 +621,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx) ...@@ -621,8 +621,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
ff_h264_decode_init_vlc(); ff_h264_decode_init_vlc();
ff_init_cabac_states();
if (avctx->codec_id == AV_CODEC_ID_H264) { if (avctx->codec_id == AV_CODEC_ID_H264) {
if (avctx->ticks_per_frame == 1) if (avctx->ticks_per_frame == 1)
h->avctx->framerate.num *= 2; h->avctx->framerate.num *= 2;
......
...@@ -2984,8 +2984,6 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx) ...@@ -2984,8 +2984,6 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
HEVCContext *s = avctx->priv_data; HEVCContext *s = avctx->priv_data;
int ret; int ret;
ff_init_cabac_states();
avctx->internal->allocate_progress = 1; avctx->internal->allocate_progress = 1;
ret = hevc_init_context(avctx); ret = hevc_init_context(avctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment