qiqian / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

Decoder aborts on PowerPC #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Encode image, e.g. test_ref.ppm
2. Decode resulting WebP file, e.g. mytest.webp (attached)

What is the expected output? What do you see instead?
- On other platforms (e.g. any Intel), libwebp correctly decodes the file.
- On PowerPC, the program executes an Abort trap.
However, on PPC, the same program DOES correctly decode test.webp from the 
distributed examples, but not streams that I encode myself.

What version of the product are you using? On what operating system?

OS X 10.5.8, PowerPC, gcc version 4.0.1

My program (encoding and decoding):
URL: http://www.telegraphics.com.au/svn/webpformat/trunk
Revision: 17

libvpx:
commit 0684c647ef38e81396567720e6fe5a1190e3c103
Date:   Fri Oct 29 11:07:31 2010 -0400

libwebp:
commit f09f96ee3fa24696fd7eb00bd9455c98ed3ca7c6
Date:   Tue Oct 19 17:16:49 2010 -0400

Please provide any additional information below.

The program is a plugin running in Photoshop CS3 PowerPC.

Exception Type:  EXC_CRASH (SIGABRT)

Thread 0 Crashed:
0   libSystem.B.dylib               0x9514fb50 __kill + 12
1   libSystem.B.dylib               0x951eabfc abort + 84
2   libSystem.B.dylib               0x951ddc0c __assert_rtn + 108
3   com.telegraphics.WebPFormat     0x22aa1e18 Transform + 456
4   com.telegraphics.WebPFormat     0x22aa4a18 VP8ReconstructBlock + 632
5   com.telegraphics.WebPFormat     0x22aa7d34 VP8Decode + 2612
6   com.telegraphics.WebPFormat     0x22aa8084 DecodeInto + 436
7   com.telegraphics.WebPFormat     0x22aa8110 WebPDecodeRGBInto + 64

Original issue reported on code.google.com by t...@telegraphics.com.au on 30 Oct 2010 at 10:48

Attachments:

GoogleCodeExporter commented 8 years ago
dwebp behaves the same.

$ examples/dwebp examples/mytest.webp -o foo.ppm
Assertion failed: (v >= -255 && v <= 255 + 255), function clip_8b, file dsp.c, 
line 54.
Abort trap

Original comment by t...@telegraphics.com.au on 30 Oct 2010 at 11:00

GoogleCodeExporter commented 8 years ago
thanks for the bug report. Before we test further, it seems you have a newer 
version of libvpx than the libpwebp version. can you go to an earlier build of 
libvpx to try?

also, can you try the standalone lightweight decoder? libwebp-decode available 
on
www.webmproject.com

Original comment by rab...@google.com on 31 Oct 2010 at 1:57

GoogleCodeExporter commented 8 years ago
Hi Rob

libvpx is not used for decoding in my program. Also, as you see from my 
follow-up comment, dwebp in libwebp is affected identically. Does that help?

--Toby

Original comment by t...@telegraphics.com.au on 31 Oct 2010 at 2:15

GoogleCodeExporter commented 8 years ago
yes, thanks. will investigate

Original comment by rab...@google.com on 31 Oct 2010 at 2:24

GoogleCodeExporter commented 8 years ago
I misspoke when I said "correctly decodes test.webp" -- it decodes, but 
incorrectly per #23. I should have said, it just does not abort.

Original comment by t...@telegraphics.com.au on 31 Oct 2010 at 2:38

GoogleCodeExporter commented 8 years ago
Toby,

hmm... can't reproduce here with 10.4.0 and gcc 4.2.1 (both bugs).

Could you try upgrading you gcc system if possible? Otherwise, could you send 
the full
call stack (with, e.g., gdb)?

Here's mine:
> gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Original comment by pascal.m...@gmail.com on 31 Oct 2010 at 2:53

GoogleCodeExporter commented 8 years ago
Pascal,

The problem manifests on PowerPC (not on Intel) - running natively on a 10.4 or 
10.5 system only.

Latest Xcode Tools for these systems are 2.5 and 3.1.4 respectively, which 
include gcc versions 4.0.1 and 4.2.1 respectively.

On both these systems, I see either Abort, or a corrupt image, when I run:

  $ examples/dwebp examples/test.webp -o foo.ppm

The only way you could reproduce this on an Intel Mac, or 10.6, is by the 
following:

mb:libwebp toby$ CFLAGS="-arch ppc" ./configure
checking for a BSD-compatible install... /usr/bin/install -c
...
mb:libwebp toby$ make
make  all-recursive
Making all in src
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  
-I/src   -arch ppc -MT bits.lo -MD -MP -MF .deps/bits.Tpo -c -o bits.lo bits.c
mkdir .libs
 gcc -DHAVE_CONFIG_H -I. -I.. -I/src -arch ppc -MT bits.lo -MD -MP -MF .deps/bits.Tpo -c bits.c  -fno-common -DPIC -o .libs/bits.o
