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