/* * 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.
*/
void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) { int i, rc, eob; int x, y, z, sz; short *coeff_ptr = b->coeff; short *round_ptr = b->round; short *quant_ptr = b->quant_fast; short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; short *dequant_ptr = d->dequant;
eob = -1; for (i = 0; i < 16; ++i) {
rc = vp8_default_zig_zag1d[i];
z = coeff_ptr[rc];
sz = (z >> 31); /* sign of z */
x = (z ^ sz) - sz; /* x = abs(z) */
y = ((x + round_ptr[rc]) * quant_ptr[rc]) >> 16; /* quantize (x) */
x = (y ^ sz) - sz; /* get the sign back */
qcoeff_ptr[rc] = x; /* write to destination */
dqcoeff_ptr[rc] = x * dequant_ptr[rc]; /* dequantized value */
if (y) {
eob = i; /* last nonzero coeffs */
}
}
*d->eob = (char)(eob + 1);
}
void vp8_regular_quantize_b_c(BLOCK *b, BLOCKD *d) { int i, rc, eob; int zbin; int x, y, z, sz; short *zbin_boost_ptr = b->zrun_zbin_boost; short *coeff_ptr = b->coeff; short *zbin_ptr = b->zbin; short *round_ptr = b->round; short *quant_ptr = b->quant; short *quant_shift_ptr = b->quant_shift; short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; short *dequant_ptr = d->dequant; short zbin_oq_value = b->zbin_extra;
void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip) { int i; int QIndex;
MACROBLOCKD *xd = &x->e_mbd; int zbin_extra;
/* Select the baseline MB Q index. */ if (xd->segmentation_enabled) { /* Abs Value */ 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 */
} else {
QIndex = cpi->common.base_qindex +
xd->segment_feature_data[MB_LVL_ALT_Q]
[xd->mode_info_context->mbmi.segment_id]; /* Clamp to valid range */
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
}
} else {
QIndex = cpi->common.base_qindex;
}
/* This initialization should be called at least once. Use ok_to_skip to * decide if it is ok to skip. * Before encoding a frame, this function is always called with ok_to_skip * =0, which means no skiping of calculations. The "last" values are * initialized at that time.
*/ if (!ok_to_skip || QIndex != x->q_index) {
xd->dequant_y1_dc[0] = 1;
xd->dequant_y1[0] = cpi->common.Y1dequant[QIndex][0];
xd->dequant_y2[0] = cpi->common.Y2dequant[QIndex][0];
xd->dequant_uv[0] = cpi->common.UVdequant[QIndex][0];
for (i = 1; i < 16; ++i) {
xd->dequant_y1_dc[i] = xd->dequant_y1[i] =
cpi->common.Y1dequant[QIndex][1];
xd->dequant_y2[i] = cpi->common.Y2dequant[QIndex][1];
xd->dequant_uv[i] = cpi->common.UVdequant[QIndex][1];
} #if 1 /*TODO: Remove dequant from BLOCKD. This is a temporary solution until * the quantizer code uses a passed in pointer to the dequant constants. * This will also require modifications to the x86 and neon assembly.
* */ for (i = 0; i < 16; ++i) x->e_mbd.block[i].dequant = xd->dequant_y1; for (i = 16; i < 24; ++i) x->e_mbd.block[i].dequant = xd->dequant_uv;
x->e_mbd.block[24].dequant = xd->dequant_y2; #endif
new_uv_delta_q = 0; // For screen content, lower the q value for UV channel. For now, select // conservative delta; same delta for dc and ac, and decrease it with lower // Q, and set to 0 below some threshold. May want to condition this in // future on the variance/energy in UV channel. if (cpi->oxcf.screen_content_mode && Q > 40) {
new_uv_delta_q = -(int)(0.15 * Q); // Check range: magnitude of delta is 4 bits. if (new_uv_delta_q < -15) {
new_uv_delta_q = -15;
}
}
update |= cm->uvdc_delta_q != new_uv_delta_q;
cm->uvdc_delta_q = new_uv_delta_q;
cm->uvac_delta_q = new_uv_delta_q;
/* Set Segment specific quatizers */
mbd->segment_feature_data[MB_LVL_ALT_Q][0] =
cpi->segment_feature_data[MB_LVL_ALT_Q][0];
mbd->segment_feature_data[MB_LVL_ALT_Q][1] =
cpi->segment_feature_data[MB_LVL_ALT_Q][1];
mbd->segment_feature_data[MB_LVL_ALT_Q][2] =
cpi->segment_feature_data[MB_LVL_ALT_Q][2];
mbd->segment_feature_data[MB_LVL_ALT_Q][3] =
cpi->segment_feature_data[MB_LVL_ALT_Q][3];
/* quantizer has to be reinitialized for any delta_q changes */ if (update) vp8cx_init_quantizer(cpi);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet)
¤
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.