Merge remote branch 'origin/master' into experimental

Change-Id: I90a1d0095712e0474b0c03773b57376911027fc6
This commit is contained in:
John Koleszar 2011-05-21 00:05:14 -04:00
commit 4d240d1eae
13 changed files with 360 additions and 468 deletions

View File

@ -20,19 +20,16 @@
|vp8_short_inv_walsh4x4_neon| PROC
; read in all four lines of values: d0->d3
vldm.64 r0, {q0, q1}
vld1.i16 {q0-q1}, [r0@128]
; first for loop
vadd.s16 d4, d0, d3 ;a = [0] + [12]
vadd.s16 d5, d1, d2 ;b = [4] + [8]
vsub.s16 d6, d1, d2 ;c = [4] - [8]
vsub.s16 d7, d0, d3 ;d = [0] - [12]
vadd.s16 d6, d1, d2 ;b = [4] + [8]
vsub.s16 d5, d0, d3 ;d = [0] - [12]
vsub.s16 d7, d1, d2 ;c = [4] - [8]
vadd.s16 d0, d4, d5 ;a + b
vadd.s16 d1, d6, d7 ;c + d
vsub.s16 d2, d4, d5 ;a - b
vsub.s16 d3, d7, d6 ;d - c
vadd.s16 q0, q2, q3 ; a+b d+c
vsub.s16 q1, q2, q3 ; a-b d-c
vtrn.32 d0, d2 ;d0: 0 1 8 9
;d2: 2 3 10 11
@ -47,29 +44,22 @@
; second for loop
vadd.s16 d4, d0, d3 ;a = [0] + [3]
vadd.s16 d5, d1, d2 ;b = [1] + [2]
vsub.s16 d6, d1, d2 ;c = [1] - [2]
vsub.s16 d7, d0, d3 ;d = [0] - [3]
vadd.s16 d6, d1, d2 ;b = [1] + [2]
vsub.s16 d5, d0, d3 ;d = [0] - [3]
vsub.s16 d7, d1, d2 ;c = [1] - [2]
vadd.s16 d0, d4, d5 ;e = a + b
vadd.s16 d1, d6, d7 ;f = c + d
vsub.s16 d2, d4, d5 ;g = a - b
vsub.s16 d3, d7, d6 ;h = d - c
vmov.i16 q8, #3
vmov.i16 q2, #3
vadd.i16 q0, q0, q2 ;e/f += 3
vadd.i16 q1, q1, q2 ;g/h += 3
vadd.s16 q0, q2, q3 ; a+b d+c
vsub.s16 q1, q2, q3 ; a-b d-c
vadd.i16 q0, q0, q8 ;e/f += 3
vadd.i16 q1, q1, q8 ;g/h += 3
vshr.s16 q0, q0, #3 ;e/f >> 3
vshr.s16 q1, q1, #3 ;g/h >> 3
vtrn.32 d0, d2
vtrn.32 d1, d3
vtrn.16 d0, d1
vtrn.16 d2, d3
vstmia.16 r1!, {q0}
vstmia.16 r1!, {q1}
vst4.i16 {d0,d1,d2,d3}, [r1@128]
bx lr
ENDP ; |vp8_short_inv_walsh4x4_neon|
@ -77,19 +67,13 @@
;short vp8_short_inv_walsh4x4_1_neon(short *input, short *output)
|vp8_short_inv_walsh4x4_1_neon| PROC
; load a full line into a neon register
vld1.16 {q0}, [r0]
; extract first element and replicate
vdup.16 q1, d0[0]
; add 3 to all values
vmov.i16 q2, #3
vadd.i16 q3, q1, q2
; right shift
vshr.s16 q3, q3, #3
; write it back
vstmia.16 r1!, {q3}
vstmia.16 r1!, {q3}
ldrsh r2, [r0] ; load input[0]
add r3, r2, #3 ; add 3
add r2, r1, #16 ; base for last 8 output
asr r0, r3, #3 ; right shift 3
vdup.16 q0, r0 ; load and duplicate
vst1.16 {q0}, [r1@128] ; write back 8
vst1.16 {q0}, [r2@128] ; write back last 8
bx lr
ENDP ; |vp8_short_inv_walsh4x4_1_neon|

