#include "global.h"
#include "cabac.h"
#include "biariencode.h"
#include "image.h"
#include "mb_access.h"

Go to the source code of this file.
Functions | |
| static void | unary_bin_encode (EncodingEnvironmentPtr eep_dp, unsigned int symbol, BiContextTypePtr ctx, int ctx_offset) |
| static void | unary_bin_max_encode (EncodingEnvironmentPtr eep_dp, unsigned int symbol, BiContextTypePtr ctx, int ctx_offset, unsigned int max_symbol) |
| static void | unary_exp_golomb_level_encode (EncodingEnvironmentPtr eep_dp, unsigned int symbol, BiContextTypePtr ctx) |
| static void | unary_exp_golomb_mv_encode (EncodingEnvironmentPtr eep_dp, unsigned int symbol, BiContextTypePtr ctx, unsigned int max_bin) |
| void | CheckAvailabilityOfNeighborsCABAC (Macroblock *currMB) |
| MotionInfoContexts * | create_contexts_MotionInfo (void) |
| TextureInfoContexts * | create_contexts_TextureInfo (void) |
| void | delete_contexts_MotionInfo (MotionInfoContexts *enco_ctx) |
| void | delete_contexts_TextureInfo (TextureInfoContexts *enco_ctx) |
| void | writeFieldModeInfo_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeMB_skip_flagInfo_CABAC (Macroblock *currMB, SyntaxElement *se, DataPartition *dp) |
| void | writeMB_transform_size_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeMB_typeInfo_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeB8_typeInfo_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeIntraPredMode_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeRefFrame_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeDquant_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeMVD_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeCIPredMode_CABAC (SyntaxElement *se, DataPartition *dp) |
| void | writeCBP_BIT_CABAC (Macroblock *currMB, int b8, int bit, int cbp, int inter, EncodingEnvironmentPtr eep_dp, TextureInfoContexts *ctx) |
| void | writeCBP_CABAC (Macroblock *currMB, SyntaxElement *se, DataPartition *dp) |
| void | write_and_store_CBP_block_bit (Macroblock *currMB, EncodingEnvironmentPtr eep_dp, int type, int cbp_bit, TextureInfoContexts *tex_ctx) |
| void | write_significance_map (Macroblock *currMB, EncodingEnvironmentPtr eep_dp, int type, int coeff[], int coeff_ctr, TextureInfoContexts *tex_ctx) |
| void | write_significant_coefficients (Macroblock *currMB, EncodingEnvironmentPtr eep_dp, int type, int coeff[], TextureInfoContexts *tex_ctx) |
| void | writeRunLevel_CABAC (Macroblock *currMB, SyntaxElement *se, DataPartition *dp) |
| void | exp_golomb_encode_eq_prob (EncodingEnvironmentPtr eep_dp, unsigned int symbol, int k) |
Variables | |
| const byte | maxpos [] = {15, 14, 63, 31, 31, 15, 3, 14, 7, 15, 15, 14, 63, 31, 31, 15, 15, 14, 63, 31, 31, 15} |
| const byte | c1isdc [] = { 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1} |
| const byte | type2ctx_bcbp [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
| const byte | type2ctx_map [] = { 0, 1, 2, 3, 4, 5, 6, 7, 6, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21} |
| const byte | type2ctx_last [] = { 0, 1, 2, 3, 4, 5, 6, 7, 6, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21} |
| const byte | type2ctx_one [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
| const byte | type2ctx_abs [] = { 0, 1, 2, 3, 3, 4, 5, 6, 5, 5, 10, 11, 12, 13, 13, 14, 16, 17, 18, 19, 19, 20} |
| const byte | max_c2 [] = { 4, 4, 4, 4, 4, 4, 3, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} |
| const byte | pos2ctx_map8x8 [] |
| const byte | pos2ctx_map8x4 [] |
| const byte | pos2ctx_map4x4 [] |
| const byte | pos2ctx_map2x4c [] |
| const byte | pos2ctx_map4x4c [] |
| const byte * | pos2ctx_map [] |
| const byte | pos2ctx_map8x8i [] |
| const byte | pos2ctx_map8x4i [] |
| const byte | pos2ctx_map4x8i [] |
| const byte * | pos2ctx_map_int [] |
| const byte | pos2ctx_last8x8 [] |
| const byte | pos2ctx_last8x4 [] |
| const byte | pos2ctx_last4x4 [] |
| const byte | pos2ctx_last2x4c [] |
| const byte | pos2ctx_last4x4c [] |
| const byte * | pos2ctx_last [] |
Definition in file cabac.c.
| void CheckAvailabilityOfNeighborsCABAC | ( | Macroblock * | currMB | ) |
Check for available neighbouring blocks and set pointers in current macroblock.
Definition at line 180 of file cabac.c.
References pix_pos::available, pix_pos::mb_addr, macroblock::mb_available_left, macroblock::mb_available_up, ImageParameters::mb_data, and ImageParameters::mb_size.
Referenced by start_macroblock(), and writeMBLayer().
| MotionInfoContexts* create_contexts_MotionInfo | ( | void | ) |
Allocation of contexts models for the motion info used for arithmetic encoding.
Definition at line 206 of file cabac.c.
References no_mem_exit().
Referenced by create_coding_state(), and malloc_slice().

| TextureInfoContexts* create_contexts_TextureInfo | ( | void | ) |
Allocates of contexts models for the texture info used for arithmetic encoding.
Definition at line 225 of file cabac.c.
References no_mem_exit().
Referenced by create_coding_state(), and malloc_slice().

| void delete_contexts_MotionInfo | ( | MotionInfoContexts * | enco_ctx | ) |
Frees the memory of the contexts models used for arithmetic encoding of the motion info.
Definition at line 244 of file cabac.c.
Referenced by delete_coding_state(), and free_slice().
| void delete_contexts_TextureInfo | ( | TextureInfoContexts * | enco_ctx | ) |
Frees the memory of the contexts models used for arithmetic encoding of the texture info.
Definition at line 259 of file cabac.c.
Referenced by delete_coding_state(), and free_slice().
| void exp_golomb_encode_eq_prob | ( | EncodingEnvironmentPtr | eep_dp, | |
| unsigned int | symbol, | |||
| int | k | |||
| ) |
Exp Golomb binarization and encoding.
Definition at line 1554 of file cabac.c.
References biari_encode_symbol_eq_prob().
Referenced by unary_exp_golomb_level_encode(), and unary_exp_golomb_mv_encode().

| static void unary_bin_encode | ( | EncodingEnvironmentPtr | eep_frame, | |
| unsigned int | symbol, | |||
| BiContextTypePtr | ctx, | |||
| int | ctx_offset | |||
| ) | [static] |
Unary binarization and encoding of a symbol by using one or two distinct models for the first two and all remaining bins.
Definition at line 1494 of file cabac.c.
References biari_encode_symbol().
Referenced by writeDquant_CABAC(), and writeRefFrame_CABAC().

| static void unary_bin_max_encode | ( | EncodingEnvironmentPtr | eep_frame, | |
| unsigned int | symbol, | |||
| BiContextTypePtr | ctx, | |||
| int | ctx_offset, | |||
| unsigned int | max_symbol | |||
| ) | [static] |
Unary binarization and encoding of a symbol by using one or two distinct models for the first two and all remaining bins; no terminating "0" for max_symbol (finite symbol alphabet).
Definition at line 1523 of file cabac.c.
References biari_encode_symbol().
Referenced by writeCIPredMode_CABAC().

| static void unary_exp_golomb_level_encode | ( | EncodingEnvironmentPtr | eep_dp, | |
| unsigned int | symbol, | |||
| BiContextTypePtr | ctx | |||
| ) | [static] |
Exp-Golomb for Level Encoding.
Definition at line 1582 of file cabac.c.
References biari_encode_symbol(), and exp_golomb_encode_eq_prob().
Referenced by write_significant_coefficients().

| static void unary_exp_golomb_mv_encode | ( | EncodingEnvironmentPtr | eep_dp, | |
| unsigned int | symbol, | |||
| BiContextTypePtr | ctx, | |||
| unsigned int | max_bin | |||
| ) | [static] |
Exp-Golomb for MV Encoding.
Definition at line 1613 of file cabac.c.
References biari_encode_symbol(), and exp_golomb_encode_eq_prob().
Referenced by writeMVD_CABAC().

| void write_and_store_CBP_block_bit | ( | Macroblock * | currMB, | |
| EncodingEnvironmentPtr | eep_dp, | |||
| int | type, | |||
| int | cbp_bit, | |||
| TextureInfoContexts * | tex_ctx | |||
| ) |
Write CBP4-BIT.
Definition at line 1118 of file cabac.c.
References pix_pos::available, biari_encode_symbol(), macroblock::cbp_bits, macroblock::cbp_bits_8x8, storable_picture::chroma_format_idc, get4x4Neighbour(), ImageParameters::is_intra_block, ImageParameters::is_v_block, pix_pos::mb_addr, ImageParameters::mb_data, ImageParameters::mb_size, macroblock::mb_type, ImageParameters::subblock_x, ImageParameters::subblock_y, pix_pos::x, pix_pos::y, and YUV444.
Referenced by writeRunLevel_CABAC().

| void write_significance_map | ( | Macroblock * | currMB, | |
| EncodingEnvironmentPtr | eep_dp, | |||
| int | type, | |||
| int | coeff[], | |||
| int | coeff_ctr, | |||
| TextureInfoContexts * | tex_ctx | |||
| ) |
Write Significance MAP.
Definition at line 1343 of file cabac.c.
References biari_encode_symbol(), macroblock::mb_field, and ImageParameters::structure.
Referenced by writeRunLevel_CABAC().

| void write_significant_coefficients | ( | Macroblock * | currMB, | |
| EncodingEnvironmentPtr | eep_dp, | |||
| int | type, | |||
| int | coeff[], | |||
| TextureInfoContexts * | tex_ctx | |||
| ) |
Write Levels.
Definition at line 1387 of file cabac.c.
References biari_encode_symbol(), biari_encode_symbol_eq_prob(), and unary_exp_golomb_level_encode().
Referenced by writeRunLevel_CABAC().

| void writeB8_typeInfo_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the 8x8 block type info.
Definition at line 621 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, ImageParameters::type, syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeCBP_BIT_CABAC | ( | Macroblock * | currMB, | |
| int | b8, | |||
| int | bit, | |||
| int | cbp, | |||
| int | inter, | |||
| EncodingEnvironmentPtr | eep_dp, | |||
| TextureInfoContexts * | ctx | |||
| ) |
This function is used to arithmetically encode the coded block pattern of an 8x8 block.
Definition at line 1006 of file cabac.c.
References pix_pos::available, biari_encode_symbol(), macroblock::cbp, get4x4Neighbour(), pix_pos::mb_addr, macroblock::mb_available_up, ImageParameters::mb_data, ImageParameters::mb_size, macroblock::mb_type, and pix_pos::y.
Referenced by RDCost_for_8x8blocks(), and writeCBP_CABAC().

| void writeCBP_CABAC | ( | Macroblock * | currMB, | |
| SyntaxElement * | se, | |||
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the coded block pattern of a macroblock.
Definition at line 1048 of file cabac.c.
References arienco_bits_written(), macroblock::b8mode, biari_encode_symbol(), datapartition::bitstream, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, macroblock::mb_available_left, macroblock::mb_available_up, Slice::tex_ctx, syntaxelement::value1, Bitstream::write_flag, writeCBP_BIT_CABAC(), YUV400, YUV444, and ImageParameters::yuv_format.
Referenced by init_slice().

| void writeCIPredMode_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the chroma intra prediction mode of an 8x8 block.
Definition at line 969 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, macroblock::c_ipred_mode, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, macroblock::mb_available_left, macroblock::mb_available_up, ImageParameters::mb_data, macroblock::mb_type, Slice::tex_ctx, unary_bin_max_encode(), syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeDquant_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the coded block pattern of a given delta quant.
Definition at line 839 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, ImageParameters::mb_data, Slice::mot_ctx, macroblock::prev_dqp, unary_bin_encode(), syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeFieldModeInfo_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the field mode info of a given MB in the case of mb-based frame/field decision.
Definition at line 275 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, syntaxelement::context, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, ImageParameters::mb_data, macroblock::mb_field, macroblock::mbAddrA, macroblock::mbAddrB, macroblock::mbAvailA, macroblock::mbAvailB, syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeIntraPredMode_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode a pair of intra prediction modes of a given MB.
Definition at line 722 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeMB_skip_flagInfo_CABAC | ( | Macroblock * | currMB, | |
| SyntaxElement * | se, | |||
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the mb_skip_flag.
Definition at line 304 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, syntaxelement::context, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, macroblock::mb_available_left, macroblock::mb_available_up, macroblock::skip_flag, ImageParameters::type, syntaxelement::value1, syntaxelement::value2, and Bitstream::write_flag.
Referenced by writeMBLayer().

| void writeMB_transform_size_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the macroblock intra_pred_size flag info of a given MB.
Definition at line 350 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), datapartition::bitstream, syntaxelement::context, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, macroblock::luma_transform_size_8x8_flag, macroblock::mb_available_left, macroblock::mb_available_up, ImageParameters::mb_data, and Bitstream::write_flag.
Referenced by init_slice().

| void writeMB_typeInfo_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the macroblock type info of a given MB.
Definition at line 380 of file cabac.c.
References arienco_bits_written(), biari_encode_symbol(), biari_encode_symbol_final(), datapartition::bitstream, syntaxelement::context, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, macroblock::mb_available_left, macroblock::mb_available_up, ImageParameters::mb_data, macroblock::mb_type, ImageParameters::type, syntaxelement::value1, and Bitstream::write_flag.
Referenced by init_slice().

| void writeMVD_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the motion vector data of a B-frame MB.
Definition at line 876 of file cabac.c.
References arienco_bits_written(), pix_pos::available, biari_encode_symbol(), biari_encode_symbol_eq_prob(), datapartition::bitstream, syntaxelement::context, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, get4x4Neighbour(), syntaxelement::len, pix_pos::mb_addr, ImageParameters::mb_data, macroblock::mb_field, ImageParameters::mb_size, ImageParameters::MbaffFrameFlag, Slice::mot_ctx, macroblock::mvd, ImageParameters::subblock_x, ImageParameters::subblock_y, unary_exp_golomb_mv_encode(), syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, pix_pos::x, and pix_pos::y.
Referenced by init_slice().

| void writeRefFrame_CABAC | ( | SyntaxElement * | se, | |
| DataPartition * | dp | |||
| ) |
This function is used to arithmetically encode the reference parameter of a given MB.
Definition at line 753 of file cabac.c.
References arienco_bits_written(), pix_pos::available, macroblock::b8mode, biari_encode_symbol(), datapartition::bitstream, syntaxelement::context, ImageParameters::current_mb_nr, ImageParameters::currentSlice, datapartition::ee_cabac, get4x4Neighbour(), syntaxelement::len, pix_pos::mb_addr, ImageParameters::mb_data, macroblock::mb_field, ImageParameters::mb_size, ImageParameters::MbaffFrameFlag, Slice::mot_ctx, storable_picture::motion, pix_pos::pos_x, pix_pos::pos_y, pic_motion_params::ref_idx, ImageParameters::subblock_x, ImageParameters::subblock_y, ImageParameters::type, unary_bin_encode(), syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, pix_pos::x, and pix_pos::y.
Referenced by init_slice().

| void writeRunLevel_CABAC | ( | Macroblock * | currMB, | |
| SyntaxElement * | se, | |||
| DataPartition * | dp | |||
| ) |
Write Block-Transform Coefficients.
Definition at line 1443 of file cabac.c.
References arienco_bits_written(), datapartition::bitstream, syntaxelement::context, ImageParameters::currentSlice, datapartition::ee_cabac, syntaxelement::len, Slice::tex_ctx, syntaxelement::value1, syntaxelement::value2, write_and_store_CBP_block_bit(), Bitstream::write_flag, write_significance_map(), and write_significant_coefficients().
Referenced by writeChromaCoeff(), writeCoeff16x16(), writeCoeff4x4_CABAC(), and writeCoeff8x8_CABAC().

| const byte* pos2ctx_last[] |
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_last2x4c[] |
| const byte pos2ctx_last4x4[] |
| const byte pos2ctx_last4x4c[] |
| const byte pos2ctx_last8x4[] |
| const byte pos2ctx_last8x8[] |
| const byte* pos2ctx_map[] |
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_map2x4c[] |
| const byte pos2ctx_map4x4[] |
| const byte pos2ctx_map4x4c[] |
| const byte pos2ctx_map4x8i[] |
| const byte pos2ctx_map8x4[] |
| const byte pos2ctx_map8x4i[] |
| const byte pos2ctx_map8x8[] |
| const byte pos2ctx_map8x8i[] |
| const byte* pos2ctx_map_int[] |
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
}