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>
|
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg 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
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* FFmpeg 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
|
2006-10-07 17:30:46 +02:00
|
|
|
* License along with FFmpeg; 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
|
|
|
|
2015-10-07 17:39:46 +02:00
|
|
|
extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63];
|
2012-04-27 22:12:19 +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;
|
|
|
|
int outstanding_count;
|
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
|
|
|
PutBitContext pb;
|
|
|
|
}CABACContext;
|
|
|
|
|
|
|
|
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
|
2015-11-27 13:37:50 +01:00
|
|
|
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
2003-05-28 20:44:52 +02:00
|
|
|
|
2008-08-31 09:39:47 +02:00
|
|
|
#endif /* AVCODEC_CABAC_H */
|