bitbank2 / JPEGDEC

An optimized JPEG decoder for Arduino
Apache License 2.0
364 stars 47 forks source link

Version 1.3.0 builds fail on Teensy 4.x boards #67

Closed KurtE closed 5 months ago

KurtE commented 5 months ago

The NEON code now fails to compile. I get a ton of error messages that look like:

from c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\JPEGDEC.cpp:32:
c:\users\kurte\appdata\local\arduino15\packages\teensy\tools\teensy-compile\11.3.1\arm\lib\gcc\arm-none-eabi\11.3.1\include\arm_neon.h:8218:1: error: inlining failed in call to 'always_inline' 'int16x8_t vqdmulhq_lane_s16(int16x8_t, int16x4_t, int)': target specific option mismatch
8218 | vqdmulhq_lane_s16 (int16x8_t __a, int16x4_t __b, const int __c)
      | ^~~~~~~~~~~~~~~~~
In file included from c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\JPEGDEC.cpp:32:
c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\jpeg.inl:2858:39: note: called from here
2858 |           i168Temp = vqdmulhq_lane_s16(i168Crx2.val[0], i164Constants, 1); // Cr x -0.71414
      |                      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\jpeg.inl:35,
                 from c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\JPEGDEC.cpp:32:
c:\users\kurte\appdata\local\arduino15\packages\teensy\tools\teensy-compile\11.3.1\arm\lib\gcc\arm-none-eabi\11.3.1\include\arm_neon.h:605:1: error: inlining failed in call to 'always_inline' 'int16x8_t vaddq_s16(int16x8_t, int16x8_t)': target specific option mismatch
  605 | vaddq_s16 (int16x8_t __a, int16x8_t __b)
      | ^~~~~~~~~
In file included from c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\JPEGDEC.cpp:32:
c:\Users\kurte\Documents\Arduino\libraries\JPEGDEC\src\jpeg.inl:2857:28: note: called from here
2857 |           i168R = vaddq_s16(i168Temp, i168Y); // now we have 8 R values

Enough errors that it overflows the Arduino output buffer.

I am building on a Windows 11, using Teensy beta install 0.59.4 and in this case building for a Teensy Micromod, also tried on T4.1. The sketch I am running is an example in my display library: https://github.com/KurtE/ILI9341_t3n/tree/master/examples/tft_picture_view

Note: if I downgrade to 1.2.10 - and it builds, but the colors appear to be wrong. The configuration file I have on this setup is I have the background set to RED, which looks like it is bleeding through. If I go back to 1.2.8, picture looks correct.

bitbank2 commented 5 months ago

Thanks for the info. I was experimenting with additional optimizations for Cortex-M and Arm NEON. I'll fix it.

bitbank2 commented 5 months ago

I pushed a fix; give it a try (not released yet) and if it works for you, I'll do a new release.

KurtE commented 5 months ago

Looks like that fixes it. Thanks

bitbank2 commented 5 months ago

New release (1.3.1) done.