View File

@ -79,7 +79,6 @@ typedef struct
int errorperbit;
int sadperbit16;
int sadperbit4;
int errthresh;
int rddiv;
int rdmult;
unsigned int * mb_activity_ptr;

View File

@ -562,9 +562,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
x->vector_range = 32;
// Count of MBs using the alternate Q if any
cpi->alt_qcount = 0;
// Reset frame count of inter 0,0 motion vector useage.
cpi->inter_zz_count = 0;

View File

@ -27,10 +27,16 @@
#else
#define IF_RTCD(x) NULL
#endif
void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x, BLOCK *be, BLOCKD *b, int best_mode)
void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
MACROBLOCK *x, int ib)
{
BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->block[ib];
RECON_INVOKE(&rtcd->common->recon, intra4x4_predict)
(b, best_mode, b->predictor);
(b, b->bmi.mode, b->predictor);
ENCODEMB_INVOKE(&rtcd->encodemb, subb)(be, b, 16);
@ -51,13 +57,7 @@ void vp8_encode_intra4x4mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb)
vp8_intra_prediction_down_copy(x);
for (i = 0; i < 16; i++)
{
BLOCK *be = &mb->block[i];
BLOCKD *b = &x->block[i];
vp8_encode_intra4x4block(rtcd, mb, be, b, b->bmi.mode);
}
vp8_encode_intra4x4block(rtcd, mb, i);
return;
}

View File

@ -16,6 +16,6 @@
void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *, MACROBLOCK *x);
void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *, MACROBLOCK *x);
void vp8_encode_intra4x4mby(const VP8_ENCODER_RTCD *, MACROBLOCK *mb);
void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *, MACROBLOCK *x, BLOCK *be, BLOCKD *b, int best_mode);
void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
MACROBLOCK *x, int ib);
#endif

View File