...
gcc -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o 
.libs/libwebpdecode.0.0.0.dylib  .libs/bits.o .libs/dsp.o .libs/frame.o 
.libs/quant.o .libs/tree.o .libs/vp8.o .libs/webp.o .libs/yuv.o   -arch ppc 
-install_name  /usr/local/lib/libwebpdecode.0.dylib -compatibility_version 1 
-current_version 1.0 -Wl,-single_module
dsymutil .libs/libwebpdecode.0.0.0.dylib || :
warning: no debug symbols in executable (-arch ppc7400)
(cd .libs && rm -f libwebpdecode.0.dylib && ln -s libwebpdecode.0.0.0.dylib 
libwebpdecode.0.dylib)
(cd .libs && rm -f libwebpdecode.dylib && ln -s libwebpdecode.0.0.0.dylib 
libwebpdecode.dylib)
ar cru .libs/libwebpdecode.a  bits.o dsp.o frame.o quant.o tree.o vp8.o webp.o 
yuv.o
ranlib .libs/libwebpdecode.a
creating libwebpdecode.la
(cd .libs && rm -f libwebpdecode.la && ln -s ../libwebpdecode.la 
libwebpdecode.la)
Making all in examples
gcc -DHAVE_CONFIG_H -I. -I..  -I../src   -arch ppc -MT dwebp.o -MD -MP -MF 
.deps/dwebp.Tpo -c -o dwebp.o dwebp.c
mv -f .deps/dwebp.Tpo .deps/dwebp.Po
/bin/sh ../libtool --tag=CC   --mode=link gcc  -arch ppc   -o dwebp dwebp.o 
../src/libwebpdecode.la 
mkdir .libs
gcc -arch ppc -o .libs/dwebp dwebp.o  ../src/.libs/libwebpdecode.dylib 
creating dwebp
mb:libwebp toby$ file src/.libs/*
src/.libs/bits.o:                         Mach-O object ppc
src/.libs/dsp.o:                          Mach-O object ppc
src/.libs/frame.o:                        Mach-O object ppc
src/.libs/libwebpdecode.0.0.0.dylib:      Mach-O dynamically linked shared 
library ppc
src/.libs/libwebpdecode.0.0.0.dylib.dSYM: directory
src/.libs/libwebpdecode.0.dylib:          Mach-O dynamically linked shared 
library ppc
src/.libs/libwebpdecode.a:                current ar archive random library
src/.libs/libwebpdecode.dylib:            Mach-O dynamically linked shared 
library ppc
src/.libs/libwebpdecode.la:               libtool library file
src/.libs/libwebpdecode.lai:              libtool library file
src/.libs/quant.o:                        Mach-O object ppc
src/.libs/tree.o:                         Mach-O object ppc
src/.libs/vp8.o:                          Mach-O object ppc
src/.libs/webp.o:                         Mach-O object ppc
src/.libs/yuv.o:                          Mach-O object ppc
mb:libwebp toby$ examples/dwebp examples/test.webp -o foo.ppm
Assertion failed: (v >= -255 && v <= 255 + 255), function clip_8b, file dsp.c, 
line 54.
Abort trap
mb:libwebp toby$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mb:libwebp toby$ uname -a
Darwin mb.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 
2010; root:xnu-1504.7.4~1/RELEASE_I386 i386

Here's a log of testing with gcc-4.2 on 10.5.8 (G5):

g5:libwebp toby$ CC=gcc-4.2 ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... powerpc-apple-darwin9.8.0
checking host system type... powerpc-apple-darwin9.8.0
checking for style of include used by make... GNU
checking for gcc... gcc-4.2
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc-4.2 accepts -g... yes
checking for gcc-4.2 option to accept ISO C89... none needed
checking dependency style of gcc-4.2... gcc3
checking for a sed that does not truncate output... 
/Volumes/data/Users/toby/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ld used by gcc-4.2... 
/usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld
checking if the linker (/usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld) is GNU 
ld... no
checking for /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld option to reload 
object files... -r
...
g5:libwebp toby$ make -j4
make  all-recursive
Making all in src
/bin/sh ../libtool --tag=CC   --mode=compile gcc-4.2 -DHAVE_CONFIG_H -I. -I..  
-I/src   -g -O2 -MT bits.lo -MD -MP -MF .deps/bits.Tpo -c -o bits.lo bits.c
/bin/sh ../libtool --tag=CC   --mode=compile gcc-4.2 -DHAVE_CONFIG_H -I. -I..  
-I/src   -g -O2 -MT dsp.lo -MD -MP -MF .deps/dsp.Tpo -c -o dsp.lo dsp.c
/bin/sh ../libtool --tag=CC   --mode=compile gcc-4.2 -DHAVE_CONFIG_H -I. -I..  
-I/src   -g -O2 -MT frame.lo -MD -MP -MF .deps/frame.Tpo -c -o frame.lo frame.c
/bin/sh ../libtool --tag=CC   --mode=compile gcc-4.2 -DHAVE_CONFIG_H -I. -I..  
-I/src   -g -O2 -MT quant.lo -MD -MP -MF .deps/quant.Tpo -c -o quant.lo quant.c
mkdir .libs
mkdir .libs
mkdir .libs
mkdir: .libs: File exists
mkdir: .libs:  gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I/src -g -O2 -MT frame.lo -MD 
-MP -MF .deps/frame.Tpo -c frame.c  -fno-common -DPIC -o .libs/frame.o
File exists
 gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I/src -g -O2 -MT quant.lo -MD -MP -MF .deps/quant.Tpo -c quant.c  -fno-common -DPIC -o .libs/quant.o
...
gcc-4.2 -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o 
.libs/libwebpdecode.0.dylib  .libs/bits.o .libs/dsp.o .libs/frame.o 
.libs/quant.o .libs/tree.o .libs/vp8.o .libs/webp.o .libs/yuv.o   -install_name 
 /usr/local/lib/libwebpdecode.0.dylib -compatibility_version 1 -current_version 
1.0
(cd .libs && rm -f libwebpdecode.dylib && ln -s libwebpdecode.0.dylib 
libwebpdecode.dylib)
(cd .libs && rm -f libwebpdecode.0.0.0.dylib && ln -s libwebpdecode.0.dylib 
libwebpdecode.0.0.0.dylib)
ar cru .libs/libwebpdecode.a  bits.o dsp.o frame.o quant.o tree.o vp8.o webp.o 
yuv.o
ranlib .libs/libwebpdecode.a
creating libwebpdecode.la
(cd .libs && rm -f libwebpdecode.la && ln -s ../libwebpdecode.la 
libwebpdecode.la)
Making all in examples
gcc-4.2 -DHAVE_CONFIG_H -I. -I..  -I../src   -g -O2 -MT dwebp.o -MD -MP -MF 
.deps/dwebp.Tpo -c -o dwebp.o dwebp.c
mv -f .deps/dwebp.Tpo .deps/dwebp.Po
/bin/sh ../libtool --tag=CC   --mode=link gcc-4.2  -g -O2   -o dwebp dwebp.o 
../src/libwebpdecode.la 
mkdir .libs
gcc-4.2 -g -O2 -o .libs/dwebp dwebp.o  ../src/.libs/libwebpdecode.0.0.0.dylib 
creating dwebp
g5:libwebp toby$ examples/dwebp examples/test.webp -o foo.ppm
Assertion failed: (v >= -255 && v <= 255 + 255), function clip_8b, file dsp.c, 
line 54.
Abort trap

Original comment by t...@telegraphics.com.au on 31 Oct 2010 at 5:06

GoogleCodeExporter commented 8 years ago
So, in summary, on ANY PowerPC system, I always see either Abort or corrupt 
image, regardless of the version of gcc used (and in all cases using latest gcc 
available for 10.4, 10.5).

As shown above, I *also* see the problem in Rosetta emulation on 10.6/Intel, 
also using latest gcc with ppc as the target architecture. If you don't have 
PowerPC hardware around, that may be the easiest route to reproduce it...

Original comment by t...@telegraphics.com.au on 31 Oct 2010 at 5:09

GoogleCodeExporter commented 8 years ago
would using the libvpx decoder for Power PC unblock you for now?

Original comment by rab...@google.com on 31 Oct 2010 at 4:34

GoogleCodeExporter commented 8 years ago
I can certainly look at that route.

Btw, I implied at first that the Abort only happened on streams that I 
generated. But through further testing I see that I usually get it on the 
test.webp as well. I am not sure under what exact circumstances I get the 
corrupt image (#23) from test.webp - the best I can say right now is that I 
always get one or the other, on PPC.

Original comment by t...@telegraphics.com.au on 31 Oct 2010 at 4:59

GoogleCodeExporter commented 8 years ago
Richard, re (9)

I switched the plugin to use libvpx for decode and it works perfectly on 
PowerPC.

Original comment by t...@telegraphics.com.au on 8 Nov 2010 at 2:31

GoogleCodeExporter commented 8 years ago
ok, cool. i also saw your update on the mailing list. Can you try the 
libwebp-decode again? Pascal seems to have fixed the power pc endian issue

Original comment by rab...@google.com on 9 Nov 2010 at 5:23

GoogleCodeExporter commented 8 years ago
I confirm this is solved by https://review.webmproject.org/1132
Thankyou!

Original comment by t...@telegraphics.com.au on 12 Nov 2010 at 12:07

GoogleCodeExporter commented 8 years ago
great!

Original comment by rab...@google.com on 12 Nov 2010 at 6:06