ryanqq / openjpeg

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

Issue using coder BYPASS (-M 1) #209

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am seeing artifacting when encoding with a self compiled OpenJPEG 1.5.1 on 
Debian.  

Encoding ~4500x6000 greyscale tiffs with the following options results in 
artifacts in the output jp2 files:
-I -p RPCL -n 6 -EPH -SOP -c 
[256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -b 64,64 -M 1 -r 
320,160,80,40,20,11.25,7,4.6,3.4,2.75,2.4,1

When encoded with these settings all files have artifacts and one file cannot 
be opened at all, despite jpylyzer reporting the headers as valid.  Changing 
the parameters to -n 7 allows that file to be opened but it still shows the 
same artifacts as other files.

No artifacts are apparent when coder bypass is removed from the parameters.

Original issue reported on code.google.com by william....@bl.uk on 7 Feb 2013 at 2:30

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 25 Feb 2014 at 3:32

GoogleCodeExporter commented 9 years ago
$ wget http://merovingio.c2rmf.cnrs.fr/iipimage/PalaisDuLouvre.tif
$ tiffcp PalaisDuLouvre.tif,0 out.tif
$ convert out.tif   -colorspace gray test.tif
$ valgrind ./bin/opj_compress -i test.tif -o test.jp2 -I -p RPCL -n 6 -EPH -SOP 
-c [256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -b 64,64 -M 1 -r 
 320,160,80,40,20,11.25,7,4.6,3.4,2.75,2.4,1
==31712== Memcheck, a memory error detector
==31712== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==31712== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==31712== Command: ./bin/opj_compress -i test.tif -o test.jp2 -I -p RPCL -n 6 
-EPH -SOP -c [256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -b 
64,64 -M 1 -r 320,160,80,40,20,11.25,7,4.6,3.4,2.75,2.4,1
==31712== 

[INFO] tile number 1 / 1
==31712== Conditional jump or move depends on uninitialised value(s)
==31712==    at 0x4E63336: opj_t1_encode_cblk (t1.c:1674)
==31712==    by 0x4E62DB2: opj_t1_encode_cblks (t1.c:1523)
==31712==    by 0x4E6BACC: opj_tcd_t1_encode (tcd.c:1958)
==31712==    by 0x4E6A441: opj_tcd_encode_tile (tcd.c:1155)
==31712==    by 0x4E42670: opj_j2k_write_sod (j2k.c:4207)
==31712==    by 0x4E50603: opj_j2k_write_first_tile_part (j2k.c:9823)
==31712==    by 0x4E500DF: opj_j2k_post_write_tile (j2k.c:9664)
==31712==    by 0x4E4F925: opj_j2k_encode (j2k.c:9441)
==31712==    by 0x4E53FA6: opj_jp2_encode (jp2.c:1651)
==31712==    by 0x4E591F0: opj_encode (openjpeg.c:853)
==31712==    by 0x406CBC: main (opj_compress.c:1682)
==31712== 
==31712== Conditional jump or move depends on uninitialised value(s)
==31712==    at 0x4E57699: opj_mqc_byteout (mqc.c:200)
==31712==    by 0x4E57E7E: opj_mqc_flush (mqc.c:401)
==31712==    by 0x4E631A1: opj_t1_encode_cblk (t1.c:1631)
==31712==    by 0x4E62DB2: opj_t1_encode_cblks (t1.c:1523)
==31712==    by 0x4E6BACC: opj_tcd_t1_encode (tcd.c:1958)
==31712==    by 0x4E6A441: opj_tcd_encode_tile (tcd.c:1155)
==31712==    by 0x4E42670: opj_j2k_write_sod (j2k.c:4207)
==31712==    by 0x4E50603: opj_j2k_write_first_tile_part (j2k.c:9823)
==31712==    by 0x4E500DF: opj_j2k_post_write_tile (j2k.c:9664)
==31712==    by 0x4E4F925: opj_j2k_encode (j2k.c:9441)
==31712==    by 0x4E53FA6: opj_jp2_encode (jp2.c:1651)
==31712==    by 0x4E591F0: opj_encode (openjpeg.c:853)

Original comment by mathieu.malaterre on 27 Feb 2014 at 10:31

GoogleCodeExporter commented 9 years ago
Removing -M 1 do indeed produces proper result (at least not bad).

Original comment by mathieu.malaterre on 27 Feb 2014 at 10:34

GoogleCodeExporter commented 9 years ago
When using BYPASS mode, there is one more byte read (cp is 13 instead of 12). I 
could not figure out where the invalid initialization is coding from anyway.

Original comment by mathieu.malaterre on 28 Feb 2014 at 10:37

GoogleCodeExporter commented 9 years ago
Reduced test case:

$ tiffcp PalaisDuLouvre.tif,0 out.tif
$ convert out.tif -colorspace gray test.tif
$ tiffcp -c none test.tif test.none.tif
$ opj_compress -i test.none.tif -o M1.j2k -M 1

Original comment by mathieu.malaterre on 12 Mar 2014 at 4:15

GoogleCodeExporter commented 9 years ago
openjpeg 1.3 and 1.5 all exhibit the same artifacts.

Original comment by mathieu.malaterre on 12 Mar 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 12 Mar 2014 at 4:19

GoogleCodeExporter commented 9 years ago
$ make opj_compress && valgrind bin/opj_compress -i test.none.tif -o M1.j2k -M 1
[ 84%] Built target openjp2
Linking C executable ../../../bin/opj_compress
[100%] Built target opj_compress
==12059== Memcheck, a memory error detector
==12059== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==12059== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==12059== Command: bin/opj_compress -i test.none.tif -o M1.j2k -M 1
==12059== 

[INFO] tile number 1 / 1
==12059== Conditional jump or move depends on uninitialised value(s)
==12059==    at 0x4E67448: opj_t1_encode_cblk (t1.c:1678)
==12059==    by 0x4E66E4C: opj_t1_encode_cblks (t1.c:1527)
==12059==    by 0x4E702A4: opj_tcd_t1_encode (tcd.c:1959)
==12059==    by 0x4E6EA3D: opj_tcd_encode_tile (tcd.c:1155)
==12059==    by 0x4E45FFB: opj_j2k_write_sod (j2k.c:4262)
==12059==    by 0x4E53F9E: opj_j2k_write_first_tile_part (j2k.c:9907)
==12059==    by 0x4E53A7A: opj_j2k_post_write_tile (j2k.c:9747)
==12059==    by 0x4E53289: opj_j2k_encode (j2k.c:9524)
==12059==    by 0x4E5CDA8: opj_encode (openjpeg.c:736)
==12059==    by 0x406E11: main (opj_compress.c:1681)
==12059== 

Original comment by mathieu.malaterre on 14 Mar 2014 at 11:10