libavcodec/cabac.h
d592f67f
 /*
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  *
b78e7197
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
d592f67f
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
b78e7197
  * version 2.1 of the License, or (at your option) any later version.
d592f67f
  *
b78e7197
  * FFmpeg is distributed in the hope that it will be useful,
d592f67f
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
b78e7197
  * License along with FFmpeg; if not, write to the Free Software
5509bffa
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d592f67f
  */
115329f1
 
d592f67f
 /**
ba87f080
  * @file
d592f67f
  * Context Adaptive Binary Arithmetic Coder.
  */
 
98790382
 #ifndef AVCODEC_CABAC_H
 #define AVCODEC_CABAC_H
26b4fe82
 
55b9ef18
 #include <stdint.h>
6b712acc
 
b2755007
 #include "put_bits.h"
d592f67f
 
7f668cd2
 #define H264_NORM_SHIFT_OFFSET 0
 #define H264_LPS_RANGE_OFFSET 512
 #define H264_MLPS_STATE_OFFSET 1024
 #define H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET 1280
 
5659b509
 #define CABAC_BITS 16
ec7eb896
 #define CABAC_MASK ((1<<CABAC_BITS)-1)
 
d592f67f
 typedef struct CABACContext{
     int low;
     int range;
     int outstanding_count;
e96682e6
     const uint8_t *bytestream_start;
     const uint8_t *bytestream;
bba83349
     const uint8_t *bytestream_end;
d592f67f
     PutBitContext pb;
 }CABACContext;
 
 void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
e96682e6
 void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
bfb39023
 void ff_init_cabac_states(void);
d592f67f
 
98790382
 #endif /* AVCODEC_CABAC_H */