diff --git a/.bazelrc b/.bazelrc index f14edd4c8..03617762e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -3,10 +3,12 @@ common --experimental_repo_remote_exec # Basic build settings build --jobs 128 -build --define='absl=1' -build --features=compiler_param_file +build --define='absl=1' # for gtest build --enable_platform_specific_config +# Enable stack traces +test --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" + # Linux build:linux --cxxopt=-std=c++17 build:linux --host_cxxopt=-std=c++17 @@ -41,13 +43,13 @@ build --apple_generate_dsym # for Android. build:android --crosstool_top=//external:android/crosstool build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain -build:android --cxxopt=-std=c++17 -build:android --copt=-w build:android --linkopt=-landroid build:android --linkopt=-ldl build:android --linkopt=-llog build:android --linkopt=-lm build:android --linkopt=-Wl,--gc-sections +# TODO: Remove this flag once we updated to NDK 25 +build:android --define=xnn_enable_arm_i8mm=false build:android_armv7 --config=android build:android_armv7 --cpu=armeabi-v7a @@ -65,6 +67,7 @@ build:android_x86_64 --config=android build:android_x86_64 --cpu=x86_64 build:android_x86_64 --fat_apk_cpu=x86_64 +# iOS configs. build:ios --apple_platform_type=ios build:ios --copt=-fno-aligned-allocation @@ -106,6 +109,9 @@ build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain build:wasm --copt=-emit-llvm build:wasm --cxxopt=-emit-llvm +# Turn off maximum stdout size +build --experimental_ui_max_stdouterr_bytes=-1 + # This bazelrc file is meant to be written by a setup script. try-import %workspace%/.configure.bazelrc diff --git a/.github/workflows/linux-test.yml b/.github/workflows/linux-test.yml index 8755bc664..00abbfecf 100644 --- a/.github/workflows/linux-test.yml +++ b/.github/workflows/linux-test.yml @@ -16,7 +16,7 @@ on: required: true jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: @@ -37,7 +37,7 @@ jobs: Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/**/*.cs Packages/com.github.homuler.mediapipe/PackageResources/MediaPipe/*.bytes Packages/com.github.homuler.mediapipe/PackageResources/MediaPipe/*.txt - key: libs-ubuntu-20.04-v1-${{ hashFiles('cache_key.txt') }} + key: libs-ubuntu-22.04-v1-${{ hashFiles('cache_key.txt') }} # Setup build tools - name: Mount bazel cache @@ -45,10 +45,10 @@ jobs: uses: actions/cache/restore@v4 with: path: "~/.cache/bazel" - key: bazel-ubuntu-20.04-v1-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('cache_key.txt') }} + key: bazel-ubuntu-22.04-v1-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('cache_key.txt') }} restore-keys: | - bazel-ubuntu-20.04-v1-${{ hashFiles('WORKSPACE') }}- - bazel-ubuntu-20.04-v1- + bazel-ubuntu-22.04-v1-${{ hashFiles('WORKSPACE') }}- + bazel-ubuntu-22.04-v1- - name: Remove cache_key.txt run: | @@ -63,10 +63,19 @@ jobs: - name: Install dependencies if: steps.cache-libs.outputs.cache-hit != 'true' run: | - # install GCC/G++ 8 + # install GCC/G++ 11 + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo apt-get update - sudo apt-get install -y --no-install-recommends gcc-8 g++-8 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8 + sudo apt-get install -y --no-install-recommends gcc-11 g++-11 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 + + # install Clang 16 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 16 + sudo ln -sf /usr/bin/clang-16 /usr/bin/clang + sudo ln -sf /usr/bin/clang++-16 /usr/bin/clang++ + sudo ln -sf /usr/bin/clang-format-16 /usr/bin/clang-format # install NuGet sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe @@ -97,7 +106,7 @@ jobs: uses: actions/cache/save@v4 with: path: ~/.cache/bazel - key: bazel-ubuntu-20.04-v1-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('cache_key.txt') }} + key: bazel-ubuntu-22.04-v1-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('cache_key.txt') }} test: runs-on: ${{ matrix.os }} @@ -107,7 +116,6 @@ jobs: matrix: os: - ubuntu-22.04 - - ubuntu-20.04 unityVersion: - 2022.3.16f1 - 2021.3.33f1 @@ -190,7 +198,7 @@ jobs: retention-days: 7 - uses: actions/upload-artifact@v4 - if: ${{ matrix.os == 'ubuntu-20.04' && startsWith(matrix.unityVersion, '2021') }} + if: ${{ matrix.os == 'ubuntu-22.04' && startsWith(matrix.unityVersion, '2021') }} with: name: Coverage results path: DummyProject/CodeCoverage diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index eb59e94fd..7d8dc562c 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -128,7 +128,7 @@ jobs: path: Packages/com.github.homuler.mediapipe/Runtime/Plugins/libmediapipe_c.dylib ios-build: - runs-on: macos-12 + runs-on: macos-14 steps: - uses: actions/checkout@v4 with: @@ -141,17 +141,6 @@ jobs: - name: Install NumPy run: pip install --no-cache-dir --user numpy - - name: Build bazel to circumvent a compile error - run: | - mkdir bin - git clone https://github.com/bazelbuild/bazel.git --depth 1 --single-branch --branch 6.1.1 - cd bazel - git apply ../third_party/bazel_ios_workaround.diff - USE_BAZEL_VERSION=6.2.1 bazel build --java_runtime_version=remotejdk_11 //src:bazel - cp bazel-bin/src/bazel ../bin - cd .. - echo "bin" >> $GITHUB_PATH - - name: Build MediaPipeUnity.framework run: | unset ANDROID_NDK_HOME diff --git a/Packages/com.github.homuler.mediapipe/Third Party Notices.md b/Packages/com.github.homuler.mediapipe/Third Party Notices.md index a9a12b1dd..22d52b822 100644 --- a/Packages/com.github.homuler.mediapipe/Third Party Notices.md +++ b/Packages/com.github.homuler.mediapipe/Third Party Notices.md @@ -489,6 +489,51 @@ IN THE SOFTWARE. --- +Component Name: cpuinfo + +Licence Type: 2-Clause BSD + +Copyright (c) 2019 Google LLC +Copyright (c) 2017-2018 Facebook Inc. +Copyright (C) 2012-2017 Georgia Institute of Technology +Copyright (C) 2010-2012 Marat Dukhan + +All rights reserved. + +https://github.com/pytorch/cpuinfo + +``` +Copyright (c) 2019 Google LLC +Copyright (c) 2017-2018 Facebook Inc. +Copyright (C) 2012-2017 Georgia Institute of Technology +Copyright (C) 2010-2012 Marat Dukhan + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +--- + Component Name: easyexif Licence Type: 2-Clause BSD @@ -2387,6 +2432,92 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND --- +Component Name: pthreadpool + +License Type: 2-Clause BSD + +Copyright 2019 Google LLC +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2015-2017 Georgia Institute of Technology +All rights reserved. + +https://github.com/Maratyszcza/pthreadpool + +``` +Copyright 2019 Google LLC +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2015-2017 Georgia Institute of Technology +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +--- + +Component Name: XNNPACK + +License Type: 3-Clause BSD + +Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +Copyright 2019 Google LLC + +https://github.com/google/XNNPACK + +``` +BSD License + +For XNNPACK software + +Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +Copyright 2019 Google LLC + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +--- + Component Name: zlib License Type: Zlib diff --git a/README.md b/README.md index 820466035..afeb3ea35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MediaPipe Unity Plugin -This is a Unity (2022.3.16f1) [Native Plugin](https://docs.unity3d.com/Manual/NativePlugins.html) to use [MediaPipe](https://github.com/google/mediapipe) (0.10.9). +This is a Unity (2022.3.16f1) [Native Plugin](https://docs.unity3d.com/Manual/NativePlugins.html) to use [MediaPipe](https://github.com/google/mediapipe) (0.10.14). The goal of this project is to port the MediaPipe API (C++) _one by one_ to C# so that it can be called from Unity.\ This approach may sacrifice performance when you need to call multiple APIs in a loop, but it gives you the flexibility to use MediaPipe instead. diff --git a/WORKSPACE b/WORKSPACE index 534182425..cd1d47461 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -10,25 +10,11 @@ http_archive( "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", ], ) - load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - bazel_skylib_workspace() - load("@bazel_skylib//lib:versions.bzl", "versions") - versions.check(minimum_bazel_version = "6.1.1") -http_archive( - name = "rules_pkg", - sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66", - url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz", -) - -load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") - -rules_pkg_dependencies() - # mediapipe http_archive( name = "mediapipe", @@ -36,22 +22,22 @@ http_archive( "-p1", ], patches = [ - "@//third_party:mediapipe_workaround.diff", "@//third_party:mediapipe_opencv.diff", "@//third_party:mediapipe_visibility.diff", "@//third_party:mediapipe_model_path.diff", "@//third_party:mediapipe_extension.diff", + "@//third_party:mediapipe_workaround.diff", ], - sha256 = "c4719fce7a00e097daf3ad972963422ebe190297f5f2288d3ab05e4f856c74c4", - strip_prefix = "mediapipe-0.10.9", - urls = ["https://github.com/google/mediapipe/archive/v0.10.9.tar.gz"], + sha256 = "9d46fa5363f5c4e11c3d1faec71b0746f15c5aab7b5460d0e5655d7af93c6957", + strip_prefix = "mediapipe-0.10.14", + urls = ["https://github.com/google/mediapipe/archive/v0.10.14.tar.gz"], ) -# ABSL cpp library lts_2023_01_25. +# ABSL on 2023-10-18 http_archive( name = "com_google_absl", urls = [ - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.0.tar.gz", + "https://github.com/abseil/abseil-cpp/archive//9687a8ea750bfcddf790372093245a1d041b21a3.tar.gz", ], patches = [ "@mediapipe//third_party:com_google_absl_windows_patch.diff", @@ -59,8 +45,8 @@ http_archive( patch_args = [ "-p1", ], - strip_prefix = "abseil-cpp-20230125.0", - sha256 = "3ea49a7d97421b88a8c48a0de16c16048e17725c7ec0f1d3ea2683a2a75adc21", + strip_prefix = "abseil-cpp-9687a8ea750bfcddf790372093245a1d041b21a3", + sha256 = "f841f78243f179326f2a80b719f2887c38fe226d288ecdc46e2aa091e6aa43bc", ) http_archive( @@ -95,6 +81,32 @@ http_archive( ], ) +http_archive( + name = "cpuinfo", + sha256 = "a615cac78fad03952cc3e1fd231ce789a8df6e81a5957b64350cb8200364b385", + strip_prefix = "cpuinfo-d6860c477c99f1fce9e28eb206891af3c0e1a1d7", + urls = [ + "https://github.com/pytorch/cpuinfo/archive/d6860c477c99f1fce9e28eb206891af3c0e1a1d7.zip" + ], +) + +# XNNPACK on 2024-03-27. +http_archive( + name = "XNNPACK", + # `curl -L | shasum -a 256` + sha256 = "179a680ef85deb5380b850f2551b214e00835c232f5b197dedf7c011a6adf5a6", + strip_prefix = "XNNPACK-2fe25b859581a34e77b48b06c640ac1a5a58612e", + url = "https://github.com/google/XNNPACK/archive/2fe25b859581a34e77b48b06c640ac1a5a58612e.zip", +) + +# TODO: This is an are indirect depedency. We should factor it out. +http_archive( + name = "pthreadpool", + sha256 = "a4cf06de57bfdf8d7b537c61f1c3071bce74e57524fe053e0bbd2332feca7f95", + strip_prefix = "pthreadpool-4fe0e1e183925bf8cfa6aae24237e724a96479b8", + urls = ["https://github.com/Maratyszcza/pthreadpool/archive/4fe0e1e183925bf8cfa6aae24237e724a96479b8.zip"], +) + load("//third_party:android_configure.bzl", "android_configure") android_configure(name = "local_config_android") @@ -278,7 +290,7 @@ http_archive( sha256 = "fe346e1aee4f5069c4cbccb88706a9a2b2b4cf98aeb91ec1319be77e07dd7435", repo_mapping = {"@com_github_glog_glog" : "@com_github_glog_glog_no_gflags"}, # TODO: Fix this in AudioTools directly - patches = ["@//third_party:com_google_audio_tools_fixes.diff"], + patches = ["@mediapipe//third_party:com_google_audio_tools_fixes.diff"], patch_args = ["-p1"] ) @@ -289,17 +301,18 @@ http_archive( build_file = "@mediapipe//third_party:pffft.BUILD", ) -# sentencepiece +# Sentencepiece http_archive( name = "com_google_sentencepiece", strip_prefix = "sentencepiece-0.1.96", + add_prefix = "sentencepiece", sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754", urls = [ "https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip" ], build_file = "@mediapipe//third_party:sentencepiece.BUILD", patches = ["@mediapipe//third_party:com_google_sentencepiece.diff"], - patch_args = ["-p1"], + patch_args = ["-d", "sentencepiece", "-p1"], ) http_archive( @@ -341,7 +354,7 @@ http_archive( name = "ceres_solver", url = "https://github.com/ceres-solver/ceres-solver/archive/123fba61cf2611a3c8bddc9d91416db26b10b558.zip", patches = [ - "@mediapipe//third_party:ceres_solver_compatibility_fixes.diff" + "@mediapipe//third_party:ceres_solver_compatibility_fixes.diff", ], patch_args = [ "-p1", @@ -467,23 +480,27 @@ http_archive( ) # TensorFlow repo should always go after the other external dependencies. -# TF on 2023-07-26. -_TENSORFLOW_GIT_COMMIT = "e92261fd4cec0b726692081c4d2966b75abf31dd" -# curl -L https://github.com/tensorflow/tensorflow/archive/.tar.gz | shasum -a 256 -_TENSORFLOW_SHA256 = "478a229bd4ec70a5b568ac23b5ea013d9fca46a47d6c43e30365a0412b9febf4" +# TF on 2024-05-09. +_TENSORFLOW_GIT_COMMIT = "8038e44ea38bb889095afaaf6ad05e94adaed8d2" +# curl -L https://github.com/tensorflow/tensorflow/archive/8038e44ea38bb889095afaaf6ad05e94adaed8d2.tar.gz | shasum -a 256 +_TENSORFLOW_SHA256 = "a00c1503a879eb21c349941bbee54aef8d557d7d2ab770e76fb26668d75aa6e0" http_archive( name = "org_tensorflow", urls = [ "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, ], patches = [ - "@mediapipe//third_party:org_tensorflow_compatibility_fixes.diff", "@mediapipe//third_party:org_tensorflow_system_python.diff", # Diff is generated with a script, don't update it manually. "@mediapipe//third_party:org_tensorflow_custom_ops.diff", # Works around Bazel issue with objc_library. # See https://github.com/bazelbuild/bazel/issues/19912 "@mediapipe//third_party:org_tensorflow_objc_build_fixes.diff", + # Restores scores for text pipelines, which return different results + # with subgraph reshaping + "@mediapipe//third_party:org_tensorflow_disable_subgraph_reshaping.diff", + # See https://github.com/tensorflow/tensorflow/issues/69036 + "@//third_party:org_tensorflow_windows_workaround.diff", ], patch_args = [ "-p1", @@ -599,3 +616,10 @@ http_archive( urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-windows-4c63f1befa1063184c5982b11b6a2cc17d4e5815.zip"], build_file = "@mediapipe//third_party:halide.BUILD", ) + +http_archive( + name = "com_github_nlohmann_json", + sha256 = "6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91", + urls = ["https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip"], + build_file = "@//third_party:nlohmann.BUILD", +) diff --git a/docker/linux/x86_64/Dockerfile b/docker/linux/x86_64/Dockerfile index dd5685588..5cfb1db1a 100644 --- a/docker/linux/x86_64/Dockerfile +++ b/docker/linux/x86_64/Dockerfile @@ -27,8 +27,33 @@ RUN apt-get update && \ software-properties-common \ sudo \ unzip \ + wget \ zip +# Upgrade binutils (>= 2.36) +RUN curl -O https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.gz && \ + tar -xvzof binutils-2.36.tar.gz && \ + cd binutils-2.36 && \ + mkdir build && \ + cd build && \ + ../configure --prefix=/usr && \ + make && \ + make install + +# Install gcc-11 +RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ + apt-get update && \ + apt-get install -y --no-install-recommends gcc-11 g++-11 && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 + +# Install Clang 16 +RUN curl https://apt.llvm.org/llvm.sh -o llvm.sh && \ + chmod +x llvm.sh && \ + ./llvm.sh 16 && \ + ln -sf /usr/bin/clang-16 /usr/bin/clang && \ + ln -sf /usr/bin/clang++-16 /usr/bin/clang++ && \ + ln -sf /usr/bin/clang-format-16 /usr/bin/clang-format + FROM base AS android WORKDIR /tmp diff --git a/mediapipe_api/framework/formats/image.cc b/mediapipe_api/framework/formats/image.cc index 656d9f89a..b0484f699 100644 --- a/mediapipe_api/framework/formats/image.cc +++ b/mediapipe_api/framework/formats/image.cc @@ -1,6 +1,6 @@ #include "mediapipe_api/framework/formats/image.h" -MpReturnCode mp_Image__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, +MpReturnCode mp_Image__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8_t* pixel_data, Deleter* deleter, mediapipe::Image** image_out) { TRY_ALL *image_out = new mediapipe::Image{std::make_shared(format, width, height, width_step, pixel_data, deleter)}; @@ -92,7 +92,7 @@ void mp_PixelWriteLock__delete(mediapipe::PixelWriteLock* pixel_Write_lock) { delete pixel_Write_lock; } -uint8* mp_PixelWriteLock__Pixels(mediapipe::PixelWriteLock* pixel_read_lock) { +uint8_t* mp_PixelWriteLock__Pixels(mediapipe::PixelWriteLock* pixel_read_lock) { return pixel_read_lock->Pixels(); } @@ -111,7 +111,7 @@ MpReturnCode mp__MakeImagePacket_At__PI_Rt(mediapipe::Image* image, mediapipe::T CATCH_ALL } -MpReturnCode mp__MakeImagePacket_At__PI_ll(mediapipe::Image* image, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeImagePacket_At__PI_ll(mediapipe::Image* image, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY_ALL *packet_out = new mediapipe::Packet{mediapipe::MakePacket(std::move(*image)).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); diff --git a/mediapipe_api/framework/formats/image.h b/mediapipe_api/framework/formats/image.h index f870b5318..eb9b9bc44 100644 --- a/mediapipe_api/framework/formats/image.h +++ b/mediapipe_api/framework/formats/image.h @@ -25,9 +25,9 @@ extern "C" { -typedef void(Deleter)(uint8*); +typedef void(Deleter)(uint8_t*); -MP_CAPI(MpReturnCode) mp_Image__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, +MP_CAPI(MpReturnCode) mp_Image__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8_t* pixel_data, Deleter* deleter, mediapipe::Image** image_out); #if !MEDIAPIPE_DISABLE_GPU @@ -56,12 +56,12 @@ MP_CAPI(MpReturnCode) mp_Image__ConvertToGpu(mediapipe::Image* image, bool* resu MP_CAPI(MpReturnCode) mp_PixelWriteLock__RI(mediapipe::Image* image, mediapipe::PixelWriteLock** pixel_Write_lock_out); MP_CAPI(void) mp_PixelWriteLock__delete(mediapipe::PixelWriteLock* pixel_Write_lock); -MP_CAPI(uint8*) mp_PixelWriteLock__Pixels(mediapipe::PixelWriteLock* pixel_read_lock); +MP_CAPI(uint8_t*) mp_PixelWriteLock__Pixels(mediapipe::PixelWriteLock* pixel_read_lock); // Packet API MP_CAPI(MpReturnCode) mp__MakeImagePacket__PI(mediapipe::Image* image, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeImagePacket_At__PI_Rt(mediapipe::Image* image, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeImagePacket_At__PI_ll(mediapipe::Image* image, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeImagePacket_At__PI_ll(mediapipe::Image* image, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__ConsumeImage(mediapipe::Packet* packet, absl::Status **status_out, mediapipe::Image** value_out); MP_CAPI(MpReturnCode) mp_Packet__GetImage(mediapipe::Packet* packet, const mediapipe::Image** value_out); MP_CAPI(MpReturnCode) mp_Packet__GetImageVector(mediapipe::Packet* packet, mp_api::StructArray* value_out); diff --git a/mediapipe_api/framework/formats/image_frame.cc b/mediapipe_api/framework/formats/image_frame.cc index dd9c11c72..3666dc696 100644 --- a/mediapipe_api/framework/formats/image_frame.cc +++ b/mediapipe_api/framework/formats/image_frame.cc @@ -13,7 +13,7 @@ MpReturnCode mp_ImageFrame__(mediapipe::ImageFrame** image_frame_out) { CATCH_EXCEPTION } -MpReturnCode mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int width, int height, uint32 alignment_boundary, +MpReturnCode mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int width, int height, uint32_t alignment_boundary, mediapipe::ImageFrame** image_frame_out) { TRY_ALL *image_frame_out = new mediapipe::ImageFrame{format, width, height, alignment_boundary}; @@ -21,7 +21,7 @@ MpReturnCode mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int CATCH_ALL } -MpReturnCode mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, Deleter* deleter, +MpReturnCode mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8_t* pixel_data, Deleter* deleter, mediapipe::ImageFrame** image_frame_out) { TRY_ALL *image_frame_out = new mediapipe::ImageFrame{format, width, height, width_step, pixel_data, deleter}; @@ -49,7 +49,7 @@ MpReturnCode mp_ImageFrame__SetAlignmentPaddingAreas(mediapipe::ImageFrame* imag bool mp_ImageFrame__IsContiguous(mediapipe::ImageFrame* image_frame) { return image_frame->IsContiguous(); } -MpReturnCode mp_ImageFrame__IsAligned__ui(mediapipe::ImageFrame* image_frame, uint32 alignment_boundary, bool* value_out) { +MpReturnCode mp_ImageFrame__IsAligned__ui(mediapipe::ImageFrame* image_frame, uint32_t alignment_boundary, bool* value_out) { TRY_ALL *value_out = image_frame->IsAligned(alignment_boundary); RETURN_CODE(MpReturnCode::Success); @@ -64,16 +64,16 @@ int mp_ImageFrame__Height(mediapipe::ImageFrame* image_frame) { return image_fra int mp_ImageFrame__WidthStep(mediapipe::ImageFrame* image_frame) { return image_frame->WidthStep(); } -uint8* mp_ImageFrame__MutablePixelData(mediapipe::ImageFrame* image_frame) { return image_frame->MutablePixelData(); } +uint8_t* mp_ImageFrame__MutablePixelData(mediapipe::ImageFrame* image_frame) { return image_frame->MutablePixelData(); } -MpReturnCode mp_ImageFrame__CopyToBuffer__Pui8_i(mediapipe::ImageFrame* image_frame, uint8* buffer, int buffer_size) { +MpReturnCode mp_ImageFrame__CopyToBuffer__Pui8_i(mediapipe::ImageFrame* image_frame, uint8_t* buffer, int buffer_size) { TRY_ALL image_frame->CopyToBuffer(buffer, buffer_size); RETURN_CODE(MpReturnCode::Success); CATCH_ALL } -MpReturnCode mp_ImageFrame__CopyToBuffer__Pui16_i(mediapipe::ImageFrame* image_frame, uint16* buffer, int buffer_size) { +MpReturnCode mp_ImageFrame__CopyToBuffer__Pui16_i(mediapipe::ImageFrame* image_frame, uint16_t* buffer, int buffer_size) { TRY_ALL image_frame->CopyToBuffer(buffer, buffer_size); RETURN_CODE(MpReturnCode::Success); @@ -102,7 +102,7 @@ MpReturnCode mp__MakeImageFramePacket_At__Pif_Rt(mediapipe::ImageFrame* image_fr CATCH_EXCEPTION } -MpReturnCode mp__MakeImageFramePacket_At__Pif_ll(mediapipe::ImageFrame* image_frame, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeImageFramePacket_At__Pif_ll(mediapipe::ImageFrame* image_frame, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(std::move(*image_frame)).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); diff --git a/mediapipe_api/framework/formats/image_frame.h b/mediapipe_api/framework/formats/image_frame.h index fc1482629..c3c31833c 100644 --- a/mediapipe_api/framework/formats/image_frame.h +++ b/mediapipe_api/framework/formats/image_frame.h @@ -17,32 +17,32 @@ extern "C" { -typedef void(Deleter)(uint8*); +typedef void(Deleter)(uint8_t*); MP_CAPI(MpReturnCode) mp_ImageFrame__(mediapipe::ImageFrame** image_frame_out); -MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int width, int height, uint32 alignment_boundary, +MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int width, int height, uint32_t alignment_boundary, mediapipe::ImageFrame** image_frame_out); -MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, +MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8_t* pixel_data, Deleter* deleter, mediapipe::ImageFrame** image_frame_out); MP_CAPI(void) mp_ImageFrame__delete(mediapipe::ImageFrame* image_frame); MP_CAPI(bool) mp_ImageFrame__IsEmpty(mediapipe::ImageFrame* image_frame); MP_CAPI(MpReturnCode) mp_ImageFrame__SetToZero(mediapipe::ImageFrame* image_frame); MP_CAPI(MpReturnCode) mp_ImageFrame__SetAlignmentPaddingAreas(mediapipe::ImageFrame* image_frame); MP_CAPI(bool) mp_ImageFrame__IsContiguous(mediapipe::ImageFrame* image_frame); -MP_CAPI(MpReturnCode) mp_ImageFrame__IsAligned__ui(mediapipe::ImageFrame* image_frame, uint32 alignment_boundary, bool* value_out); +MP_CAPI(MpReturnCode) mp_ImageFrame__IsAligned__ui(mediapipe::ImageFrame* image_frame, uint32_t alignment_boundary, bool* value_out); MP_CAPI(mediapipe::ImageFormat::Format) mp_ImageFrame__Format(mediapipe::ImageFrame* image_frame); MP_CAPI(int) mp_ImageFrame__Width(mediapipe::ImageFrame* image_frame); MP_CAPI(int) mp_ImageFrame__Height(mediapipe::ImageFrame* image_frame); MP_CAPI(int) mp_ImageFrame__WidthStep(mediapipe::ImageFrame* image_frame); -MP_CAPI(uint8*) mp_ImageFrame__MutablePixelData(mediapipe::ImageFrame* image_frame); -MP_CAPI(MpReturnCode) mp_ImageFrame__CopyToBuffer__Pui8_i(mediapipe::ImageFrame* image_frame, uint8* buffer, int buffer_size); -MP_CAPI(MpReturnCode) mp_ImageFrame__CopyToBuffer__Pui16_i(mediapipe::ImageFrame* image_frame, uint16* buffer, int buffer_size); +MP_CAPI(uint8_t*) mp_ImageFrame__MutablePixelData(mediapipe::ImageFrame* image_frame); +MP_CAPI(MpReturnCode) mp_ImageFrame__CopyToBuffer__Pui8_i(mediapipe::ImageFrame* image_frame, uint8_t* buffer, int buffer_size); +MP_CAPI(MpReturnCode) mp_ImageFrame__CopyToBuffer__Pui16_i(mediapipe::ImageFrame* image_frame, uint16_t* buffer, int buffer_size); MP_CAPI(MpReturnCode) mp_ImageFrame__CopyToBuffer__Pf_i(mediapipe::ImageFrame* image_frame, float* buffer, int buffer_size); // Packet API MP_CAPI(MpReturnCode) mp__MakeImageFramePacket__Pif(mediapipe::ImageFrame* image_frame, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeImageFramePacket_At__Pif_Rt(mediapipe::ImageFrame* image_frame, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeImageFramePacket_At__Pif_ll(mediapipe::ImageFrame* image_frame, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeImageFramePacket_At__Pif_ll(mediapipe::ImageFrame* image_frame, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__ConsumeImageFrame(mediapipe::Packet* packet, absl::Status** status_out, mediapipe::ImageFrame** value_out); MP_CAPI(MpReturnCode) mp_Packet__GetImageFrame(mediapipe::Packet* packet, const mediapipe::ImageFrame** value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsImageFrame(mediapipe::Packet* packet, absl::Status** status_out); diff --git a/mediapipe_api/framework/formats/matrix.cc b/mediapipe_api/framework/formats/matrix.cc index 0520196f1..4d57408d1 100644 --- a/mediapipe_api/framework/formats/matrix.cc +++ b/mediapipe_api/framework/formats/matrix.cc @@ -16,7 +16,7 @@ MpReturnCode mp__MakeColMajorMatrixPacket__Pf_i_i(float* pcm_data, int rows, int CATCH_EXCEPTION } -MpReturnCode mp__MakeColMajorMatrixPacket_At__Pf_i_i_ll(float* pcm_data, int rows, int cols, int64 timestamp_microsec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeColMajorMatrixPacket_At__Pf_i_i_ll(float* pcm_data, int rows, int cols, int64_t timestamp_microsec, mediapipe::Packet** packet_out) { TRY Eigen::Map m(pcm_data, rows, cols); diff --git a/mediapipe_api/framework/formats/matrix.h b/mediapipe_api/framework/formats/matrix.h index 9f64fbdf8..ef6c1ce06 100644 --- a/mediapipe_api/framework/formats/matrix.h +++ b/mediapipe_api/framework/formats/matrix.h @@ -27,7 +27,7 @@ namespace mp_api { extern "C" { MP_CAPI(MpReturnCode) mp__MakeColMajorMatrixPacket__Pf_i_i(float* pcm_data, int rows, int cols, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeColMajorMatrixPacket_At__Pf_i_i_ll(float* pcm_data, int rows, int cols, int64 timestamp_microsec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeColMajorMatrixPacket_At__Pf_i_i_ll(float* pcm_data, int rows, int cols, int64_t timestamp_microsec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetMpMatrix(mediapipe::Packet* packet, mp_api::Matrix* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsMatrix(mediapipe::Packet* packet, absl::Status** status_out); diff --git a/mediapipe_api/framework/packet.cc b/mediapipe_api/framework/packet.cc index f8638274c..46e8fe31b 100644 --- a/mediapipe_api/framework/packet.cc +++ b/mediapipe_api/framework/packet.cc @@ -35,7 +35,7 @@ MpReturnCode mp_Packet__Timestamp(mediapipe::Packet* packet, mediapipe::Timestam CATCH_EXCEPTION } -int64 mp_Packet__TimestampMicroseconds(mediapipe::Packet* packet) { +int64_t mp_Packet__TimestampMicroseconds(mediapipe::Packet* packet) { return packet->Timestamp().Microseconds(); } @@ -75,7 +75,7 @@ MpReturnCode mp__MakeBoolPacket_At__b_Rt(bool value, mediapipe::Timestamp* times CATCH_EXCEPTION } -MpReturnCode mp__MakeBoolPacket_At__b_ll(bool value, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeBoolPacket_At__b_ll(bool value, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(value).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -101,7 +101,7 @@ MpReturnCode mp__MakeBoolVectorPacket__Pb_i(bool* value, int size, mediapipe::Pa return mp__MakeVectorPacket(value, size, packet_out); } -MpReturnCode mp__MakeBoolVectorPacket_At__Pb_i_ll(bool* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeBoolVectorPacket_At__Pb_i_ll(bool* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { return mp__MakeVectorPacket_At(value, size, timestampMicrosec, packet_out); } @@ -124,7 +124,7 @@ MpReturnCode mp__MakeDoublePacket__d(double value, mediapipe::Packet** packet_ou CATCH_EXCEPTION } -MpReturnCode mp__MakeDoublePacket_At__d_ll(double value, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeDoublePacket_At__d_ll(double value, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(value).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -160,7 +160,7 @@ MpReturnCode mp__MakeFloatPacket_At__f_Rt(float value, mediapipe::Timestamp* tim CATCH_EXCEPTION } -MpReturnCode mp__MakeFloatPacket_At__f_ll(float value, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeFloatPacket_At__f_ll(float value, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(value).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -200,7 +200,7 @@ MpReturnCode mp__MakeFloatArrayPacket_At__Pf_i_Rt(float* value, int size, mediap CATCH_EXCEPTION } -MpReturnCode mp__MakeFloatArrayPacket_At__Pf_i_ll(float* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeFloatArrayPacket_At__Pf_i_ll(float* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY auto array = new float[size]; std::memcpy(array, value, size * sizeof(float)); @@ -233,7 +233,7 @@ MpReturnCode mp__MakeFloatVectorPacket_At__Pf_i_Rt(float* value, int size, media return mp__MakeVectorPacket_At(value, size, timestamp, packet_out); } -MpReturnCode mp__MakeFloatVectorPacket_At__Pf_i_ll(float* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeFloatVectorPacket_At__Pf_i_ll(float* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { return mp__MakeVectorPacket_At(value, size, timestampMicrosec, packet_out); } @@ -263,7 +263,7 @@ MpReturnCode mp__MakeIntPacket_At__i_Rt(int value, mediapipe::Timestamp* timesta CATCH_EXCEPTION } -MpReturnCode mp__MakeIntPacket_At__i_ll(int value, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeIntPacket_At__i_ll(int value, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(value).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -299,7 +299,7 @@ MpReturnCode mp__MakeStringPacket_At__PKc_Rt(const char* str, mediapipe::Timesta CATCH_EXCEPTION } -MpReturnCode mp__MakeStringPacket_At__PKc_ll(const char* str, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeStringPacket_At__PKc_ll(const char* str, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(std::string(str)).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -320,7 +320,7 @@ MpReturnCode mp__MakeStringPacket_At__PKc_i_Rt(const char* str, int size, mediap CATCH_EXCEPTION } -MpReturnCode mp__MakeStringPacket_At__PKc_i_ll(const char* str, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeStringPacket_At__PKc_i_ll(const char* str, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(std::string(str, size)).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); @@ -400,7 +400,7 @@ MpReturnCode mp__PacketFromDynamicProto__PKc_PKc_i(const char* type_name, const } MpReturnCode mp__PacketFromDynamicProto_At__PKc_PKc_i_ll(const char* type_name, const char* serialized_proto, int size, - int64 timestampMicrosec, + int64_t timestampMicrosec, absl::Status** status_out, mediapipe::Packet** packet_out) { TRY_ALL auto status_or_packet = mediapipe::packet_internal::PacketFromDynamicProto(type_name, std::string(serialized_proto, size)); diff --git a/mediapipe_api/framework/packet.h b/mediapipe_api/framework/packet.h index 1116f10a2..5a39a001e 100644 --- a/mediapipe_api/framework/packet.h +++ b/mediapipe_api/framework/packet.h @@ -39,7 +39,7 @@ MP_CAPI(void) mp_Packet__delete(mediapipe::Packet* packet); MP_CAPI(MpReturnCode) mp_Packet__At__Rt(mediapipe::Packet* packet, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); MP_CAPI(bool) mp_Packet__IsEmpty(mediapipe::Packet* packet); MP_CAPI(MpReturnCode) mp_Packet__Timestamp(mediapipe::Packet* packet, mediapipe::Timestamp** timestamp_out); -MP_CAPI(int64) mp_Packet__TimestampMicroseconds(mediapipe::Packet* packet); +MP_CAPI(int64_t) mp_Packet__TimestampMicroseconds(mediapipe::Packet* packet); MP_CAPI(MpReturnCode) mp_Packet__DebugString(mediapipe::Packet* packet, const char** str_out); MP_CAPI(MpReturnCode) mp_Packet__RegisteredTypeName(mediapipe::Packet* packet, const char** str_out); MP_CAPI(MpReturnCode) mp_Packet__DebugTypeName(mediapipe::Packet* packet, const char** str_out); @@ -47,57 +47,57 @@ MP_CAPI(MpReturnCode) mp_Packet__DebugTypeName(mediapipe::Packet* packet, const // bool MP_CAPI(MpReturnCode) mp__MakeBoolPacket__b(bool value, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeBoolPacket_At__b_Rt(bool value, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeBoolPacket_At__b_ll(bool value, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeBoolPacket_At__b_ll(bool value, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetBool(mediapipe::Packet* packet, bool* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsBool(mediapipe::Packet* packet, absl::Status** status_out); // std::vector MP_CAPI(MpReturnCode) mp__MakeBoolVectorPacket__Pb_i(bool* value, int size, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeBoolVectorPacket_At__Pb_i_ll(bool* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeBoolVectorPacket_At__Pb_i_ll(bool* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetBoolVector(mediapipe::Packet* packet, mp_api::StructArray* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsBoolVector(mediapipe::Packet* packet, absl::Status** status_out); // double MP_CAPI(MpReturnCode) mp__MakeDoublePacket__d(double value, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeDoublePacket_At__d_ll(double value, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeDoublePacket_At__d_ll(double value, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetDouble(mediapipe::Packet* packet, double* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsDouble(mediapipe::Packet* packet, absl::Status** status_out); // float MP_CAPI(MpReturnCode) mp__MakeFloatPacket__f(float value, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeFloatPacket_At__f_Rt(float value, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeFloatPacket_At__f_ll(float value, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeFloatPacket_At__f_ll(float value, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetFloat(mediapipe::Packet* packet, float* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsFloat(mediapipe::Packet* packet, absl::Status** status_out); // float[] MP_CAPI(MpReturnCode) mp__MakeFloatArrayPacket__Pf_i(float* value, int size, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeFloatArrayPacket_At__Pf_i_Rt(float* value, int size, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeFloatArrayPacket_At__Pf_i_ll(float* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeFloatArrayPacket_At__Pf_i_ll(float* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetFloatArray_i(mediapipe::Packet* packet, int size, const float** value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsFloatArray(mediapipe::Packet* packet, absl::Status** status_out); // std::vector MP_CAPI(MpReturnCode) mp__MakeFloatVectorPacket__Pf_i(float* value, int size, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeFloatVectorPacket_At__Pf_i_Rt(float* value, int size, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeFloatVectorPacket_At__Pf_i_ll(float* value, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeFloatVectorPacket_At__Pf_i_ll(float* value, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetFloatVector(mediapipe::Packet* packet, mp_api::StructArray* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsFloatVector(mediapipe::Packet* packet, absl::Status** status_out); // int MP_CAPI(MpReturnCode) mp__MakeIntPacket__i(int value, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeIntPacket_At__i_Rt(int value, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeIntPacket_At__i_ll(int value, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeIntPacket_At__i_ll(int value, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetInt(mediapipe::Packet* packet, int* value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsInt(mediapipe::Packet* packet, absl::Status** status_out); // String MP_CAPI(MpReturnCode) mp__MakeStringPacket__PKc(const char* str, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_Rt(const char* str, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_ll(const char* str, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_ll(const char* str, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeStringPacket__PKc_i(const char* str, int size, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_i_Rt(const char* str, int size, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_i_ll(const char* str, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeStringPacket_At__PKc_i_ll(const char* str, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetString(mediapipe::Packet* packet, const char** value_out); MP_CAPI(MpReturnCode) mp_Packet__GetByteString(mediapipe::Packet* packet, const char** value_out, int* size_out); MP_CAPI(MpReturnCode) mp_Packet__ConsumeString(mediapipe::Packet* packet, absl::Status** status_out, const char** value_out); @@ -108,7 +108,7 @@ MP_CAPI(MpReturnCode) mp_Packet__ValidateAsString(mediapipe::Packet* packet, abs MP_CAPI(MpReturnCode) mp__PacketFromDynamicProto__PKc_PKc_i(const char* type_name, const char* serialized_proto, int size, absl::Status** status_out, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__PacketFromDynamicProto_At__PKc_PKc_i_ll(const char* type_name, const char* serialized_proto, int size, - int64 timestampMicrosec, + int64_t timestampMicrosec, absl::Status** status_out, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__GetProtoMessageLite(mediapipe::Packet* packet, mp_api::SerializedProto* value_out); MP_CAPI(MpReturnCode) mp_Packet__GetVectorOfProtoMessageLite(mediapipe::Packet* packet, mp_api::StructArray* value_out); @@ -174,7 +174,7 @@ inline MpReturnCode mp__MakeVectorPacket_At(const T* array, int size, mediapipe: } template -inline MpReturnCode mp__MakeVectorPacket_At(const T* array, int size, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +inline MpReturnCode mp__MakeVectorPacket_At(const T* array, int size, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY std::vector vector(array, array + size); *packet_out = new mediapipe::Packet{mediapipe::MakePacket>(vector).At(mediapipe::Timestamp(timestampMicrosec))}; diff --git a/mediapipe_api/framework/timestamp.cc b/mediapipe_api/framework/timestamp.cc index 18384e2c7..47604fe01 100644 --- a/mediapipe_api/framework/timestamp.cc +++ b/mediapipe_api/framework/timestamp.cc @@ -6,7 +6,7 @@ #include "mediapipe_api/framework/timestamp.h" -MpReturnCode mp_Timestamp__l(int64 timestamp, mediapipe::Timestamp** timestamp_out) { +MpReturnCode mp_Timestamp__l(int64_t timestamp, mediapipe::Timestamp** timestamp_out) { TRY *timestamp_out = new mediapipe::Timestamp(timestamp); RETURN_CODE(MpReturnCode::Success); @@ -15,11 +15,11 @@ MpReturnCode mp_Timestamp__l(int64 timestamp, mediapipe::Timestamp** timestamp_o void mp_Timestamp__delete(mediapipe::Timestamp* timestamp) { delete timestamp; } -int64 mp_Timestamp__Value(mediapipe::Timestamp* timestamp) { return timestamp->Value(); } +int64_t mp_Timestamp__Value(mediapipe::Timestamp* timestamp) { return timestamp->Value(); } double mp_Timestamp__Seconds(mediapipe::Timestamp* timestamp) { return timestamp->Seconds(); } -int64 mp_Timestamp__Microseconds(mediapipe::Timestamp* timestamp) { return timestamp->Microseconds(); } +int64_t mp_Timestamp__Microseconds(mediapipe::Timestamp* timestamp) { return timestamp->Microseconds(); } MpReturnCode mp_Timestamp__DebugString(mediapipe::Timestamp* timestamp, const char** str_out) { TRY diff --git a/mediapipe_api/framework/timestamp.h b/mediapipe_api/framework/timestamp.h index 74d4df087..7e3f706d0 100644 --- a/mediapipe_api/framework/timestamp.h +++ b/mediapipe_api/framework/timestamp.h @@ -12,11 +12,11 @@ extern "C" { -MP_CAPI(MpReturnCode) mp_Timestamp__l(int64 timestamp, mediapipe::Timestamp** timestamp_out); +MP_CAPI(MpReturnCode) mp_Timestamp__l(int64_t timestamp, mediapipe::Timestamp** timestamp_out); MP_CAPI(void) mp_Timestamp__delete(mediapipe::Timestamp* timestamp); -MP_CAPI(int64) mp_Timestamp__Value(mediapipe::Timestamp* timestamp); +MP_CAPI(int64_t) mp_Timestamp__Value(mediapipe::Timestamp* timestamp); MP_CAPI(double) mp_Timestamp__Seconds(mediapipe::Timestamp* timestamp); -MP_CAPI(int64) mp_Timestamp__Microseconds(mediapipe::Timestamp* timestamp); +MP_CAPI(int64_t) mp_Timestamp__Microseconds(mediapipe::Timestamp* timestamp); MP_CAPI(MpReturnCode) mp_Timestamp__DebugString(mediapipe::Timestamp* timestamp, const char** str_out); MP_CAPI(bool) mp_Timestamp__IsSpecialValue(mediapipe::Timestamp* timestamp); MP_CAPI(bool) mp_Timestamp__IsRangeValue(mediapipe::Timestamp* timestamp); diff --git a/mediapipe_api/gpu/gpu_buffer.cc b/mediapipe_api/gpu/gpu_buffer.cc index 3185359b8..2dfe0c438 100644 --- a/mediapipe_api/gpu/gpu_buffer.cc +++ b/mediapipe_api/gpu/gpu_buffer.cc @@ -40,7 +40,7 @@ MpReturnCode mp__MakeGpuBufferPacket_At__Rgb_Rts(mediapipe::GpuBuffer* gpu_buffe CATCH_EXCEPTION } -MpReturnCode mp__MakeGpuBufferPacket_At__Rgb_ll(mediapipe::GpuBuffer* gpu_buffer, int64 timestampMicrosec, mediapipe::Packet** packet_out) { +MpReturnCode mp__MakeGpuBufferPacket_At__Rgb_ll(mediapipe::GpuBuffer* gpu_buffer, int64_t timestampMicrosec, mediapipe::Packet** packet_out) { TRY *packet_out = new mediapipe::Packet{mediapipe::MakePacket(std::move(*gpu_buffer)).At(mediapipe::Timestamp(timestampMicrosec))}; RETURN_CODE(MpReturnCode::Success); diff --git a/mediapipe_api/gpu/gpu_buffer.h b/mediapipe_api/gpu/gpu_buffer.h index c9ed54a6f..6146b82b9 100644 --- a/mediapipe_api/gpu/gpu_buffer.h +++ b/mediapipe_api/gpu/gpu_buffer.h @@ -31,7 +31,7 @@ MP_CAPI(mediapipe::GpuBufferFormat) mp_GpuBuffer__format(mediapipe::GpuBuffer* g MP_CAPI(MpReturnCode) mp__MakeGpuBufferPacket__Rgb(mediapipe::GpuBuffer* gpu_buffer, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp__MakeGpuBufferPacket_At__Rgb_Rts(mediapipe::GpuBuffer* gpu_buffer, mediapipe::Timestamp* timestamp, mediapipe::Packet** packet_out); -MP_CAPI(MpReturnCode) mp__MakeGpuBufferPacket_At__Rgb_ll(mediapipe::GpuBuffer* gpu_buffer, int64 timestampMicrosec, mediapipe::Packet** packet_out); +MP_CAPI(MpReturnCode) mp__MakeGpuBufferPacket_At__Rgb_ll(mediapipe::GpuBuffer* gpu_buffer, int64_t timestampMicrosec, mediapipe::Packet** packet_out); MP_CAPI(MpReturnCode) mp_Packet__ConsumeGpuBuffer(mediapipe::Packet* packet, absl::Status** status_out, mediapipe::GpuBuffer** value_out); MP_CAPI(MpReturnCode) mp_Packet__GetGpuBuffer(mediapipe::Packet* packet, const mediapipe::GpuBuffer** value_out); MP_CAPI(MpReturnCode) mp_Packet__ValidateAsGpuBuffer(mediapipe::Packet* packet, absl::Status** status_out); diff --git a/mediapipe_api/objc/BUILD b/mediapipe_api/objc/BUILD index 7033085d4..490a7e8f0 100644 --- a/mediapipe_api/objc/BUILD +++ b/mediapipe_api/objc/BUILD @@ -32,7 +32,7 @@ ios_framework( "ipad", ], infoplists = ["Info.plist"], - minimum_os_version = "11.0", + minimum_os_version = "12.0", visibility = ["//visibility:public"], deps = [ ":mediapipe_c_ios", diff --git a/third_party/com_google_audio_tools_fixes.diff b/third_party/com_google_audio_tools_fixes.diff deleted file mode 100644 index 113f12607..000000000 --- a/third_party/com_google_audio_tools_fixes.diff +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/audio/dsp/number_util.cc b/audio/dsp/number_util.cc -index 756e1f8..6a0c6d6 100644 ---- a/audio/dsp/number_util.cc -+++ b/audio/dsp/number_util.cc -@@ -16,6 +16,7 @@ - - #include "audio/dsp/number_util.h" - -+#include - #include - #include - #include -diff --git a/audio/dsp/porting.cc b/audio/dsp/porting.cc -index e906d2d..753c286 100644 ---- a/audio/dsp/porting.cc -+++ b/audio/dsp/porting.cc -@@ -16,6 +16,7 @@ - - #include "audio/dsp/porting.h" - -+#include - #include - #include - -diff --git a/audio/dsp/porting.h b/audio/dsp/porting.h -index 56e45d2..c0b7954 100644 ---- a/audio/dsp/porting.h -+++ b/audio/dsp/porting.h -@@ -19,6 +19,7 @@ - - #include - #include -+#include - #include - - using std::string; diff --git a/third_party/mediapipe_extension.diff b/third_party/mediapipe_extension.diff index 174a7fa0d..26f54d221 100644 --- a/third_party/mediapipe_extension.diff +++ b/third_party/mediapipe_extension.diff @@ -1,5 +1,5 @@ diff --git a/mediapipe/BUILD b/mediapipe/BUILD -index 432ed18f..8b70fd77 100644 +index 90edc8a5..adea5964 100644 --- a/mediapipe/BUILD +++ b/mediapipe/BUILD @@ -196,6 +196,31 @@ config_setting_and_platform( @@ -35,7 +35,7 @@ index 432ed18f..8b70fd77 100644 ["provisioning_profile.mobileprovision"], visibility = ["//visibility:public"], diff --git a/mediapipe/calculators/tensor/BUILD b/mediapipe/calculators/tensor/BUILD -index 61862443..b60e4be8 100644 +index bda2ce82..a2f200b5 100644 --- a/mediapipe/calculators/tensor/BUILD +++ b/mediapipe/calculators/tensor/BUILD @@ -69,6 +69,7 @@ selects.config_setting_group( @@ -46,7 +46,7 @@ index 61862443..b60e4be8 100644 ], ) -@@ -1131,6 +1132,11 @@ cc_library( +@@ -1462,6 +1463,11 @@ cc_library( "//mediapipe/gpu:gpu_buffer", "//mediapipe/gpu:gpu_service", ], @@ -59,7 +59,7 @@ index 61862443..b60e4be8 100644 ":image_to_tensor_converter_gl_buffer", "//mediapipe/gpu:gl_calculator_helper", diff --git a/mediapipe/gpu/BUILD b/mediapipe/gpu/BUILD -index 88864e89..65694002 100644 +index 7e0c45b3..9b4ead93 100644 --- a/mediapipe/gpu/BUILD +++ b/mediapipe/gpu/BUILD @@ -169,6 +169,9 @@ cc_library( @@ -73,7 +73,7 @@ index 88864e89..65694002 100644 hdrs = ["gl_context.h"], copts = select({ diff --git a/mediapipe/gpu/gl_context_webgl.cc b/mediapipe/gpu/gl_context_webgl.cc -index 0f14581b..088f9d21 100644 +index 7560fca0..e24865e6 100644 --- a/mediapipe/gpu/gl_context_webgl.cc +++ b/mediapipe/gpu/gl_context_webgl.cc @@ -52,6 +52,10 @@ absl::Status GlContext::CreateContextInternal( @@ -88,7 +88,7 @@ index 0f14581b..088f9d21 100644 emscripten_webgl_init_context_attributes(&attrs); attrs.explicitSwapControl = 0; diff --git a/mediapipe/gpu/gl_scaler_calculator.cc b/mediapipe/gpu/gl_scaler_calculator.cc -index a181287f..1174dc8c 100644 +index 5ab6dedc..d4cd312d 100644 --- a/mediapipe/gpu/gl_scaler_calculator.cc +++ b/mediapipe/gpu/gl_scaler_calculator.cc @@ -12,6 +12,8 @@ @@ -100,7 +100,7 @@ index a181287f..1174dc8c 100644 #include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/formats/image.h" #include "mediapipe/framework/port/ret_check.h" -@@ -68,6 +70,7 @@ using Image = mediapipe::Image; +@@ -69,6 +71,7 @@ using Image = mediapipe::Image; // existing calculator options, depending on field merge_fields. // OUTPUT_DIMENSIONS: the output width and height in pixels. // ROTATION: the counterclockwise rotation angle in degrees. @@ -108,7 +108,7 @@ index a181287f..1174dc8c 100644 // These can also be specified as options. // To enable horizontal or vertical flip, specify them in options. // The flipping is applied after rotation. -@@ -92,6 +95,7 @@ class GlScalerCalculator : public CalculatorBase { +@@ -96,6 +99,7 @@ class GlScalerCalculator : public CalculatorBase { private: GlCalculatorHelper helper_; @@ -116,7 +116,7 @@ index a181287f..1174dc8c 100644 int dst_width_ = 0; int dst_height_ = 0; float dst_scale_ = -1.f; -@@ -129,6 +133,9 @@ absl::Status GlScalerCalculator::GetContract(CalculatorContract* cc) { +@@ -134,6 +138,9 @@ absl::Status GlScalerCalculator::GetContract(CalculatorContract* cc) { } MP_RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc)); @@ -126,7 +126,7 @@ index a181287f..1174dc8c 100644 if (cc->InputSidePackets().HasTag(kOptionsTag)) { cc->InputSidePackets().Tag(kOptionsTag).Set(); } -@@ -196,6 +203,11 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) { +@@ -202,6 +209,11 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) { dst_width_ = dimensions[0]; dst_height_ = dimensions[1]; } @@ -138,7 +138,7 @@ index a181287f..1174dc8c 100644 if (cc->InputSidePackets().HasTag(kRotationTag)) { rotation_ccw = cc->InputSidePackets().Tag(kRotationTag).Get(); } -@@ -206,7 +218,7 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) { +@@ -212,7 +224,7 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) { } absl::Status GlScalerCalculator::Process(CalculatorContext* cc) { @@ -147,23 +147,23 @@ index a181287f..1174dc8c 100644 if (cc->Inputs().Tag(kOutputDimensionsTag).IsEmpty()) { // OUTPUT_DIMENSIONS input stream is specified, but value is missing. return absl::OkStatus(); -@@ -288,9 +300,18 @@ absl::Status GlScalerCalculator::Process(CalculatorContext* cc) { +@@ -294,9 +306,18 @@ absl::Status GlScalerCalculator::Process(CalculatorContext* cc) { MakePacket(left_right_padding).At(cc->InputTimestamp())); } -- auto dst = helper_.CreateDestinationTexture(dst_width, dst_height, -- GetOutputFormat()); +- auto dst = helper_.CreateDestinationTexture( +- dst_width, dst_height, GetOutputFormat(input.format())); - + GlTexture dst; +#if MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER + // for iOS -+ dst = helper_.CreateDestinationTexture(dst_width, dst_height, GetOutputFormat()); ++ dst = helper_.CreateDestinationTexture(dst_width, dst_height, GetOutputFormat(input.format())); +#else + if (dst_buffer_) { + dst_buffer_.internal_storage()->Reuse(); + dst = helper_.CreateDestinationTexture(dst_buffer_); + } else { -+ dst = helper_.CreateDestinationTexture(dst_width, dst_height, GetOutputFormat()); ++ dst = helper_.CreateDestinationTexture(dst_width, dst_height, GetOutputFormat(input.format())); + } +#endif helper_.BindFramebuffer(dst); diff --git a/third_party/mediapipe_opencv.diff b/third_party/mediapipe_opencv.diff index b49cdd30b..8bd186cc2 100644 --- a/third_party/mediapipe_opencv.diff +++ b/third_party/mediapipe_opencv.diff @@ -1,15 +1,15 @@ diff --git a/third_party/BUILD b/third_party/BUILD -index d784fc3c..d2e758b3 100644 +index 78b83fa0..d2e758b3 100644 --- a/third_party/BUILD +++ b/third_party/BUILD -@@ -13,7 +13,6 @@ - # limitations under the License. +@@ -14,7 +14,6 @@ # --load("@rules_foreign_cc//foreign_cc:cmake.bzl", "cmake") load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +-load("@rules_foreign_cc//foreign_cc:cmake.bzl", "cmake") licenses(["notice"]) # Apache License 2.0 + @@ -53,67 +52,9 @@ cc_library( }), ) diff --git a/third_party/mediapipe_workaround.diff b/third_party/mediapipe_workaround.diff index aacc0b102..8ac24a961 100644 --- a/third_party/mediapipe_workaround.diff +++ b/third_party/mediapipe_workaround.diff @@ -1,13 +1,23 @@ -diff --git a/mediapipe/BUILD b/mediapipe/BUILD -index 432ed18f..a93b6d96 100644 ---- a/mediapipe/BUILD -+++ b/mediapipe/BUILD -@@ -14,7 +14,7 @@ - - licenses(["notice"]) # Apache 2.0 - --load("@mediapipe//mediapipe:platforms.bzl", "config_setting_and_platform") -+load("//mediapipe:platforms.bzl", "config_setting_and_platform") - - # Generic Android - config_setting( +diff --git a/mediapipe/tasks/cc/core/task_api_factory.h b/mediapipe/tasks/cc/core/task_api_factory.h +index a11a23fc..dbb5fe6c 100644 +--- a/mediapipe/tasks/cc/core/task_api_factory.h ++++ b/mediapipe/tasks/cc/core/task_api_factory.h +@@ -76,15 +76,17 @@ class TaskApiFactory { + found_task_subgraph = true; + } + } ++#if !MEDIAPIPE_DISABLE_GPU + MP_ASSIGN_OR_RETURN( + auto runner, +-#if !MEDIAPIPE_DISABLE_GPU + core::TaskRunner::Create(std::move(graph_config), std::move(resolver), + std::move(packets_callback), + std::move(default_executor), + std::move(input_side_packets), + /*resources=*/nullptr, std::move(error_fn))); + #else ++ MP_ASSIGN_OR_RETURN( ++ auto runner, + core::TaskRunner::Create( + std::move(graph_config), std::move(resolver), + std::move(packets_callback), std::move(default_executor), diff --git a/third_party/org_tensorflow_windows_workaround.diff b/third_party/org_tensorflow_windows_workaround.diff new file mode 100644 index 000000000..742d99266 --- /dev/null +++ b/third_party/org_tensorflow_windows_workaround.diff @@ -0,0 +1,31 @@ +diff --git a/tensorflow/lite/core/c/operator.cc b/tensorflow/lite/core/c/operator.cc +index 261504de8e1..a2938edacad 100644 +--- a/tensorflow/lite/core/c/operator.cc ++++ b/tensorflow/lite/core/c/operator.cc +@@ -25,16 +25,16 @@ limitations under the License. + + TfLiteOperator* TfLiteOperatorCreate(TfLiteBuiltinOperator builtin_code, + const char* custom_name, int version) { +- return new TfLiteOperator{.custom_name = custom_name, +- .version = version, +- .init = nullptr, +- .free = nullptr, +- .prepare = nullptr, +- .invoke = nullptr, +- .async_kernel = nullptr, +- .builtin_code = builtin_code, +- .node_index = -1, +- .inplace_operator = kTfLiteInplaceOpNone}; ++ return new TfLiteOperator{/* .custom_name = */ custom_name, ++ /* .version = */ version, ++ /* .init = */ nullptr, ++ /* .free = */ nullptr, ++ /* .prepare = */ nullptr, ++ /* .invoke = */ nullptr, ++ /* .async_kernel = */ nullptr, ++ /* .builtin_code = */ builtin_code, ++ /* .node_index = */ -1, ++ /* .inplace_operator = */ kTfLiteInplaceOpNone}; + } + + void TfLiteOperatorDelete(TfLiteOperator* reg) { delete reg; }