#include "global.h"
#include "cabac.h"
#include "memalloc.h"
#include "elements.h"
#include "image.h"
#include "biaridecod.h"
#include "mb_access.h"
#include "vlc.h"
Go to the source code of this file.
Functions | |
static unsigned int | unary_bin_decode (DecodingEnvironmentPtr dep_dp, BiContextTypePtr ctx, int ctx_offset) |
static unsigned int | unary_bin_max_decode (DecodingEnvironmentPtr dep_dp, BiContextTypePtr ctx, int ctx_offset, unsigned int max_symbol) |
static unsigned int | unary_exp_golomb_level_decode (DecodingEnvironmentPtr dep_dp, BiContextTypePtr ctx) |
static unsigned int | unary_exp_golomb_mv_decode (DecodingEnvironmentPtr dep_dp, BiContextTypePtr ctx, unsigned int max_bin) |
void | CheckAvailabilityOfNeighborsCABAC (Macroblock *currMB) |
void | cabac_new_slice (Slice *currSlice) |
MotionInfoContexts * | create_contexts_MotionInfo (void) |
TextureInfoContexts * | create_contexts_TextureInfo (void) |
void | delete_contexts_MotionInfo (MotionInfoContexts *deco_ctx) |
void | delete_contexts_TextureInfo (TextureInfoContexts *deco_ctx) |
void | readFieldModeInfo_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
int | check_next_mb_and_get_field_mode_CABAC (Slice *currSlice, SyntaxElement *se, DataPartition *act_dp) |
void | readMVD_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readB8_typeInfo_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readMB_skip_flagInfo_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readMB_transform_size_flag_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readMB_typeInfo_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readIntraPredMode_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readRefFrame_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readDquant_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readCBP_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
void | readCIPredMode_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
int | read_and_store_CBP_block_bit_444 (Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int type) |
int | read_and_store_CBP_block_bit_normal (Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int type) |
int | read_significance_map (Macroblock *currMB, DecodingEnvironmentPtr dep_dp, int type, int coeff[]) |
void | read_significant_coefficients (DecodingEnvironmentPtr dep_dp, TextureInfoContexts *tex_ctx, int type, int coeff[]) |
void | readRunLevel_CABAC (Macroblock *currMB, SyntaxElement *se, DecodingEnvironmentPtr dep_dp) |
int | readSyntaxElement_CABAC (SyntaxElement *se, ImageParameters *p_Img, DataPartition *this_dataPart) |
int | cabac_startcode_follows (Slice *currSlice, int eos_bit) |
unsigned int | exp_golomb_decode_eq_prob (DecodingEnvironmentPtr dep_dp, int k) |
void | readIPCM_CABAC (Slice *currSlice, struct datapartition *dP) |
Variables | |
static const int | maxpos [] = {15, 14, 63, 31, 31, 15, 3, 14, 7, 15, 15, 14, 63, 31, 31, 15, 15, 14, 63, 31, 31, 15} |
static const int | c1isdc [] = { 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1} |
static const int | type2ctx_bcbp [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
static const int | type2ctx_map [] = { 0, 1, 2, 3, 4, 5, 6, 7, 6, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21} |
static const int | type2ctx_last [] = { 0, 1, 2, 3, 4, 5, 6, 7, 6, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21} |
static const int | type2ctx_one [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
static const int | type2ctx_abs [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
static const int | max_c2 [] = { 4, 4, 4, 4, 4, 4, 3, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} |
static const byte | pos2ctx_map8x8 [] |
static const byte | pos2ctx_map8x4 [] |
static const byte | pos2ctx_map4x4 [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14} |
static const byte | pos2ctx_map2x4c [] = { 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} |
static const byte | pos2ctx_map4x4c [] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2} |
static const byte * | pos2ctx_map [] |
static const byte | pos2ctx_map8x8i [] |
static const byte | pos2ctx_map8x4i [] |
static const byte | pos2ctx_map4x8i [] |
static const byte * | pos2ctx_map_int [] |
static const byte | pos2ctx_last8x8 [] |
static const byte | pos2ctx_last8x4 [] |
static const byte | pos2ctx_last4x4 [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} |
static const byte | pos2ctx_last2x4c [] = { 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} |
static const byte | pos2ctx_last4x4c [] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2} |
static const byte * | pos2ctx_last [] |
Definition in file cabac.c.
int cabac_startcode_follows | ( | Slice * | currSlice, | |
int | eos_bit | |||
) |
finding end of a slice in case this is not the end of a frame
Unsure whether the "correction" below actually solves an off-by-one problem or whether it introduces one in some cases :-( Anyway, with this change the bit stream format works with CABAC again. StW, 8.7.02
Definition at line 1756 of file cabac.c.
References assignSE2partition, biari_decode_final(), slice::dp_mode, and slice::partArr.
MotionInfoContexts* create_contexts_MotionInfo | ( | void | ) |
Allocation of contexts models for the motion info used for arithmetic decoding.
Definition at line 77 of file cabac.c.
References no_mem_exit().
Referenced by malloc_slice().
TextureInfoContexts* create_contexts_TextureInfo | ( | void | ) |
Allocates of contexts models for the texture info used for arithmetic decoding.
Definition at line 96 of file cabac.c.
References no_mem_exit().
Referenced by malloc_slice().
void delete_contexts_MotionInfo | ( | MotionInfoContexts * | deco_ctx | ) |
Frees the memory of the contexts models used for arithmetic decoding of the motion info.
Definition at line 115 of file cabac.c.
Referenced by free_slice().
void delete_contexts_TextureInfo | ( | TextureInfoContexts * | deco_ctx | ) |
Frees the memory of the contexts models used for arithmetic decoding of the texture info.
Definition at line 131 of file cabac.c.
Referenced by free_slice().
unsigned int exp_golomb_decode_eq_prob | ( | DecodingEnvironmentPtr | dep_dp, | |
int | k | |||
) |
Exp Golomb binarization and decoding of a symbol with prob. of 0.5.
Definition at line 1788 of file cabac.c.
References biari_decode_symbol_eq_prob().
Referenced by unary_exp_golomb_level_decode(), and unary_exp_golomb_mv_decode().
int read_and_store_CBP_block_bit_444 | ( | Macroblock * | currMB, | |
DecodingEnvironmentPtr | dep_dp, | |||
int | type | |||
) |
Read CBP4-BIT.
Definition at line 1087 of file cabac.c.
References biari_decode_symbol(), get4x4Neighbour(), macroblock::p_Img, macroblock::p_Slice, slice::tex_ctx, and YUV444.
Referenced by readRunLevel_CABAC().
int read_and_store_CBP_block_bit_normal | ( | Macroblock * | currMB, | |
DecodingEnvironmentPtr | dep_dp, | |||
int | type | |||
) |
Read CBP4-BIT.
Definition at line 1321 of file cabac.c.
References biari_decode_symbol(), get4x4Neighbour(), macroblock::p_Img, macroblock::p_Slice, and slice::tex_ctx.
Referenced by readRunLevel_CABAC().
int read_significance_map | ( | Macroblock * | currMB, | |
DecodingEnvironmentPtr | dep_dp, | |||
int | type, | |||
int | coeff[] | |||
) |
Read Significance MAP.
Definition at line 1495 of file cabac.c.
References biari_decode_symbol(), macroblock::p_Img, macroblock::p_Slice, and slice::tex_ctx.
Referenced by readRunLevel_CABAC().
void read_significant_coefficients | ( | DecodingEnvironmentPtr | dep_dp, | |
TextureInfoContexts * | tex_ctx, | |||
int | type, | |||
int | coeff[] | |||
) |
Read Levels.
Definition at line 1560 of file cabac.c.
References biari_decode_symbol(), biari_decode_symbol_eq_prob(), and unary_exp_golomb_level_decode().
Referenced by readRunLevel_CABAC().
void readB8_typeInfo_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the 8x8 block type.
Definition at line 337 of file cabac.c.
References biari_decode_symbol(), slice::mot_ctx, macroblock::p_Slice, slice::slice_type, and syntaxelement::value1.
Referenced by read_one_macroblock_b_slice(), and read_one_macroblock_p_slice().
void readCBP_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the coded block pattern of a given MB.
Definition at line 909 of file cabac.c.
References biari_decode_symbol(), get4x4Neighbour(), macroblock::mb_left, macroblock::mb_up, macroblock::p_Img, macroblock::p_Slice, slice::tex_ctx, syntaxelement::value1, YUV400, and YUV444.
Referenced by read_CBP_and_coeffs_from_NAL_CABAC().
void readCIPredMode_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the chroma intra prediction mode of a given MB.
Definition at line 1043 of file cabac.c.
References biari_decode_symbol(), macroblock::c_ipred_mode, macroblock::mb_left, macroblock::mb_up, macroblock::p_Slice, slice::tex_ctx, unary_bin_max_decode(), and syntaxelement::value1.
Referenced by read_ipred_modes().
void readDquant_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the delta qp of a given MB.
Definition at line 874 of file cabac.c.
References biari_decode_symbol(), slice::mot_ctx, macroblock::p_Slice, unary_bin_decode(), and syntaxelement::value1.
void readIntraPredMode_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode a pair of intra prediction modes of a given MB.
Definition at line 765 of file cabac.c.
References biari_decode_symbol(), macroblock::p_Slice, slice::tex_ctx, and syntaxelement::value1.
Referenced by read_ipred_modes().
void readIPCM_CABAC | ( | Slice * | currSlice, | |
struct datapartition * | dP | |||
) |
Read I_PCM macroblock.
Definition at line 1896 of file cabac.c.
References Bitstream::bitstream_length, GetBits(), Bitstream::streamBuffer, and YUV400.
Referenced by read_IPCM_coeffs_from_NAL().
void readMB_skip_flagInfo_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the macroblock type info of a given MB.
Definition at line 421 of file cabac.c.
References biari_decode_symbol(), macroblock::mb_left, macroblock::mb_up, slice::mot_ctx, macroblock::p_Slice, slice::slice_type, syntaxelement::value1, and syntaxelement::value2.
Referenced by read_one_macroblock_b_slice(), and read_one_macroblock_p_slice().
void readMB_transform_size_flag_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the macroblock intra_pred_size flag info of a given MB.
Definition at line 470 of file cabac.c.
References biari_decode_symbol(), macroblock::mb_left, macroblock::mb_up, macroblock::p_Slice, slice::tex_ctx, and syntaxelement::value1.
Referenced by read_CBP_and_coeffs_from_NAL_CABAC(), read_CBP_and_coeffs_from_NAL_CAVLC(), read_one_macroblock_b_slice(), read_one_macroblock_i_slice(), and read_one_macroblock_p_slice().
void readMB_typeInfo_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the macroblock type info of a given MB.
Definition at line 499 of file cabac.c.
References biari_decode_final(), biari_decode_symbol(), syntaxelement::context, macroblock::mb_left, macroblock::mb_up, slice::mot_ctx, macroblock::p_Slice, slice::slice_type, and syntaxelement::value1.
Referenced by read_one_macroblock_b_slice(), read_one_macroblock_i_slice(), and read_one_macroblock_p_slice().
void readMVD_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the motion vector data of a B-frame MB.
Definition at line 252 of file cabac.c.
References biari_decode_symbol(), biari_decode_symbol_eq_prob(), syntaxelement::context, get4x4Neighbour(), slice::mot_ctx, macroblock::p_Img, macroblock::p_Slice, unary_exp_golomb_mv_decode(), syntaxelement::value1, and syntaxelement::value2.
Referenced by read_motion_info_from_NAL_b_slice(), and read_motion_info_from_NAL_p_slice().
void readRefFrame_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
This function is used to arithmetically decode the reference parameter of a given MB.
Definition at line 799 of file cabac.c.
References biari_decode_symbol(), syntaxelement::context, get4x4Neighbour(), slice::mot_ctx, storable_picture::motion, macroblock::p_Img, macroblock::p_Slice, pic_motion_params::ref_idx, unary_bin_decode(), syntaxelement::value1, and syntaxelement::value2.
Referenced by prepareListforRefIdx().
void readRunLevel_CABAC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DecodingEnvironmentPtr | dep_dp | |||
) |
Read Block-Transform Coefficients.
Definition at line 1602 of file cabac.c.
References syntaxelement::context, macroblock::p_Img, macroblock::p_Slice, read_and_store_CBP_block_bit_444(), read_and_store_CBP_block_bit_normal(), read_significance_map(), read_significant_coefficients(), slice::tex_ctx, syntaxelement::value1, syntaxelement::value2, and YUV444.
Referenced by read_CBP_and_coeffs_from_NAL_CABAC(), read_CBP_and_coeffs_from_NAL_CAVLC(), readCompCoeff4x4SMB_CABAC(), and readCompCoeff8x8_CABAC().
int readSyntaxElement_CABAC | ( | SyntaxElement * | se, | |
ImageParameters * | p_Img, | |||
DataPartition * | this_dataPart | |||
) |
arithmetic decoding
Definition at line 1658 of file cabac.c.
References arideco_bits_read(), syntaxelement::len, and syntaxelement::reading.
static unsigned int unary_bin_decode | ( | DecodingEnvironmentPtr | dep_dp, | |
BiContextTypePtr | ctx, | |||
int | ctx_offset | |||
) | [static] |
decoding of unary binarization using one or 2 distinct models for the first and all remaining bins
Definition at line 1721 of file cabac.c.
References biari_decode_symbol().
Referenced by readDquant_CABAC(), and readRefFrame_CABAC().
static unsigned int unary_bin_max_decode | ( | DecodingEnvironmentPtr | dep_dp, | |
BiContextTypePtr | ctx, | |||
int | ctx_offset, | |||
unsigned int | max_symbol | |||
) | [static] |
decoding of unary binarization using one or 2 distinct models for the first and all remaining bins; no terminating "0" for max_symbol
Definition at line 1686 of file cabac.c.
References biari_decode_symbol().
Referenced by readCIPredMode_CABAC().
static unsigned int unary_exp_golomb_level_decode | ( | DecodingEnvironmentPtr | dep_dp, | |
BiContextTypePtr | ctx | |||
) | [static] |
Exp-Golomb decoding for LEVELS.
Definition at line 1820 of file cabac.c.
References biari_decode_symbol(), and exp_golomb_decode_eq_prob().
Referenced by read_significant_coefficients().
static unsigned int unary_exp_golomb_mv_decode | ( | DecodingEnvironmentPtr | dep_dp, | |
BiContextTypePtr | ctx, | |||
unsigned int | max_bin | |||
) | [static] |
Exp-Golomb decoding for Motion Vectors.
Definition at line 1856 of file cabac.c.
References biari_decode_symbol(), and exp_golomb_decode_eq_prob().
Referenced by readMVD_CABAC().
const byte* pos2ctx_last[] [static] |
Initial value:
{pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last8x8, pos2ctx_last8x4, pos2ctx_last8x4, pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last2x4c, pos2ctx_last4x4c, pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last8x8,pos2ctx_last8x4, pos2ctx_last8x4, pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last4x4, pos2ctx_last8x8,pos2ctx_last8x4, pos2ctx_last8x4, pos2ctx_last4x4}
const byte pos2ctx_last8x4[] [static] |
const byte pos2ctx_last8x8[] [static] |
const byte* pos2ctx_map[] [static] |
Initial value:
{pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8, pos2ctx_map8x4, pos2ctx_map8x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map2x4c, pos2ctx_map4x4c, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8,pos2ctx_map8x4, pos2ctx_map8x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8,pos2ctx_map8x4, pos2ctx_map8x4,pos2ctx_map4x4}
const byte pos2ctx_map4x8i[] [static] |
const byte pos2ctx_map8x4[] [static] |
const byte pos2ctx_map8x4i[] [static] |
const byte pos2ctx_map8x8[] [static] |
const byte pos2ctx_map8x8i[] [static] |
const byte* pos2ctx_map_int[] [static] |
Initial value:
{pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8i,pos2ctx_map8x4i, pos2ctx_map4x8i,pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map2x4c, pos2ctx_map4x4c, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8i,pos2ctx_map8x4i, pos2ctx_map8x4i,pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map4x4, pos2ctx_map8x8i,pos2ctx_map8x4i, pos2ctx_map8x4i,pos2ctx_map4x4}