@ -302,7 +302,6 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc)
z->sadperbit16 = x->sadperbit16;
z->sadperbit4 = x->sadperbit4;
z->errthresh = x->errthresh;
/*
z->mv_col_min = x->mv_col_min;

File diff suppressed because it is too large Load Diff

View File

@ -375,11 +375,11 @@ static void dealloc_compressor_data(VP8_COMP *cpi)
cpi->mb.pip = 0;
#if !(CONFIG_REALTIME_ONLY)
vpx_free(cpi->total_stats);
cpi->total_stats = 0;
vpx_free(cpi->twopass.total_stats);
cpi->twopass.total_stats = 0;
vpx_free(cpi->this_frame_stats);
cpi->this_frame_stats = 0;
vpx_free(cpi->twopass.this_frame_stats);
cpi->twopass.this_frame_stats = 0;
#endif
}
@ -1413,15 +1413,15 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
cm->mb_rows * cm->mb_cols));
#if !(CONFIG_REALTIME_ONLY)
vpx_free(cpi->total_stats);
vpx_free(cpi->twopass.total_stats);
cpi->total_stats = vpx_calloc(1, sizeof(FIRSTPASS_STATS));
cpi->twopass.total_stats = vpx_calloc(1, sizeof(FIRSTPASS_STATS));
vpx_free(cpi->this_frame_stats);
vpx_free(cpi->twopass.this_frame_stats);
cpi->this_frame_stats = vpx_calloc(1, sizeof(FIRSTPASS_STATS));
cpi->twopass.this_frame_stats = vpx_calloc(1, sizeof(FIRSTPASS_STATS));
if(!cpi->total_stats || !cpi->this_frame_stats)
if(!cpi->twopass.total_stats || !cpi->twopass.this_frame_stats)
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate firstpass stats");
#endif
@ -1484,7 +1484,7 @@ void vp8_new_frame_rate(VP8_COMP *cpi, double framerate)
cpi->max_gf_interval = 12;
// Extended interval for genuinely static scenes
cpi->static_scene_max_gf_interval = cpi->key_frame_frequency >> 1;
cpi->twopass.static_scene_max_gf_interval = cpi->key_frame_frequency >> 1;
// Special conditions when altr ref frame enabled in lagged compress mode
if (cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames)
@ -1492,12 +1492,12 @@ void vp8_new_frame_rate(VP8_COMP *cpi, double framerate)
if (cpi->max_gf_interval > cpi->oxcf.lag_in_frames - 1)
cpi->max_gf_interval = cpi->oxcf.lag_in_frames - 1;
if (cpi->static_scene_max_gf_interval > cpi->oxcf.lag_in_frames - 1)
cpi->static_scene_max_gf_interval = cpi->oxcf.lag_in_frames - 1;
if (cpi->twopass.static_scene_max_gf_interval > cpi->oxcf.lag_in_frames - 1)
cpi->twopass.static_scene_max_gf_interval = cpi->oxcf.lag_in_frames - 1;
}
if ( cpi->max_gf_interval > cpi->static_scene_max_gf_interval )
cpi->max_gf_interval = cpi->static_scene_max_gf_interval;
if ( cpi->max_gf_interval > cpi->twopass.static_scene_max_gf_interval )
cpi->max_gf_interval = cpi->twopass.static_scene_max_gf_interval;
}
@ -1912,7 +1912,7 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
// Set reference frame sign bias for ALTREF frame to 1 (for now)
cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1;
cpi->gf_decay_rate = 0;
cpi->twopass.gf_decay_rate = 0;
cpi->baseline_gf_interval = DEFAULT_GF_INTERVAL;
cpi->gold_is_last = 0 ;
@ -2041,7 +2041,7 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->rate_correction_factor = 1.0;
cpi->key_frame_rate_correction_factor = 1.0;
cpi->gf_rate_correction_factor = 1.0;
cpi->est_max_qcorrection_factor = 1.0;
cpi->twopass.est_max_qcorrection_factor = 1.0;
cpi->mb.mvcost[0] = &cpi->mb.mvcosts[0][mv_max+1];
cpi->mb.mvcost[1] = &cpi->mb.mvcosts[1][mv_max+1];
@ -2077,8 +2077,8 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
size_t packet_sz = sizeof(FIRSTPASS_STATS);
int packets = oxcf->two_pass_stats_in.sz / packet_sz;
cpi->stats_in = oxcf->two_pass_stats_in.buf;
cpi->stats_in_end = (void*)((char *)cpi->stats_in
cpi->twopass.stats_in = oxcf->two_pass_stats_in.buf;
cpi->twopass.stats_in_end = (void*)((char *)cpi->twopass.stats_in
+ (packets - 1) * packet_sz);
vp8_init_second_pass(cpi);
}
@ -2162,8 +2162,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->diamond_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, diamond_search);
cpi->refining_search_sad = SEARCH_INVOKE(&cpi->rtcd.search, refining_search);
cpi->ready_for_new_frame = 1;
// make sure frame 1 is okay
cpi->error_bins[0] = cpi->common.MBs;
@ -3301,8 +3299,8 @@ static void encode_frame_to_data_rate
{
if (cpi->common.refresh_alt_ref_frame)
{
cpi->per_frame_bandwidth = cpi->gf_bits; // Per frame bit target for the alt ref frame
cpi->target_bandwidth = cpi->gf_bits * cpi->output_frame_rate; // per second target bitrate
cpi->per_frame_bandwidth = cpi->twopass.gf_bits; // Per frame bit target for the alt ref frame
cpi->target_bandwidth = cpi->twopass.gf_bits * cpi->output_frame_rate; // per second target bitrate
}
}
else
@ -3502,15 +3500,15 @@ static void encode_frame_to_data_rate
buff_lvl_step = (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level) / Adjustment;
if (buff_lvl_step)
{
Adjustment = (cpi->buffer_level - cpi->oxcf.optimal_buffer_level) / buff_lvl_step;
cpi->active_worst_quality -= Adjustment;
}
}
else
{
cpi->active_worst_quality -= Adjustment;
else
Adjustment = 0;
}
cpi->active_worst_quality -= Adjustment;
if(cpi->active_worst_quality < cpi->active_best_quality)
cpi->active_worst_quality = cpi->active_best_quality;
}
}
@ -4107,7 +4105,7 @@ static void encode_frame_to_data_rate
// Special case code to reduce pulsing when key frames are forced at a
// fixed interval. Note the reconstruction error if it is the frame before
// the force key frame
if ( cpi->next_key_frame_forced && (cpi->frames_to_key == 0) )
if ( cpi->next_key_frame_forced && (cpi->twopass.frames_to_key == 0) )
{
cpi->ambient_err = vp8_calc_ss_err(cpi->Source,
&cm->yv12_fb[cm->new_fb_idx],
@ -4313,17 +4311,17 @@ static void encode_frame_to_data_rate
// Update bits left to the kf and gf groups to account for overshoot or undershoot on these frames
if (cm->frame_type == KEY_FRAME)
{
cpi->kf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
cpi->twopass.kf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
if (cpi->kf_group_bits < 0)
cpi->kf_group_bits = 0 ;
if (cpi->twopass.kf_group_bits < 0)
cpi->twopass.kf_group_bits = 0 ;
}
else if (cm->refresh_golden_frame || cm->refresh_alt_ref_frame)
{
cpi->gf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
cpi->twopass.gf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
if (cpi->gf_group_bits < 0)
cpi->gf_group_bits = 0 ;
if (cpi->twopass.gf_group_bits < 0)
cpi->twopass.gf_group_bits = 0 ;
}
if (cm->frame_type != KEY_FRAME)
@ -4370,7 +4368,7 @@ static void encode_frame_to_data_rate
//cpi->avg_frame_qindex, cpi->zbin_over_quant,
cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
cm->frame_type, cpi->gfu_boost,
cpi->est_max_qcorrection_factor, (int)cpi->bits_left,
cpi->twopass.est_max_qcorrection_factor, (int)cpi->bits_left,
cpi->total_coded_error_left,
(double)cpi->bits_left / cpi->total_coded_error_left,
cpi->tot_recode_hits);
@ -4389,7 +4387,7 @@ static void encode_frame_to_data_rate
//cpi->avg_frame_qindex, cpi->zbin_over_quant,
cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
cm->frame_type, cpi->gfu_boost,
cpi->est_max_qcorrection_factor, (int)cpi->bits_left,
cpi->twopass.est_max_qcorrection_factor, (int)cpi->bits_left,
cpi->total_coded_error_left, cpi->tot_recode_hits);
fclose(f);
@ -4598,13 +4596,13 @@ static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
vp8_second_pass(cpi);
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
cpi->bits_left -= 8 * *size;
cpi->twopass.bits_left -= 8 * *size;
if (!cpi->common.refresh_alt_ref_frame)
{
double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
*cpi->oxcf.two_pass_vbrmin_section / 100);
cpi->bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
cpi->twopass.bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
}
}
#endif
@ -4738,10 +4736,10 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
*size = 0;
#if !(CONFIG_REALTIME_ONLY)
if (flush && cpi->pass == 1 && !cpi->first_pass_done)
if (flush && cpi->pass == 1 && !cpi->twopass.first_pass_done)
{
vp8_end_first_pass(cpi); /* get last stats packet */
cpi->first_pass_done = 1;
cpi->twopass.first_pass_done = 1;
}
#endif
@ -4909,8 +4907,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
}
cpi->ready_for_new_frame = 1;
vpx_usec_timer_mark(&cmptimer);
cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);

