-
Notifications
You must be signed in to change notification settings - Fork 284
Declare rgbPixelBytes and grayPixelBytes as size_t #3184
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
Open
wantehchang
wants to merge
1
commit into
AOMediaCodec:main
Choose a base branch
from
wantehchang:fix-pr-3072
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,7 +279,7 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
|
|
||
| struct YUVBlock yuvBlock[2][2]; | ||
| float rgbPixel[3]; | ||
| const uint32_t rgbPixelBytes = state.rgb.pixelBytes; | ||
| const size_t rgbPixelBytes = state.rgb.pixelBytes; | ||
| const uint32_t offsetBytesR = state.rgb.offsetBytesR; | ||
| const uint32_t offsetBytesG = state.rgb.offsetBytesG; | ||
| const uint32_t offsetBytesB = state.rgb.offsetBytesB; | ||
|
|
@@ -387,13 +387,13 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
| } | ||
|
|
||
| if (state.yuv.channelBytes > 1) { | ||
| uint16_t * pY = (uint16_t *)&yPlane[(i * 2) + (j * yRowBytes)]; | ||
| uint16_t * pY = (uint16_t *)&yPlane[(i * sizeof(uint16_t)) + (j * yRowBytes)]; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, if you think changing |
||
| *pY = (uint16_t)avifYUVColorSpaceInfoYToUNorm(&state.yuv, yuvBlock[bI][bJ].y); | ||
| if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) { | ||
| // YUV444, full chroma | ||
| uint16_t * pU = (uint16_t *)&uPlane[(i * 2) + (j * uRowBytes)]; | ||
| uint16_t * pU = (uint16_t *)&uPlane[(i * sizeof(uint16_t)) + (j * uRowBytes)]; | ||
| *pU = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, yuvBlock[bI][bJ].u); | ||
| uint16_t * pV = (uint16_t *)&vPlane[(i * 2) + (j * vRowBytes)]; | ||
| uint16_t * pV = (uint16_t *)&vPlane[(i * sizeof(uint16_t)) + (j * vRowBytes)]; | ||
| *pV = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, yuvBlock[bI][bJ].v); | ||
| } | ||
| } else { | ||
|
|
@@ -430,9 +430,9 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
| size_t uvI = outerI >> chromaShiftX; | ||
| size_t uvJ = outerJ >> chromaShiftY; | ||
| if (state.yuv.channelBytes > 1) { | ||
| uint16_t * pU = (uint16_t *)&uPlane[(uvI * 2) + (uvJ * uRowBytes)]; | ||
| uint16_t * pU = (uint16_t *)&uPlane[(uvI * sizeof(uint16_t)) + (uvJ * uRowBytes)]; | ||
| *pU = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgU); | ||
| uint16_t * pV = (uint16_t *)&vPlane[(uvI * 2) + (uvJ * vRowBytes)]; | ||
| uint16_t * pV = (uint16_t *)&vPlane[(uvI * sizeof(uint16_t)) + (uvJ * vRowBytes)]; | ||
| *pV = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgV); | ||
| } else { | ||
| uPlane[uvI + (uvJ * uRowBytes)] = (uint8_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgU); | ||
|
|
@@ -456,9 +456,9 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
| size_t uvI = outerI >> chromaShiftX; | ||
| size_t uvJ = outerJ + bJ; | ||
| if (state.yuv.channelBytes > 1) { | ||
| uint16_t * pU = (uint16_t *)&uPlane[(uvI * 2) + (uvJ * uRowBytes)]; | ||
| uint16_t * pU = (uint16_t *)&uPlane[(uvI * sizeof(uint16_t)) + (uvJ * uRowBytes)]; | ||
| *pU = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgU); | ||
| uint16_t * pV = (uint16_t *)&vPlane[(uvI * 2) + (uvJ * vRowBytes)]; | ||
| uint16_t * pV = (uint16_t *)&vPlane[(uvI * sizeof(uint16_t)) + (uvJ * vRowBytes)]; | ||
| *pV = (uint16_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgV); | ||
| } else { | ||
| uPlane[uvI + (uvJ * uRowBytes)] = (uint8_t)avifYUVColorSpaceInfoUVToUNorm(&state.yuv, avgU); | ||
|
|
@@ -469,7 +469,7 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
| } | ||
| } | ||
| } else if (!converted && isGray) { | ||
| const uint32_t grayPixelBytes = state.rgb.pixelBytes; | ||
| const size_t grayPixelBytes = state.rgb.pixelBytes; | ||
| const uint32_t offsetBytesGray = state.rgb.offsetBytesGray; | ||
| const uint32_t offsetBytesA = state.rgb.offsetBytesA; | ||
| const size_t grayRowBytes = rgb->rowBytes; | ||
|
|
@@ -510,7 +510,7 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb) | |
| } | ||
| int gInt = avifYUVColorSpaceInfoYToUNorm(&state.yuv, g); | ||
| if (state.yuv.channelBytes > 1) { | ||
| uint16_t * pY = (uint16_t *)&yPlane[(i * 2) + j * yRowBytes]; | ||
| uint16_t * pY = (uint16_t *)&yPlane[(i * sizeof(uint16_t)) + j * yRowBytes]; | ||
| *pY = (uint16_t)gInt; | ||
| } else { | ||
| yPlane[i + (j * yRowBytes)] = (uint8_t)gInt; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vincent: This PR is no longer necessary now that pull request #3072 has been updated to declare the index variables
i,j,uvI,uvJassize_t. But I think it is still good to declarergbPixelBytesandgrayPixelBytesassize_tbecause the related*RowBytesvariables are declared assize_t.