Skip to content

Commit

Permalink
Fix for IPP not available on ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Jan 3, 2025
1 parent f2e6ca4 commit 5c7fc2d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
15 changes: 8 additions & 7 deletions cpp/open3d/t/geometry/TriangleMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,9 +1447,10 @@ Image TriangleMesh::ProjectImagesToAlbedo(
const std::vector<core::Tensor> &extrinsic_matrices,
int tex_size /*=1024*/,
bool update_material /*=true*/) {
if (!GetDevice().IsCPU()) {
if (!GetDevice().IsCPU() || !Image::HAVE_IPP) {
utility::LogError(
"ProjectImagesToAlbedo is only supported on CPU device.");
"ProjectImagesToAlbedo is only supported on x86_64 CPU "
"devices.");
}
using core::None;
using tk = core::TensorKey;
Expand Down Expand Up @@ -1585,11 +1586,11 @@ Image TriangleMesh::ProjectImagesToAlbedo(
// C. Interpolate weighted image to weighted texture
// albedo[u,v] = image[ i[u,v], j[u,v] ]
this_albedo[widx].Fill(0.f);
ipp::Remap(weighted_image[widx], /*{height, width, 4} f32*/
uv2xy2[0], /* {texsz, texsz} f32*/
uv2xy2[1], /* {texsz, texsz} f32*/
this_albedo[widx], /*{texsz, texsz, 4} f32*/
t::geometry::Image::InterpType::Linear);
IPP_CALL(ipp::Remap, weighted_image[widx], /*{height, width, 4} f32*/
uv2xy2[0], /* {texsz, texsz} f32*/
uv2xy2[1], /* {texsz, texsz} f32*/
this_albedo[widx], /*{texsz, texsz, 4} f32*/
t::geometry::Image::InterpType::Linear);
// Weights can become negative with higher order interpolation

std::unique_lock<std::mutex> albedo_lock{albedo_mutex};
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/t/io/ImageIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ constexpr int kOpen3DImageIODefaultQuality = -1;
///
/// Supported file extensions are png, jpg/jpeg. Data type and number of
/// channels depends on the file extension.
/// - PNG: Dtype should be one of core::UInt8, core::UInt16
/// - PNG: Dtype should be one of core::Bool, core::UInt8, core::UInt16
/// Supported number of channels are 1, 3, and 4.
/// - JPG: Dtyppe should be core::UInt8
/// Supported number of channels are 1 and 3.
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/t/geometry/TriangleMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ TEST_P(TriangleMeshPermuteDevices, ProjectImagesToAlbedo) {
using ::testing::ElementsAre;
using ::testing::FloatEq;
core::Device device = GetParam();
if (!device.IsCPU()) GTEST_SKIP() << "Not Implemented!";
if (!device.IsCPU() || !Image::HAVE_IPP) GTEST_SKIP() << "Not Implemented!";
TriangleMesh sphere =
TriangleMesh::FromLegacy(*geometry::TriangleMesh::CreateSphere(
1.0, 20, /*create_uv_map=*/true));
Expand Down
7 changes: 3 additions & 4 deletions cpp/tests/t/io/ImageIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ TEST(ImageIO, WriteImageToJPG) {
EXPECT_TRUE(img.AsTensor().AllClose(read_img.AsTensor()));
}

// JPG supports only UInt8, and PNG supports both UInt8 and UInt16.
// JPG supports only UInt8, and PNG supports Bool, UInt8 and UInt16.
// All other data types are expected to fail.
TEST(ImageIO, DifferentDtype) {
const std::string tmp_path = utility::filesystem::GetTempDirectoryPath();
Expand Down Expand Up @@ -210,9 +210,8 @@ TEST(ImageIO, DifferentDtype) {
EXPECT_FALSE(
t::io::WriteImage(tmp_path + "/test_imageio_dtype.png",
t::geometry::Image(100, 200, 3, core::Int64)));
EXPECT_FALSE(
t::io::WriteImage(tmp_path + "/test_imageio_dtype.png",
t::geometry::Image(100, 200, 3, core::Bool)));
EXPECT_TRUE(t::io::WriteImage(tmp_path + "/test_imageio_dtype.png",
t::geometry::Image(100, 200, 3, core::Bool)));
}

TEST(ImageIO, CornerCases) {
Expand Down

0 comments on commit 5c7fc2d

Please sign in to comment.