View File

@ -313,10 +313,6 @@ typedef struct VP8_COMP
int rd_thresh_mult[MAX_MODES];
int rd_baseline_thresh[MAX_MODES];
int rd_threshes[MAX_MODES];
int mvcostbase;
int mvcostmultiplier;
int subseqblockweight;
int errthresh;
int RDMULT;
int RDDIV ;
@ -329,16 +325,6 @@ typedef struct VP8_COMP
long long intra_error;
long long last_intra_error;
#if 0
// Experimental RD code
long long frame_distortion;
long long last_frame_distortion;
#endif
int last_mb_distortion;
int frames_since_auto_filter;
int this_frame_target;
int projected_frame_size;
int last_q[2]; // Separate values for Intra/Inter
@ -346,37 +332,18 @@ typedef struct VP8_COMP
double rate_correction_factor;
double key_frame_rate_correction_factor;
double gf_rate_correction_factor;
double est_max_qcorrection_factor;
int frames_till_gf_update_due; // Count down till next GF
int current_gf_interval; // GF interval chosen when we coded the last GF
int gf_overspend_bits; // Total bits overspent becasue of GF boost (cumulative)
int gf_group_bits; // Projected Bits available for a group of frames including 1 GF or ARF
int gf_bits; // Bits for the golden frame or ARF - 2 pass only
int mid_gf_extra_bits; // A few extra bits for the frame half way between two gfs.
// Projected total bits available for a key frame group of frames
long long kf_group_bits;
// Error score of frames still to be coded in kf group
long long kf_group_error_left;
// Bits for the key frame in a key frame group - 2 pass only
int kf_bits;
int non_gf_bitrate_adjustment; // Used in the few frames following a GF to recover the extra bits spent in that GF
int initial_gf_use; // percentage use of gf 2 frames after gf
int gf_group_error_left; // Remaining error from uncoded frames in a gf group. Two pass use only
int kf_overspend_bits; // Extra bits spent on key frames that need to be recovered on inter frames
int kf_bitrate_adjustment; // Current number of bit s to try and recover on each inter frame.
int max_gf_interval;
int static_scene_max_gf_interval;
int baseline_gf_interval;
int gf_decay_rate;
int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
INT64 key_frame_count;
@ -384,7 +351,6 @@ typedef struct VP8_COMP
int per_frame_bandwidth; // Current section per frame bandwidth target
int av_per_frame_bandwidth; // Average frame size target for clip
int min_frame_bandwidth; // Minimum allocation that should be used for any frame
int last_key_frame_size;
int inter_frame_target;
double output_frame_rate;
long long last_time_stamp_seen;
@ -422,8 +388,6 @@ typedef struct VP8_COMP
int active_best_quality;
int cq_target_quality;
int maxq_max_limit;
int maxq_min_limit;
int drop_frames_allowed; // Are we permitted to drop frames?
int drop_frame; // Drop this frame?
@ -443,39 +407,12 @@ typedef struct VP8_COMP
vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens-1];
unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens-1][2];
/* Second compressed data partition contains coefficient data. */
unsigned char *output_partition2;
size_t output_partition2size;
int frames_to_key;
int gfu_boost;
int kf_boost;
int last_boost;
double total_error_left;
double total_intra_error_left;
double total_coded_error_left;
double start_tot_err_left;
double min_error;
double kf_intra_err_min;
double gf_intra_err_min;
double modified_error_total;
double modified_error_used;
double modified_error_left;
double clip_bpe;
double observed_bpe;
double avg_iiratio;
int target_bandwidth;
long long bits_left;
long long clip_bits_total;
FIRSTPASS_STATS *total_stats;
FIRSTPASS_STATS *this_frame_stats;
FIRSTPASS_STATS *stats_in, *stats_in_end;
struct vpx_codec_pkt_list *output_pkt_list;
int first_pass_done;
#if 0
// Experimental code for lagged and one pass
@ -499,7 +436,6 @@ typedef struct VP8_COMP
int goldfreq;
int auto_worst_q;
int cpu_used;
int chroma_boost;
int horiz_scale;
int vert_scale;
int pass;
@ -517,31 +453,11 @@ typedef struct VP8_COMP
int this_frame_percent_intra;
int last_frame_percent_intra;
int last_key_frame_q;
int last_kffilt_lvl;
int ref_frame_flags;
SPEED_FEATURES sf;
int error_bins[1024];
int inter_lvl;
int intra_lvl;
int motion_lvl;
int motion_speed;
int motion_var;
unsigned int next_iiratio;
unsigned int this_iiratio;
int this_frame_modified_error;
double norm_intra_err_per_mb;
double norm_inter_err_per_mb;
double norm_iidiff_per_mb;
int last_best_mode_index; // Record of mode index chosen for previous macro block.
int last_auto_filt_val;
int last_auto_filt_q;
// Data used for real time conferencing mode to help determine if it would be good to update the gf
int inter_zz_count;
int gf_bad_count;
@ -549,10 +465,6 @@ typedef struct VP8_COMP
int skip_true_count;
int skip_false_count;
int alt_qcount;
int ready_for_new_frame;
unsigned char *segmentation_map;
signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values)
int segment_encode_breakout[MAX_MB_SEGMENTS]; // segment threashold for encode breakout
@ -602,14 +514,49 @@ typedef struct VP8_COMP
unsigned int time_pick_lpf;
unsigned int time_encode_mb_row;
unsigned int tempdata1;
unsigned int tempdata2;
int base_skip_false_prob[128];
unsigned int section_intra_rating;
double section_max_qfactor;
struct twopass_rc
{
unsigned int section_intra_rating;
double section_max_qfactor;
unsigned int next_iiratio;
unsigned int this_iiratio;
FIRSTPASS_STATS *total_stats;
FIRSTPASS_STATS *this_frame_stats;
FIRSTPASS_STATS *stats_in, *stats_in_end;
int first_pass_done;
long long bits_left;
long long clip_bits_total;
double avg_iiratio;
double modified_error_total;
double modified_error_used;
double modified_error_left;
double total_error_left;
double total_intra_error_left;
double total_coded_error_left;
double start_tot_err_left;
double kf_intra_err_min;
double gf_intra_err_min;
int frames_to_key;
int maxq_max_limit;
int maxq_min_limit;
int gf_decay_rate;
int static_scene_max_gf_interval;
int kf_bits;
int gf_group_error_left; // Remaining error from uncoded frames in a gf group. Two pass use only
// Projected total bits available for a key frame group of frames
long long kf_group_bits;
// Error score of frames still to be coded in kf group
long long kf_group_error_left;
int gf_group_bits; // Projected Bits available for a group of frames including 1 GF or ARF
int gf_bits; // Bits for the golden frame or ARF - 2 pass only
int mid_gf_extra_bits; // A few extra bits for the frame half way between two gfs.
double est_max_qcorrection_factor;
} twopass;
#if CONFIG_RUNTIME_CPU_DETECT
VP8_ENCODER_RTCD rtcd;

