mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
add the missing cost for I4/I16 mode selection
was missing from the RD-computation of intra-4x4 score. Doesn't change anything significantly, it's just More Correct. Change-Id: I25c5b53a810d97e6fb7f98c549fd23bbe55e1bf4
This commit is contained in:
@ -33,7 +33,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static inline int clip(int v, int m, int M) {
|
||||
return v < m ? m : v > M ? M : v;
|
||||
@ -132,7 +132,7 @@ static const uint8_t kFreqSharpening[16] = {
|
||||
90, 90, 90, 90
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Initialize quantization parameters in VP8Matrix
|
||||
|
||||
// Returns the average quantizer
|
||||
@ -192,7 +192,7 @@ static void SetupMatrices(VP8Encoder* enc) {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Initialize filtering parameters
|
||||
|
||||
// Very small filter-strength values have close to no visual effect. So we can
|
||||
@ -214,7 +214,7 @@ static void SetupFilterStrength(VP8Encoder* const enc) {
|
||||
enc->filter_hdr_.sharpness_ = enc->config_->filter_sharpness;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Note: if you change the values below, remember that the max range
|
||||
// allowed by the syntax for DQ_UV is [-16,16].
|
||||
@ -286,7 +286,7 @@ void VP8SetSegmentParams(VP8Encoder* const enc, float quality) {
|
||||
SetupFilterStrength(enc); // initialize segments' filtering, eventually
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Form the predictions in cache
|
||||
|
||||
// Must be ordered using {DC_PRED, TM_PRED, V_PRED, H_PRED} as index
|
||||
@ -316,7 +316,7 @@ void VP8MakeIntra4Preds(const VP8EncIterator* const it) {
|
||||
VP8EncPredLuma4(it->yuv_p_, it->i4_top_);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Quantize
|
||||
|
||||
// Layout:
|
||||
@ -341,7 +341,7 @@ const int VP8Scan[16 + 4 + 4] = {
|
||||
8 + 0 * BPS, 12 + 0 * BPS, 8 + 4 * BPS, 12 + 4 * BPS // V
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Distortion measurement
|
||||
|
||||
static const uint16_t kWeightY[16] = {
|
||||
@ -384,7 +384,7 @@ static void AddScore(VP8ModeScore* const dst, const VP8ModeScore* const src) {
|
||||
dst->score += src->score;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Performs trellis-optimized quantization.
|
||||
|
||||
// Trellis
|
||||
@ -571,7 +571,7 @@ static int TrellisQuantizeBlock(const VP8EncIterator* const it,
|
||||
|
||||
#undef NODE
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Performs: difference, transform, quantize, back-transform, add
|
||||
// all at once. Output is the reconstructed block in *yuv_out, and the
|
||||
// quantized levels in *levels.
|
||||
@ -685,7 +685,7 @@ static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd,
|
||||
return (nz << 16);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// RD-opt decision. Reconstruct each modes, evalue distortion and bit-cost.
|
||||
// Pick the mode is lower RD-cost = Rate + lamba * Distortion.
|
||||
|
||||
@ -738,7 +738,7 @@ static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
VP8SetIntra16Mode(it, rd->mode_i16);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// return the cost array corresponding to the surrounding prediction modes.
|
||||
static const uint16_t* GetCostModeI4(VP8EncIterator* const it,
|
||||
@ -760,7 +760,7 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
VP8ModeScore rd_best;
|
||||
|
||||
InitScore(&rd_best);
|
||||
rd_best.score = 0;
|
||||
rd_best.score = 211; // '211' is the value of VP8BitCost(0, 145)
|
||||
VP8IteratorStartI4(it);
|
||||
do {
|
||||
VP8ModeScore rd_i4;
|
||||
@ -817,7 +817,7 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
return 1; // select intra4x4 over intra16x16
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
VP8Encoder* const enc = it->enc_;
|
||||
@ -855,7 +855,7 @@ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
AddScore(rd, &rd_best);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Final reconstruction and quantization.
|
||||
|
||||
static void SimpleQuantize(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
@ -882,7 +882,7 @@ static void SimpleQuantize(VP8EncIterator* const it, VP8ModeScore* const rd) {
|
||||
rd->nz = nz;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
|
||||
int VP8Decimate(VP8EncIterator* const it, VP8ModeScore* const rd, int rd_opt) {
|
||||
|
Reference in New Issue
Block a user