aom: make aom_sse_to_psnr() static w/CONFIG_INTERNAL_STATS=0

From 4a0eca4907ae85e3f1230ae10394770062b516c0 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Tue, 13 Aug 2024 16:55:49 -0700
Subject: [PATCH] make aom_sse_to_psnr() static w/CONFIG_INTERNAL_STATS=0

Bug: aomedia:3416
Change-Id: I3533d50bb6a3d2096e5ab96d147ec5a57391022b
---
 aom_dsp/psnr.c | 11 ++++++++++-
 aom_dsp/psnr.h |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/aom_dsp/psnr.c b/aom_dsp/psnr.c
index b174c1e92f..af166f0013 100644
--- a/aom_dsp/psnr.c
+++ b/aom_dsp/psnr.c
@@ -12,12 +12,19 @@
 #include <assert.h>
 #include <math.h>
 
+#include "config/aom_config.h"
 #include "config/aom_dsp_rtcd.h"
 
 #include "aom_dsp/psnr.h"
 #include "aom_scale/yv12config.h"
 
-double aom_sse_to_psnr(double samples, double peak, double sse) {
+#if CONFIG_INTERNAL_STATS
+#define STATIC
+#else
+#define STATIC static
+#endif  // CONFIG_INTERNAL_STATS
+
+STATIC double aom_sse_to_psnr(double samples, double peak, double sse) {
   if (sse > 0.0) {
     const double psnr = 10.0 * log10(samples * peak * peak / sse);
     return psnr > MAX_PSNR ? MAX_PSNR : psnr;
@@ -26,6 +33,8 @@ double aom_sse_to_psnr(double samples, double peak, double sse) {
   }
 }
 
+#undef STATIC
+
 static int64_t encoder_sse(const uint8_t *a, int a_stride, const uint8_t *b,
                            int b_stride, int w, int h) {
   int i, j;
diff --git a/aom_dsp/psnr.h b/aom_dsp/psnr.h
index f4fd1d6418..87718f7afb 100644
--- a/aom_dsp/psnr.h
+++ b/aom_dsp/psnr.h
@@ -13,6 +13,7 @@
 #define AOM_AOM_DSP_PSNR_H_
 
 #include "aom_scale/yv12config.h"
+#include "config/aom_config.h"
 
 #define MAX_PSNR 100.0
 
@@ -29,6 +30,7 @@ typedef struct {
   uint32_t samples_hbd[4];  // total/y/u/v when input-bit-depth < bit-depth
 } PSNR_STATS;
 
+#if CONFIG_INTERNAL_STATS
 /*!\brief Converts SSE to PSNR
  *
  * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PSNR).
@@ -38,6 +40,7 @@ typedef struct {
  * \param[in]    sse           Sum of squared errors
  */
 double aom_sse_to_psnr(double samples, double peak, double sse);
+#endif  // CONFIG_INTERNAL_STATS
 uint64_t aom_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
                        int vstart, int height);
 uint64_t aom_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,