This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit a928af15544c06908497c144e90b5dd7f314fc3a
Author: jsorel <[email protected]>
AuthorDate: Tue Jun 2 14:51:47 2026 +0200

    feat(GeoHeif): add CompressionConfiguration and CompressedUnitsItemInfo 
boxes
---
 .../sis/storage/isobmff/MainBoxRegistry.java       |  2 +
 .../isobmff/mpeg/CompressedUnitsItemInfo.java      | 89 ++++++++++++++++++++++
 .../isobmff/mpeg/CompressionConfiguration.java     | 76 ++++++++++++++++++
 3 files changed, 167 insertions(+)

diff --git 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java
 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java
index 86a0236970..4ac834aa31 100644
--- 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java
+++ 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java
@@ -85,6 +85,8 @@ final class MainBoxRegistry extends BoxRegistry {
             case ComponentPalette.BOXTYPE:              return new 
ComponentPalette(reader, reader.componentDefinition);
             case ComponentPatternDefinition.BOXTYPE:    return new 
ComponentPatternDefinition(reader, reader.componentDefinition);
             case ComponentReferenceLevel.BOXTYPE:       return new 
ComponentReferenceLevel(reader);
+            case CompressedUnitsItemInfo.BOXTYPE:       return new 
CompressedUnitsItemInfo(reader);
+            case CompressionConfiguration.BOXTYPE:      return new 
CompressionConfiguration(reader);
             case ContentDescribes.BOXTYPE:              return new 
ContentDescribes(reader);
             case Copyright.BOXTYPE:                     return new 
Copyright(reader);
             case CreationTime.BOXTYPE:                  return new 
CreationTime(reader);
diff --git 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressedUnitsItemInfo.java
 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressedUnitsItemInfo.java
new file mode 100644
index 0000000000..3c9a46bedf
--- /dev/null
+++ 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressedUnitsItemInfo.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,z
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage.isobmff.mpeg;
+
+import java.io.IOException;
+import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.storage.isobmff.FullBox;
+import org.apache.sis.storage.isobmff.Reader;
+import org.apache.sis.storage.isobmff.Incomplete;
+import org.apache.sis.storage.isobmff.UnsupportedVersionException;
+
+
+/**
+ * Compressed units item info.
+ * <b>Not yet implemented.</b>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @see ISO/IEC 23001-17:2024/Amd 2:2025
+ */
+@Incomplete
+public final class CompressedUnitsItemInfo extends FullBox {
+    /**
+     * Numerical representation of the {@code "icef"} box type.
+     */
+    public static final int BOXTYPE = ((((('i' << 8) | 'c') << 8) | 'e') << 8) 
| 'f';
+
+    private static final int[] UNIT_OFFSET_BITS_TABLE = new int[]{0, 16, 24, 
32, 64 };
+    private static final int[] UNIT_SIZE_BITS_TABLE = new int[]{8, 16, 24, 32, 
64 };
+
+    /**
+     * Returns the four-character type of this box.
+     * This value is fixed to {@link #BOXTYPE}.
+     */
+    @Override
+    public final int type() {
+        return BOXTYPE;
+    }
+
+    /**
+     * Number of bits to encode an offset.
+     */
+    public final int unitOffset;
+    /**
+     * Number of bits to encode a size.
+     */
+    public final int unitSize;
+    public final int numCompressedUnits;
+
+    /**
+     * Creates a new box and loads the payload from the given reader.
+     *
+     * @param  reader  the reader from which to read the payload.
+     * @throws IOException if an error occurred while reading the payload.
+     */
+    public CompressedUnitsItemInfo(final Reader reader) throws IOException, 
UnsupportedVersionException {
+        super(reader);
+        requireVersionZero();
+        final ChannelDataInput input = reader.input;
+        unitOffset = UNIT_OFFSET_BITS_TABLE[(int) input.readBits(3)];
+        unitSize = UNIT_SIZE_BITS_TABLE[(int) input.readBits(3)];
+        input.skipRemainingBits();
+        numCompressedUnits = input.readInt();
+    }
+
+    public long[][] readUnits(final Reader reader) throws IOException {
+        final ChannelDataInput input = reader.input;
+        final long[][] units = new long[numCompressedUnits][2];
+        for (int i = 0; i < numCompressedUnits; i++) {
+            units[i][0] = input.readBits(unitOffset);
+            units[i][1] = input.readBits(unitSize);
+        }
+        return units;
+    }
+}
diff --git 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressionConfiguration.java
 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressionConfiguration.java
new file mode 100644
index 0000000000..eb41d91ca8
--- /dev/null
+++ 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/mpeg/CompressionConfiguration.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,z
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage.isobmff.mpeg;
+
+import java.io.IOException;
+import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.storage.isobmff.FullBox;
+import org.apache.sis.storage.isobmff.Reader;
+import org.apache.sis.storage.isobmff.Incomplete;
+import org.apache.sis.storage.isobmff.UnsupportedVersionException;
+
+
+/**
+ * Compression configuration box.
+ * <b>Not yet implemented.</b>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @see ISO/IEC 23001-17:2024/Amd 2:2025
+ */
+@Incomplete
+public final class CompressionConfiguration extends FullBox {
+    /**
+     * Numerical representation of the {@code "cmpC"} box type.
+     */
+    public static final int BOXTYPE = ((((('c' << 8) | 'm') << 8) | 'p') << 8) 
| 'C';
+
+    public static final int UNIT_TYPE_FULL_ITEM = 0;
+    public static final int UNIT_TYPE_IMAGE = 1;
+    public static final int UNIT_TYPE_IMAGE_TILE = 2;
+    public static final int UNIT_TYPE_IMAGE_ROW = 3;
+    public static final int UNIT_TYPE_IMAGE_PIXEL = 4;
+
+    /**
+     * Returns the four-character type of this box.
+     * This value is fixed to {@link #BOXTYPE}.
+     */
+    @Override
+    public final int type() {
+        return BOXTYPE;
+    }
+
+    /**
+     * Identifier of the compression, FourCC code.
+     */
+    public final int compressionType;
+    public final int unitType;
+
+    /**
+     * Creates a new box and loads the payload from the given reader.
+     *
+     * @param  reader  the reader from which to read the payload.
+     * @throws IOException if an error occurred while reading the payload.
+     */
+    public CompressionConfiguration(final Reader reader) throws IOException, 
UnsupportedVersionException {
+        super(reader);
+        requireVersionZero();
+        final ChannelDataInput input = reader.input;
+        compressionType = input.readInt();
+        unitType = input.readUnsignedByte();
+    }
+}

Reply via email to