// Copyright 2014 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING 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. // ----------------------------------------------------------------------------- // // WebPPicture tools for measuring distortion // // Author: Skal (pascal.massimino@gmail.com)
typedefdouble (*AccumulateFunc)(const uint8_t* src, int src_stride, const uint8_t* ref, int ref_stride, int w, int h);
//------------------------------------------------------------------------------ // local-min distortion // // For every pixel in the *reference* picture, we search for the local best // match in the compressed image. This is not a symmetrical measure.
#define RADIUS 2// search radius. Shouldn't be too large.
staticdouble AccumulateLSIM(const uint8_t* src, int src_stride, const uint8_t* ref, int ref_stride, int w, int h) { int x, y; double total_sse = 0.; for (y = 0; y < h; ++y) { constint y_0 = (y - RADIUS < 0) ? 0 : y - RADIUS; constint y_1 = (y + RADIUS + 1 >= h) ? h : y + RADIUS + 1; for (x = 0; x < w; ++x) { constint x_0 = (x - RADIUS < 0) ? 0 : x - RADIUS; constint x_1 = (x + RADIUS + 1 >= w) ? w : x + RADIUS + 1; double best_sse = 255. * 255.; constdouble value = (double)ref[y * ref_stride + x]; int i, j; for (j = y_0; j < y_1; ++j) { const uint8_t* const s = src + j * src_stride; for (i = x_0; i < x_1; ++i) { constdouble diff = s[i] - value; constdouble sse = diff * diff; if (sse < best_sse) best_sse = sse;
}
}
total_sse += best_sse;
}
} return total_sse;
} #undef RADIUS
staticdouble AccumulateSSE(const uint8_t* src, int src_stride, const uint8_t* ref, int ref_stride, int w, int h) { int y; double total_sse = 0.; for (y = 0; y < h; ++y) {
total_sse += VP8AccumulateSSE(src, ref, w);
src += src_stride;
ref += ref_stride;
} return total_sse;
}
#else// defined(WEBP_DISABLE_STATS) int WebPPlaneDistortion(const uint8_t* src, size_t src_stride, const uint8_t* ref, size_t ref_stride, int width, int height, size_t x_step, int type, float* distortion, float* result) {
(void)src;
(void)src_stride;
(void)ref;
(void)ref_stride;
(void)width;
(void)height;
(void)x_step;
(void)type; if (distortion == NULL || result == NULL) return0;
*distortion = 0.f;
*result = 0.f; return1;
}
int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref, int type, float results[5]) { int i;
(void)src;
(void)ref;
(void)type; if (results == NULL) return0; for (i = 0; i < 5; ++i) results[i] = 0.f; return1;
}
#endif// !defined(WEBP_DISABLE_STATS)
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-05)
¤
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.