Skip to content

Commit 3a20b37

Browse files
author
Evgeniy Sidenko
committed
* fixed api documentaion
* fixed a wrong method name
1 parent db7628a commit 3a20b37

7 files changed

Lines changed: 69 additions & 46 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class HeicHeader
2929
* <p>
3030
* Meta data IsoBmff box.
3131
* </p>
32+
* @return The meta data IsoBmff box.
3233
*/
3334
public final MetaBox getMeta(){ return meta; }
3435
/**
@@ -42,6 +43,7 @@ public class HeicHeader
4243
* <p>
4344
* The identifier of the default frame.
4445
* </p>
46+
* @return The identifier of the default frame.
4547
*/
4648
public final /*UInt32*/long getDefaultFrameId() {
4749
return (meta.getpitm() != null ? meta.getpitm().item_ID : 0);

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ private HeicImage(HeicHeader header, BitStreamWithNalSupport stream)
5353

5454
/**
5555
* <p>
56-
* Reads the file meta data and creates a class object for further decoding of the file contents.
57-
* <p>This operation does not decode pixels.
58-
* Use the default frame methods GetByteArray or GetInt32Array afterwards in order to decode pixels.</p>
56+
* Reads the file metadata and creates a class object for further decoding of the file contents.
57+
* </p>
58+
* <p>
59+
* This operation does not decode pixels.
60+
* Use the default frame methods GetByteArray or GetInt32Array afterwards in order to decode pixels.
5961
* </p>
6062
*
6163
* @param stream File stream.
62-
* @return Returns a heic image object with metadata read.
64+
* @return Returns a HEIC image object with metadata read.
6365
*/
6466
public static HeicImage load(IOStream stream)
6567
{
@@ -78,7 +80,7 @@ public static HeicImage load(IOStream stream)
7880

7981
while (bitstream.moreData())
8082
{
81-
Box box = Box.parceBox(bitstream);
83+
Box box = Box.parseBox(bitstream);
8284

8385
if (box.type == BoxType.meta)
8486
{
@@ -101,7 +103,7 @@ public static boolean canLoad(IOStream stream)
101103
{
102104
BitStreamWithNalSupport bitstream = new BitStreamWithNalSupport(stream);
103105

104-
Box box = Box.parceBox(bitstream);
106+
Box box = Box.parseBox(bitstream);
105107

106108
if (!(box instanceof FileTypeBox))
107109
{
@@ -122,8 +124,8 @@ public static boolean canLoad(IOStream stream)
122124
/**
123125
* <p>
124126
* Get pixel data of the default image frame in the format of byte array.
125-
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
126127
* </p>
128+
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
127129
*
128130
* @param pixelFormat Pixel format that defines the order of colors and the presence of alpha byte.
129131
* @return Byte array, null if frame does not contain image data.
@@ -136,8 +138,8 @@ public static boolean canLoad(IOStream stream)
136138
/**
137139
* <p>
138140
* Get pixel data of the default image frame in the format of byte array.
139-
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
140141
* </p>
142+
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
141143
*
142144
* @param pixelFormat Pixel format that defines the order of colors and the presence of alpha byte.
143145
* @param boundsRectangle Bounds of the requested area.
@@ -151,8 +153,8 @@ public static boolean canLoad(IOStream stream)
151153
/**
152154
* <p>
153155
* Get pixel data of the default image frame in the format of integer array.
154-
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
155156
* </p>
157+
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
156158
*
157159
* @param pixelFormat Pixel format that defines the order of colors.
158160
* @return Integer array, null if frame does not contain image data.
@@ -165,8 +167,8 @@ public final int[] getInt32Array(PixelFormat pixelFormat)
165167
/**
166168
* <p>
167169
* Get pixel data of the default image frame in the format of integer array.
168-
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
169170
* </p>
171+
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
170172
*
171173
* @param pixelFormat Pixel format that defines the order of colors.
172174
* @param boundsRectangle Bounds of the requested area.
@@ -181,6 +183,7 @@ public final int[] getInt32Array(PixelFormat pixelFormat, Rectangle boundsRectan
181183
* <p>
182184
* Heic image header. Grants convenient access to IsoBmff container meta data.
183185
* </p>
186+
* @return The Heic image header.
184187
*/
185188
public final HeicHeader getHeader()
186189
{
@@ -191,6 +194,7 @@ public final HeicHeader getHeader()
191194
* <p>
192195
* Dictionary of public Heic image frames with access by identifier.
193196
* </p>
197+
* @return The dictionary of public Heic image frames with access by identifier.
194198
*/
195199
public final Map<Long, HeicImageFrame> getFrames()
196200
{
@@ -202,6 +206,7 @@ public final Map<Long, HeicImageFrame> getFrames()
202206
* <p>
203207
* Dictionary of all Heic image frames with access by identifier.
204208
* </p>
209+
* @return The dictionary of all Heic image frames with access by identifier.
205210
*/
206211
public final Map<Long, HeicImageFrame> getAllFrames()
207212
{
@@ -210,8 +215,9 @@ public final Map<Long, HeicImageFrame> getAllFrames()
210215

211216
/**
212217
* <p>
213-
* Returns the default image frame, which is specified in meta data.
218+
* Returns the default image frame, which is specified in metadata.
214219
* </p>
220+
* @return the default image frame, which is specified in metadata.
215221
*/
216222
public final HeicImageFrame getDefaultFrame()
217223
{
@@ -222,6 +228,7 @@ public final HeicImageFrame getDefaultFrame()
222228
* <p>
223229
* Width of the default image frame in pixels.
224230
* </p>
231+
* @return The width of the default image frame in pixels.
225232
*/
226233
public final /*UInt32*/long getWidth()
227234
{
@@ -232,6 +239,7 @@ public final HeicImageFrame getDefaultFrame()
232239
* <p>
233240
* Height of the default image frame in pixels.
234241
* </p>
242+
* @return The height of the default image frame in pixels.
235243
*/
236244
public final /*UInt32*/long getHeight()
237245
{
@@ -240,7 +248,7 @@ public final HeicImageFrame getDefaultFrame()
240248

241249
/**
242250
* <p>
243-
* Fill frames dictionary with read meta data.
251+
* Fill frames dictionary with read metadata.
244252
* </p>
245253
*
246254
* @param stream File stream.

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

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ public class HeicImageFrame
9696

9797
/**
9898
* <p>
99-
* Type of an image frame content.
99+
* Type of image frame content.
100100
* </p>
101+
* @return The type of image frame content.
101102
*/
102103
public final ImageFrameType getImageType()
103104
{
@@ -108,6 +109,7 @@ public final ImageFrameType getImageType()
108109
* <p>
109110
* Width of the image frame in pixels.
110111
* </p>
112+
* @return The width of the image frame in pixels.
111113
*/
112114
public final /*UInt32*/long getWidth()
113115
{
@@ -118,6 +120,7 @@ public final ImageFrameType getImageType()
118120
* <p>
119121
* Height of the image frame in pixels.
120122
* </p>
123+
* @return The height of the image frame in pixels.
121124
*/
122125
public final /*UInt32*/long getHeight()
123126
{
@@ -126,7 +129,7 @@ public final ImageFrameType getImageType()
126129

127130
/**
128131
* <p>
129-
* Indicates the presence of transparency of transparency layer.
132+
* Indicates the presence of transparency of layer.
130133
* </p>
131134
*
132135
* @return True if frame is linked with alpha data frame, false otherwise.
@@ -174,8 +177,9 @@ public final boolean isDerived()
174177

175178
/**
176179
* <p>
177-
* Indicates the type of derivative content if the frame is derived.
180+
* Returns the type of derivative content if the frame is derived.
178181
* </p>
182+
* @return The type of derivative content if the frame is derived.
179183
*/
180184
public final BoxType getDerivativeType()
181185
{
@@ -184,8 +188,9 @@ public final BoxType getDerivativeType()
184188

185189
/**
186190
* <p>
187-
* Indicates the type of auxiliary reference layer if the frame type is auxiliary.
191+
* Returns the type of auxiliary reference layer if the frame type is auxiliary.
188192
* </p>
193+
* @return The type of auxiliary reference layer if the frame type is auxiliary.
189194
*/
190195
public final AuxiliaryReferenceType getAuxiliaryReferenceType()
191196
{
@@ -196,6 +201,7 @@ public final AuxiliaryReferenceType getAuxiliaryReferenceType()
196201
* <p>
197202
* Indicates the type of auxiliary reference layer if the frame type is auxiliary.
198203
* </p>
204+
* @param value the type of auxiliary reference layer if the frame type is auxiliary.
199205
*/
200206
private void setAuxiliaryReferenceType(AuxiliaryReferenceType value)
201207
{
@@ -206,26 +212,18 @@ private void setAuxiliaryReferenceType(AuxiliaryReferenceType value)
206212
* <p>
207213
* Number of channels with color data.
208214
* </p>
215+
* @return The number of channels with color data.
209216
*/
210217
public final byte getNumberOfChannels()
211218
{
212219
return numberOfChannels;
213220
}
214221

215-
/**
216-
* <p>
217-
* Number of channels with color data.
218-
* </p>
219-
*/
220-
private void setNumberOfChannels(byte value)
221-
{
222-
numberOfChannels = value;
223-
}
224-
225222
/**
226223
* <p>
227224
* Bits per channel with color data.
228225
* </p>
226+
* @return The bits per channel with color data.
229227
*/
230228
public final byte[] getBitsPerChannel()
231229
{
@@ -234,14 +232,13 @@ public final byte[] getBitsPerChannel()
234232

235233
/**
236234
* <p>
237-
* Bits per channel with color data.
235+
* Get pixel data in the format of byte array.
238236
* </p>
237+
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
238+
*
239+
* @param pixelFormat Pixel format that defines the order of colors and the presence of alpha byte.
240+
* @return Byte array, null if frame does not contain image data.
239241
*/
240-
private void setBitsPerChannel(byte[] value)
241-
{
242-
bitsPerChannel = value;
243-
}
244-
245242
public final byte[] getByteArray(PixelFormat pixelFormat)
246243
{
247244
return getByteArray(pixelFormat, new Rectangle());
@@ -250,8 +247,8 @@ public final byte[] getByteArray(PixelFormat pixelFormat)
250247
/**
251248
* <p>
252249
* Get pixel data in the format of byte array.
253-
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
254250
* </p>
251+
* <p>Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line.</p>
255252
*
256253
* @param pixelFormat Pixel format that defines the order of colors and the presence of alpha byte.
257254
* @param boundsRectangle Bounds of the requested area.
@@ -292,6 +289,15 @@ public final byte[] getByteArray(PixelFormat pixelFormat, Rectangle boundsRectan
292289
return output;
293290
}
294291

292+
/**
293+
* <p>
294+
* Get pixel data in the format of integer array.
295+
* </p>
296+
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
297+
*
298+
* @param pixelFormat Pixel format that defines the order of colors.
299+
* @return Integer array, null if frame does not contain image data.
300+
*/
295301
public final int[] getInt32Array(PixelFormat pixelFormat)
296302
{
297303
return getInt32Array(pixelFormat, new Rectangle());
@@ -300,8 +306,8 @@ public final int[] getInt32Array(PixelFormat pixelFormat)
300306
/**
301307
* <p>
302308
* Get pixel data in the format of integer array.
303-
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
304309
* </p>
310+
* <p>Each int value refers to one pixel left to right top to bottom line by line.</p>
305311
*
306312
* @param pixelFormat Pixel format that defines the order of colors.
307313
* @param boundsRectangle Bounds of the requested area.
@@ -341,10 +347,10 @@ public final int[] getInt32Array(PixelFormat pixelFormat, Rectangle boundsRectan
341347
/**
342348
* <p>
343349
* Get frame text data.
344-
* <p>Exists only for mime frame types.</p>
345350
* </p>
351+
* <p>Exists only for mime frame types.</p>
346352
*
347-
* @return String
353+
* @return The frame text data.
348354
*/
349355
public final String getTextData()
350356
{
@@ -375,11 +381,11 @@ public final String getTextData()
375381
/**
376382
* <p>
377383
* Add layer reference to the frame.
378-
* Used to link reference layers that are reverce-linked (alpha layer, depth map, hdr).
384+
* Used to link reference layers that are reverse-linked (alpha layer, depth map, hdr).
379385
* </p>
380386
*
381-
* @param id Layer identificator.
382-
* @param type Layer type.
387+
* @param id A layer identifier.
388+
* @param type A layer type.
383389
*/
384390
final void addLayerReference(/*UInt32*/long id, AuxiliaryReferenceType type)
385391
{
@@ -759,8 +765,8 @@ private void loadProperties(BitStreamWithNalSupport stream, List<Box> properties
759765
break;
760766
case pixi:
761767
PixelInformationProperty pixi = (PixelInformationProperty) item;
762-
setNumberOfChannels(pixi.num_channels);
763-
setBitsPerChannel(pixi.bits_per_channel);
768+
this.numberOfChannels = pixi.num_channels;
769+
this.bitsPerChannel = pixi.bits_per_channel;
764770
break;
765771
case rloc:
766772
//RelativeLocationProperty rloc = (RelativeLocationProperty) item;

src/main/java/openize/isobmff/ItemPropertyContainerBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public ItemPropertyContainerBox(BitStreamReader stream, /*UInt64*/long startPos)
4646
int i = 1;
4747
while (stream.getBitPosition() < startPos + size * 8)
4848
{
49-
items.put(i, Box.parceBox(stream));
49+
items.put(i, Box.parseBox(stream));
5050
i++;
5151
}
5252

src/main/java/openize/isobmff/MetaBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public MetaBox(BitStreamReader stream, /*UInt64*/long size, /*UInt64*/long start
4949

5050
while (stream.getBitPosition() < startPos + size * 8)
5151
{
52-
Box box = Box.parceBox(stream);
52+
Box box = Box.parseBox(stream);
5353
boxes.put(box.type, box);
5454
}
5555

src/main/java/openize/isobmff/MovieBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public MovieBox(BitStreamReader stream, /*UInt64*/long size, /*UInt64*/long star
4848

4949
while (stream.getBitPosition() < startPos + size * 8)
5050
{
51-
Box box = Box.parceBox(stream);
51+
Box box = Box.parseBox(stream);
5252
boxes.add(box);
5353
}
5454

0 commit comments

Comments
 (0)