godot/thirdparty/libwebp/src/enc/picture_psnr_enc.c

// 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 ([email protected])

#include "src/webp/encode.h"

#if !(defined(WEBP_DISABLE_STATS) || defined(WEBP_REDUCE_SIZE))

#include <math.h>
#include <stdlib.h>

#include "src/dsp/dsp.h"
#include "src/enc/vp8i_enc.h"
#include "src/utils/utils.h"

AccumulateFunc;

//------------------------------------------------------------------------------
// 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

static double AccumulateLSIM(const uint8_t* src, int src_stride,
                             const uint8_t* ref, int ref_stride,
                             int w, int h) {}
#undef RADIUS

static double AccumulateSSE(const uint8_t* src, int src_stride,
                            const uint8_t* ref, int ref_stride,
                            int w, int h) {}

//------------------------------------------------------------------------------

static double AccumulateSSIM(const uint8_t* src, int src_stride,
                             const uint8_t* ref, int ref_stride,
                             int w, int h) {}

//------------------------------------------------------------------------------
// Distortion

// Max value returned in case of exact similarity.
static const double kMinDistortion_dB =;

static double GetPSNR(double v, double size) {}

static double GetLogSSIM(double v, double size) {}

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) {}

#ifdef WORDS_BIGENDIAN
#define BLUE_OFFSET
#else
#define BLUE_OFFSET
#endif

int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
                          int type, float results[5]) {}

#undef BLUE_OFFSET

#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) return 0;
  *distortion = 0.f;
  *result = 0.f;
  return 1;
}

int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
                          int type, float results[5]) {
  int i;
  (void)src;
  (void)ref;
  (void)type;
  if (results == NULL) return 0;
  for (i = 0; i < 5; ++i) results[i] = 0.f;
  return 1;
}

#endif  // !defined(WEBP_DISABLE_STATS)