Merge remote branch 'internal/upstream' into HEAD

Conflicts:
	configure

Change-Id: I0bc38a6558d0d7f62cd2c551e75c3a59e39008bd
This commit is contained in:
John Koleszar 2011-01-21 10:14:46 -05:00
Родитель 46d9ff1b97 8064583d26
Коммит b6aee6ffab
4 изменённых файлов: 73 добавлений и 31 удалений

Просмотреть файл

@ -78,6 +78,7 @@ Build options:
--log=yes|no|FILE file configure log is written to [config.err] --log=yes|no|FILE file configure log is written to [config.err]
--target=TARGET target platform tuple [generic-gnu] --target=TARGET target platform tuple [generic-gnu]
--cpu=CPU optimize for a specific cpu rather than a family --cpu=CPU optimize for a specific cpu rather than a family
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
${toggle_extra_warnings} emit harmless warnings (always non-fatal) ${toggle_extra_warnings} emit harmless warnings (always non-fatal)
${toggle_werror} treat warnings as errors, if possible ${toggle_werror} treat warnings as errors, if possible
(not available with all compilers) (not available with all compilers)
@ -442,6 +443,9 @@ process_common_cmdline() {
;; ;;
--cpu=*) tune_cpu="$optval" --cpu=*) tune_cpu="$optval"
;; ;;
--extra-cflags=*)
extra_cflags="${optval}"
;;
--enable-?*|--disable-?*) --enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
echo "${CMDLINE_SELECT} ${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null || die_unknown $opt echo "${CMDLINE_SELECT} ${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null || die_unknown $opt
@ -665,7 +669,7 @@ process_common_toolchain() {
check_add_cflags -march=${tgt_isa} check_add_cflags -march=${tgt_isa}
check_add_asflags -march=${tgt_isa} check_add_asflags -march=${tgt_isa}
fi fi
enabled debug && add_asflags -g
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
;; ;;
rvct) rvct)
@ -690,6 +694,7 @@ process_common_toolchain() {
arch_int=${tgt_isa##armv} arch_int=${tgt_isa##armv}
arch_int=${arch_int%%te} arch_int=${arch_int%%te}
check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\"" check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\""
enabled debug && add_asflags -g
;; ;;
esac esac
@ -972,6 +977,10 @@ EOF
add_cflags -D_LARGEFILE_SOURCE add_cflags -D_LARGEFILE_SOURCE
add_cflags -D_FILE_OFFSET_BITS=64 add_cflags -D_FILE_OFFSET_BITS=64
fi fi
# append any user defined extra cflags
check_add_cflags ${extra_cflags} || \
die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler"
} }
process_toolchain() { process_toolchain() {

3
configure поставляемый
Просмотреть файл

@ -319,10 +319,9 @@ process_cmdline() {
log_echo "Ignoring $opt -- not in experimental mode." log_echo "Ignoring $opt -- not in experimental mode."
fi fi
else else
process_common_cmdline $opt process_common_cmdline "$opt"
fi fi
;; ;;
*) process_common_cmdline $opt
;; ;;
esac esac
done done

Просмотреть файл

@ -1337,17 +1337,20 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
double decay_accumulator = 1.0; double decay_accumulator = 1.0;
double boost_factor = IIFACTOR; double boost_factor = IIFACTOR;
double loop_decay_rate = 1.00; // Starting decay rate double loop_decay_rate = 1.00; // Starting decay rate
double this_frame_mv_in_out = 0.0; double this_frame_mv_in_out = 0.0;
double mv_in_out_accumulator = 0.0; double mv_in_out_accumulator = 0.0;
double abs_mv_in_out_accumulator = 0.0; double abs_mv_in_out_accumulator = 0.0;
double mod_err_per_mb_accumulator = 0.0; double mod_err_per_mb_accumulator = 0.0;
int max_bits = frame_max_bits(cpi); // Max for a single frame int max_bits = frame_max_bits(cpi); // Max for a single frame
unsigned char *fpmm_pos; unsigned char *fpmm_pos;
unsigned int allow_alt_ref =
cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames;
cpi->gf_group_bits = 0; cpi->gf_group_bits = 0;
cpi->gf_decay_rate = 0; cpi->gf_decay_rate = 0;
@ -1362,47 +1365,57 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
// Preload the stats for the next frame. // Preload the stats for the next frame.
mod_frame_err = calculate_modified_err(cpi, this_frame); mod_frame_err = calculate_modified_err(cpi, this_frame);
// Note the error of the frame at the start of the group (this will be the GF frame error if we code a normal gf // Note the error of the frame at the start of the group (this will be
// the GF frame error if we code a normal gf
gf_first_frame_err = mod_frame_err; gf_first_frame_err = mod_frame_err;
// Special treatment if the current frame is a key frame (which is also a gf). // Special treatment if the current frame is a key frame (which is also
// If it is then its error score (and hence bit allocation) need to be subtracted out // a gf). If it is then its error score (and hence bit allocation) need
// from the calculation for the GF group // to be subtracted out from the calculation for the GF group
if (cpi->common.frame_type == KEY_FRAME) if (cpi->common.frame_type == KEY_FRAME)
gf_group_err -= gf_first_frame_err; gf_group_err -= gf_first_frame_err;
// Scan forward to try and work out how many frames the next gf group should contain and // Scan forward to try and work out how many frames the next gf group
// what level of boost is appropriate for the GF or ARF that will be coded with the group // should contain and what level of boost is appropriate for the GF
// or ARF that will be coded with the group
i = 0; i = 0;
while (((i < cpi->static_scene_max_gf_interval) || ((cpi->frames_to_key - i) < MIN_GF_INTERVAL)) && (i < cpi->frames_to_key)) while (((i < cpi->static_scene_max_gf_interval) ||
((cpi->frames_to_key - i) < MIN_GF_INTERVAL)) &&
(i < cpi->frames_to_key))
{ {
double r; double r;
double this_frame_mvr_ratio; double this_frame_mvr_ratio;
double this_frame_mvc_ratio; double this_frame_mvc_ratio;
double motion_decay; double motion_decay;
double motion_pct = next_frame.pcnt_motion; //double motion_pct = next_frame.pcnt_motion;
double motion_pct;
i++; // Increment the loop counter i++; // Increment the loop counter
// Accumulate error score of frames in this gf group // Accumulate error score of frames in this gf group
mod_frame_err = calculate_modified_err(cpi, this_frame); mod_frame_err = calculate_modified_err(cpi, this_frame);
gf_group_err += mod_frame_err; gf_group_err += mod_frame_err;
mod_err_per_mb_accumulator += mod_frame_err / DOUBLE_DIVIDE_CHECK((double)cpi->common.MBs); mod_err_per_mb_accumulator +=
mod_frame_err / DOUBLE_DIVIDE_CHECK((double)cpi->common.MBs);
if (EOF == vp8_input_stats(cpi, &next_frame)) if (EOF == vp8_input_stats(cpi, &next_frame))
break; break;
// Accumulate motion stats. // Accumulate motion stats.
motion_pct = next_frame.pcnt_motion;
mv_accumulator_rabs += fabs(next_frame.mvr_abs * motion_pct); mv_accumulator_rabs += fabs(next_frame.mvr_abs * motion_pct);
mv_accumulator_cabs += fabs(next_frame.mvc_abs * motion_pct); mv_accumulator_cabs += fabs(next_frame.mvc_abs * motion_pct);
//Accumulate Motion In/Out of frame stats //Accumulate Motion In/Out of frame stats
this_frame_mv_in_out = next_frame.mv_in_out_count * next_frame.pcnt_motion; this_frame_mv_in_out =
mv_in_out_accumulator += next_frame.mv_in_out_count * next_frame.pcnt_motion; next_frame.mv_in_out_count * motion_pct;
abs_mv_in_out_accumulator += fabs(next_frame.mv_in_out_count * next_frame.pcnt_motion); mv_in_out_accumulator +=
next_frame.mv_in_out_count * motion_pct;
abs_mv_in_out_accumulator +=
fabs(next_frame.mv_in_out_count * motion_pct);
// If there is a significant amount of motion // If there is a significant amount of motion
if (motion_pct > 0.05) if (motion_pct > 0.05)
@ -1431,7 +1444,9 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
} }
// Underlying boost factor is based on inter intra error ratio // Underlying boost factor is based on inter intra error ratio
r = (boost_factor * (next_frame.intra_error / DOUBLE_DIVIDE_CHECK(next_frame.coded_error))); r = ( boost_factor *
( next_frame.intra_error /
DOUBLE_DIVIDE_CHECK(next_frame.coded_error)));
if (next_frame.intra_error > cpi->gf_intra_err_min) if (next_frame.intra_error > cpi->gf_intra_err_min)
r = (IIKFACTOR2 * next_frame.intra_error / r = (IIKFACTOR2 * next_frame.intra_error /
@ -1440,13 +1455,15 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
r = (IIKFACTOR2 * cpi->gf_intra_err_min / r = (IIKFACTOR2 * cpi->gf_intra_err_min /
DOUBLE_DIVIDE_CHECK(next_frame.coded_error)); DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
// Increase boost for frames where new data coming into frame (eg zoom out) // Increase boost for frames where new data coming into frame
// Slightly reduce boost if there is a net balance of motion out of the frame (zoom in) // (eg zoom out). Slightly reduce boost if there is a net balance
// of motion out of the frame (zoom in).
// The range for this_frame_mv_in_out is -1.0 to +1.0 // The range for this_frame_mv_in_out is -1.0 to +1.0
if (this_frame_mv_in_out > 0.0) if (this_frame_mv_in_out > 0.0)
r += r * (this_frame_mv_in_out * 2.0); r += r * (this_frame_mv_in_out * 2.0);
// In extreme case boost is halved
else else
r += r * (this_frame_mv_in_out / 2.0); // In extreme case boost is halved r += r * (this_frame_mv_in_out / 2.0);
if (r > GF_RMAX) if (r > GF_RMAX)
r = GF_RMAX; r = GF_RMAX;
@ -1484,10 +1501,24 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
boost_score += (decay_accumulator * r); boost_score += (decay_accumulator * r);
// Break clause to detect very still sections after motion
// For example a staic image after a fade or other transition
// instead of a clean key frame.
if ( (i > MIN_GF_INTERVAL) &&
(loop_decay_rate >= 0.999) &&
(decay_accumulator < 0.9) )
{
// Force GF not alt ref
allow_alt_ref = FALSE;
boost_score = old_boost_score;
break;
}
// Break out conditions. // Break out conditions.
if ( /* i>4 || */ if ( /* i>4 || */
// Break at cpi->max_gf_interval unless almost totally static // Break at cpi->max_gf_interval unless almost totally static
(i >= cpi->max_gf_interval && (decay_accumulator < 0.99)) || (i >= cpi->max_gf_interval && (decay_accumulator < 0.995)) ||
( (
// Dont break out with a very short interval // Dont break out with a very short interval
(i > MIN_GF_INTERVAL) && (i > MIN_GF_INTERVAL) &&
@ -1509,7 +1540,8 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
old_boost_score = boost_score; old_boost_score = boost_score;
} }
cpi->gf_decay_rate = (i > 0) ? (int)(100.0 * (1.0 - decay_accumulator)) / i : 0; cpi->gf_decay_rate =
(i > 0) ? (int)(100.0 * (1.0 - decay_accumulator)) / i : 0;
// When using CBR apply additional buffer related upper limits // When using CBR apply additional buffer related upper limits
if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
@ -1519,7 +1551,8 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
// For cbr apply buffer related limits // For cbr apply buffer related limits
if (cpi->drop_frames_allowed) if (cpi->drop_frames_allowed)
{ {
int df_buffer_level = cpi->oxcf.drop_frames_water_mark * (cpi->oxcf.optimal_buffer_level / 100); int df_buffer_level = cpi->oxcf.drop_frames_water_mark *
(cpi->oxcf.optimal_buffer_level / 100);
if (cpi->buffer_level > df_buffer_level) if (cpi->buffer_level > df_buffer_level)
max_boost = ((double)((cpi->buffer_level - df_buffer_level) * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth); max_boost = ((double)((cpi->buffer_level - df_buffer_level) * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
@ -1542,10 +1575,10 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
cpi->gfu_boost = (int)(boost_score * 100.0) >> 4; cpi->gfu_boost = (int)(boost_score * 100.0) >> 4;
// Should we use the alternate refernce frame // Should we use the alternate refernce frame
if (cpi->oxcf.play_alternate && if (allow_alt_ref &&
cpi->oxcf.lag_in_frames &&
(i >= MIN_GF_INTERVAL) && (i >= MIN_GF_INTERVAL) &&
(i <= (cpi->frames_to_key - MIN_GF_INTERVAL)) && // dont use ARF very near next kf // dont use ARF very near next kf
(i <= (cpi->frames_to_key - MIN_GF_INTERVAL)) &&
(((next_frame.pcnt_inter > 0.75) && (((next_frame.pcnt_inter > 0.75) &&
((mv_in_out_accumulator / (double)i > -0.2) || (mv_in_out_accumulator > -2.0)) && ((mv_in_out_accumulator / (double)i > -0.2) || (mv_in_out_accumulator > -2.0)) &&
//(cpi->gfu_boost>150) && //(cpi->gfu_boost>150) &&
@ -2451,7 +2484,7 @@ void vp8_find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
{ {
double r; double r;
double motion_decay; double motion_decay;
double motion_pct = next_frame.pcnt_motion; double motion_pct;
if (EOF == vp8_input_stats(cpi, &next_frame)) if (EOF == vp8_input_stats(cpi, &next_frame))
break; break;
@ -2471,6 +2504,7 @@ void vp8_find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
loop_decay_rate = next_frame.pcnt_inter; loop_decay_rate = next_frame.pcnt_inter;
// High % motion -> somewhat higher decay rate // High % motion -> somewhat higher decay rate
motion_pct = next_frame.pcnt_motion;
motion_decay = (1.0 - (motion_pct / 20.0)); motion_decay = (1.0 - (motion_pct / 20.0));
if (motion_decay < loop_decay_rate) if (motion_decay < loop_decay_rate)
loop_decay_rate = motion_decay; loop_decay_rate = motion_decay;

Просмотреть файл

@ -3928,7 +3928,7 @@ static void encode_frame_to_data_rate
// One pass more conservative // One pass more conservative
else else
cpi->active_best_quality = kf_high_motion_minq[Q]; cpi->active_best_quality = kf_high_motion_minq[Q];
} }
else if (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame) else if (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame)
{ {
@ -4273,7 +4273,7 @@ static void encode_frame_to_data_rate
IF_RTCD(&cpi->rtcd.variance)); IF_RTCD(&cpi->rtcd.variance));
// The key frame is not good enough // The key frame is not good enough
if ( kf_err > ((cpi->ambient_err * 3) >> 2) ) if ( kf_err > ((cpi->ambient_err * 7) >> 3) )
{ {
// Lower q_high // Lower q_high
q_high = (Q > q_low) ? (Q - 1) : q_low; q_high = (Q > q_low) ? (Q - 1) : q_low;