// Copyright (c) the JPEG XL 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.
void Quantizer::ComputeGlobalScaleAndQuant(float quant_dc, float quant_median, float quant_median_absd) { // Target value for the median value in the quant field. constfloat kQuantFieldTarget = 5; // We reduce the median of the quant field by the median absolute deviation: // higher resolution on highly varying quant fields. float scale = kGlobalScaleDenom * (quant_median - quant_median_absd) /
kQuantFieldTarget; // Ensure that new_global_scale is positive and no more than 1<<15. if (scale < 1) scale = 1; if (scale > (1 << 15)) scale = 1 << 15; int new_global_scale = static_cast<int>(scale); // Ensure that quant_dc_ will always be at least // 0.625 * kGlobalScaleDenom/kGlobalScaleNumerator = 10. constint scaled_quant_dc = static_cast<int>(quant_dc * kGlobalScaleNumerator * 1.6); if (new_global_scale > scaled_quant_dc) {
new_global_scale = scaled_quant_dc; if (new_global_scale <= 0) new_global_scale = 1;
}
global_scale_ = new_global_scale; // Code below uses inv_global_scale_.
RecomputeFromGlobalScale();
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.