2003-05-28 18:44:52 +00:00
|
|
|
/*
|
|
|
|
* H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
|
|
|
|
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2003-05-28 18:44:52 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-05-28 18:44:52 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2003-05-28 18:44:52 +00:00
|
|
|
* 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
|
2006-10-07 15:30:46 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-01-12 22:43:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2003-05-28 18:44:52 +00:00
|
|
|
*/
|
2005-12-17 18:14:38 +00:00
|
|
|
|
2003-05-28 18:44:52 +00:00
|
|
|
/**
|
2010-04-20 14:45:34 +00:00
|
|
|
* @file
|
2003-05-28 18:44:52 +00:00
|
|
|
* Context Adaptive Binary Arithmetic Coder.
|
|
|
|
*/
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVCODEC_CABAC_H
|
|
|
|
#define AVCODEC_CABAC_H
|
2007-05-10 22:26:44 +00:00
|
|
|
|
2012-01-12 20:56:02 +00:00
|
|
|
#include <stdint.h>
|
2011-06-20 00:54:32 +00:00
|
|
|
|
2009-04-12 08:35:26 +00:00
|
|
|
#include "put_bits.h"
|
2003-05-28 18:44:52 +00:00
|
|
|
|
2012-04-27 20:12:19 +00:00
|
|
|
#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
|
|
|
|
|
2006-10-07 15:44:14 +00:00
|
|
|
#define CABAC_BITS 16
|
2004-10-26 03:12:21 +00:00
|
|
|
#define CABAC_MASK ((1<<CABAC_BITS)-1)
|
|
|
|
|
2003-05-28 18:44:52 +00:00
|
|
|
typedef struct CABACContext{
|
|
|
|
int low;
|
|
|
|
int range;
|
|
|
|
int outstanding_count;
|
2004-05-18 17:09:46 +00:00
|
|
|
const uint8_t *bytestream_start;
|
|
|
|
const uint8_t *bytestream;
|
2004-07-08 00:53:21 +00:00
|
|
|
const uint8_t *bytestream_end;
|
2003-05-28 18:44:52 +00:00
|
|
|
PutBitContext pb;
|
|
|
|
}CABACContext;
|
|
|
|
|
|
|
|
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
|
2004-05-18 17:09:46 +00:00
|
|
|
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
2006-10-11 14:44:17 +00:00
|
|
|
void ff_init_cabac_states(CABACContext *c);
|
2003-05-28 18:44:52 +00:00
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#endif /* AVCODEC_CABAC_H */
|