Skip to content

Don't delete gain map metadata if ignore_gain_map#3290

Merged
wantehchang merged 3 commits into
AOMediaCodec:mainfrom
wantehchang:omit-set-view-if-copy
Jul 2, 2026
Merged

Don't delete gain map metadata if ignore_gain_map#3290
wantehchang merged 3 commits into
AOMediaCodec:mainfrom
wantehchang:omit-set-view-if-copy

Conversation

@wantehchang

@wantehchang wantehchang commented Jul 1, 2026

Copy link
Copy Markdown
Member

Don't delete gain map metadata if ignore_gain_map

In avif::ReadImage(), if ignore_gain_map is true, don't delete gain map
metadata. Let the caller do that.

Also, since avif::ReadImage() calls avifImageCopy(), it doesn't need to
call avifImageCreateView().

@wantehchang wantehchang requested a review from maryla-uc July 1, 2026 21:12
@wantehchang wantehchang force-pushed the omit-set-view-if-copy branch from da4133e to 7a5dd90 Compare July 1, 2026 21:29
@wantehchang wantehchang changed the title Skip avifImageCreateView() before avifImageCopy() Don't delete gain map metadata if ignore_gain_map Jul 1, 2026
In avif::ReadImage(), if ignore_gain_map is true, don't delete gain map
metadata. Let the caller do that.

Also, since avif::ReadImage() calls avifImageCopy(), it doesn't need to
call avifImageCreateView().
if (base_image->gainMap) {
assert(base_image->gainMap->image == nullptr);
avifGainMapDestroy(base_image->gainMap);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only caller of avif::ReadImage() that passes ignore_gain_map=true.

Comment thread apps/avifgainmaputil/combine_command.cc
Comment thread apps/avifgainmaputil/imageio.cc Outdated
But pass ignoreGainMap=false to the avifImageCreateView call.

@wantehchang wantehchang left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.

Comment thread apps/avifgainmaputil/combine_command.cc
Comment thread apps/avifgainmaputil/imageio.cc Outdated
@wantehchang wantehchang merged commit 0c8ee66 into AOMediaCodec:main Jul 2, 2026
25 checks passed
@wantehchang wantehchang deleted the omit-set-view-if-copy branch July 2, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants