Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Failed to read attribute" error message on Big Endian platform? #189

Open
s-trinh opened this issue Mar 11, 2023 · 2 comments
Open

"Failed to read attribute" error message on Big Endian platform? #189

s-trinh opened this issue Mar 11, 2023 · 2 comments

Comments

@s-trinh
Copy link

s-trinh commented Mar 11, 2023

Describe the issue

   Error: Unable to parse EXR header from /root/visp-images/memorial/
  memorial_color_32bits.exr : Failed to read attribute.

when testing to read an EXR file on a Build on ubuntu20.04 s390x (Big Endian) platform.

To Reproduce
Steps to reproduce the behavior:

  1. Compile TinyEXR with:
General configuration information for ViSP 3.5.1

  Version control:               unknown

  Platform:
    Timestamp:                   2023-03-11T17:14:14Z
    Host:                        Linux 5.15.0-1034-azure s390x
    CMake:                       3.16.3
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  System information:
    Number of CPU logical cores: 2
    Number of CPU physical cores: 2
    Total physical memory (in MiB): 6943
    OS name:                     Linux
    OS release:                  5.15.0-1034-azure
    OS version:                  #41~20.04.1-Ubuntu SMP Sat Feb 11 17:02:42 UTC 2023
    OS platform:                 s390x
    CPU name:                    Unknown P6 family
    Is the CPU 64-bit?           yes
    Does the CPU have FPU?       yes
    CPU optimization:

  C/C++:
    Built as dynamic libs?:      yes
    C++ Compiler:                /usr/bin/c++  (ver 9.4.0)
    C++ flags (Release):         -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -fPIC -O3 -DNDEBUG
    C++ flags (Debug):           -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -fPIC -g
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -fPIC -O3 -DNDEBUG
    C flags (Debug):             -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -fPIC -g
    Linker flags (Release):
    Linker flags (Debug):
    Use cxx standard:            17

Version at: 3c8e0cb
2. Load EXR Image memorial_color_32bits.exr
3. See error:

EXR image read
Color
32-bits

/home/runner/work/visp/visp/modules/core/test/image-with-dataset/testIoEXR.cpp:88
...............................................................................

/home/runner/work/visp/visp/modules/core/test/image-with-dataset/testIoEXR.cpp:88: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with message:
Error: Unable to parse EXR header from /root/visp-images/memorial/
memorial_color_32bits.exr : Failed to read attribute.


I suspect an issue with endianness since it occurs specifically on this platform: Build on ubuntu20.04 s390x (Big Endian).

Otherwise, did I miss checking something when reading the EXR file?
This is the code used.

Many thanks.

@s-trinh s-trinh changed the title "Failed to read attribute" error message "Failed to read attribute" error message on Big Endian platform? Mar 11, 2023
@syoyo
Copy link
Owner

syoyo commented Mar 12, 2023

[memorial_color_32bits.exr](https://github.com/lagadic/visp-images/blob/master/memorial/memorial_color_32bits.exr) can be correctly load in test_tinyexr example on x86_64, so the issue would be Endianness.

There was a Big Endian support in TinyEXR when I had a SPARC CPU(8~9 years ago!), but not maintained in recent years.

@s-trinh Something may be still missing to support Big Endian in recently added codes You may find an issue in ReadAttribute by dumping its content.

tinyexr/tinyexr.h

Line 1029 in 02310c7

static bool ReadAttribute(std::string *name, std::string *type,

Contribution of Big Endian support is much appreciated!
(PIZ decompression/compression support in Big Endian is also appreciated!

tinyexr/tinyexr.h

Line 3161 in 02310c7

#if !TINYEXR_LITTLE_ENDIAN
)

@s-trinh
Copy link
Author

s-trinh commented Mar 12, 2023

Thanks for your answer 👍
I will see what I could do.

fspindle added a commit to lagadic/visp that referenced this issue Mar 17, 2023
* Remove macos-12 from ios github action

* Add support of I/O EXR image format in order to have a standardized file format for float images.

* Fix build around exception handling in EXR image

* Somehow using FreeEXRImage() and FreeEXRHeader() segfault the program. Looks like free() should be used: https://github.com/syoyo/tinyexr/blob/02310c77e5156c36fedf6cf810c4071e3f83906f/test/unit/tester.cc#L1311-L1313 ?

* Add the OpenCV backend for EXR image reading / saving.

* Try automatically checkout ViSP-images with the correct branch.

* Try fallback to the master branch.

* Try automatically checkout ViSP-images with the correct branch.

* Try cloning the same branch name of ViSP-images or the master branch otherwise.

* Add the OpenCV backend for EXR image reading / saving.

Automatically checkout ViSP-images with the correct branch.

Add fallback to the master branch.

* Clone the same branch name of ViSP-images or the master branch otherwise.

* Update accordingly the image filepaths.

* Disable the EXR tests on big endian platform, see: syoyo/tinyexr#189

* Add the doc.

* Update some remaining image paths to use the png image format.

---------

Co-authored-by: Fabien Spindler <Fabien.Spindler@inria.fr>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants