Skip to content

Commit 6ac2c9b

Browse files
author
Evgeniy Sidenko
committed
The library has become thread-safe
1 parent aca1ab6 commit 6ac2c9b

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>openize</groupId>
88
<artifactId>openize-heic</artifactId>
9-
<version>25.6</version>
9+
<version>25.8</version>
1010
<name>Openize.HEIC for Java</name>
1111
<description>Openize.Heic is an open source implementation of the ISO/IEC 23008-12:2017 HEIF file format decoder. It is written from scratch and has a plain Java API to enable a simple integration into other software.</description>
1212
<url>https://github.com/openize-heic/Openize.HEIC-for-Java</url>

src/main/java/openize/heic/decoder/HeicImage.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private HeicImage(HeicHeader header, BitStreamWithNalSupport stream)
5757
* </p>
5858
* <p>
5959
* This operation does not decode pixels.
60-
* Use the default frame methods GetByteArray or GetInt32Array afterwards in order to decode pixels.
60+
* Use the default frame methods GetByteArray or GetInt32Array afterward in order to decode pixels.
6161
* </p>
6262
*
6363
* @param stream File stream.
@@ -198,6 +198,20 @@ public final int[] getInt32Array(PixelFormat pixelFormat, int[] dstArray)
198198
return getInt32Array(pixelFormat, new Rectangle(), dstArray);
199199
}
200200

201+
/**
202+
* <p>
203+
* Get pixel data of the default image frame in the format of integer array.
204+
* </p>
205+
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
206+
*
207+
* @param pixelFormat Pixel format that defines the order of colors.
208+
* @param boundsRectangle Bounds of the requested area.
209+
* @return Integer array, null if frame does not contain image data. In general, it equals to {@code dstArray}.
210+
*/
211+
public final int[] getInt32Array(PixelFormat pixelFormat, Rectangle boundsRectangle)
212+
{
213+
return getDefaultFrame().getInt32Array(pixelFormat, boundsRectangle, null);
214+
}
201215
/**
202216
* <p>
203217
* Get pixel data of the default image frame in the format of integer array.

src/main/java/openize/heic/decoder/ScalingList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Scaling
8181
41,41,54,54,54,71,71,91
8282
};
8383

84-
static void initiate(seq_parameter_set_rbsp sps)
84+
static synchronized void initiate(seq_parameter_set_rbsp sps)
8585
{
8686
if (getScalingFactor() != null)
8787
{

src/main/java/openize/heic/decoder/Scans.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111
package openize.heic.decoder;
1212

1313

14-
1514
final class Scans
1615
{
1716
public static byte[][][][] getScanOrder(){ return scanOrder; }
1817
private static byte[][][][] scanOrder;
1918

2019
private static boolean _initialised = false;
2120

22-
static void initialize()
21+
static synchronized void initialize()
2322
{
2423
if (_initialised) return;
25-
_initialised = true;
2624

25+
_initialised = true;
2726
scanOrderInitialize();
2827
}
2928

@@ -32,17 +31,17 @@ static void scanOrderInitialize()
3231
scanOrder = new byte[6][][][];
3332
for (int log2BlockSize = 0; log2BlockSize < 6; log2BlockSize++)
3433
{
35-
getScanOrder()[log2BlockSize] = new byte[4][][];
34+
scanOrder[log2BlockSize] = new byte[4][][];
3635

3736
if (log2BlockSize < 4)
3837
{
39-
getScanOrder()[log2BlockSize][0] = diagonalScanInitialize((byte)(1 << log2BlockSize));
40-
getScanOrder()[log2BlockSize][1] = horizontalScanInitialize((byte)(1 << log2BlockSize));
41-
getScanOrder()[log2BlockSize][2] = verticalScanInitialize((byte)(1 << log2BlockSize));
38+
scanOrder[log2BlockSize][0] = diagonalScanInitialize((byte)(1 << log2BlockSize));
39+
scanOrder[log2BlockSize][1] = horizontalScanInitialize((byte)(1 << log2BlockSize));
40+
scanOrder[log2BlockSize][2] = verticalScanInitialize((byte)(1 << log2BlockSize));
4241
}
4342

4443
if (log2BlockSize > 1)
45-
getScanOrder()[log2BlockSize][3] = traverseScanInitialize((byte)(1 << log2BlockSize));
44+
scanOrder[log2BlockSize][3] = traverseScanInitialize((byte)(1 << log2BlockSize));
4645
}
4746
}
4847

@@ -156,8 +155,4 @@ static byte[][] traverseScanInitialize(byte blkSize)
156155

157156
return travScan;
158157
}
159-
160-
161-
162158
}
163-

0 commit comments

Comments
 (0)