From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- media/libwebp/src/moz/cpu.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ media/libwebp/src/moz/moz.build | 21 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 media/libwebp/src/moz/cpu.cpp create mode 100644 media/libwebp/src/moz/moz.build (limited to 'media/libwebp/src/moz') diff --git a/media/libwebp/src/moz/cpu.cpp b/media/libwebp/src/moz/cpu.cpp new file mode 100644 index 0000000000..245401db24 --- /dev/null +++ b/media/libwebp/src/moz/cpu.cpp @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* This file replaces the CPU info methods originally implemented in + * src/dsp/cpu.c, due to missing dependencies for Andriod builds. It + * controls if NEON/SSE/etc is used. */ + +#include "../dsp/dsp.h" +#include "mozilla/arm.h" +#include "mozilla/SSE.h" + +extern "C" { +extern VP8CPUInfo VP8GetCPUInfo; +extern VP8CPUInfo SharpYuvGetCPUInfo; +} + +static int MozCPUInfo(CPUFeature feature) +{ + switch (feature) { + case kSSE2: + return mozilla::supports_sse2(); + case kSSE3: + return mozilla::supports_sse3(); + case kSSE4_1: + return mozilla::supports_sse4_1(); + case kAVX: + return mozilla::supports_avx(); + case kAVX2: + return mozilla::supports_avx2(); + case kNEON: + return mozilla::supports_neon(); +#if defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || defined(WEBP_USE_MSA) + case kMIPS32: + case kMIPSdspR2: + case kMSA: + return 1; +#endif + default: + return 0; + } +} + +VP8CPUInfo VP8GetCPUInfo = MozCPUInfo; +VP8CPUInfo SharpYuvGetCPUInfo = MozCPUInfo; diff --git a/media/libwebp/src/moz/moz.build b/media/libwebp/src/moz/moz.build new file mode 100644 index 0000000000..0dfea37ed3 --- /dev/null +++ b/media/libwebp/src/moz/moz.build @@ -0,0 +1,21 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +SOURCES += [ + 'cpu.cpp', +] + +LOCAL_INCLUDES += [ + '/media/libwebp', +] + +# Add libFuzzer configuration directives +include('/tools/fuzzing/libfuzzer-config.mozbuild') + +FINAL_LIBRARY = 'gkmedias' + +# We allow warnings for third-party code that can be updated from upstream. +AllowCompilerWarnings() -- cgit v1.2.3