libexif 0.6.21 generates on an arm system (codesourcery 2009q1 toolchain) the following message:
# /arm_test /write-exif.jpg
Dumping IFD '0'...
Dumping exif content (4 entries)...
Tag: 0x11a ('XResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72
Tag: 0x11b ('YResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72
Tag: 0x128 ('ResolutionUnit')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Inch
Tag: 0x213 ('YCbCrPositioning')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Centered
Dumping IFD 'EXIF'...
Dumping exif content (3 entries)...
Tag: 0x9000 ('ExifVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: Exif Version 2.1
Tag: 0xa000 ('FlashPixVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: FlashPix Version 1.0
Tag: 0xa001 ('ColorSpace')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Internal error (unknown value -1)
On a normal System x64 with same image:
Dumping IFD '0'...
Dumping exif content (4 entries)...
Tag: 0x11a ('XResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72.00
Tag: 0x11b ('YResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72.00
Tag: 0x128 ('ResolutionUnit')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Inch
Tag: 0x213 ('YCbCrPositioning')
Format: 3 ('Short')
Components: 1
Size: 2
Value: centered
Dumping IFD 'EXIF'...
Dumping exif content (7 entries)...
Tag: 0x9000 ('ExifVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: Exif Version 2.1
Tag: 0x9101 ('ComponentsConfiguration')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: Y Cb Cr -
Tag: 0x9286 ('UserComment')
Format: 7 ('Undefined')
Components: 35
Size: 35
Value: libexif demonstration image
Tag: 0xa000 ('FlashPixVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: FlashPix Version 1.0
Tag: 0xa001 ('ColorSpace')
Format: 3 ('Short')
Components: 1
Size: 2
Value: sRGB
Tag: 0xa002 ('PixelXDimension')
Format: 4 ('Long')
Components: 1
Size: 4
Value: 640
Tag: 0xa003 ('PixelYDimension')
Format: 4 ('Long')
Components: 1
Size: 4
Value: 650
test image
main file
exif_data_get_entry(exif_data, EXIF_TAG_USER_COMMENT);
The function does also not work on arm (return NULL), but on x64.
There are some differences in the working and non-working logs that lead me to believe that they were generated by different versions of libexif. Can you try a statically-linked ver. 0.6.21 exif front-end on both platforms to rule out an application issue? And there may be some clues in the debug output, so please attach that as well. Is this a little endian or big endian ARM platform?
exif_data_get_entry naturally should return NULL if there is no such tag in the image, but clearly the attached image does have that tag.
I've just tried this with qemu-arm with the attached test program and image, and it gives me the same result as the "On a normal System x64 with same image" log in the bug report (modulus the formatting differences resulting from using a pre-0.6.20 version). You'll have to provide much more information to help reproduce this.
My ARM binary passes the libexif-testsuite just fine as well. It's possible it's a compiler issue; try compiling everything without any optimization flags.
correct output x64
build libexif-0.6.21 for arm with buildroot
Hi dfandrich,
sorry, the x64 output was from the ubuntu 10.04 libexif lib. The new one is attached. The libexif build with buildroot is also attached.
The processor is an TI DM365 Leopardboard with little endian.
I use eclipse to build the arm_test.c:
make all
Building file: ../src/arm_test.c
Invoking: Cross GCC Compiler
arm-none-linux-gnueabi-gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/arm_test.d" -MT"src/arm_test.d" -o "src/arm_test.o" "../src/arm_test.c"
Finished building: ../src/arm_test.c
Building target: arm_test
Invoking: Cross GCC Linker
arm-none-linux-gnueabi-gcc -static -L/home/klaus/development/handpyrometer/buildroot/output/staging/usr/lib -o "arm_test" ./src/arm_test.o -lexif -lm
Finished building target: arm_test
How can i compile and run the libexif-testsuite?
Next, i try a other toolchain.
Thanks for helping me.
exif output on arm:
# exif /write-exif.jpg -d
ExifLoader: Scanning 1024 byte(s) of data...
ExifData: Parsing 224 byte(s) EXIF data...
ExifData: Found EXIF header.
ExifData: Found EXIF header.
ExifData: IFD 0 at 8.
ExifData: Loading 5 entries...
ExifData: Loading entry 0x11a ('XResolution')...
ExifData: Loading entry 0x11b ('YResolution')...
ExifData: Loading entry 0x128 ('ResolutionUnit')...
ExifData: Loading entry 0x213 ('YCbCrPositioning')...
ExifData: Unknown tag 0xffff8769 (entry 4 in '0'). Please report this tag to <libexif-devel@lists.sourceforge.net>.
exif-content: Tag 'ExifVersion' is mandatory in IFD 'EXIF' and has therefore been added.
exif-content: Tag 'FlashPixVersion' is mandatory in IFD 'EXIF' and has therefore been added.
exif-content: Tag 'ColorSpace' is mandatory in IFD 'EXIF' and has therefore been added.
EXIF tags in '/write-exif.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag |Value
--------------------+----------------------------------------------------------
X-Resolution |72
Y-Resolution |72
Resolution Unit |Inch
YCbCr Positioning |Centered
Exif Version |Exif Version 2.1
FlashPixVersion |FlashPix Version 1.0
Color Space |Internal error (unknown value -1)
--------------------+----------------------------------------------------------
# exif /write-exif.jpg -v
0.6.21
Hi,
i changed in exif-utils.c the function exif_get_short. The code is copied from signed version. I think, it is a problem to cast signed short to unsigned short.
ExifShort
exif_get_short (const unsigned char *buf, ExifByteOrder order)
{
if (!buf) return 0;
switch (order) {
case EXIF_BYTE_ORDER_MOTOROLA:
return ((buf[0] << 8) | buf[1]);
case EXIF_BYTE_ORDER_INTEL:
return ((buf[1] << 8) | buf[0]);
}
/* Won't be reached */
return (0);
}
Now it works:
Dumping IFD '0'...
Dumping exif content (4 entries)...
Tag: 0x11a ('XResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72
Tag: 0x11b ('YResolution')
Format: 5 ('Rational')
Components: 1
Size: 8
Value: 72
Tag: 0x128 ('ResolutionUnit')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Inch
Tag: 0x213 ('YCbCrPositioning')
Format: 3 ('Short')
Components: 1
Size: 2
Value: Centered
Dumping IFD 'EXIF'...
Dumping exif content (7 entries)...
Tag: 0x9000 ('ExifVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: Exif Version 2.1
Tag: 0x9101 ('ComponentsConfiguration')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: Y Cb Cr -
Tag: 0x9286 ('UserComment')
Format: 7 ('Undefined')
Components: 35
Size: 35
Value: libexif demonstration image
Tag: 0xa000 ('FlashPixVersion')
Format: 7 ('Undefined')
Components: 4
Size: 4
Value: FlashPix Version 1.0
Tag: 0xa001 ('ColorSpace')
Format: 3 ('Short')
Components: 1
Size: 2
Value: sRGB
Tag: 0xa002 ('PixelXDimension')
Format: 4 ('Long')
Components: 1
Size: 4
Value: 640
Tag: 0xa003 ('PixelYDimension')
Format: 4 ('Long')
Components: 1
Size: 4
Value: 650
I still don't understand why this would make any difference. exif_get_short currently masks the output of exif_get_sshort by 0xffff, so it should never return a value greater than that. I don't see how (barring a compiler bug) that you would get the value 0xffff8769 out of that function, even if sizeof(uint16_t ) != 2 (just what is sizeof(uint16_t) on your platform, anyway?) Can you figure that out?
test proj sshort
Hi,
i wrote a little test program (is attached). This is the output on arm and x64:
value ExifSShort ffffffff
value ExifSShort ffffffff
value ExifSShort -1
value ExifShort ffff
value ExifShort 65535
value ExifSShort ffff8fff
value ExifSShort -28673
value ExifShort 8fff
value ExifShort 36863
sizeof ExifSShort 2
sizeof ExifShort 2
sizeof uint16_t 2
sizeof ExifTag 4
Can you verify this output? I have no idea, why ExifSShort printout ffffffff and not ffff.
./gcc -vUsing built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)
gcc -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Ziel: i686-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread-Modell: posix
gcc-Version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)