PeteyMi / openjpeg

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

patch for openjpeg-trunk-r2347 and BIG_ENDIAN #242

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attached are patches for BIG_ENDIAN.

One could group BE and LE in 'cio.c' as is done in 'cio.h'.
But then the problem with the ENDIAN keyword must be solved.

------------------------------------------------------
#if defined(OPJ_BIG_ENDIAN)
src/lib/openjp2/cio.h

/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
__LITTLE_ENDIAN__ to match the endianness of the architecture being
#cmakedefine OPJ_BIG_ENDIAN
#elif defined(__BIG_ENDIAN__)
# define OPJ_BIG_ENDIAN
src/lib/openjp2/opj_config_private.h.cmake.in

#ifdef WORDS_BIGENDIAN
#if WORDS_BIGENDIAN == 1
#if WORDS_BIGENDIAN == 0
src/bin/jpwl/convert.c

#ifdef WORDS_BIGENDIAN
#if WORDS_BIGENDIAN == 1
#if WORDS_BIGENDIAN == 0
src/bin/jp2/convert.c
------------------------------------------------------

'src/bin/common/opj_apps_config.h.cmake.in' does not contain
the 'ENDIAN' keyword, although it must contain it:

------------------------------------------------------
#include "opj_apps_config.h"
src/bin/jpwl/opj_jpwl_decompress.c

#include "opj_apps_config.h"
src/bin/jpwl/convert.c

#include "opj_apps_config.h"
src/bin/jpwl/opj_jpwl_compress.c

#include "opj_apps_config.h"
src/bin/mj2/opj_mj2_compress.c

#include "opj_apps_config.h"
src/bin/mj2/opj_mj2_decompress.c

#include "opj_apps_config.h"
src/bin/jp2/opj_decompress.c

#include "opj_apps_config.h"
src/bin/jp2/convert.c

#include "opj_apps_config.h"
src/bin/jp2/opj_compress.c

#include "opj_apps_config.h"
src/bin/common/color.c
------------------------------------------------------

I propose to use 'WORDS_BIGENDIAN': it is used in the BRANCH.

winfried

Original issue reported on code.google.com by szukw...@arcor.de on 28 Sep 2013 at 3:59

Attachments:

GoogleCodeExporter commented 9 years ago
Is there a test that is failing ? How do I make sure this solve an issue ? How 
do I make sure I wont create a regression after applying this patch ? thx

Original comment by mathieu.malaterre on 24 Feb 2014 at 8:44

GoogleCodeExporter commented 9 years ago
There can not be a regression.

If 'WORDS_BIGENDIAN' is used, these patches allow to use 'WORDS_BIGENDIAN
at all relevant places.

The additional correction in line 69 of cio.c replaces '4' with
'sizeof(OPJ_UINT32)'.

The correction in line 47 of cio.c is necessary for BE; otherwise 
the code is the same as in LE.

winfried

Original comment by szukw...@gmail.com on 24 Feb 2014 at 5:50

GoogleCodeExporter commented 9 years ago
Unfortunately I am no longer sure about the code in line 47 of cio.c : you have 
to
wait for 10 days.

winfried

Original comment by szukw...@arcor.de on 24 Feb 2014 at 6:56

GoogleCodeExporter commented 9 years ago
Mathieu,

here is the ENDIAN patch for openjpeg-trunk-r2578. I use 'WORDS_BIGENDIAN'.
If you prefer 'OPJ_BIG_ENDIAN' ( Why? ), you must replace ALL occurrences
of 'WORDS_BIGENDIAN' with 'OPJ_BIG_ENDIAN'; even in the binaries.

The test

#if WORDS_BIGENDIAN == 0

is very old. It can be used only with

#cmakedefine01 WORDS_BIGENDIAN

This patch has been tested with a G5 machine.

winfried

Original comment by szukw...@arcor.de on 6 Mar 2014 at 1:38

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 19 Mar 2014 at 1:15

GoogleCodeExporter commented 9 years ago
I prefer OPJ_BIG_ENDIAN because it does not pollute the global namespace, it 
uses an OPJ_ prefix. OPJ_BIG_ENDIAN is used in openjpeg 2.0 anyway. This makes 
it easier for me to backport stuff to 1.x branch.

Original comment by mathieu.malaterre on 25 Mar 2014 at 4:46

GoogleCodeExporter commented 9 years ago
I am tempted to close this as a dup of issue 302

Original comment by mathieu.malaterre on 26 Mar 2014 at 3:28