You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example7 is not really meant to read iPhone8 images as they are organized bit differently than conformance file the example uses. But Reader can definitely parse iPhone8 images so with some additions to the example7 code you can also duplicate them on writing output.
Typical iPhone8 heic file actually consist of 50 images. They form "grid" image item, which is shown to user when watching photo on phone. This is probably done because single still image is too big for phone HEVC encoder to handle so original image is split into smaller tiles that are encoded and form the grid image.
48 master images that are hidden and have linked derived image (iPhone case this it "grid" item). So they have following ImageInformation.features:
ImageFeatureEnum::IsMasterImage
ImageFeatureEnum::IsHiddenImage
ImageFeatureEnum::HasLinkedDerivedImage
1 derived image, which is also primary/cover image and which has linked external metadata and thumbnail. So it has following ImageInformation.features:
ImageFeatureEnum::IsMasterImage
ImageFeatureEnum::IsPrimaryImage
ImageFeatureEnum::IsDerivedImage
ImageFeatureEnum::IsCoverImage
ImageFeatureEnum::HasLinkedThumbnails
ImageFeatureEnum::HasLinkedMetadata
1 thumbnail image with ImageFeatureEnum::IsThumbnailImage
File also has 2 items in FileInformation.rootMetaBoxInformation.itemInformations:
Item for derived image "grid" definition. With matching itemID to derived image above.
Item for external "Exif" metadata with ItemFeatureEnum::IsMetadataItem and ::IsExifItem.
You can process the items like this:
// get information about all input file content
FileInformation fileInfo{};
reader->getFileInformation(fileInfo);
// go through all items in input file
for (const auto& item : fileInfo.rootMetaBoxInformation.itemInformations)
{
FourCC itemType{};
reader->getItemType(item.itemId, itemType);
if (itemType == "grid")
{
Grid gridItem{};
reader->getItem(item.itemId, gridItem);
for (const auto& gridMember : gridItem.imageIds)
{
// grid members are the hidden coded images
}
}
else if (itemType == "exif")
{
// can be processed like in example 8
}
}
...
for (const auto& image : fileInfo.rootMetaBoxInformation.imageInformations)
{
// you can process the image information through here (like which one is the primary image and its thumbnail, etc
}
In decoding case you typically create decoder instance, configure it with information from Reader::getDecoderParameterSets() and then give it actual image bitstream you get from Reader::getItemData() to decode the image.
@nokiatech
Thanks for wrote the great open source lib, I want decode a grid image, but wan't to get lossless source image, becasue MediaCodec decodes all source images will cost too much time, actually I just wanna get a middle size file for Previewer in Android Devices.
When I'm using this file:
Image Resolution: 5792x4344px
Image Size: 3.41MB
Source Image Count: 109
The Mediacodec decode one image will cost about 50ms, totally 5.5s, how can I solve this problem?
Thanks so much! :)
Activity
nokiatech commentedon Mar 16, 2018
Example7 is not really meant to read iPhone8 images as they are organized bit differently than conformance file the example uses. But Reader can definitely parse iPhone8 images so with some additions to the example7 code you can also duplicate them on writing output.
Typical iPhone8 heic file actually consist of 50 images. They form "grid" image item, which is shown to user when watching photo on phone. This is probably done because single still image is too big for phone HEVC encoder to handle so original image is split into smaller tiles that are encoded and form the grid image.
ImageInformation.features
:ImageFeatureEnum::IsMasterImage
ImageFeatureEnum::IsHiddenImage
ImageFeatureEnum::HasLinkedDerivedImage
ImageInformation.features
:ImageFeatureEnum::IsMasterImage
ImageFeatureEnum::IsPrimaryImage
ImageFeatureEnum::IsDerivedImage
ImageFeatureEnum::IsCoverImage
ImageFeatureEnum::HasLinkedThumbnails
ImageFeatureEnum::HasLinkedMetadata
ImageFeatureEnum::IsThumbnailImage
File also has 2 items in
FileInformation.rootMetaBoxInformation.itemInformations
:ItemFeatureEnum::IsMetadataItem
and::IsExifItem
.You can process the items like this:
jassonjackson commentedon Mar 19, 2018
Thank you!Another question,How to feed 'data' to decoder and display the cover image in exampe1?
nokiatech commentedon Mar 19, 2018
You can use your platform HEVC/H.265 codecs to decode/encode images. HEIF library itself doesn't contain codecs.
In decoding case you typically create decoder instance, configure it with information from
Reader::getDecoderParameterSets()
and then give it actual image bitstream you get fromReader::getItemData()
to decode the image.myrao commentedon Nov 17, 2020
@nokiatech
Thanks for wrote the great open source lib, I want decode a grid image, but wan't to get lossless source image, becasue MediaCodec decodes all source images will cost too much time, actually I just wanna get a middle size file for Previewer in Android Devices.
When I'm using this file:
The Mediacodec decode one image will cost about 50ms, totally 5.5s, how can I solve this problem?
Thanks so much! :)