Merge "Code simplification" into experimental

This commit is contained in:
Paul Wilkins 2012-02-17 11:04:32 +00:00 committed by On2 (Google) Code Review
commit 5e1b5bff7d
15 changed files with 31 additions and 1718 deletions

View File

@ -186,17 +186,19 @@ void vp8_setup_version(VP8_COMMON *cm)
cm->full_pixel = 0;
break;
case 2:
case 3:
cm->no_lpf = 1;
cm->filter_type = NORMAL_LOOPFILTER;
cm->use_bilinear_mc_filter = 1;
cm->full_pixel = 0;
break;
case 3:
cm->no_lpf = 1;
cm->filter_type = SIMPLE_LOOPFILTER;
cm->use_bilinear_mc_filter = 1;
cm->full_pixel = 1;
break;
// Full pel only code deprecated in experimental code base
//case 3:
// cm->no_lpf = 1;
// cm->filter_type = SIMPLE_LOOPFILTER;
// cm->use_bilinear_mc_filter = 1;
// cm->full_pixel = 1;
// break;
}
}
void vp8_create_common(VP8_COMMON *oci)

View File

@ -56,8 +56,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_armv6;
/*cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;*/
/*cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_c;*/
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_armv6;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_armv6;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_armv6;
@ -103,8 +101,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_neon;
/*cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;*/
cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_neon;
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_neon;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_neon;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_neon;

View File

@ -83,7 +83,6 @@ extern prototype_variance(vp8_variance_halfpixvar16x16_hv_neon);
//extern prototype_getmbss(vp8_get_mb_ss_c);
extern prototype_variance(vp8_mse16x16_neon);
extern prototype_get16x16prederror(vp8_get4x4sse_cs_neon);
#if !CONFIG_RUNTIME_CPU_DETECT
#undef vp8_variance_sad4x4
@ -146,8 +145,6 @@ extern prototype_get16x16prederror(vp8_get4x4sse_cs_neon);
#undef vp8_variance_mse16x16
#define vp8_variance_mse16x16 vp8_mse16x16_neon
#undef vp8_variance_get4x4sse_cs
#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_neon
#endif
#endif

View File

