Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update a comment in avifImageYUVAnyToRGBAnySlow() #1487

Conversation

wantehchang
Copy link
Collaborator

The following comment in avifImageYUVAnyToRGBAnySlow()

// Monochrome: ... (identity mode is irrelevant)

added in commit ca2c34d, was written when avifReformatMode had only two values (the default mode and identity mode). Now avifReformatMode has 3 values (or 5 if AVIF_ENABLE_EXPERIMENTAL_YCGCO_R is defined). Instead of enumerating all the non-default modes in the comment, just change "identity mode" to "state->mode".

The following comment in avifImageYUVAnyToRGBAnySlow()

  // Monochrome: ... (identity mode is irrelevant)

added in commit ca2c34d, was written when avifReformatMode had only two
values (the default mode and identity mode). Now avifReformatMode has 3
values (or 5 if AVIF_ENABLE_EXPERIMENTAL_YCGCO_R is defined). Instead of
enumerating all the non-default modes in the comment, just change
"identity mode" to "state->mode".
@@ -763,7 +763,7 @@ static avifResult avifImageYUVAnyToRGBAnySlow(const avifImage * image,
G = Y - ((2 * ((kr * (1 - kr) * Cr) + (kb * (1 - kb) * Cb))) / kg);
}
} else {
// Monochrome: just populate all channels with luma (identity mode is irrelevant)
// Monochrome: just populate all channels with luma (state->mode is irrelevant)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternatively we could say "reformat mode is irrelevant". I use "state->mode" because the if (hasColor) code above (lines 735-764) uses different formulas depending on state->mode.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think the comment you have now is fine.

@@ -763,7 +763,7 @@ static avifResult avifImageYUVAnyToRGBAnySlow(const avifImage * image,
G = Y - ((2 * ((kr * (1 - kr) * Cr) + (kb * (1 - kb) * Cb))) / kg);
}
} else {
// Monochrome: just populate all channels with luma (identity mode is irrelevant)
// Monochrome: just populate all channels with luma (state->mode is irrelevant)
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think the comment you have now is fine.

@wantehchang wantehchang merged commit 6443c22 into AOMediaCodec:main Aug 2, 2023
14 checks passed
@wantehchang wantehchang deleted the update-comment-in-reformat-about-monochrome branch August 2, 2023 17:22
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