转换成JPEG时HEIC瓦片损坏 [英] corrupted HEIC tile when converting to JPEG

查看:338
本文介绍了转换成JPEG时HEIC瓦片损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将.HEIC图像转换为jpeg。 .HEIC文件使用iphone运行最新的ios公开测试版拍摄的图像。我正在使用

解决方案

第七个图块中的VPS / SPS / PPS参数集有一个错误。如果问题出在实际文件或HEIF解析器中,我没有跟踪,但是在此期间有一个简单的解决方法。



请参阅HevcImageFileReader :: getItemDataWithDecoderParameters并观察它如何将参数集添加到每个图块的实际项目数据。



您需要做的是读取第一个图块的参数集,并重新使用它们随后的瓦片而不是重新读取它们。这可以解决来自第七个瓦片的损坏参数。看起来安全可以这样做,因为这是一种网格格式,要求是每个图块都相同。


I'm having trouble converting a .HEIC image to a jpeg. The .HEIC file an image taken with an iphone running the latest ios public beta. I'm using the library nokia provided to parse the file and extract the image tiles from the .HEIC file, convert them to jpeg and glue them together using ffmpeg/montage.

There is a bit too much code to paste it all into this question so i put all of it in this github repo. Its pretty self explanatory and should be runnable with just a few dependencies. They are explained in the repo's README. This has all been done on osx btw.

The .HEIC files contains a 8x6 grid of images(tiles) and if you put them together you get the complete image. Simply put whatever image i input the 7th tile is corrupted as shown below and i really don't understand why. I've filed an issue with nokia, but the repo seems pretty dead and i don't really expect an answer there.

解决方案

There's a bug in the VPS/SPS/PPS parameter sets in the 7th tile. I have not tracked down if the issue lies in the actual file or in the HEIF parser, but there is a simple workaround in the meantime.

Refer to HevcImageFileReader::getItemDataWithDecoderParameters and observe how it prepends the parameter sets to the actual item data for each tile.

All you need to do is read the parameter sets for the first tile and reuse them for subsequent tiles instead of re-reading them. This will work around the corrupt parameters coming from the 7th tile. It appears safe to do this since this is a grid format and the requirement is that each tile be identical.

这篇关于转换成JPEG时HEIC瓦片损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