#include <stdio.h>#include <stdlib.h>#include <math.h>#include "common.h"#include "options.h"#include "bitstream.h"#include "availbits.h"#include "encode_new.h"

Go to the source code of this file.
Defines | |
| #define | NUMTABLES 5 |
| #define | DUMPTABLESx |
| #define | NEWBITx |
Functions | |
| int | encode_init (frame_info *frame) |
| void | scalefactor_calc_new (double sb_sample[][3][SCALE_BLOCK][SBLIMIT], unsigned int sf_index[][3][SBLIMIT], int nch, int sblimit) |
| INLINE double | mod (double a) |
| void | combine_LR_new (double sb_sample[2][3][SCALE_BLOCK][SBLIMIT], double joint_sample[3][SCALE_BLOCK][SBLIMIT], int sblimit) |
| void | find_sf_max (unsigned int sf_index[2][3][SBLIMIT], frame_info *frame, double sf_max[2][SBLIMIT]) |
| void | sf_transmission_pattern (unsigned int sf_index[2][3][SBLIMIT], unsigned int sf_selectinfo[2][SBLIMIT], frame_info *frame) |
| void | write_header (frame_info *frame, Bit_stream_struc *bs) |
| void | write_bit_alloc (unsigned int bit_alloc[2][SBLIMIT], frame_info *frame, Bit_stream_struc *bs) |
| void | write_scalefactors (unsigned int bit_alloc[2][SBLIMIT], unsigned int sf_selectinfo[2][SBLIMIT], unsigned int sf_index[2][3][SBLIMIT], frame_info *frame, Bit_stream_struc *bs) |
| void | subband_quantization_new (unsigned int sf_index[2][3][SBLIMIT], double sb_samples[2][3][SCALE_BLOCK][SBLIMIT], unsigned int j_scale[3][SBLIMIT], double j_samps[3][SCALE_BLOCK][SBLIMIT], unsigned int bit_alloc[2][SBLIMIT], unsigned int sbband[2][3][SCALE_BLOCK][SBLIMIT], frame_info *frame) |
| void | write_samples_new (unsigned int sbband[2][3][SCALE_BLOCK][SBLIMIT], unsigned int bit_alloc[2][SBLIMIT], frame_info *frame, Bit_stream_struc *bs) |
| int | bits_for_nonoise_new (double SMR[2][SBLIMIT], unsigned int scfsi[2][SBLIMIT], frame_info *frame, float min_mnr, unsigned int bit_alloc[2][SBLIMIT]) |
| void | main_bit_allocation_new (double SMR[2][SBLIMIT], unsigned int scfsi[2][SBLIMIT], unsigned int bit_alloc[2][SBLIMIT], int *adb, frame_info *frame, options *glopts) |
| void | VBR_maxmnr_new (double mnr[2][SBLIMIT], char used[2][SBLIMIT], int sblimit, int nch, int *min_sb, int *min_ch, options *glopts) |
| int | VBR_bit_allocation_new (double SMR[2][SBLIMIT], unsigned int scfsi[2][SBLIMIT], unsigned int bit_alloc[2][SBLIMIT], int *adb, frame_info *frame, options *glopts) |
| void | maxmnr_new (double mnr[2][SBLIMIT], char used[2][SBLIMIT], int sblimit, int nch, int *min_sb, int *min_ch) |
| int | a_bit_allocation_new (double SMR[2][SBLIMIT], unsigned int scfsi[2][SBLIMIT], unsigned int bit_alloc[2][SBLIMIT], int *adb, frame_info *frame) |
Variables | |
| int | vbrstats_new [15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
| static int | step_index [9][16] |
| static int | nbal [9] = {4, 4, 3, 2, 4, 3, 4, 3, 2} |
| static int | steps [18] = {0, 3, 5, 7, 9, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535} |
| static int | steps2n [18] = {0, 2, 4, 4, 8, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768} |
| static int | bits [18] = {0, 5, 7, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} |
| static int | group [18] = {0, 1, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} |
| static int | table_sblimit [5] = {27, 30, 8, 12, 30} |
| static int | line [5][SBLIMIT] |
| double | scalefactor [64] |
| static double | SNR [18] |
| int | tablenum = 0 |
| static double | a [18] |
| static double | b [18] |
| #define DUMPTABLESx |
| #define NEWBITx |
| #define NUMTABLES 5 |
| int a_bit_allocation_new | ( | double | SMR[2][SBLIMIT], | |
| unsigned int | scfsi[2][SBLIMIT], | |||
| unsigned int | bit_alloc[2][SBLIMIT], | |||
| int * | adb, | |||
| frame_info * | frame | |||
| ) |
Definition at line 1078 of file encode_new.c.
References bit_alloc(), bits, frame_header::error_protection, group, frame_info::header, init, frame_info::jsbound, line, maxmnr_new(), nbal, frame_info::nch, frame_info::sblimit, SCALE_BLOCK, SNR, step_index, and tablenum.
Referenced by main_bit_allocation_new().

| int bits_for_nonoise_new | ( | double | SMR[2][SBLIMIT], | |
| unsigned int | scfsi[2][SBLIMIT], | |||
| frame_info * | frame, | |||
| float | min_mnr, | |||
| unsigned int | bit_alloc[2][SBLIMIT] | |||
| ) |
Definition at line 634 of file encode_new.c.
References bit_alloc(), bits, frame_header::error_protection, group, frame_info::header, frame_info::jsbound, line, nbal, frame_info::nch, frame_info::sblimit, SCALE_BLOCK, SNR, step_index, and tablenum.
Referenced by main_bit_allocation_new().

| void combine_LR_new | ( | double | sb_sample[2][3][SCALE_BLOCK][SBLIMIT], | |
| double | joint_sample[3][SCALE_BLOCK][SBLIMIT], | |||
| int | sblimit | |||
| ) |
| int encode_init | ( | frame_info * | frame | ) |
Definition at line 104 of file encode_new.c.
References bitrate, frame_header::bitrate_index, fprintf, frame_info::header, line, MPEG_AUDIO_ID, nbal, frame_info::nch, NUMTABLES, s_freq, frame_header::sampling_frequency, SBLIMIT, step_index, steps, table_sblimit, tablenum, and frame_header::version.
| void find_sf_max | ( | unsigned int | sf_index[2][3][SBLIMIT], | |
| frame_info * | frame, | |||
| double | sf_max[2][SBLIMIT] | |||
| ) |
Definition at line 260 of file encode_new.c.
References multiple, frame_info::nch, and frame_info::sblimit.
Referenced by toolame().
| void main_bit_allocation_new | ( | double | SMR[2][SBLIMIT], | |
| unsigned int | scfsi[2][SBLIMIT], | |||
| unsigned int | bit_alloc[2][SBLIMIT], | |||
| int * | adb, | |||
| frame_info * | frame, | |||
| options * | glopts | |||
| ) |
Definition at line 733 of file encode_new.c.
References a_bit_allocation_new(), frame_info::actual_mode, available_bits(), bit_alloc(), bitrate, frame_header::bitrate_index, bits_for_nonoise_new(), FALSE, fprintf, frame_info::header, header, init, js_bound(), frame_info::jsbound, frame_header::lay, frame_header::mode, frame_header::mode_ext, MPG_MD_JOINT_STEREO, MPG_MD_MONO, MPG_MD_STEREO, s_freq, frame_header::sampling_frequency, frame_info::sblimit, TRUE, options::vbr, VBR_bit_allocation_new(), options::vbrlevel, vbrstats_new, options::verbosity, and frame_header::version.
Referenced by toolame().

| void maxmnr_new | ( | double | mnr[2][SBLIMIT], | |
| char | used[2][SBLIMIT], | |||
| int | sblimit, | |||
| int | nch, | |||
| int * | min_sb, | |||
| int * | min_ch | |||
| ) |
| INLINE double mod | ( | double | a | ) |
Definition at line 231 of file encode_new.c.
Referenced by decode_init(), l1_unscale(), l2_unscale_group(), and parse_mos().
| void scalefactor_calc_new | ( | double | sb_sample[][3][SCALE_BLOCK][SBLIMIT], | |
| unsigned int | sf_index[][3][SBLIMIT], | |||
| int | nch, | |||
| int | sblimit | |||
| ) |
Definition at line 179 of file encode_new.c.
References SCALE_BLOCK, and scalefactor.
Referenced by toolame().
| void sf_transmission_pattern | ( | unsigned int | sf_index[2][3][SBLIMIT], | |
| unsigned int | sf_selectinfo[2][SBLIMIT], | |||
| frame_info * | frame | |||
| ) |
Definition at line 288 of file encode_new.c.
References frame_info::nch, and frame_info::sblimit.
Referenced by toolame().
| void subband_quantization_new | ( | unsigned int | sf_index[2][3][SBLIMIT], | |
| double | sb_samples[2][3][SCALE_BLOCK][SBLIMIT], | |||
| unsigned int | j_scale[3][SBLIMIT], | |||
| double | j_samps[3][SCALE_BLOCK][SBLIMIT], | |||
| unsigned int | bit_alloc[2][SBLIMIT], | |||
| unsigned int | sbband[2][3][SCALE_BLOCK][SBLIMIT], | |||
| frame_info * | frame | |||
| ) |
Definition at line 480 of file encode_new.c.
References a, b, bit_alloc(), frame_info::jsbound, line, frame_info::nch, frame_info::sblimit, SCALE_BLOCK, scalefactor, step_index, steps2n, and tablenum.
Referenced by toolame().

| int VBR_bit_allocation_new | ( | double | SMR[2][SBLIMIT], | |
| unsigned int | scfsi[2][SBLIMIT], | |||
| unsigned int | bit_alloc[2][SBLIMIT], | |||
| int * | adb, | |||
| frame_info * | frame, | |||
| options * | glopts | |||
| ) |
Definition at line 934 of file encode_new.c.
References bit_alloc(), bits, frame_header::error_protection, group, frame_info::header, init, frame_info::jsbound, line, nbal, frame_info::nch, frame_info::sblimit, SCALE_BLOCK, SNR, step_index, tablenum, and VBR_maxmnr_new().
Referenced by main_bit_allocation_new().

| void VBR_maxmnr_new | ( | double | mnr[2][SBLIMIT], | |
| char | used[2][SBLIMIT], | |||
| int | sblimit, | |||
| int | nch, | |||
| int * | min_sb, | |||
| int * | min_ch, | |||
| options * | glopts | |||
| ) |
Definition at line 888 of file encode_new.c.
References options::vbrlevel.
Referenced by VBR_bit_allocation_new().
| void write_bit_alloc | ( | unsigned int | bit_alloc[2][SBLIMIT], | |
| frame_info * | frame, | |||
| Bit_stream_struc * | bs | |||
| ) |
Definition at line 383 of file encode_new.c.
References bit_alloc(), frame_info::jsbound, line, nbal, frame_info::nch, putbits(), frame_info::sblimit, and tablenum.
Referenced by toolame().

| void write_header | ( | frame_info * | frame, | |
| Bit_stream_struc * | bs | |||
| ) |
Definition at line 356 of file encode_new.c.
References frame_header::bitrate_index, frame_header::copyright, frame_header::emphasis, frame_header::error_protection, frame_header::extension, frame_info::header, header, frame_header::lay, frame_header::mode, frame_header::mode_ext, frame_header::original, frame_header::padding, put1bit(), putbits(), frame_header::sampling_frequency, and frame_header::version.

| void write_samples_new | ( | unsigned int | sbband[2][3][SCALE_BLOCK][SBLIMIT], | |
| unsigned int | bit_alloc[2][SBLIMIT], | |||
| frame_info * | frame, | |||
| Bit_stream_struc * | bs | |||
| ) |
Definition at line 560 of file encode_new.c.
References bit_alloc(), bits, group, frame_info::jsbound, line, frame_info::nch, putbits(), frame_info::sblimit, SCALE_BLOCK, step_index, steps, and tablenum.
Referenced by toolame().

| void write_scalefactors | ( | unsigned int | bit_alloc[2][SBLIMIT], | |
| unsigned int | sf_selectinfo[2][SBLIMIT], | |||
| unsigned int | sf_index[2][3][SBLIMIT], | |||
| frame_info * | frame, | |||
| Bit_stream_struc * | bs | |||
| ) |
Definition at line 413 of file encode_new.c.
References bit_alloc(), frame_info::nch, putbits(), and frame_info::sblimit.
Referenced by toolame().

double a[18] [static] |
Initial value:
{
0,
0.750000000, 0.625000000, 0.875000000, 0.562500000, 0.937500000,
0.968750000, 0.984375000, 0.992187500, 0.996093750, 0.998046875,
0.999023438, 0.999511719, 0.999755859, 0.999877930, 0.999938965,
0.999969482, 0.999984741
}
Definition at line 448 of file encode_new.c.
double b[18] [static] |
Initial value:
{
0,
-0.250000000, -0.375000000, -0.125000000, -0.437500000, -0.062500000,
-0.031250000, -0.015625000, -0.007812500, -0.003906250, -0.001953125,
-0.000976563, -0.000488281, -0.000244141, -0.000122070, -0.000061035,
-0.000030518, -0.000015259
}
Definition at line 456 of file encode_new.c.
int bits[18] = {0, 5, 7, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} [static] |
Definition at line 38 of file encode_new.c.
Referenced by a_bit_allocation_new(), adaptive_quantization(), AudioDevice::arm_buffer(), avg_bits_per_pixel(), bit8x8_c(), bits_for_nonoise_new(), BitstreamPutVopHeader(), CodeCoeff(), CodeCoeff_RVLC(), compute_mantissa_size(), decode_cabac_mb_type(), dvbsub_read_2bit_string(), dvbsub_read_4bit_string(), dvbsub_read_8bit_string(), encode_frame(), ff_rate_control_init(), ff_rate_estimate_qscale(), generate_bits_table(), get_bits_diff(), get_motion_vector_fixed(), get_motion_vector_vlc(), get_qscale(), handle_pcm(), img_copy(), init_pass2(), jpeg_load_dht(), kodak_65000_decode(), main(), modify_qscale(), mp_decode_layer2(), mpeg3_check_sig(), mpeg3_get_file_type(), msmpeg4v2_encode_motion(), PutVoVolHeader(), quicktime_divx_write_vol(), quicktime_fastjpg_huffparse(), quicktime_mpeg4_write_vol(), rd8x8_c(), AudioDevice::read_buffer(), read_huffman_tables(), FileAVI::read_samples(), read_transport(), ReadIeeeExtendedHighLow(), sample_encoding(), step_two(), VBR_bit_allocation_new(), VopCodeShapeTextIntraCom(), VopShapeMotText(), FileTIFF::write_frame(), write_samples_new(), WriteMVcomponent(), and xan_huffman_decode().
int group[18] = {0, 1, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} [static] |
Definition at line 41 of file encode_new.c.
Referenced by a_bit_allocation_new(), bits_for_nonoise_new(), VBR_bit_allocation_new(), and write_samples_new().
int line[5][SBLIMIT] [static] |
Initial value:
{
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1,-1,-1},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,-1,-1},
{4, 4, 5, 5, 5, 5, 5, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
{4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
{6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
}
Definition at line 54 of file encode_new.c.
Referenced by a_bit_allocation_new(), bad_pixels(), bits_for_nonoise_new(), correlate_slice_buffered(), decode_frame(), decode_rle(), decode_subband_slice_buffered(), dequantize_slice_buffered(), encode_init(), parse_ffconfig(), parse_rollei(), predict_slice_buffered(), psycho_1_make_map(), psycho_1_minimum_mask(), readcmdline(), rtsp_parse_request(), subband_quantization_new(), VBR_bit_allocation_new(), write_bit_alloc(), and write_samples_new().
int nbal[9] = {4, 4, 3, 2, 4, 3, 4, 3, 2} [static] |
Definition at line 29 of file encode_new.c.
Referenced by a_bit_allocation_new(), bits_for_nonoise_new(), encode_init(), VBR_bit_allocation_new(), and write_bit_alloc().
| double scalefactor[64] |
Initial value:
{
2.00000000000000, 1.58740105196820, 1.25992104989487,
1.00000000000000, 0.79370052598410, 0.62996052494744, 0.50000000000000,
0.39685026299205, 0.31498026247372, 0.25000000000000, 0.19842513149602,
0.15749013123686, 0.12500000000000, 0.09921256574801, 0.07874506561843,
0.06250000000000, 0.04960628287401, 0.03937253280921, 0.03125000000000,
0.02480314143700, 0.01968626640461, 0.01562500000000, 0.01240157071850,
0.00984313320230, 0.00781250000000, 0.00620078535925, 0.00492156660115,
0.00390625000000, 0.00310039267963, 0.00246078330058, 0.00195312500000,
0.00155019633981, 0.00123039165029, 0.00097656250000, 0.00077509816991,
0.00061519582514, 0.00048828125000, 0.00038754908495, 0.00030759791257,
0.00024414062500, 0.00019377454248, 0.00015379895629, 0.00012207031250,
0.00009688727124, 0.00007689947814, 0.00006103515625, 0.00004844363562,
0.00003844973907, 0.00003051757813, 0.00002422181781, 0.00001922486954,
0.00001525878906, 0.00001211090890, 0.00000961243477, 0.00000762939453,
0.00000605545445, 0.00000480621738, 0.00000381469727, 0.00000302772723,
0.00000240310869, 0.00000190734863, 0.00000151386361, 0.00000120155435,
1E-20
}
Definition at line 65 of file encode_new.c.
Referenced by scalefactor_calc_new(), and subband_quantization_new().
double SNR[18] [static] |
Initial value:
{ 0.00, 7.00, 11.00, 16.00, 20.84,
25.28, 31.59, 37.75, 43.84,
49.89, 55.93, 61.96, 67.98, 74.01,
80.03, 86.05, 92.01, 98.01
}
Definition at line 96 of file encode_new.c.
int step_index[9][16] [static] |
Initial value:
{
{0, 1, 3, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,17},
{0, 1, 2, 3, 4, 5, 6,17, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 2, 17,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 2, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16},
{0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15},
{0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
Definition at line 16 of file encode_new.c.
Referenced by a_bit_allocation_new(), bits_for_nonoise_new(), encode_init(), subband_quantization_new(), VBR_bit_allocation_new(), and write_samples_new().
int steps[18] = {0, 3, 5, 7, 9, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535} [static] |
Definition at line 34 of file encode_new.c.
Referenced by encode_frame(), encode_init(), LinearBlurConfig::LinearBlurConfig(), MotionBlurConfig::MotionBlurConfig(), mp_decode_layer2(), ZoomBlurMain::process_buffer(), MotionBlurMain::process_realtime(), RadialBlurConfig::RadialBlurConfig(), write_samples_new(), and ZoomBlurConfig::ZoomBlurConfig().
int steps2n[18] = {0, 2, 4, 4, 8, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768} [static] |
int table_sblimit[5] = {27, 30, 8, 12, 30} [static] |
| int tablenum = 0 |
Definition at line 102 of file encode_new.c.
Referenced by a_bit_allocation_new(), bits_for_nonoise_new(), encode_init(), subband_quantization_new(), VBR_bit_allocation_new(), write_bit_alloc(), and write_samples_new().
| int vbrstats_new[15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
1.5.5