From 4a19512a3b960a8e75e059d4dfd09f60289f4055 Mon Sep 17 00:00:00 2001 From: liujinhong Date: Sat, 26 Oct 2024 14:48:27 +0800 Subject: [PATCH] =?UTF-8?q?heif=E8=A7=A3=E7=A0=81aireview=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujinhong --- .../include/heif_impl/heif_parser/heif_error.h | 1 - .../heif_parser/box/item_property_hvcc_box.cpp | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/common/libs/image/libextplugin/include/heif_impl/heif_parser/heif_error.h b/plugins/common/libs/image/libextplugin/include/heif_impl/heif_parser/heif_error.h index 6f25c6897..e492fc85a 100644 --- a/plugins/common/libs/image/libextplugin/include/heif_impl/heif_parser/heif_error.h +++ b/plugins/common/libs/image/libextplugin/include/heif_impl/heif_parser/heif_error.h @@ -42,7 +42,6 @@ enum heif_error { heif_invalid_exif_data = 20, heif_invalid_mirror_direction = 21, heif_error_grid_too_large = 22, - heif_invalid_color_range_flag = 23, }; } // namespace ImagePlugin } // namespace OHOS diff --git a/plugins/common/libs/image/libextplugin/src/heif_impl/heif_parser/box/item_property_hvcc_box.cpp b/plugins/common/libs/image/libextplugin/src/heif_impl/heif_parser/box/item_property_hvcc_box.cpp index 38ff8662a..3bc6dbc1a 100644 --- a/plugins/common/libs/image/libextplugin/src/heif_impl/heif_parser/box/item_property_hvcc_box.cpp +++ b/plugins/common/libs/image/libextplugin/src/heif_impl/heif_parser/box/item_property_hvcc_box.cpp @@ -219,12 +219,16 @@ std::vector HeifHvccBox::GetNaluData(const std::vector &n void HeifHvccBox::ProcessBoxData(std::vector &nalu) { int naluSize = nalu.size(); + std::vector indicesToDelete; for (int i = UINT16_BYTES_NUM; i < naluSize; ++i) { if (nalu[i - UINT8_BYTES_NUM] == 0x00 && nalu[i - SKIP_DOUBLE_DATA_PROCESS_BYTE] == 0x00 && nalu[i] == 0x03) { - nalu.erase(nalu.begin() + i); + indicesToDelete.push_back(i); } } + for (auto it = indicesToDelete.rbegin(); it != indicesToDelete.rend(); ++it) { + nalu.erase(nalu.begin() + *it); + } } void HeifHvccBox::ParserHvccColorRangeFlag(const std::vector &nalArrays) @@ -356,13 +360,12 @@ void HeifHvccBox::ReadGolombCodesForSizeId(std::vector &nalUnits, int s void HeifHvccBox::ParseSpsScallListData(std::vector &nalUnits) { - std::vector> scalingListPredModeFlag; for (int sizeId = 0; sizeId < GENERAL_PROFILE_SIZE; ++sizeId) { for (int matrixId = 0; matrixId < NUM_TEMPORAL_ID_SIZE; - matrixId += ((sizeId == SUB_LAYER_MINUS) ? SUB_LAYER_MINUS : READ_BIT_NUM_FLAG)) { - scalingListPredModeFlag[sizeId][matrixId] = GetWord(nalUnits, READ_BIT_NUM_FLAG); - if (!scalingListPredModeFlag[sizeId][matrixId]) { - scalingListPredModeFlag[sizeId][matrixId] = GetGolombCode(nalUnits); + matrixId += ((sizeId == SUB_LAYER_MINUS) ? SUB_LAYER_MINUS : READ_BIT_NUM_FLAG)) { + uint8_t tmpFlag = GetWord(nalUnits, READ_BIT_NUM_FLAG); + if (!tmpFlag) { + GetGolombCode(nalUnits); } else { ReadGolombCodesForSizeId(nalUnits, sizeId); }