xinxinlx / openjpeg

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

Import r2299 ? #319

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
We may need to import r2299 on trunk

Original issue reported on code.google.com by mathieu.malaterre on 27 Mar 2014 at 10:45

GoogleCodeExporter commented 9 years ago
This seems to be reported by winfried:

http://code.google.com/p/openjpeg/issues/detail?id=316#c20

Original comment by mathieu.malaterre on 27 Mar 2014 at 10:46

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 27 Mar 2014 at 10:46

GoogleCodeExporter commented 9 years ago
winfried, do you still get this warning:

/usr/local/src/OpenJPEG-2.0.0/openjpeg-trunk-r2793/src/lib/openjp2/tcd.c: In 
function 'opj_tcd_dc_level_shift_decode':
/usr/local/src/OpenJPEG-2.0.0/openjpeg-trunk-r2793/src/lib/openjp2/tcd.c:1695:83
: warning: incompatible implicit declaration of built-in function 'lrintf' 
[enabled by default]

If you apply patch from r2299 on trunk ?

Original comment by mathieu.malaterre on 27 Mar 2014 at 10:47

GoogleCodeExporter commented 9 years ago
machine : Linux 32-Bit
compiler: gcc 4.8.2
cmake   : 2.8.5
autoconf: 2.68

openjpeg-2.0-trunk-r2824:

-- The C compiler identification is GNU
-- Check for working C compiler: /usr/local/gcc-4.8.2/bin/gcc
-- Check for working C compiler: /usr/local/gcc-4.8.2/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done

-- Checking for 64-bit off_t
-- Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64
-- Checking for fseeko/ftello
-- Checking for fseeko/ftello - present
-- Large File support - found

BUILD/src/lib/openjp2/opj_config_private.h:

/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGE_FILES */
#define _FILE_OFFSET_BITS 64
#define OPJ_HAVE_FSEEKO ON

make:
-------------------------------------------------
/usr/local/src/OpenJPEG-2.0.0/openjpeg-2.0-trunk-r2824/src/lib/openjp2/tcd.c: 
In function 'opj_tcd_dc_level_shift_decode':
/usr/local/src/OpenJPEG-2.0.0/openjpeg-2.0-trunk-r2824/src/lib/openjp2/tcd.c:169
5:83: warning: incompatible implicit declaration of built-in function 'lrintf' 
[enabled by default]
                                         *l_current_ptr = opj_int_clamp((OPJ_INT32)lrintf(l_value) + l_tccp->m_dc_level_shift, l_min, l_max); ;

bin/opj_compress -i p6_rose.ppm -o p6_rose.ppm.jp2
-------------------------------------------------
jiv p6_rose.ppm.jp2
  incorrect magic number
  error: cannot load image data
  cannot load image

./read_magic  p6_rose.ppm.jp2
            MAGIC(0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20,0xff,0x4f,0xff,0x51)
P2_RFC3745_MAGIC "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
                                                  ===============

file p6_rose.ppm.jp2
p6_rose.ppm.jp2: JPEG 2000 image

bin/opj_compress -i p6_rose.ppm -o p6_rose.ppm.j2k
-------------------------------------------------
jiv p6_rose.ppm.j2k <== OK

file p6_rose.ppm.j2k
p6_rose.ppm.j2k: JPEG-2000 Code Stream Bitmap data

winfried

Original comment by szukw...@arcor.de on 28 Mar 2014 at 9:12

GoogleCodeExporter commented 9 years ago
I have now compiled openjpeg-2.0-trunk-r2824 

 * on a WIN7-64-bit machine: JP2 and J2k are OK
 * on a WINXP-32-bit machine: JP2 and J2k are OK

I remember that Mathieu has used the '-m32' definition. What is the
value of '__WORDSIZE' in /usr/include/bits/wordsize.h ?

On my x86_64 machine I get

#if defined __x86_64__
# define __WORDSIZE 64
# define __WORDSIZE_COMPAT32    1
#else
# define __WORDSIZE 32
#endif
# define __WORDSIZE 64

On the 32-Bit machine I get

# define __WORDSIZE 32

winfried

Original comment by szukw...@arcor.de on 29 Mar 2014 at 12:49

GoogleCodeExporter commented 9 years ago
Although it wont't impress you: I have fixed Issue 316 (see below).

                        64-Bit       32-Bit
                      x86_64 Win7  Linux  XP

__WORDSIZE             64          32
sizeof(long)            8    4      4     4
sizeof(size_t)          8    8      4     4
sizeof(long long)       8    8      8     8
sizeof(int64_t)         8           8
sizeof(signed __int64)       8            8
sizeof(off_t)           8    4      4     4
sizeof(fpos_t)         16    8     12     8

The 'cmake/TestFileOffsetBits.c' can not be compiled
on Win7-64-Bit, Linux-32-Bit, XP-32-Bit.

On Linux-32-Bit this simply is ignored.
On Win7-64-Bit and XP-32-Bit compilation fails.

On x86_64, compilation succeeds:

off_t_is_large 1
LARGE_OFF_T 9223372036854775807
LARGE_OFF_T % 2147483629 == 721 ==> 1
LARGE_OFF_T % 2147483647 == 1 ==> 1

opj_config_private.h:
------------------------------
x86_64:

/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGE_FILES */
/* #undef _FILE_OFFSET_BITS */
#define OPJ_HAVE_FSEEKO ON

Win7-64-Bit:

/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGE_FILES */
/* #undef _FILE_OFFSET_BITS */
/* #undef OPJ_HAVE_FSEEKO */

XP-32-Bit:

/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGE_FILES */
/* #undef _FILE_OFFSET_BITS */
/* #undef OPJ_HAVE_FSEEKO */

Linux-32-Bit:

/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGE_FILES */
#define _FILE_OFFSET_BITS 64
/* #define OPJ_HAVE_FSEEKO ON */

SUCCESS FOR JP2 AFTER DISABLING THE LAST LINE.

This would mean in opj_config_private.h.cmake.in for Linux-32-Bit:

/* #cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@ */

NOW AND ONLY NOW Issue 316 had been fixed for Linux-32-Bit.

winfried

Original comment by szukw...@arcor.de on 31 Mar 2014 at 1:50