Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial structure for decompressing JPEG XR images (assist #8493). #1014

Merged
merged 60 commits into from
Apr 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7c4bb6d
Initial ome-jpegxr project structure.
Oct 29, 2013
3f7f3f8
Align names, disable tests for now.
Nov 1, 2013
46857c7
Rename component to ome-jxr, add tests.
Nov 4, 2013
69ac4b3
Slight refactoring of tests and reader.
Nov 5, 2013
d78a253
Remove "x" attribute from test file.
Nov 5, 2013
b607321
Add encoder version check and tests.
Nov 5, 2013
d864766
Fix Maven build.
Nov 6, 2013
6a035e2
Simplify endianness detection logic.
Nov 6, 2013
fe8a155
Add IFD getter and refactor tests.
Nov 7, 2013
a97cf68
Set the stream byte-order in ctor.
Nov 7, 2013
aac4635
Further refactoring and test additions.
Nov 12, 2013
c41db4e
Another round of major refactoring.
Nov 14, 2013
080ab08
Initial impl of metadata extraction.
Nov 15, 2013
91fef86
Make metadata extraction almost work.
Nov 19, 2013
420f87b
Clean up tests, comments; add close() method.
Nov 20, 2013
64d76ce
Add ColorFormat enum; further work on metadata.
Nov 20, 2013
4ec99e0
Almost full implementation of metadata reading.
Nov 21, 2013
eafc686
Add elements to JXRMetadata class.
Nov 22, 2013
86f28a9
Format code.
Nov 22, 2013
89e3dca
Update root build system files for ome-jxr
melissalinkert Nov 25, 2013
88ffd97
Add remaining pixel formats from table A.6 of ITU-T T.832
melissalinkert Nov 25, 2013
c35ed6a
Consistently capitalise text in PixelFormat.
Dec 2, 2013
73cf183
Rename and move test classes.
Dec 2, 2013
95964a8
Add new tests.
Dec 2, 2013
79227b5
Correct method name; return metadata defaults.
Dec 2, 2013
8a4d391
Create decoder and fix TestNG xml file.
Dec 6, 2013
9470d77
Rename JXRMetadata to IFDMetadata.
Dec 16, 2013
d758ac5
Another round of changes related to decoding.
Dec 16, 2013
91f730b
Move BitBuffer and BitWriter to scifio-devel.
Dec 16, 2013
3bef599
Delete JXRImage.
Dec 16, 2013
21fc4f9
Further refactoring and new logic in decoder.
Dec 16, 2013
7173831
Remove loci-common from dependencies.
Jan 8, 2014
1f19754
Initial impl of image header parsing.
Jan 8, 2014
d3b8559
Update date range in licence comments.
Jan 8, 2014
bc4fba6
Update comments.
Jan 9, 2014
f8eed02
Initial version of codestream parsing.
Jan 9, 2014
ce25864
Fix whitespace.
Jan 9, 2014
afbe2bc
Fix Maven build.
Jan 10, 2014
0a51145
Further refactoring: Introduce Parser base class.
Jan 17, 2014
9b10b4b
Clean up DatastreamParser and fix test.
Feb 24, 2014
385ff30
Rename const field.
Feb 24, 2014
ff5c571
Implement Chain-of-responsibility pattern.
Mar 4, 2014
a367cde
Fix ant/mvn build after rebasing.
Mar 12, 2014
3bcda94
Move classes out of 'metadata' package.
Mar 17, 2014
a3008fe
Update parsing logic and tests.
Mar 17, 2014
3c920e9
Fix imports.
Mar 17, 2014
defd70a
Finish implementing IMAGE_HEADER() parsing.
Mar 18, 2014
ee44e2e
Fix javadoc and add package descriptions.
Mar 20, 2014
cb8dd7a
Minor test and code fixes.
Mar 20, 2014
d480910
Update unit tests.
Mar 24, 2014
1237bbb
Add plane header parsing method stubs.
Mar 24, 2014
73e3fa6
Add byte boundary method to BitBuffer.
Mar 27, 2014
775204e
Rename class and test.
Mar 27, 2014
afd6935
Add FrequencyBand enum.
Mar 27, 2014
52cd5ee
Update image header parsing logic.
Mar 27, 2014
5039f9e
Rename enums and update tests.
Mar 28, 2014
c9c556b
Add further logic to DatastreamParser.
Mar 28, 2014
20691bf
Clean up and add missing tests.
Mar 31, 2014
fabd40e
Fix Travis build.
Apr 1, 2014
8efacec
Fix findbugs error (type unboxing and comparison).
Apr 3, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions ant/toplevel.properties
Expand Up @@ -29,6 +29,7 @@ merged-docs.source = ${root.dir}/components/formats-common/build/src:\
${root.dir}/components/formats-gpl/build/src:\
${root.dir}/components/bio-formats-plugins/build/src:\
${root.dir}/components/metakit/build/src:\
${root.dir}/components/ome-jxr/build/src:\
${root.dir}/components/ome-xml/build/src:\
${root.dir}/components/stubs/lwf-stubs/build/src:\
${root.dir}/components/test-suite/build/src:\
Expand Down Expand Up @@ -87,6 +88,7 @@ loci-tools.libraries = formats-api.jar \
metakit.jar \
native-lib-loader-2.0-SNAPSHOT.jar \
netcdf-4.3.19.jar \
ome-jxr.jar \
ome-xml.jar \
perf4j-0.9.13.jar \
ome-poi.jar \
Expand Down
45 changes: 45 additions & 0 deletions ant/toplevel.xml
Expand Up @@ -23,6 +23,7 @@ Type "ant -p" for a list of targets.
compile-lwf-stubs,
compile-mdbtools,
compile-metakit,
compile-ome-jxr,
compile-ome-xml,
compile-ome-poi,
compile-formats-api,
Expand All @@ -42,6 +43,7 @@ Type "ant -p" for a list of targets.
jar-lwf-stubs,
jar-mdbtools,
jar-metakit,
jar-ome-jxr,
jar-ome-xml,
jar-ome-poi,
jar-formats-api,
Expand All @@ -63,6 +65,7 @@ Type "ant -p" for a list of targets.
osgi-lwf-stubs,
osgi-mdbtools,
osgi-metakit,
osgi-ome-jxr,
osgi-ome-xml,
osgi-ome-poi,
osgi-formats-api,
Expand All @@ -89,6 +92,7 @@ Type "ant -p" for a list of targets.
findbugs-formats-api,
findbugs-formats-bsd,
findbugs-bio-formats-tools,
findbugs-ome-jxr,
findbugs-tests"
description="run findbugs on most components"/>

Expand All @@ -102,6 +106,7 @@ Type "ant -p" for a list of targets.
clean-lwf-stubs,
clean-mdbtools,
clean-metakit,
clean-ome-jxr,
clean-ome-xml,
clean-ome-poi,
clean-formats-api,
Expand All @@ -125,6 +130,7 @@ Type "ant -p" for a list of targets.
test-lwf-stubs,
test-mdbtools,
test-metakit,
test-ome-jxr,
test-ome-xml,
test-ome-poi,
test-formats-api,
Expand Down Expand Up @@ -322,6 +328,42 @@ Type "ant -p" for a list of targets.
<ant dir="components/metakit" target="test"/>
</target>

<!-- OME JPEG XR library -->

<target name="deps-ome-jxr"
depends="jar-formats-common, jar-formats-bsd"/>

<target name="compile-ome-jxr" depends="deps-ome-jxr"
description="compile classes for OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="ome-jxr.compile"/>
</target>

<target name="jar-ome-jxr" depends="deps-ome-jxr"
description="generate JAR file for OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="ome-jxr.jar"/>
</target>

<target name="osgi-ome-jxr" depends="jar-ome-jxr"
description="generate OSGi bundle for OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="ome-jxr.osgi"/>
</target>

<target name="findbugs-ome-jxr" depends="jar-ome-jxr"
description="run findbugs on OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="ome-jxr.findbugs"/>
</target>

<target name="clean-ome-jxr"
depends="clean-formats-common"
description="remove build files for OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="ome-jxr.clean"/>
</target>

<target name="test-ome-jxr" depends="jar-ome-jxr, testing-deps"
description="compile and run tests for OME JPEG XR Java library">
<ant dir="components/ome-jxr" target="test"/>
</target>

<!-- OME-XML Java library -->

<target name="deps-ome-xml" depends="copy-jars, jar-formats-common" />
Expand Down Expand Up @@ -541,6 +583,7 @@ Type "ant -p" for a list of targets.
depends="copy-jars, jar-formats-common,
jar-mdbtools,
jar-metakit,
jar-ome-jxr,
jar-ome-xml,
jar-ome-poi,
jar-formats-api,
Expand Down Expand Up @@ -570,6 +613,7 @@ Type "ant -p" for a list of targets.
depends="clean-formats-common,
clean-mdbtools,
clean-metakit,
clean-ome-jxr,
clean-ome-xml,
clean-ome-poi,
clean-formats-api,
Expand Down Expand Up @@ -784,6 +828,7 @@ Type "ant -p" for a list of targets.
jar-bio-formats-plugins,
jar-mdbtools,
jar-metakit,
jar-ome-jxr,
jar-ome-xml,
jar-ome-poi,
jar-formats-api,
Expand Down
26 changes: 26 additions & 0 deletions components/formats-bsd/src/loci/formats/codec/BitBuffer.java
Expand Up @@ -190,6 +190,16 @@ public int getBits(int bitsToRead) {
return toStore;
}

/**
* Checks if the current position is on a byte boundary, that is the next
* bit in the byte array is the first bit in a byte.
*
* @return true if bit is on byte boundary, false otherwise.
*/
public boolean isBitOnByteBoundary() {
return currentBit % 8 == 0 ? true : false;
}

/**
* Testing method.
* @param args Ignored.
Expand Down Expand Up @@ -239,6 +249,7 @@ public static void main(String[] args) {
bb.skipBits(len[i]);
}
}

// Test reading past end of buffer.
LOGGER.info("Testing end of buffer");
bb = new BitBuffer(bw.toByteArray());
Expand All @@ -248,5 +259,20 @@ public static void main(String[] args) {
if (-1 != read) {
LOGGER.info("-1 expected at end of buffer, {} received.", read);
}

// Test byte boundary detection
LOGGER.info("Testing byte boundary detection");
bb = new BitBuffer(bw.toByteArray());
for (int i = 0; i < trials; i++) {
int c = r.nextInt(100);
if (c > 50) {
if (len[i] > 8) {
bb.getBits(8);
if (!bb.isBitOnByteBoundary()){
LOGGER.info("Bit on byte boundary expected, but not returned.");
}
}
}
}
}
}