#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include "lame.h"
#include "machine.h"
#include "encoder.h"
#include "util.h"
#include "tables.h"
#include "quantize_pvt.h"
#include "lame_global_flags.h"
#include "gain_analysis.h"
#include "VbrTag.h"
#include "bitstream.h"
Include dependency graph for bitstream.c:
Go to the source code of this file.
#define MAX_LENGTH 32 |
Definition at line 49 of file bitstream.c.
Referenced by Huffmancode(), putbits2(), putbits_noheaders(), and writeheader().
void add_dummy_byte | ( | lame_global_flags const *const | gfp, | |
unsigned char | val, | |||
unsigned int | n | |||
) |
Definition at line 862 of file bitstream.c.
References gfc, gfp, lame_internal_flags::header, i, lame_global_struct::internal_flags, MAX_HEADER_BUF, putbits_noheaders(), and lame_internal_flags::write_timing.
Referenced by id3tag_write_v1(), id3tag_write_v2(), and InitVbrTag().
Here is the call graph for this function:
int compute_flushbits | ( | const lame_global_flags * | gfp, | |
int * | total_bytes_output | |||
) |
Definition at line 744 of file bitstream.c.
References lame_internal_flags::bs, bit_stream_struc::buf_byte_idx, DEBUGF, ERRORF, getframebits(), gfc, gfp, lame_internal_flags::h_ptr, lame_internal_flags::header, lame_global_struct::internal_flags, MAX_HEADER_BUF, lame_internal_flags::sideinfo_len, bit_stream_struc::totbit, lame_internal_flags::w_ptr, and lame_internal_flags::write_timing.
Referenced by flush_bitstream(), format_bitstream(), and lame_get_size_mp3buffer().
Here is the call graph for this function:
int copy_buffer | ( | lame_internal_flags * | gfc, | |
unsigned char * | buffer, | |||
int | size, | |||
int | mp3data | |||
) |
sum number of bytes belonging to the mp3 stream this info will be written into the Xing/LAME header for seeking
Definition at line 967 of file bitstream.c.
References AnalyzeSamples(), lame_internal_flags::bs, bit_stream_struc::buf, bit_stream_struc::buf_bit_idx, bit_stream_struc::buf_byte_idx, lame_internal_flags::channels_out, lame_internal_flags::decode_on_the_fly, lame_internal_flags::findPeakSample, lame_internal_flags::findReplayGain, GAIN_ANALYSIS_ERROR, gfc, i, lame_decode1_unclipped(), memcpy, VBR_seek_info_t::nBytesWritten, lame_internal_flags::nMusicCRC, lame_internal_flags::PeakSample, lame_internal_flags::rgdata, UpdateMusicCRC(), and lame_internal_flags::VBR_seek_table.
Referenced by lame_encode_buffer_sample_t(), lame_encode_flush(), and lame_encode_flush_nogap().
Here is the call graph for this function:
static int CRC_update | ( | int | value, | |
int | crc | |||
) | [static] |
Definition at line 239 of file bitstream.c.
References CRC16_POLYNOMIAL, and i.
Referenced by CRC_writeheader().
void CRC_writeheader | ( | lame_internal_flags const * | gfc, | |
char * | header | |||
) |
Definition at line 255 of file bitstream.c.
References CRC_update(), gfc, i, and lame_internal_flags::sideinfo_len.
Referenced by PutVbrTag().
Here is the call graph for this function:
static void drain_into_ancillary | ( | lame_global_flags const * | gfp, | |
int | remainingBits | |||
) | [inline, static] |
Definition at line 179 of file bitstream.c.
References lame_internal_flags::ancillary_flag, lame_global_struct::disable_reservoir, get_lame_short_version(), gfc, gfp, i, lame_global_struct::internal_flags, and putbits2().
Referenced by flush_bitstream(), and format_bitstream().
Here is the call graph for this function:
static void encodeSideInfo2 | ( | lame_global_flags const * | gfp, | |
int | bitsPerFrame | |||
) | [inline, static] |
Definition at line 271 of file bitstream.c.
References lame_internal_flags::bitrate_index, lame_internal_flags::buf, lame_internal_flags::channels_out, lame_global_struct::copyright, lame_global_struct::emphasis, lame_global_struct::error_protection, lame_global_struct::extension, gfc, gfp, lame_internal_flags::h_ptr, lame_internal_flags::header, lame_global_struct::internal_flags, lame_internal_flags::l3_side, III_side_info_t::main_data_begin, lame_global_struct::mode, lame_internal_flags::mode_ext, NORM_TYPE, lame_global_struct::original, lame_global_struct::out_samplerate, lame_internal_flags::padding, III_side_info_t::private_bits, lame_internal_flags::ptr, lame_internal_flags::samplerate_index, III_side_info_t::scfsi, lame_internal_flags::sideinfo_len, III_side_info_t::tt, lame_global_struct::version, and writeheader().
Referenced by format_bitstream().
Here is the call graph for this function:
void flush_bitstream | ( | lame_global_flags const * | gfp | ) |
Definition at line 805 of file bitstream.c.
References lame_internal_flags::bs, compute_flushbits(), drain_into_ancillary(), lame_internal_flags::findPeakSample, lame_internal_flags::findReplayGain, GAIN_NOT_ENOUGH_SAMPLES, getframebits(), GetTitleGain(), gfc, gfp, lame_internal_flags::h_ptr, lame_internal_flags::header, lame_global_struct::internal_flags, lame_internal_flags::l3_side, III_side_info_t::main_data_begin, MAX_HEADER_BUF, lame_internal_flags::noclipGainChange, lame_internal_flags::noclipScale, lame_internal_flags::PeakSample, lame_internal_flags::RadioGain, lame_internal_flags::ResvSize, lame_internal_flags::rgdata, lame_global_struct::scale, bit_stream_struc::totbit, and lame_internal_flags::write_timing.
Referenced by lame_encode_flush(), and lame_encode_flush_nogap().
Here is the call graph for this function:
int format_bitstream | ( | lame_global_flags const * | gfp | ) |
Definition at line 887 of file bitstream.c.
References lame_internal_flags::bs, compute_flushbits(), drain_into_ancillary(), encodeSideInfo2(), ERRORF, getframebits(), gfc, gfp, lame_internal_flags::header, i, lame_global_struct::internal_flags, lame_internal_flags::l3_side, III_side_info_t::main_data_begin, MAX_HEADER_BUF, III_side_info_t::resvDrain_post, III_side_info_t::resvDrain_pre, lame_internal_flags::ResvSize, lame_internal_flags::sideinfo_len, bit_stream_struc::totbit, lame_internal_flags::write_timing, and writeMainData().
Here is the call graph for this function:
int getframebits | ( | const lame_global_flags * | gfp | ) |
Definition at line 65 of file bitstream.c.
References lame_internal_flags::bitrate_index, bitrate_table, lame_global_struct::brate, gfc, gfp, lame_global_struct::internal_flags, lame_global_struct::out_samplerate, lame_internal_flags::padding, and lame_global_struct::version.
Referenced by calc_target_bits(), compute_flushbits(), flush_bitstream(), format_bitstream(), get_framebits(), and ResvFrameBegin().
static int huffman_coder_count1 | ( | lame_internal_flags * | gfc, | |
gr_info const * | gi | |||
) | [inline, static] |
Definition at line 439 of file bitstream.c.
References gr_info::big_values, lame_internal_flags::bs, gr_info::count1, gr_info::count1bits, gr_info::count1table_select, DEBUGF, gfc, huffcodetab::hlen, ht, i, gr_info::l3_enc, putbits2(), huffcodetab::table, bit_stream_struc::totbit, and gr_info::xr.
Referenced by writeMainData().
Here is the call graph for this function:
static int Huffmancode | ( | lame_internal_flags *const | gfc, | |
const unsigned int | tableindex, | |||
int | start, | |||
int | end, | |||
gr_info const * | gi | |||
) | [inline, static] |
Definition at line 509 of file bitstream.c.
References gfc, huffcodetab::hlen, ht, gr_info::l3_enc, huffcodetab::linmax, MAX_LENGTH, putbits2(), huffcodetab::table, huffcodetab::xlen, and gr_info::xr.
Referenced by LongHuffmancodebits(), and ShortHuffmancodebits().
Here is the call graph for this function:
void init_bit_stream_w | ( | lame_internal_flags * | gfc | ) |
Definition at line 1054 of file bitstream.c.
References lame_internal_flags::bs, bit_stream_struc::buf, bit_stream_struc::buf_bit_idx, bit_stream_struc::buf_byte_idx, bit_stream_struc::buf_size, BUFFER_SIZE, gfc, lame_internal_flags::h_ptr, lame_internal_flags::header, bit_stream_struc::totbit, lame_internal_flags::w_ptr, and lame_internal_flags::write_timing.
Referenced by lame_init_params().
static int LongHuffmancodebits | ( | lame_internal_flags * | gfc, | |
gr_info const * | gi | |||
) | [static] |
Definition at line 600 of file bitstream.c.
References gr_info::big_values, gfc, Huffmancode(), i, scalefac_struct::l, gr_info::region0_count, gr_info::region1_count, lame_internal_flags::scalefac_band, and gr_info::table_select.
Referenced by writeMainData().
Here is the call graph for this function:
static void putbits2 | ( | lame_internal_flags * | gfc, | |
int | val, | |||
int | j | |||
) | [inline, static] |
Definition at line 106 of file bitstream.c.
References lame_internal_flags::bs, bit_stream_struc::buf, bit_stream_struc::buf_bit_idx, bit_stream_struc::buf_byte_idx, BUFFER_SIZE, gfc, lame_internal_flags::header, MAX_LENGTH, Min, putheader_bits(), bit_stream_struc::totbit, lame_internal_flags::w_ptr, and lame_internal_flags::write_timing.
Referenced by drain_into_ancillary(), huffman_coder_count1(), Huffmancode(), and writeMainData().
Here is the call graph for this function:
static void putbits_noheaders | ( | lame_internal_flags * | gfc, | |
int | val, | |||
int | j | |||
) | [inline, static] |
Definition at line 141 of file bitstream.c.
References lame_internal_flags::bs, bit_stream_struc::buf, bit_stream_struc::buf_bit_idx, bit_stream_struc::buf_byte_idx, BUFFER_SIZE, gfc, MAX_LENGTH, Min, and bit_stream_struc::totbit.
Referenced by add_dummy_byte().
void putheader_bits | ( | lame_internal_flags * | gfc | ) |
Definition at line 87 of file bitstream.c.
References lame_internal_flags::bs, lame_internal_flags::buf, bit_stream_struc::buf, bit_stream_struc::buf_byte_idx, gfc, lame_internal_flags::header, MAX_HEADER_BUF, memcpy, lame_internal_flags::sideinfo_len, bit_stream_struc::totbit, and lame_internal_flags::w_ptr.
Referenced by putbits2().
static int ShortHuffmancodebits | ( | lame_internal_flags * | gfc, | |
gr_info const * | gi | |||
) | [static] |
Definition at line 584 of file bitstream.c.
References gr_info::big_values, gfc, Huffmancode(), scalefac_struct::s, lame_internal_flags::scalefac_band, and gr_info::table_select.
Referenced by writeMainData().
Here is the call graph for this function:
static void writeheader | ( | lame_internal_flags * | gfc, | |
int | val, | |||
int | j | |||
) | [inline, static] |
Definition at line 222 of file bitstream.c.
References lame_internal_flags::buf, gfc, lame_internal_flags::h_ptr, lame_internal_flags::header, MAX_LENGTH, Min, and lame_internal_flags::ptr.
Referenced by encodeSideInfo2().
static int writeMainData | ( | lame_global_flags const *const | gfp | ) | [inline, static] |
Definition at line 628 of file bitstream.c.
References lame_internal_flags::bs, lame_internal_flags::channels_out, DEBUGF, gfc, gfp, huffman_coder_count1(), i, lame_global_struct::internal_flags, lame_internal_flags::l3_side, LongHuffmancodebits(), Max, putbits2(), SHORT_TYPE, ShortHuffmancodebits(), slen1_tab, slen2_tab, bit_stream_struc::totbit, III_side_info_t::tt, and lame_global_struct::version.
Referenced by format_bitstream().
Here is the call graph for this function: