tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

psnr.h (4825B)


      1 /*
      2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
      3 *
      4 * This source code is subject to the terms of the BSD 2 Clause License and
      5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
      6 * was not distributed with this source code in the LICENSE file, you can
      7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
      8 * Media Patent License 1.0 was not distributed with this source code in the
      9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
     10 */
     11 
     12 #ifndef AOM_AOM_DSP_PSNR_H_
     13 #define AOM_AOM_DSP_PSNR_H_
     14 
     15 #include "aom_scale/yv12config.h"
     16 #include "config/aom_config.h"
     17 
     18 #define MAX_PSNR 100.0
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 typedef struct {
     25  double psnr[4];           // total/y/u/v
     26  uint64_t sse[4];          // total/y/u/v
     27  uint32_t samples[4];      // total/y/u/v
     28  double psnr_hbd[4];       // total/y/u/v when input-bit-depth < bit-depth
     29  uint64_t sse_hbd[4];      // total/y/u/v when input-bit-depth < bit-depth
     30  uint32_t samples_hbd[4];  // total/y/u/v when input-bit-depth < bit-depth
     31 } PSNR_STATS;
     32 
     33 #if CONFIG_INTERNAL_STATS
     34 /*!\brief Converts SSE to PSNR
     35 *
     36 * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PSNR).
     37 *
     38 * \param[in]    samples       Number of samples
     39 * \param[in]    peak          Max sample value
     40 * \param[in]    sse           Sum of squared errors
     41 */
     42 double aom_sse_to_psnr(double samples, double peak, double sse);
     43 #endif  // CONFIG_INTERNAL_STATS
     44 uint64_t aom_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
     45                       int vstart, int height);
     46 uint64_t aom_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
     47                       int vstart, int height);
     48 uint64_t aom_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
     49                       int vstart, int height);
     50 int64_t aom_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
     51                           const YV12_BUFFER_CONFIG *b, int hstart, int width,
     52                           int vstart, int height);
     53 int64_t aom_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
     54 int64_t aom_get_u_sse_part(const YV12_BUFFER_CONFIG *a,
     55                           const YV12_BUFFER_CONFIG *b, int hstart, int width,
     56                           int vstart, int height);
     57 int64_t aom_get_u_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
     58 int64_t aom_get_v_sse_part(const YV12_BUFFER_CONFIG *a,
     59                           const YV12_BUFFER_CONFIG *b, int hstart, int width,
     60                           int vstart, int height);
     61 int64_t aom_get_v_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
     62 int64_t aom_get_sse_plane(const YV12_BUFFER_CONFIG *a,
     63                          const YV12_BUFFER_CONFIG *b, int plane, int highbd);
     64 #if CONFIG_AV1_HIGHBITDEPTH
     65 uint64_t aom_highbd_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart,
     66                              int width, int vstart, int height);
     67 uint64_t aom_highbd_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart,
     68                              int width, int vstart, int height);
     69 uint64_t aom_highbd_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart,
     70                              int width, int vstart, int height);
     71 int64_t aom_highbd_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
     72                                  const YV12_BUFFER_CONFIG *b, int hstart,
     73                                  int width, int vstart, int height);
     74 int64_t aom_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a,
     75                             const YV12_BUFFER_CONFIG *b);
     76 int64_t aom_highbd_get_u_sse_part(const YV12_BUFFER_CONFIG *a,
     77                                  const YV12_BUFFER_CONFIG *b, int hstart,
     78                                  int width, int vstart, int height);
     79 int64_t aom_highbd_get_u_sse(const YV12_BUFFER_CONFIG *a,
     80                             const YV12_BUFFER_CONFIG *b);
     81 int64_t aom_highbd_get_v_sse_part(const YV12_BUFFER_CONFIG *a,
     82                                  const YV12_BUFFER_CONFIG *b, int hstart,
     83                                  int width, int vstart, int height);
     84 int64_t aom_highbd_get_v_sse(const YV12_BUFFER_CONFIG *a,
     85                             const YV12_BUFFER_CONFIG *b);
     86 void aom_calc_highbd_psnr(const YV12_BUFFER_CONFIG *a,
     87                          const YV12_BUFFER_CONFIG *b, PSNR_STATS *psnr,
     88                          unsigned int bit_depth, unsigned int in_bit_depth);
     89 #endif
     90 void aom_calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
     91                   PSNR_STATS *psnr);
     92 
     93 double aom_psnrhvs(const YV12_BUFFER_CONFIG *source,
     94                   const YV12_BUFFER_CONFIG *dest, double *phvs_y,
     95                   double *phvs_u, double *phvs_v, uint32_t bd, uint32_t in_bd);
     96 #ifdef __cplusplus
     97 }  // extern "C"
     98 #endif
     99 #endif  // AOM_AOM_DSP_PSNR_H_