Commit 8a73b8c5 authored by Anton Khirnov's avatar Anton Khirnov Committed by Hendrik Leppkes

cabac: Make cabac starts hardcoded

There's not much reason to generate such a small table at runtime.
Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parent 9692fd76
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
...@@ -52,6 +52,5 @@ typedef struct CABACContext{ ...@@ -52,6 +52,5 @@ typedef struct CABACContext{
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size); void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
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 */
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,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
......
...@@ -659,8 +659,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx) ...@@ -659,8 +659,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) {
if(h->avctx->time_base.den < INT_MAX/2) { if(h->avctx->time_base.den < INT_MAX/2) {
......
...@@ -3234,8 +3234,6 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx) ...@@ -3234,8 +3234,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