View File

@ -170,8 +170,7 @@ static int get_prediction_error(BLOCK *be, BLOCKD *b, const vp8_variance_rtcd_vt
static int pick_intra4x4block(
const VP8_ENCODER_RTCD *rtcd,
MACROBLOCK *x,
BLOCK *be,
BLOCKD *b,
int ib,
B_PREDICTION_MODE *best_mode,
B_PREDICTION_MODE above,
B_PREDICTION_MODE left,
@ -179,6 +178,9 @@ static int pick_intra4x4block(
int *bestrate,
int *bestdistortion)
{
BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->block[ib];
B_PREDICTION_MODE mode;
int best_rd = INT_MAX; // 1<<30
int rate;
@ -214,8 +216,7 @@ static int pick_intra4x4block(
}
b->bmi.mode = (B_PREDICTION_MODE)(*best_mode);
vp8_encode_intra4x4block(rtcd, x, be, b, b->bmi.mode);
vp8_encode_intra4x4block(rtcd, x, ib);
return best_rd;
}
@ -245,8 +246,7 @@ int vp8_pick_intra4x4mby_modes
B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d);
pick_intra4x4block(rtcd, mb, mb->block + i, xd->block + i,
&best_mode, A, L, &r, &d);
pick_intra4x4block(rtcd, mb, i, &best_mode, A, L, &r, &d);
cost += r;
distortion += d;
@ -923,9 +923,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
cpi->rd_threshes[best_mode_index] = (cpi->rd_baseline_thresh[best_mode_index] >> 7) * cpi->rd_thresh_mult[best_mode_index];
}
// Keep a record of best mode index for use in next loop
cpi->last_best_mode_index = best_mode_index;
if (best_mbmode.mode <= B_PRED)
{
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;

View File

@ -142,7 +142,7 @@ static int get_max_filter_level(VP8_COMP *cpi, int base_qindex)
// with lots of intra coming in.
int max_filter_level = MAX_LOOP_FILTER ;//* 3 / 4;
if (cpi->section_intra_rating > 8)
if (cpi->twopass.section_intra_rating > 8)
max_filter_level = MAX_LOOP_FILTER * 3 / 4;
(void) cpi;
@ -377,8 +377,8 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
Bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; //PGW change 12/12/06 for small images
// jbb chg: 20100118 - in sections with lots of new material coming in don't bias as much to a low filter value
if (cpi->section_intra_rating < 20)
Bias = Bias * cpi->section_intra_rating / 20;
if (cpi->twopass.section_intra_rating < 20)
Bias = Bias * cpi->twopass.section_intra_rating / 20;
filt_high = ((filt_mid + filter_step) > max_filter_level) ? max_filter_level : (filt_mid + filter_step);
filt_low = ((filt_mid - filter_step) < min_filter_level) ? min_filter_level : (filt_mid - filter_step);
@ -474,8 +474,4 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
}
cm->filter_level = filt_best;
cpi->last_auto_filt_val = filt_best;
cpi->last_auto_filt_q = cm->base_qindex;
cpi->frames_since_auto_filter = 0;
}

