aom: Remove aom_ports/msvc.h

From 134c6e5a62eea4b4e86b30cf3231cb3ac3d4cbf7 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Thu, 9 May 2024 12:32:08 -0700
Subject: [PATCH] Remove aom_ports/msvc.h

The aom_ports/msvc.h header provides snprintf() and round() for MSVC
older than Visual Studio 2015 and Visual Studio 2013, respectively. It
also provides _mm256_insert_epi32, _mm256_extract_epi32 and
_mm256_insert_epi16 for versions prior to 2017.

Since the project now requires Visual Studio 2019 or later, it is
safe to remove aom_ports/msvc.h.

This matches the change made in libvpx:
f65aff7b9 Remove vpx_ports/msvc.h

Change-Id: I2fe4c41eaa126f4cf17639c11895f1e464294c76
---
 aom_ports/aom_ports.cmake |  2 +-
 aom_ports/bitops.h        |  1 -
 aom_ports/msvc.h          | 75 ---------------------------------------
 common/args.c             |  1 -
 common/tools_common.h     |  1 -
 common/y4minput.c         |  1 -
 test/hbd_metrics_test.cc  |  1 -
 7 files changed, 1 insertion(+), 81 deletions(-)
 delete mode 100644 aom_ports/msvc.h

diff --git a/aom_ports/aom_ports.cmake b/aom_ports/aom_ports.cmake
index 8fd2ffd078..6df2bf020b 100644
--- a/aom_ports/aom_ports.cmake
+++ b/aom_ports/aom_ports.cmake
@@ -18,7 +18,7 @@ list(APPEND AOM_PORTS_INCLUDES "${AOM_ROOT}/aom_ports/aom_once.h"
             "${AOM_ROOT}/aom_ports/emmintrin_compat.h"
             "${AOM_ROOT}/aom_ports/mem.h" "${AOM_ROOT}/aom_ports/mem_ops.h"
             "${AOM_ROOT}/aom_ports/mem_ops_aligned.h"
-            "${AOM_ROOT}/aom_ports/msvc.h" "${AOM_ROOT}/aom_ports/sanitizer.h")
+            "${AOM_ROOT}/aom_ports/sanitizer.h")
 
 list(APPEND AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/float.asm")
 
diff --git a/aom_ports/bitops.h b/aom_ports/bitops.h
index 0795855083..7db4cde90b 100644
--- a/aom_ports/bitops.h
+++ b/aom_ports/bitops.h
@@ -15,7 +15,6 @@
 #include <assert.h>
 #include <stdint.h>
 
-#include "aom_ports/msvc.h"
 #include "config/aom_config.h"
 
 #ifdef _MSC_VER
diff --git a/aom_ports/msvc.h b/aom_ports/msvc.h
deleted file mode 100644
index e78e605f2f..0000000000
--- a/aom_ports/msvc.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2016, 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_AOM_PORTS_MSVC_H_
-#define AOM_AOM_PORTS_MSVC_H_
-#ifdef _MSC_VER
-
-#include "config/aom_config.h"
-
-#if _MSC_VER < 1900  // VS2015 provides snprintf
-#define snprintf _snprintf
-#endif  // _MSC_VER < 1900
-
-#if _MSC_VER < 1800  // VS2013 provides round
-#include <math.h>
-static INLINE double round(double x) {
-  if (x < 0)
-    return ceil(x - 0.5);
-  else
-    return floor(x + 0.5);
-}
-
-static INLINE float roundf(float x) {
-  if (x < 0)
-    return (float)ceil(x - 0.5f);
-  else
-    return (float)floor(x + 0.5f);
-}
-
-static INLINE long lroundf(float x) {
-  if (x < 0)
-    return (long)(x - 0.5f);
-  else
-    return (long)(x + 0.5f);
-}
-#endif  // _MSC_VER < 1800
-
-#if HAVE_AVX
-#include <immintrin.h>
-// Note:
-// _mm256_insert_epi16 intrinsics is available from vs2017.
-// We define this macro for vs2015 and earlier. The
-// intrinsics used here are in vs2015 document:
-// https://msdn.microsoft.com/en-us/library/hh977022.aspx
-// Input parameters:
-// a: __m256i,
-// d: int16_t,
-// indx: imm8 (0 - 15)
-#if _MSC_VER <= 1900
-#define _mm256_insert_epi16(a, d, indx)                                      \
-  _mm256_insertf128_si256(                                                   \
-      a,                                                                     \
-      _mm_insert_epi16(_mm256_extractf128_si256(a, indx >> 3), d, indx % 8), \
-      indx >> 3)
-
-static INLINE int _mm256_extract_epi32(__m256i a, const int i) {
-  return a.m256i_i32[i & 7];
-}
-static INLINE __m256i _mm256_insert_epi32(__m256i a, int b, const int i) {
-  __m256i c = a;
-  c.m256i_i32[i & 7] = b;
-  return c;
-}
-#endif  // _MSC_VER <= 1900
-#endif  // HAVE_AVX
-#endif  // _MSC_VER
-#endif  // AOM_AOM_PORTS_MSVC_H_
diff --git a/common/args.c b/common/args.c
index b5ede193b5..c380dde8a0 100644
--- a/common/args.c
+++ b/common/args.c
@@ -17,7 +17,6 @@
 #include <limits.h>
 
 #include "aom/aom_integer.h"
-#include "aom_ports/msvc.h"
 #include "aom/aom_codec.h"
 #include "common/tools_common.h"
 
diff --git a/common/tools_common.h b/common/tools_common.h
index 9d891d1561..cde21646ed 100644
--- a/common/tools_common.h
+++ b/common/tools_common.h
@@ -20,7 +20,6 @@
 #include "aom/aom_image.h"
 #include "aom/aom_integer.h"
 #include "aom_ports/mem.h"
-#include "aom_ports/msvc.h"
 
 #if CONFIG_AV1_ENCODER
 #include "common/y4minput.h"
diff --git a/common/y4minput.c b/common/y4minput.c
index 1974d76f1f..6a8601edfb 100644
--- a/common/y4minput.c
+++ b/common/y4minput.c
@@ -17,7 +17,6 @@
 #include <string.h>
 
 #include "aom/aom_integer.h"
-#include "aom_ports/msvc.h"
 #include "y4minput.h"
 
 // Reads 'size' bytes from 'file' into 'buf' with some fault tolerance.
diff --git a/test/hbd_metrics_test.cc b/test/hbd_metrics_test.cc
index 71c816f1cc..59bca9bcec 100644
--- a/test/hbd_metrics_test.cc
+++ b/test/hbd_metrics_test.cc
@@ -23,7 +23,6 @@
 #include "aom_dsp/psnr.h"
 #include "aom_dsp/ssim.h"
 #include "aom_ports/mem.h"
-#include "aom_ports/msvc.h"
 #include "aom_scale/yv12config.h"
 
 using libaom_test::ACMRandom;