#include "contributors.h"
#include <math.h>
#include "global.h"
#include "enc_statistics.h"
#include "vlc.h"
Go to the source code of this file.
Definition in file vlc.c.
void cbp_linfo_inter_normal | ( | int | cbp, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
Definition at line 335 of file vlc.c.
References NCBP, and ue_linfo().
Referenced by start_macroblock().
void cbp_linfo_inter_other | ( | int | cbp, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
Definition at line 322 of file vlc.c.
References NCBP, and ue_linfo().
Referenced by start_macroblock().
void cbp_linfo_intra_normal | ( | int | cbp, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
Definition at line 309 of file vlc.c.
References NCBP, and ue_linfo().
Referenced by start_macroblock().
void cbp_linfo_intra_other | ( | int | cbp, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
Definition at line 295 of file vlc.c.
References NCBP, and ue_linfo().
Referenced by start_macroblock().
void levrun_linfo_c2x2 | ( | int | level, | |
int | run, | |||
int * | len, | |||
int * | info | |||
) |
void levrun_linfo_inter | ( | int | level, | |
int | run, | |||
int * | len, | |||
int * | info | |||
) |
Single scan coefficients.
Definition at line 399 of file vlc.c.
Referenced by dct_4x4_sp().
void reset_mb_nz_coeff | ( | ImageParameters * | p_Img, | |
int | mb_number | |||
) |
Resets the nz_coeff parameters for a macroblock.
Definition at line 1454 of file vlc.c.
References img_par::nz_coeff.
Referenced by encode_one_macroblock_high(), encode_one_macroblock_highfast(), encode_one_macroblock_highloss(), encode_one_macroblock_low(), write_macroblock(), writeCoeff16x16_CABAC(), writeCoeff16x16_CAVLC(), writeMBLayerBSlice(), and writeMBLayerPSlice().
void se_linfo | ( | int | se, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
mapping for se(v) syntax elements
se | value to be mapped | |
dummy | dummy parameter | |
len | returns mapped value length | |
info | returns mapped value |
Definition at line 272 of file vlc.c.
Referenced by se_v(), and writeSE_SVLC().
int se_v | ( | char * | tracestring, | |
int | value, | |||
Bitstream * | bitstream | |||
) |
se_v, writes an se(v) syntax element, returns the length in bits
tracestring | the string for the trace file | |
value | the value to be coded | |
bitstream | the target bitstream the value should be coded into |
Definition at line 117 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, se_linfo(), symbol2uvlc(), syntaxelement::value1, syntaxelement::value2, and writeUVLC2buffer().
Referenced by GeneratePic_parameter_set_rbsp(), GenerateSeq_parameter_set_rbsp(), pred_weight_table(), Scaling_List(), and SliceHeader().
int symbol2uvlc | ( | SyntaxElement * | sym | ) |
Makes code word and passes it back A code word has the following format: 0 0 0 ... 1 Xn ...X2 X1 X0.
Definition at line 451 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::inf, and syntaxelement::len.
Referenced by se_v(), ue_v(), writeCBP_VLC(), writeSE_SVLC(), writeSE_UVLC(), and writeSyntaxElement2Buf_UVLC().
int symbol2vlc | ( | SyntaxElement * | sym | ) |
Makes code word and passes it back.
Definition at line 770 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::inf, and syntaxelement::len.
Referenced by writeSyntaxElement_Level_VLC1(), writeSyntaxElement_Level_VLCN(), writeSyntaxElement_NumCoeffTrailingOnes(), writeSyntaxElement_NumCoeffTrailingOnesChromaDC(), writeSyntaxElement_Run(), writeSyntaxElement_TotalZeros(), writeSyntaxElement_TotalZerosChromaDC(), and writeSyntaxElement_VLC().
u_1, writes a flag (u(1) syntax element, returns the length in bits, always 1
tracestring | the string for the trace file | |
value | the value to be coded | |
bitstream | the target bitstream the value should be coded into |
Definition at line 163 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::len, syntaxelement::value1, and writeUVLC2buffer().
Referenced by dec_ref_pic_marking(), GeneratePic_parameter_set_rbsp(), GenerateSeq_parameter_set_rbsp(), GenerateVUI_parameters_rbsp(), pred_weight_table(), ref_pic_list_reordering(), SliceHeader(), and WriteHRDParameters().
int u_v | ( | int | n, | |
char * | tracestring, | |||
int | value, | |||
Bitstream * | bitstream | |||
) |
u_v, writes a n bit fixed length syntax element, returns the length in bits,
n | length in bits | |
tracestring | the string for the trace file | |
value | the value to be coded | |
bitstream | the target bitstream the value should be coded into |
Definition at line 210 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::len, syntaxelement::value1, and writeUVLC2buffer().
Referenced by GeneratePic_parameter_set_rbsp(), GenerateSEImessage_rbsp(), GenerateSeq_parameter_set_rbsp(), GenerateVUI_parameters_rbsp(), SliceHeader(), and WriteHRDParameters().
void ue_linfo | ( | int | ue, | |
int | dummy, | |||
int * | len, | |||
int * | info | |||
) |
mapping for ue(v) syntax elements
ue | value to be mapped | |
dummy | dummy parameter | |
info | returns mapped value | |
len | returns mapped value length |
Definition at line 245 of file vlc.c.
Referenced by cbp_linfo_inter_normal(), cbp_linfo_inter_other(), cbp_linfo_intra_normal(), cbp_linfo_intra_other(), ComposeSparePictureMessage(), CompressSpareMBMap(), FinalizeSpareMBMap(), FinalizeSubseqInfo(), RDCost_for_8x8blocks(), RDCost_for_macroblocks(), ue_v(), and writeSE_UVLC().
int ue_v | ( | char * | tracestring, | |
int | value, | |||
Bitstream * | bitstream | |||
) |
ue_v, writes an ue(v) syntax element, returns the length in bits
tracestring | the string for the trace file | |
value | the value to be coded | |
bitstream | the target bitstream the value should be coded into |
Definition at line 72 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2uvlc(), ue_linfo(), syntaxelement::value1, syntaxelement::value2, and writeUVLC2buffer().
Referenced by dec_ref_pic_marking(), GeneratePic_parameter_set_rbsp(), GenerateSeq_parameter_set_rbsp(), GenerateVUI_parameters_rbsp(), pred_weight_table(), ref_pic_list_reordering(), SliceHeader(), and WriteHRDParameters().
void writeCBP_VLC | ( | Macroblock * | currMB, | |
SyntaxElement * | se, | |||
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 510 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, macroblock::mb_type, symbol2uvlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
void writeIntraPredMode_CAVLC | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates code and passes the codeword to the buffer
Definition at line 540 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::inf, syntaxelement::len, syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
void writeSE_Dummy | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 734 of file vlc.c.
References syntaxelement::len.
void writeSE_Fix | ( | SyntaxElement * | se, | |
Bitstream * | bitstream | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 748 of file vlc.c.
References writeUVLC2buffer().
void writeSE_Flag | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 692 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::len, syntaxelement::value1, and writeUVLC2buffer().
Referenced by writeMBLayerBSlice(), and writeMBLayerPSlice().
void writeSE_invFlag | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 713 of file vlc.c.
References syntaxelement::bitpattern, syntaxelement::len, syntaxelement::value1, and writeUVLC2buffer().
void writeSE_SVLC | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 488 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, se_linfo(), symbol2uvlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
void writeSE_UVLC | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 466 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2uvlc(), syntaxelement::type, ue_linfo(), syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by end_macroblock(), Partition_BC_Header(), writeMBLayerBSlice(), and writeMBLayerPSlice().
int writeSyntaxElement2Buf_Fixed | ( | SyntaxElement * | se, | |
Bitstream * | this_streamBuffer | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 673 of file vlc.c.
References syntaxelement::len, syntaxelement::type, and writeUVLC2buffer().
Referenced by FinalizeSubseqInfo().
int writeSyntaxElement2Buf_UVLC | ( | SyntaxElement * | se, | |
Bitstream * | this_streamBuffer | |||
) |
generates UVLC code and passes the codeword to the buffer
Definition at line 577 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2uvlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeUVLC2buffer().
Referenced by ComposeSparePictureMessage(), CompressSpareMBMap(), FinalizeSpareMBMap(), and FinalizeSubseqInfo().
int writeSyntaxElement_Level_VLC1 | ( | SyntaxElement * | se, | |
DataPartition * | dp, | |||
int | profile_idc | |||
) |
write VLC for Coeff Level (VLC1)
Definition at line 1224 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_Level_VLCN | ( | SyntaxElement * | se, | |
int | vlc, | |||
DataPartition * | dp, | |||
int | profile_idc | |||
) |
write VLC for Coeff Level
Definition at line 1293 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_NumCoeffTrailingOnes | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
write VLC for NumCoeff and TrailingOnes
Definition at line 820 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_NumCoeffTrailingOnesChromaDC | ( | ImageParameters * | p_Img, | |
SyntaxElement * | se, | |||
DataPartition * | dp | |||
) |
write VLC for NumCoeff and TrailingOnes for Chroma DC
Definition at line 918 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_Run | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
write VLC for Run Before Next Coefficient, VLC0
Definition at line 1167 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_TotalZeros | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
write VLC for TotalZeros
Definition at line 994 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_TotalZerosChromaDC | ( | ImageParameters * | p_Img, | |
SyntaxElement * | se, | |||
DataPartition * | dp | |||
) |
write VLC for TotalZeros for Chroma DC
Definition at line 1067 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int writeSyntaxElement_VLC | ( | SyntaxElement * | se, | |
DataPartition * | dp | |||
) |
generates VLC code and passes the codeword to the buffer
Definition at line 793 of file vlc.c.
References syntaxelement::inf, syntaxelement::len, symbol2vlc(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, Bitstream::write_flag, and writeUVLC2buffer().
Referenced by writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
void writeUVLC2buffer | ( | SyntaxElement * | se, | |
Bitstream * | currStream | |||
) |
writes UVLC code to the appropriate buffer
Definition at line 601 of file vlc.c.
References syntaxelement::bitpattern, Bitstream::bits_to_go, Bitstream::byte_buf, Bitstream::byte_pos, syntaxelement::len, and Bitstream::streamBuffer.
Referenced by se_v(), u_1(), u_v(), ue_v(), writeCBP_VLC(), writeIntraPredMode_CAVLC(), writeSE_Fix(), writeSE_Flag(), writeSE_invFlag(), writeSE_SVLC(), writeSE_UVLC(), writeSyntaxElement2Buf_Fixed(), writeSyntaxElement2Buf_UVLC(), writeSyntaxElement_Level_VLC1(), writeSyntaxElement_Level_VLCN(), writeSyntaxElement_NumCoeffTrailingOnes(), writeSyntaxElement_NumCoeffTrailingOnesChromaDC(), writeSyntaxElement_Run(), writeSyntaxElement_TotalZeros(), writeSyntaxElement_TotalZerosChromaDC(), and writeSyntaxElement_VLC().
void writeVlcByteAlign | ( | ImageParameters * | p_Img, | |
Bitstream * | currStream, | |||
StatParameters * | cur_stats | |||
) |
puts the less than 8 bits in the byte buffer of the Bitstream into the streamBuffer.
p_Img | ImageParameters for current picture encoding | |
currStream | the Bitstream the alignment should be established | |
cur_stats | currently used statistics parameters |
Definition at line 1438 of file vlc.c.
References Bitstream::bits_to_go, Bitstream::byte_buf, Bitstream::byte_pos, and Bitstream::streamBuffer.
Referenced by start_slice().
Initial value:
{ { { 1, 0},{10, 1},{11, 2},{ 6, 5},{12, 3},{ 7, 6},{14,14},{ 2,10},{13, 4},{15,15},{ 8, 7},{ 3,11}, { 9, 8},{ 4,12},{ 5,13},{ 0, 9},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}, { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}, { 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0} }, { { 3, 0},{29, 2},{30, 3},{17, 7},{31, 4},{18, 8},{37,17},{ 8,13},{32, 5},{38,18},{19, 9},{ 9,14}, {20,10},{10,15},{11,16},{ 2,11},{16, 1},{33,32},{34,33},{21,36},{35,34},{22,37},{39,44},{ 4,40}, {36,35},{40,45},{23,38},{ 5,41},{24,39},{ 6,42},{ 7,43},{ 1,19},{41, 6},{42,24},{43,25},{25,20}, {44,26},{26,21},{46,46},{12,28},{45,27},{47,47},{27,22},{13,29},{28,23},{14,30},{15,31},{ 0,12} } }
Definition at line 32 of file vlc.c.
Referenced by cbp_linfo_inter_normal(), cbp_linfo_inter_other(), cbp_linfo_intra_normal(), and cbp_linfo_intra_other().