Skip to content

avifenc: add --ignore-alpha flag to discard alpha channel on encode#3216

Open
wantehchang wants to merge 3 commits into
AOMediaCodec:mainfrom
wantehchang:copy-of-enyetsuen-pr-3130
Open

avifenc: add --ignore-alpha flag to discard alpha channel on encode#3216
wantehchang wants to merge 3 commits into
AOMediaCodec:mainfrom
wantehchang:copy-of-enyetsuen-pr-3130

Conversation

@wantehchang
Copy link
Copy Markdown
Member

@wantehchang wantehchang commented May 20, 2026

The first and second commits are copies of the first and second commits in pull request #3130 by @enyetsuen.

The third commit contains my edits and further changes.

@wantehchang wantehchang force-pushed the copy-of-enyetsuen-pr-3130 branch 3 times, most recently from 499b3c2 to bd45ed0 Compare May 22, 2026 00:56
@wantehchang wantehchang requested a review from vrabaud May 22, 2026 00:57
Copy link
Copy Markdown
Member Author

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

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

Vincent: I requested a review from you because I remember you worked on the avifReadImage() function. This PR is quite large, but there are a lot of mechanical changes. I suggest reviewing the code in the following order:

  1. CHANGELOG.md
  2. apps/avifenc.c
  3. doc/avifenc.1.md
  4. apps/shared/avifutil.{h,c}
  5. apps/shared/avifpng.{h,c}
  6. apps/shared/y4m.{h,c}
  7. tests/test_cmd.sh
  8. Other files

Thank you!

@vigneshvg Vignesh: FYI. You requested the --ignore-alpha option in issue #1665.

@wantehchang wantehchang force-pushed the copy-of-enyetsuen-pr-3130 branch from bd45ed0 to e28e60f Compare May 25, 2026 15:35
@wantehchang wantehchang self-assigned this May 27, 2026
enyetsuen and others added 3 commits May 26, 2026 17:11
Remove the --noalpha flag. Just add --ignore-alpha.

Make stylistic changes.

Have avifInputReadImage() propagate the ignoreAlpha parameter further
down the call chain all the way to the leaf functions.

Add a changelog entry.

Update doc/avifenc.1.md.

Add a test for PNG input.
@wantehchang wantehchang force-pushed the copy-of-enyetsuen-pr-3130 branch from e28e60f to e481fbb Compare May 27, 2026 00:13
Comment thread apps/avifenc.c
ignoreColorProfile,
ignoreExif,
ignoreXMP,
ignoreAlpha,
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.

Vincent: When I wrote this PR, I didn't realize that avifImageFreePlanes() is a public function. Since adding the ignoreAlpha parameter to avifReadImage() makes it necessary to update its callers, an alternative solution is to leave avifReadImage() unchanged and call avifImageFreePlanes(dstImage, AVIF_PLANES_A) if ignoreAlpha is true. This will make the PR much smaller at the cost of allocating and copying the alpha plane from the input image unnecessarily. Would you prefer this alternative solution?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's ok, it's all internal. We should probably merge those ignores flags into a struct anyway.

Comment thread apps/avifenc.c
ignoreColorProfile,
ignoreExif,
ignoreXMP,
ignoreAlpha,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's ok, it's all internal. We should probably merge those ignores flags into a struct anyway.

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.

3 participants