@ -22,7 +22,6 @@
#include "encodeintra.h"
#include "vp8/common/reconinter.h"
#include "rdopt.h"
#include "pickinter.h"
#include "vp8/common/findnearmv.h"
#include "vp8/common/reconintra.h"
#include "vp8/common/seg_common.h"
@ -1161,14 +1160,6 @@ static void encode_frame_internal(VP8_COMP *cpi)
totalrate = 0;
if (cpi->compressor_speed == 2)
{
if (cpi->oxcf.cpu_used < 0)
cpi->Speed = -(cpi->oxcf.cpu_used);
else
vp8_auto_select_speed(cpi);
}
// Functions setup for all frame types so we can use MC in AltRef
if (cm->mcomp_filter_type == SIXTAP)
{
@ -1579,10 +1570,11 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
{
int rate;
if (cpi->sf.RD && cpi->compressor_speed != 2)
vp8_rd_pick_intra_mode(cpi, x, &rate);
else
vp8_pick_intra_mode(cpi, x, &rate);
// Non rd path deprecated in test code base
//if (cpi->sf.RD && cpi->compressor_speed != 2)
vp8_rd_pick_intra_mode(cpi, x, &rate);
//else
// vp8_pick_intra_mode(cpi, x, &rate);
if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
{
@ -1651,7 +1643,8 @@ int vp8cx_encode_inter_macroblock
else
x->encode_breakout = cpi->oxcf.encode_breakout;
if (cpi->sf.RD)
//if (cpi->sf.RD)
// For now this codebase is limited to a single rd encode path
{
int zbin_mode_boost_enabled = cpi->zbin_mode_boost_enabled;
int single, dual, hybrid;
@ -1715,9 +1708,10 @@ int vp8cx_encode_inter_macroblock
cpi->zbin_mode_boost_enabled = zbin_mode_boost_enabled;
}
else
vp8_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
&distortion, &intra_error);
//else
// The non rd encode path has been deleted from this code base
// to simplify development
// vp8_pick_inter_mode
cpi->prediction_error += distortion;
cpi->intra_error += intra_error;

View File

@ -1002,7 +1002,7 @@ static int estimate_max_q(VP8_COMP *cpi,
// Corrections for higher compression speed settings
// (reduced compression expected)
if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@ -1105,7 +1105,7 @@ static int estimate_cq( VP8_COMP *cpi,
// Corrections for higher compression speed settings
// (reduced compression expected)
if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@ -1173,7 +1173,7 @@ static int estimate_q(VP8_COMP *cpi, double section_err, int section_target_band
target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) ? (512 * section_target_bandwitdh) / num_mbs : 512 * (section_target_bandwitdh / num_mbs);
// Corrections for higher compression speed settings (reduced compression expected)
if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@ -1246,7 +1246,7 @@ static int estimate_kf_group_q(VP8_COMP *cpi, double section_err, int section_ta
iiratio_correction_factor = 0.5;
// Corrections for higher compression speed settings (reduced compression expected)
if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);

View File

@ -69,8 +69,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_c;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;
cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_c;
#if CONFIG_T8X8
cpi->rtcd.fdct.short8x8 = vp8_short_fdct8x8_c;
cpi->rtcd.fdct.haar_short2x2 = vp8_short_fhaar2x2_c;

View File

@ -792,6 +792,10 @@ void vp8_set_speed_features(VP8_COMP *cpi)
VP8_COMMON *cm = &cpi->common;
int last_improved_quant = sf->improved_quant;
// Only modes 0 and 1 supported for now in experimental code basae
if ( Mode > 1 )
Mode = 1;
// Initialise default mode frequency sampling variables
for (i = 0; i < MAX_MODES; i ++)
{
@ -871,7 +875,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
break;
case 1:
case 3:
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_DC ] = 0;
@ -890,7 +893,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000;
#if 1
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0;
@ -901,13 +903,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARA ] = 0;
// sf->thresh_mult[THR_DC ] = 0;
// sf->thresh_mult[THR_V_PRED ] = 1000;
// sf->thresh_mult[THR_H_PRED ] = 1000;
// sf->thresh_mult[THR_B_PRED ] = 2000;
// sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000;
@ -929,15 +924,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_DUAL_NEWLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 1000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 1000;
#else
sf->thresh_mult[THR_NEWMV ] = 1500;
sf->thresh_mult[THR_NEWG ] = 1500;
sf->thresh_mult[THR_NEWA ] = 1500;
sf->thresh_mult[THR_SPLITMV ] = 5000;
sf->thresh_mult[THR_SPLITG ] = 10000;
sf->thresh_mult[THR_SPLITA ] = 10000;
#endif
if (Speed > 0)
{
@ -1063,453 +1049,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
}
if (Speed > 3)
{
sf->thresh_mult[THR_SPLITA ] = INT_MAX;
sf->thresh_mult[THR_SPLITG ] = INT_MAX;
sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
cpi->mode_check_freq[THR_V_PRED] = 0;
cpi->mode_check_freq[THR_H_PRED] = 0;
cpi->mode_check_freq[THR_B_PRED] = 0;
cpi->mode_check_freq[THR_I8X8_PRED] = 0;
cpi->mode_check_freq[THR_NEARG] = 0;
cpi->mode_check_freq[THR_NEWG] = 0;
cpi->mode_check_freq[THR_NEARA] = 0;
cpi->mode_check_freq[THR_NEWA] = 0;
sf->auto_filter = 1;
sf->recode_loop = 0; // recode loop off
sf->RD = 0; // Turn rd off
}
if (Speed > 4)
{
sf->auto_filter = 0; // Faster selection of loop filter
cpi->mode_check_freq[THR_V_PRED] = 2;
cpi->mode_check_freq[THR_H_PRED] = 2;
cpi->mode_check_freq[THR_B_PRED] = 2;
cpi->mode_check_freq[THR_I8X8_PRED]=2;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
cpi->mode_check_freq[THR_NEARG] = 2;
cpi->mode_check_freq[THR_NEWG] = 4;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
cpi->mode_check_freq[THR_NEARA] = 2;
cpi->mode_check_freq[THR_NEWA] = 4;
}
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEARESTG ] = 2000;
sf->thresh_mult[THR_ZEROG ] = 2000;
sf->thresh_mult[THR_NEARG ] = 2000;
sf->thresh_mult[THR_NEWG ] = 4000;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
sf->thresh_mult[THR_NEARESTA ] = 2000;
sf->thresh_mult[THR_ZEROA ] = 2000;
sf->thresh_mult[THR_NEARA ] = 2000;
sf->thresh_mult[THR_NEWA ] = 4000;
}
sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
}
break;
case 2:
sf->optimize_coefficients = 0;
sf->recode_loop = 0;
sf->auto_filter = 1;
sf->iterative_sub_pixel = 1;
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_DC ] = 0;
sf->thresh_mult[THR_TM ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_V_PRED ] = 1000;
sf->thresh_mult[THR_H_PRED ] = 1000;
sf->thresh_mult[THR_B_PRED ] = 2500;
sf->thresh_mult[THR_I8X8_PRED] = 2500;
sf->thresh_mult[THR_NEARESTG ] = 1000;
sf->thresh_mult[THR_ZEROG ] = 1000;
sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARESTA ] = 1000;
sf->thresh_mult[THR_ZEROA ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000;
sf->thresh_mult[THR_NEWMV ] = 2000;
sf->thresh_mult[THR_NEWG ] = 2000;
sf->thresh_mult[THR_NEWA ] = 2000;
sf->thresh_mult[THR_SPLITMV ] = 5000;
sf->thresh_mult[THR_SPLITG ] = 10000;
sf->thresh_mult[THR_SPLITA ] = 10000;
sf->search_method = NSTEP;
sf->thresh_mult[THR_DUAL_ZEROLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 1000;
sf->thresh_mult[THR_DUAL_NEARLG ] = 1000;
sf->thresh_mult[THR_DUAL_ZEROLA ] = 1000;
sf->thresh_mult[THR_DUAL_NEARESTLA] = 1000;
sf->thresh_mult[THR_DUAL_NEARLA ] = 1000;
sf->thresh_mult[THR_DUAL_ZEROGA ] = 1000;
sf->thresh_mult[THR_DUAL_NEARESTGA] = 1000;
sf->thresh_mult[THR_DUAL_NEARGA ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2000;
if (Speed > 0)
{
cpi->mode_check_freq[THR_SPLITG] = 4;
cpi->mode_check_freq[THR_SPLITA] = 4;
cpi->mode_check_freq[THR_SPLITMV] = 2;
sf->thresh_mult[THR_DC ] = 0;
sf->thresh_mult[THR_TM ] = 1000;
sf->thresh_mult[THR_V_PRED ] = 2000;
sf->thresh_mult[THR_H_PRED ] = 2000;
sf->thresh_mult[THR_B_PRED ] = 5000;
sf->thresh_mult[THR_I8X8_PRED] = 5000;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_NEARMV ] = 0;
sf->thresh_mult[THR_NEWMV ] = 2000;
sf->thresh_mult[THR_SPLITMV ] = 10000;
}
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEARESTG ] = 1000;
sf->thresh_mult[THR_ZEROG ] = 1000;
sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEWG ] = 2000;
sf->thresh_mult[THR_SPLITG ] = 20000;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
sf->thresh_mult[THR_NEARESTA ] = 1000;
sf->thresh_mult[THR_ZEROA ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000;
sf->thresh_mult[THR_NEWA ] = 2000;
sf->thresh_mult[THR_SPLITA ] = 20000;
}
sf->improved_quant = 0;
sf->improved_dct = 0;
sf->use_fastquant_for_pick = 1;
sf->no_skip_block4x4_search = 0;
sf->first_step = 1;
}
if (Speed > 1)
{
cpi->mode_check_freq[THR_SPLITMV] = 7;
cpi->mode_check_freq[THR_SPLITG] = 15;
cpi->mode_check_freq[THR_SPLITA] = 15;
sf->thresh_mult[THR_TM ] = 2000;
sf->thresh_mult[THR_V_PRED ] = 2000;
sf->thresh_mult[THR_H_PRED ] = 2000;
sf->thresh_mult[THR_B_PRED ] = 5000;
sf->thresh_mult[THR_I8X8_PRED] = 5000;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{
sf->thresh_mult[THR_NEWMV ] = 2000;
sf->thresh_mult[THR_SPLITMV ] = 25000;
}
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEARESTG ] = 2000;
sf->thresh_mult[THR_ZEROG ] = 2000;
sf->thresh_mult[THR_NEARG ] = 2000;
sf->thresh_mult[THR_NEWG ] = 2500;
sf->thresh_mult[THR_SPLITG ] = 50000;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
sf->thresh_mult[THR_NEARESTA ] = 2000;
sf->thresh_mult[THR_ZEROA ] = 2000;
sf->thresh_mult[THR_NEARA ] = 2000;
sf->thresh_mult[THR_NEWA ] = 2500;
sf->thresh_mult[THR_SPLITA ] = 50000;
}
sf->thresh_mult[THR_DUAL_ZEROLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 2000;
sf->thresh_mult[THR_DUAL_NEARLG ] = 2000;
sf->thresh_mult[THR_DUAL_ZEROLA ] = 2000;
sf->thresh_mult[THR_DUAL_NEARESTLA] = 2000;
sf->thresh_mult[THR_DUAL_NEARLA ] = 2000;
sf->thresh_mult[THR_DUAL_ZEROGA ] = 2000;
sf->thresh_mult[THR_DUAL_NEARESTGA] = 2000;
sf->thresh_mult[THR_DUAL_NEARGA ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2500;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2500;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2500;
}
if (Speed > 2)
{
sf->auto_filter = 0; // Faster selection of loop filter
cpi->mode_check_freq[THR_V_PRED] = 2;
cpi->mode_check_freq[THR_H_PRED] = 2;
cpi->mode_check_freq[THR_B_PRED] = 2;
cpi->mode_check_freq[THR_I8X8_PRED]=2;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
cpi->mode_check_freq[THR_NEARG] = 2;
cpi->mode_check_freq[THR_NEWG] = 4;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
cpi->mode_check_freq[THR_NEARA] = 2;
cpi->mode_check_freq[THR_NEWA] = 4;
}
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
sf->thresh_mult[THR_SPLITG ] = INT_MAX;
sf->thresh_mult[THR_SPLITA ] = INT_MAX;
}
if (Speed > 3)
{
sf->RD = 0;
sf->auto_filter = 1;
}
if (Speed > 4)
{
sf->auto_filter = 0; // Faster selection of loop filter
sf->search_method = HEX;
//sf->search_method = DIAMOND;
sf->iterative_sub_pixel = 0;
cpi->mode_check_freq[THR_V_PRED] = 4;
cpi->mode_check_freq[THR_H_PRED] = 4;
cpi->mode_check_freq[THR_B_PRED] = 4;
cpi->mode_check_freq[THR_I8X8_PRED]=4;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
cpi->mode_check_freq[THR_NEARG] = 2;
cpi->mode_check_freq[THR_NEWG] = 4;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
cpi->mode_check_freq[THR_NEARA] = 2;
cpi->mode_check_freq[THR_NEWA] = 4;
}
sf->thresh_mult[THR_TM ] = 2000;
sf->thresh_mult[THR_B_PRED ] = 5000;
sf->thresh_mult[THR_I8X8_PRED] = 5000;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEARESTG ] = 2000;
sf->thresh_mult[THR_ZEROG ] = 2000;
sf->thresh_mult[THR_NEARG ] = 2000;
sf->thresh_mult[THR_NEWG ] = 4000;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
sf->thresh_mult[THR_NEARESTA ] = 2000;
sf->thresh_mult[THR_ZEROA ] = 2000;
sf->thresh_mult[THR_NEARA ] = 2000;
sf->thresh_mult[THR_NEWA ] = 4000;
}
sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
}
if (Speed > 5)
{
// Disable split MB intra prediction mode
sf->thresh_mult[THR_B_PRED] = INT_MAX;
sf->thresh_mult[THR_I8X8_PRED] = INT_MAX;
}
if (Speed > 6)
{
unsigned int i, sum = 0;
unsigned int total_mbs = cm->MBs;
int thresh;
int total_skip;
int min = 2000;
if (cpi->oxcf.encode_breakout > 2000)
min = cpi->oxcf.encode_breakout;
min >>= 7;
for (i = 0; i < min; i++)
{
sum += cpi->error_bins[i];
}
total_skip = sum;
sum = 0;
// i starts from 2 to make sure thresh started from 2048
for (; i < 1024; i++)
{
sum += cpi->error_bins[i];
if (10 * sum >= (unsigned int)(cpi->Speed - 6)*(total_mbs - total_skip))
break;
}
i--;
thresh = (i << 7);
if (thresh < 2000)
thresh = 2000;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{
sf->thresh_mult[THR_NEWMV] = thresh;
sf->thresh_mult[THR_NEARESTMV ] = thresh >> 1;
sf->thresh_mult[THR_NEARMV ] = thresh >> 1;
}
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEWG] = thresh << 1;
sf->thresh_mult[THR_NEARESTG ] = thresh;
sf->thresh_mult[THR_NEARG ] = thresh;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
sf->thresh_mult[THR_NEWA] = thresh << 1;
sf->thresh_mult[THR_NEARESTA ] = thresh;
sf->thresh_mult[THR_NEARA ] = thresh;
}
sf->thresh_mult[THR_DUAL_ZEROLG ] = thresh;
sf->thresh_mult[THR_DUAL_NEARESTLG] = thresh;
sf->thresh_mult[THR_DUAL_NEARLG ] = thresh;
sf->thresh_mult[THR_DUAL_ZEROLA ] = thresh;
sf->thresh_mult[THR_DUAL_NEARESTLA] = thresh;
sf->thresh_mult[THR_DUAL_NEARLA ] = thresh;
sf->thresh_mult[THR_DUAL_ZEROGA ] = thresh;
sf->thresh_mult[THR_DUAL_NEARESTGA] = thresh;
sf->thresh_mult[THR_DUAL_NEARGA ] = thresh;
sf->thresh_mult[THR_DUAL_NEWLG ] = thresh << 1;
sf->thresh_mult[THR_DUAL_NEWLA ] = thresh << 1;
sf->thresh_mult[THR_DUAL_NEWGA ] = thresh << 1;
// Disable other intra prediction modes
sf->thresh_mult[THR_TM] = INT_MAX;
sf->thresh_mult[THR_V_PRED] = INT_MAX;
sf->thresh_mult[THR_H_PRED] = INT_MAX;
sf->improved_mv_pred = 0;
}
if (Speed > 8)
{
sf->quarter_pixel_search = 0;
}
if (Speed > 9)
{
int Tmp = cpi->Speed - 8;
if (Tmp > 4)
Tmp = 4;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
cpi->mode_check_freq[THR_ZEROG] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_NEARESTG] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_NEARG] = 1 << Tmp;
cpi->mode_check_freq[THR_NEWG] = 1 << (Tmp + 1);
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
cpi->mode_check_freq[THR_ZEROA] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_NEARESTA] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_NEARA] = 1 << Tmp;
cpi->mode_check_freq[THR_NEWA] = 1 << (Tmp + 1);
}
cpi->mode_check_freq[THR_DUAL_ZEROLG ] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARESTLG] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 1 << Tmp;
cpi->mode_check_freq[THR_DUAL_ZEROLA ] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARESTLA] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARLA ] = 1 << Tmp;
cpi->mode_check_freq[THR_DUAL_ZEROGA ] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARESTGA] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARGA ] = 1 << Tmp;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 1 << (Tmp + 1);
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 1 << (Tmp + 1);
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 1 << (Tmp + 1);
cpi->mode_check_freq[THR_NEWMV] = 1 << (Tmp - 1);
}
cm->filter_type = NORMAL_LOOPFILTER;
if (Speed >= 14)
cm->filter_type = SIMPLE_LOOPFILTER;
if (Speed >= 15)
{
sf->half_pixel_search = 0; // This has a big hit on quality. Last resort
}
vpx_memset(cpi->error_bins, 0, sizeof(cpi->error_bins));
}; /* switch */
@ -1646,19 +1186,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
{
cpi->find_fractional_mv_step = vp8_find_best_half_pixel_step;
}
else
{
cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
}
if (cpi->sf.optimize_coefficients == 1 && cpi->pass!=1)
cpi->mb.optimize = 1;
else
cpi->mb.optimize = 0;
if (cpi->common.full_pixel)
cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
#ifdef SPEEDSTATS
frames_at_speed[cpi->Speed]++;
#endif
@ -1930,44 +1463,12 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
switch (cpi->oxcf.Mode)
{
case MODE_REALTIME:
cpi->pass = 0;
cpi->compressor_speed = 2;
if (cpi->oxcf.cpu_used < -16)
{
cpi->oxcf.cpu_used = -16;
}
if (cpi->oxcf.cpu_used > 16)
cpi->oxcf.cpu_used = 16;
break;
case MODE_GOODQUALITY:
cpi->pass = 0;
cpi->compressor_speed = 1;
if (cpi->oxcf.cpu_used < -5)
{
cpi->oxcf.cpu_used = -5;
}
if (cpi->oxcf.cpu_used > 5)
cpi->oxcf.cpu_used = 5;
break;
case MODE_BESTQUALITY:
cpi->pass = 0;
cpi->compressor_speed = 0;
break;
// Real time and one pass deprecated in test code base
case MODE_FIRSTPASS:
cpi->pass = 1;
cpi->compressor_speed = 1;
break;
case MODE_SECONDPASS:
cpi->pass = 2;
cpi->compressor_speed = 1;
@ -1981,6 +1482,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
cpi->oxcf.cpu_used = 5;
break;
case MODE_SECONDPASS_BEST:
cpi->pass = 2;
cpi->compressor_speed = 0;
@ -2453,13 +1955,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
vp8_init_second_pass(cpi);
}
if (cpi->compressor_speed == 2)
{
cpi->cpu_freq = 0; //vp8_get_processor_freq();
cpi->avg_encode_time = 0;
cpi->avg_pick_mode_time = 0;
}
vp8_set_speed_features(cpi);
// Set starting values of RD threshold multipliers (128 = *1)
@ -2632,25 +2127,6 @@ void vp8_remove_compressor(VP8_PTR *ptr)
#endif
#ifdef SPEEDSTATS
if (cpi->compressor_speed == 2)
{
int i;
FILE *f = fopen("cxspeed.stt", "a");
cnt_pm /= cpi->common.MBs;
for (i = 0; i < 16; i++)
fprintf(f, "%5d", frames_at_speed[i]);
fprintf(f, "\n");
//fprintf(f, "%10d PM %10d %10d %10d EF %10d %10d %10d\n", cpi->Speed, cpi->avg_pick_mode_time, (tot_pm/cnt_pm), cnt_pm, cpi->avg_encode_time, 0, 0);
fclose(f);
}
#endif
#ifdef MODE_STATS
{
extern int count_mb_seg[4];
@ -3311,50 +2787,6 @@ static int decide_key_frame(VP8_COMP *cpi)
// Clear down mmx registers
vp8_clear_system_state(); //__asm emms;
if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0))
{
double change = 1.0 * abs((int)(cpi->intra_error - cpi->last_intra_error)) / (1 + cpi->last_intra_error);
double change2 = 1.0 * abs((int)(cpi->prediction_error - cpi->last_prediction_error)) / (1 + cpi->last_prediction_error);
double minerror = cm->MBs * 256;
#if 0
if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
&& cpi->prediction_error > minerror
&& (change > .25 || change2 > .25))
{
FILE *f = fopen("intra_inter.stt", "a");
if (cpi->prediction_error <= 0)
cpi->prediction_error = 1;
fprintf(f, "%d %d %d %d %14.4f\n",
cm->current_video_frame,
(int) cpi->prediction_error,
(int) cpi->intra_error,
(int)((10 * cpi->intra_error) / cpi->prediction_error),
change);
fclose(f);
}
#endif
cpi->last_intra_error = cpi->intra_error;
cpi->last_prediction_error = cpi->prediction_error;
if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
&& cpi->prediction_error > minerror
&& (change > .25 || change2 > .25))
{
/*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > cpi->last_frame_percent_intra + 3*/
return TRUE;
}
return FALSE;
}
// If the following are true we might as well code a key frame
if (((cpi->this_frame_percent_intra == 100) &&
(cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra + 2))) ||
@ -3759,18 +3191,6 @@ static void encode_frame_to_data_rate
// Clear down mmx registers to allow floating point in what follows
vp8_clear_system_state();
if (cpi->compressor_speed == 2)
{
if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
{
if(cpi->force_next_frame_intra)
{
cm->frame_type = KEY_FRAME; /* delayed intra frame */
}
}
cpi->force_next_frame_intra = 0;
}
// For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth
if (cpi->pass == 2)
{
@ -4345,13 +3765,7 @@ static void encode_frame_to_data_rate
{
int key_frame_decision = decide_key_frame(cpi);
if (cpi->compressor_speed == 2)
{
/* we don't do re-encoding in realtime mode
* if key frame is decided than we force it on next frame */
cpi->force_next_frame_intra = key_frame_decision;
}
else if (key_frame_decision)
if (key_frame_decision)
{
// Reset all our sizing numbers and recode
cm->frame_type = KEY_FRAME;
@ -5374,13 +4788,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
cpi->last_end_time_stamp_seen = cpi->source->ts_end;
}
if (cpi->compressor_speed == 2)
{
check_gf_quality(cpi);
vpx_usec_timer_start(&tsctimer);
vpx_usec_timer_start(&ticktimer);
}
// start with a 0 size frame
*size = 0;
@ -5430,39 +4837,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
else
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
if (cpi->compressor_speed == 2)
{
unsigned int duration, duration2;
vpx_usec_timer_mark(&tsctimer);
vpx_usec_timer_mark(&ticktimer);
duration = vpx_usec_timer_elapsed(&ticktimer);
duration2 = (unsigned int)((double)duration / 2);
if (cm->frame_type != KEY_FRAME)
{
if (cpi->avg_encode_time == 0)
cpi->avg_encode_time = duration;
else
cpi->avg_encode_time = (7 * cpi->avg_encode_time + duration) >> 3;
}
if (duration2)
{
//if(*frame_flags!=1)
{
if (cpi->avg_pick_mode_time == 0)
cpi->avg_pick_mode_time = duration2;
else
cpi->avg_pick_mode_time = (7 * cpi->avg_pick_mode_time + duration2) >> 3;
}
}
}
if(cm->refresh_entropy_probs)
{
if(cm->refresh_alt_ref_frame)

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef __INC_PICKINTER_H
#define __INC_PICKINTER_H
#include "vpx_ports/config.h"
#include "vp8/common/onyxc_int.h"
extern void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra);
extern void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate);
#endif

View File

@ -48,8 +48,6 @@ void (*vp8_subtract_mby)(short *diff, unsigned char *src, unsigned char *pred, i
void (*vp8_subtract_mbuv)(short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride);
void (*vp8_fast_quantize_b)(BLOCK *b, BLOCKD *d);
unsigned int (*vp8_get4x4sse_cs)(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
// c imports
extern int block_error_c(short *coeff, short *dqcoeff);
extern int vp8_mbblock_error_c(MACROBLOCK *mb, int dc);
@ -85,7 +83,6 @@ extern sub_pixel_variance_function sub_pixel_variance16x8_c;
extern sub_pixel_variance_function sub_pixel_variance16x16_c;
extern unsigned int vp8_get_mb_ss_c(short *);
extern unsigned int vp8_get4x4sse_cs_c(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
// ppc
extern int vp8_block_error_ppc(short *coeff, short *dqcoeff);
@ -143,7 +140,6 @@ void vp8_cmachine_specific_config(void)
vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_ppc;
vp8_get_mb_ss = vp8_get_mb_ss_c;
vp8_get4x4sse_cs = vp8_get4x4sse_cs_c;
vp8_sad16x16 = vp8_sad16x16_ppc;
vp8_sad16x8 = vp8_sad16x8_ppc;

View File

@ -471,13 +471,6 @@ static void calc_gf_params(VP8_COMP *cpi)
#endif
}
// golden frame boost without recode loop often goes awry. be safe by keeping numbers down.
if (!cpi->sf.recode_loop)
{
if (cpi->compressor_speed == 2)
Boost = Boost / 2;
}
// Apply an upper limit based on Q for 1 pass encodes
// TODO.
// This is a temporay measure oas one pass not really supported yet in

View File

@ -315,11 +315,6 @@ extern prototype_getmbss(vp8_variance_getmbss);
#endif
extern prototype_variance(vp8_variance_mse16x16);
#ifndef vp8_variance_get4x4sse_cs
#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_c
#endif
extern prototype_get16x16prederror(vp8_variance_get4x4sse_cs);
#ifndef vp8_ssimpf_8x8
#define vp8_ssimpf_8x8 vp8_ssim_parms_8x8_c
#endif
@ -373,8 +368,6 @@ typedef struct
vp8_getmbss_fn_t getmbss;
vp8_variance_fn_t mse16x16;
vp8_get16x16prederror_fn_t get4x4sse_cs;
vp8_sad_multi_fn_t sad16x16x3;
vp8_sad_multi_fn_t sad16x8x3;
vp8_sad_multi_fn_t sad8x16x3;

View File

@ -42,7 +42,6 @@ extern prototype_subpixvariance(vp8_sub_pixel_mse16x16_mmx);
extern prototype_getmbss(vp8_get_mb_ss_mmx);
extern prototype_variance(vp8_mse16x16_mmx);
extern prototype_variance2(vp8_get8x8var_mmx);
extern prototype_get16x16prederror(vp8_get4x4sse_cs_mmx);
#if !CONFIG_RUNTIME_CPU_DETECT
#undef vp8_variance_sad4x4
@ -108,9 +107,6 @@ extern prototype_get16x16prederror(vp8_get4x4sse_cs_mmx);
#undef vp8_variance_mse16x16
#define vp8_variance_mse16x16 vp8_mse16x16_mmx
#undef vp8_variance_get4x4sse_cs
#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_mmx
#endif
#endif

View File

@ -152,8 +152,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_mmx;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_mmx;
cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_mmx;
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_mmx;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_mmx;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_mmx;
@ -201,8 +199,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_wmt;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_sse2;
/* cpi->rtcd.variance.get4x4sse_cs not implemented for wmt */;
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_sse2;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_sse2;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_sse2;

View File

@ -57,7 +57,6 @@ VP8_CX_SRCS-yes += encoder/lookahead.h
VP8_CX_SRCS-yes += encoder/mcomp.h
VP8_CX_SRCS-yes += encoder/modecosts.h
VP8_CX_SRCS-yes += encoder/onyx_int.h
VP8_CX_SRCS-yes += encoder/pickinter.h
VP8_CX_SRCS-yes += encoder/psnr.h
VP8_CX_SRCS-yes += encoder/quantize.h
VP8_CX_SRCS-yes += encoder/ratectrl.h
@ -68,7 +67,6 @@ VP8_CX_SRCS-yes += encoder/variance.h
VP8_CX_SRCS-yes += encoder/mcomp.c
VP8_CX_SRCS-yes += encoder/modecosts.c
VP8_CX_SRCS-yes += encoder/onyx_if.c
VP8_CX_SRCS-yes += encoder/pickinter.c
VP8_CX_SRCS-yes += encoder/picklpf.c
VP8_CX_SRCS-yes += encoder/psnr.c
VP8_CX_SRCS-yes += encoder/quantize.c