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