/* * Copyright (c) 2013 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.
*/
for (i = 0; i < MAX_SEGMENTS; ++i) { int qindex_delta =
vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type, cm->base_qindex,
rate_ratio[i], cm->bit_depth);
// We don't allow qindex 0 in a segment if the base value is not 0. // Q index 0 (lossless) implies 4x4 encoding only and in AQ mode 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. if ((cm->base_qindex != 0) && ((cm->base_qindex + qindex_delta) == 0)) {
qindex_delta = -cm->base_qindex + 1;
}
// No need to enable SEG_LVL_ALT_Q for this segment. if (rate_ratio[i] == 1.0) { continue;
}
vp9_set_segdata(seg, i, SEG_LVL_ALT_Q, qindex_delta);
vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
}
}
}
/* TODO(agrange, paulwilkins): The block_variance calls the unoptimized versions * of variance() and highbd_8_variance(). It should not.
*/ staticvoid aq_variance(const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int w, int h, unsignedint *sse, int *sum) { int i, j;
*sum = 0;
*sse = 0;
for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { constint diff = a[j] - b[j];
*sum += diff;
*sse += diff * diff;
}
a += a_stride;
b += b_stride;
}
}
#if CONFIG_VP9_HIGHBITDEPTH staticvoid aq_highbd_variance64(const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, int w, int h,
uint64_t *sse, int64_t *sum) { int i, j;
// Get the range of sub block energy values; void vp9_get_sub_block_energy(VP9_COMP *cpi, MACROBLOCK *mb, int mi_row, int mi_col, BLOCK_SIZE bsize, int *min_e, int *max_e) {
VP9_COMMON *const cm = &cpi->common; constint bw = num_8x8_blocks_wide_lookup[bsize]; constint bh = num_8x8_blocks_high_lookup[bsize]; constint xmis = VPXMIN(cm->mi_cols - mi_col, bw); constint ymis = VPXMIN(cm->mi_rows - mi_row, bh); int x, y;
if (xmis < bw || ymis < bh) {
vp9_setup_src_planes(mb, cpi->Source, mi_row, mi_col);
*min_e = vp9_block_energy(cpi, mb, bsize);
*max_e = *min_e;
} else { unsignedint var; // Because scale_block_energy is non-decreasing, we can find the min/max // block variance and scale afterwards. This avoids a costly scaling at // every iteration. unsignedint min_var = UINT_MAX; unsignedint max_var = 0;
for (y = 0; y < ymis; ++y) { for (x = 0; x < xmis; ++x) {
vp9_setup_src_planes(mb, cpi->Source, mi_row + y, mi_col + x);
vpx_clear_system_state();
var = block_variance(cpi, mb, BLOCK_8X8);
vpx_clear_system_state();
min_var = VPXMIN(min_var, var);
max_var = VPXMAX(max_var, var);
}
}
*min_e = scale_block_energy(cpi, min_var);
*max_e = scale_block_energy(cpi, max_var);
}
// Re-instate source pointers back to what they should have been on entry.
vp9_setup_src_planes(mb, cpi->Source, mi_row, mi_col);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.