View File

@ -671,7 +671,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
{
if (cpi->pass == 2)
{
cpi->per_frame_bandwidth = cpi->gf_bits; // Per frame bit target for the alt ref frame
cpi->per_frame_bandwidth = cpi->twopass.gf_bits; // Per frame bit target for the alt ref frame
cpi->this_frame_target = cpi->per_frame_bandwidth;
}
@ -1100,7 +1100,6 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
}
#endif
cpi->initial_gf_use = 0;
if (cpi->auto_adjust_gold_quantizer)
{
@ -1476,7 +1475,6 @@ void vp8_adjust_key_frame_context(VP8_COMP *cpi)
}
cpi->frames_since_key = 0;
cpi->last_key_frame_size = cpi->projected_frame_size;
cpi->key_frame_count++;
}

View File

@ -278,10 +278,11 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME))
{
if (cpi->next_iiratio > 31)
if (cpi->twopass.next_iiratio > 31)
cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4;
else
cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) >> 4;
cpi->RDMULT +=
(cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4;
}
#if !CONFIG_EXTEND_QRANGE
@ -2448,9 +2449,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
}
// Keep a record of best mode index that we chose
cpi->last_best_mode_index = best_mode_index;
// Note how often each mode chosen as best
cpi->mode_chosen_counts[best_mode_index] ++;