// Initialize elements of cpi with valid defaults.
VP8_COMP cpi;
- cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
+ cpi.mb.e_mbd.mb_segment_abs_delta = SEGMENT_DELTADATA;
cpi.cyclic_refresh_mode_enabled = 0;
cpi.mb.e_mbd.segmentation_enabled = 0;
cpi.mb.e_mbd.update_mb_segmentation_map = 0;
unsigned char update_mb_segmentation_data;
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
- unsigned char mb_segement_abs_delta;
+ unsigned char mb_segment_abs_delta;
/* Per frame flags that define which MB level features (such as quantizer or
* loop filter level) */
/* Note the baseline filter values for each segment */
if (mbd->segmentation_enabled) {
- if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA) {
+ if (mbd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
lvl_seg = mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
} else { /* Delta Value */
lvl_seg += mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
/* Decide whether to use the default or alternate baseline Q value. */
if (xd->segmentation_enabled) {
/* Abs Value */
- if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA) {
+ if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id];
/* Delta Value */
/* reset the segment feature data to 0 with delta coding (Default state). */
memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
- xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
+ xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
/* reset the mode ref deltasa for loop filter */
memset(xd->ref_lf_deltas, 0, sizeof(xd->ref_lf_deltas));
xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(bc);
if (xd->update_mb_segmentation_data) {
- xd->mb_segement_abs_delta = (unsigned char)vp8_read_bit(bc);
+ xd->mb_segment_abs_delta = (unsigned char)vp8_read_bit(bc);
memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
mbd->dst = xd->dst;
mbd->segmentation_enabled = xd->segmentation_enabled;
- mbd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
+ mbd->mb_segment_abs_delta = xd->mb_segment_abs_delta;
memcpy(mbd->segment_feature_data, xd->segment_feature_data,
sizeof(xd->segment_feature_data));
if (xd->update_mb_segmentation_data) {
signed char Data;
- vp8_write_bit(bc, xd->mb_segement_abs_delta);
+ vp8_write_bit(bc, xd->mb_segment_abs_delta);
/* For each segmentation feature (Quant and loop filter level) */
for (i = 0; i < MB_LVL_MAX; ++i) {
zd->subpixel_predict8x8 = xd->subpixel_predict8x8;
zd->subpixel_predict16x16 = xd->subpixel_predict16x16;
zd->segmentation_enabled = xd->segmentation_enabled;
- zd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
+ zd->mb_segment_abs_delta = xd->mb_segment_abs_delta;
memcpy(zd->segment_feature_data, xd->segment_feature_data,
sizeof(xd->segment_feature_data));
/* Should we use the alternate refernce frame */
if (allow_alt_ref && (i >= MIN_GF_INTERVAL) &&
- /* dont use ARF very near next kf */
+ /* don't use ARF very near next kf */
(i <= (cpi->twopass.frames_to_key - MIN_GF_INTERVAL)) &&
#if NEW_BOOST
((next_frame.pcnt_inter > 0.75) || (next_frame.pcnt_second_ref > 0.5)) &&
if (cpi->twopass.gf_group_bits < 0) cpi->twopass.gf_group_bits = 0;
/* This condition could fail if there are two kfs very close together
- * despite (MIN_GF_INTERVAL) and would cause a devide by 0 in the
+ * despite (MIN_GF_INTERVAL) and would cause a divide by 0 in the
* calculation of cpi->twopass.alt_extra_bits.
*/
if (cpi->baseline_gf_interval >= 3) {
}
/* The last few frames of a clip almost always have to few or too many
- * bits and for the sake of over exact rate control we dont want to make
+ * bits and for the sake of over exact rate control we don't want to make
* radical adjustments to the allowed quantizer range just to use up a
* few surplus bits or get beneath the target rate.
*/
*/
static void set_segment_data(VP8_COMP *cpi, signed char *feature_data,
unsigned char abs_delta) {
- cpi->mb.e_mbd.mb_segement_abs_delta = abs_delta;
+ cpi->mb.e_mbd.mb_segment_abs_delta = abs_delta;
memcpy(cpi->segment_feature_data, feature_data,
sizeof(cpi->segment_feature_data));
}
}
/* in addition if the following are true and this is not a golden frame
* then code a key frame Note that on golden frames there often seems
- * to be a pop in intra useage anyway hence this restriction is
+ * to be a pop in intra usage anyway hence this restriction is
* designed to prevent spurious key frames. The Intra pop needs to be
* investigated.
*/
Q = cpi->avg_frame_qindex;
}
- /* For constrained quality dont allow Q less than the cq level */
+ /* For constrained quality don't allow Q less than the cq level */
if ((cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
(Q < cpi->cq_target_quality)) {
Q = cpi->cq_target_quality;
} else {
cpi->active_best_quality = inter_minq[Q];
- /* For the constant/constrained quality mode we dont want
+ /* For the constant/constrained quality mode we don't want
* q to fall below the cq level.
*/
if ((cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
* higher quality on the frames to prevent bits just going to waste.
*/
if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- /* Note that the use of >= here elliminates the risk of a devide
+ /* Note that the use of >= here elliminates the risk of a divide
* by 0 error in the else if clause
*/
if (cpi->buffer_level >= cpi->oxcf.maximum_buffer_size) {
vp8_cal_dissimilarity(cpi);
#endif
- /* Update the GF useage maps.
+ /* Update the GF usage maps.
* This is done after completing the compression of a frame when all
* modes etc. are finalized but before loop filter
*/
if (cpi->oxcf.number_of_layers == 1) {
- vp8_update_gf_useage_maps(cpi, cm, &cpi->mb);
+ vp8_update_gf_usage_maps(cpi, cm, &cpi->mb);
}
if (cm->frame_type == KEY_FRAME) cm->refresh_last_frame = 1;
(cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
int Boost = 0;
- int gf_frame_useage = 0; /* Golden frame useage since last GF */
+ int gf_frame_usage = 0; /* Golden frame usage since last GF */
int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
cpi->recent_ref_frame_usage[LAST_FRAME] +
cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
(cpi->common.mb_rows * cpi->common.mb_cols);
if (tot_mbs) {
- gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
- cpi->recent_ref_frame_usage[ALTREF_FRAME]) *
- 100 / tot_mbs;
+ gf_frame_usage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
+ cpi->recent_ref_frame_usage[ALTREF_FRAME]) *
+ 100 / tot_mbs;
}
- if (pct_gf_active > gf_frame_useage) gf_frame_useage = pct_gf_active;
+ if (pct_gf_active > gf_frame_usage) gf_frame_usage = pct_gf_active;
/* Not two pass */
if (cpi->pass != 2) {
/* Adjust boost based upon ambient Q */
Boost = GFQ_ADJUSTMENT;
- /* Adjust based upon most recently measure intra useage */
+ /* Adjust based upon most recently measure intra usage */
Boost = Boost *
gf_intra_usage_adjustment[(cpi->this_frame_percent_intra < 15)
? cpi->this_frame_percent_intra
100;
/* Adjust gf boost based upon GF usage since last GF */
- Boost = Boost * gf_adjust_table[gf_frame_useage] / 100;
+ Boost = Boost * gf_adjust_table[gf_frame_usage] / 100;
#endif
}
if (cpi->last_boost >= 1500) cpi->frames_till_gf_update_due++;
- if (gf_interval_table[gf_frame_useage] > cpi->frames_till_gf_update_due) {
- cpi->frames_till_gf_update_due = gf_interval_table[gf_frame_useage];
+ if (gf_interval_table[gf_frame_usage] > cpi->frames_till_gf_update_due) {
+ cpi->frames_till_gf_update_due = gf_interval_table[gf_frame_usage];
}
if (cpi->frames_till_gf_update_due > cpi->max_gf_interval) {
int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME]
: cpi->oxcf.fixed_q;
- int gf_frame_useage = 0; /* Golden frame useage since last GF */
+ int gf_frame_usage = 0; /* Golden frame usage since last GF */
int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
cpi->recent_ref_frame_usage[LAST_FRAME] +
cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
(cpi->common.mb_rows * cpi->common.mb_cols);
if (tot_mbs) {
- gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
- cpi->recent_ref_frame_usage[ALTREF_FRAME]) *
- 100 / tot_mbs;
+ gf_frame_usage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
+ cpi->recent_ref_frame_usage[ALTREF_FRAME]) *
+ 100 / tot_mbs;
}
- if (pct_gf_active > gf_frame_useage) gf_frame_useage = pct_gf_active;
+ if (pct_gf_active > gf_frame_usage) gf_frame_usage = pct_gf_active;
/* Is a fixed manual GF frequency being used */
if (cpi->auto_gold) {
- /* For one pass throw a GF if recent frame intra useage is
- * low or the GF useage is high
+ /* For one pass throw a GF if recent frame intra usage is
+ * low or the GF usage is high
*/
if ((cpi->pass == 0) &&
- (cpi->this_frame_percent_intra < 15 || gf_frame_useage >= 5)) {
+ (cpi->this_frame_percent_intra < 15 || gf_frame_usage >= 5)) {
cpi->common.refresh_golden_frame = 1;
/* Two pass GF descision */
if (0) {
FILE *f;
- f = fopen("gf_useaget.stt", "a");
+ f = fopen("gf_usaget.stt", "a");
fprintf(f, " %8ld %10ld %10ld %10ld %10ld\n",
cpi->common.current_video_frame, cpi->gfu_boost,
- GFQ_ADJUSTMENT, cpi->gfu_boost, gf_frame_useage);
+ GFQ_ADJUSTMENT, cpi->gfu_boost, gf_frame_usage);
fclose(f);
}
rd.distortion2 += distortion;
/* If even the 'Y' rd value of split is higher than best so far
- * then dont bother looking at UV
+ * then don't bother looking at UV
*/
if (tmp_rd < best_mode.yrd) {
/* Now work out UV cost and add it in */
#include "segmentation.h"
#include "vpx_mem/vpx_mem.h"
-void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x) {
+void vp8_update_gf_usage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x) {
int mb_row, mb_col;
MODE_INFO *this_mb_mode_info = cm->mi;
x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
if ((cm->frame_type == KEY_FRAME) || (cm->refresh_golden_frame)) {
- /* Reset Gf useage monitors */
+ /* Reset Gf usage monitors */
memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
} else {
extern "C" {
#endif
-extern void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm,
- MACROBLOCK *x);
+extern void vp8_update_gf_usage_maps(VP8_COMP *cpi, VP8_COMMON *cm,
+ MACROBLOCK *x);
#ifdef __cplusplus
} // extern "C"
/* Select the baseline MB Q index. */
if (xd->segmentation_enabled) {
/* Abs Value */
- if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA) {
+ if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
QIndex = xd->segment_feature_data[MB_LVL_ALT_Q]
[xd->mode_info_context->mbmi.segment_id];
/* Delta Value */
mi->mode = ZEROMV;
if (bsize < BLOCK_8X8) {
vpx_internal_error(xd->error_info, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid usage of segement feature on small blocks");
+ "Invalid usage of segment feature on small blocks");
return;
}
} else {
&cpi->rc, cm->frame_type, cm->base_qindex,
aq_c_q_adj_factor[aq_strength][segment], cm->bit_depth);
- // For AQ complexity mode, we dont allow Q0 in a segment if the base
+ // For AQ complexity mode, we don't allow Q0 in a segment if the base
// Q is not 0. Q0 (lossless) implies 4x4 only and in AQ mode 2 a segment
// Q delta is sometimes applied without going back around the rd loop.
// This could lead to an illegal combination of partition size and q.
}
// Second scan using clamps based on the previous cycle average.
- // This may modify the total and average somewhat but we dont bother with
+ // This may modify the total and average somewhat but we don't bother with
// further itterations.
modified_score_total = 0.0;
s = twopass->stats_in;
// brief break in prediction (such as a flash) but subsequent frames
// are reasonably well predicted by an earlier (pre flash) frame.
// The recovery after a flash is indicated by a high pcnt_second_ref
- // useage or a second ref coded error notabley lower than the last
+ // usage or a second ref coded error notabley lower than the last
// frame coded error.
if (frame_stats == NULL) {
return 0;
double score_total = 0.0;
int i = 0;
- // We dont ever want to return a 0 score here.
+ // We don't ever want to return a 0 score here.
if (frame_count == 0) return 1.0;
while ((i < frame_count) && (s < twopass->stats_in_end)) {
if (
// Don't break out with a very short interval.
(gop_coding_frames >= active_gf_interval->min) &&
- // If possible dont break very close to a kf
+ // If possible don't break very close to a kf
((rc->frames_to_key - gop_coding_frames) >= rc->min_gf_interval) &&
(gop_coding_frames & 0x01) && (!flash_detected) &&
((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
next_frame->intra_error / DOUBLE_DIVIDE_CHECK(next_frame->coded_error);
// Return true the intra/inter ratio for the current frame is
- // low but better in the next and previous frame and the relative useage of
+ // low but better in the next and previous frame and the relative usage of
// intra in the current frame is markedly higher than the last and next frame.
if ((this_ii_ratio < 2.0) && (last_ii_ratio > 2.25) &&
(next_ii_ratio > 2.25) && (this_pcnt_intra > (3 * last_pcnt_intra)) &&
// Minimum % intra coding observed in first pass (1.0 = 100%)
#define MIN_INTRA_LEVEL 0.25
// Threshold for use of the lagging second reference frame. Scene cuts do not
-// usually have a high second ref useage.
+// usually have a high second ref usage.
#define SECOND_REF_USEAGE_THRESH 0.2
// Hard threshold where the first pass chooses intra for almost all blocks.
// In such a case even if the frame is not a scene cut coding a key frame
twopass->key_frame_section_intra_rating = calculate_section_intra_ratio(
start_position, twopass->stats_in_end, rc->frames_to_key);
- // Special case for static / slide show content but dont apply
+ // Special case for static / slide show content but don't apply
// if the kf group is very short.
if ((zero_motion_accumulator > 0.99) && (rc->frames_to_key > 8)) {
rc->kf_boost = (int)(twopass->kf_max_total_boost);
vp9_init_vizier_params(twopass, screen_area);
}
- // If this is an arf frame then we dont want to read the stats file or
+ // If this is an arf frame then we don't want to read the stats file or
// advance the input pointer as we already have what we need.
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
int target_rate;
} else {
q = rc->avg_frame_qindex[KEY_FRAME];
}
- // For constrained quality dont allow Q less than the cq level
+ // For constrained quality don't allow Q less than the cq level
if (oxcf->rc_mode == VPX_CQ) {
if (q < cq_level) q = cq_level;
} else {
q = active_worst_quality;
}
- // For constrained quality dont allow Q less than the cq level
+ // For constrained quality don't allow Q less than the cq level
if (oxcf->rc_mode == VPX_CQ) {
if (q < cq_level) q = cq_level;
}
if (tmp_best_rdu > 0) {
// If even the 'Y' rd value of split is higher than best so far
- // then dont bother looking at UV
+ // then don't bother looking at UV
vp9_build_inter_predictors_sbuv(&x->e_mbd, mi_row, mi_col, BLOCK_8X8);
memset(x->skip_txfm, SKIP_TXFM_NONE, sizeof(x->skip_txfm));
if (!super_block_uvrd(cpi, x, &rate_uv, &distortion_uv, &uv_skippable,