aom: add av1/encoder/blockiness.h

From 3ca0c74cd7cb632362f5da3979b593262ce32689 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Tue, 18 Jun 2024 15:33:04 -0700
Subject: [PATCH] add av1/encoder/blockiness.h

This adds a prototype for av1_get_blockiness() and fixes a
-Wmissing-prototypes warning.

+ removed unused headers from blockiness.c

Bug: aomedia:3416
Change-Id: If1fa1a5d6b978c929ec28f613ff87ff97a1e083e
---
 av1/av1.cmake            |  3 ++-
 av1/encoder/blockiness.c | 11 +++--------
 av1/encoder/blockiness.h | 19 +++++++++++++++++++
 av1/encoder/encoder.c    |  7 +++----
 4 files changed, 27 insertions(+), 13 deletions(-)
 create mode 100644 av1/encoder/blockiness.h

diff --git a/av1/av1.cmake b/av1/av1.cmake
index 4ca5007c1..195525564 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -525,7 +525,8 @@ if(CONFIG_INSPECTION)
 endif()
 
 if(CONFIG_INTERNAL_STATS)
-  list(APPEND AOM_AV1_ENCODER_SOURCES "${AOM_ROOT}/av1/encoder/blockiness.c")
+  list(APPEND AOM_AV1_ENCODER_SOURCES "${AOM_ROOT}/av1/encoder/blockiness.c"
+              "${AOM_ROOT}/av1/encoder/blockiness.h")
 endif()
 
 if(CONFIG_REALTIME_ONLY)
diff --git a/av1/encoder/blockiness.c b/av1/encoder/blockiness.c
index 8c93df38d..6945592d1 100644
--- a/av1/encoder/blockiness.c
+++ b/av1/encoder/blockiness.c
@@ -9,15 +9,10 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "config/av1_rtcd.h"
-#include "config/aom_config.h"
-#include "config/aom_dsp_rtcd.h"
+#include "av1/encoder/blockiness.h"
 
-#include "av1/common/common.h"
-#include "av1/common/filter.h"
-#include "aom/aom_integer.h"
-#include "aom_dsp/aom_filter.h"
-#include "aom_ports/mem.h"
+#include <stdint.h>
+#include <stdlib.h>
 
 static int horizontal_filter(const uint8_t *s) {
   return (s[1] - s[-2]) * 2 + (s[-1] - s[0]) * 6;
diff --git a/av1/encoder/blockiness.h b/av1/encoder/blockiness.h
new file mode 100644
index 000000000..e381a421a
--- /dev/null
+++ b/av1/encoder/blockiness.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2024, Alliance for Open Media. All rights reserved.
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AOM_AV1_ENCODER_BLOCKINESS_H_
+#define AOM_AV1_ENCODER_BLOCKINESS_H_
+
+double av1_get_blockiness(const unsigned char *img1, int img1_pitch,
+                          const unsigned char *img2, int img2_pitch, int width,
+                          int height);
+
+#endif  // AOM_AV1_ENCODER_BLOCKINESS_H_
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index fd293b194..f8fca381d 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -56,6 +56,9 @@
 #include "av1/encoder/aq_cyclicrefresh.h"
 #include "av1/encoder/aq_variance.h"
 #include "av1/encoder/bitstream.h"
+#if CONFIG_INTERNAL_STATS
+#include "av1/encoder/blockiness.h"
+#endif
 #include "av1/encoder/context_tree.h"
 #include "av1/encoder/dwt.h"
 #include "av1/encoder/encodeframe.h"
@@ -4202,10 +4205,6 @@ void print_entropy_stats(AV1_PRIMARY *const ppi) {
 #endif  // CONFIG_ENTROPY_STATS
 
 #if CONFIG_INTERNAL_STATS
-extern double av1_get_blockiness(const unsigned char *img1, int img1_pitch,
-                                 const unsigned char *img2, int img2_pitch,
-                                 int width, int height);
-
 static void adjust_image_stat(double y, double u, double v, double all,
                               ImageStat *s) {
   s->stat[STAT_Y] += y;