Skip to content

Commit

Permalink
avifFillAlpha and avifReformatAlpha do not need a return value. (AOMe…
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud authored Oct 5, 2023
1 parent 6130ff5 commit b4ddd63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/avif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ typedef struct avifAlphaParams

} avifAlphaParams;

avifBool avifFillAlpha(const avifAlphaParams * params);
avifBool avifReformatAlpha(const avifAlphaParams * params);
void avifFillAlpha(const avifAlphaParams * params);
void avifReformatAlpha(const avifAlphaParams * params);

typedef enum avifReformatMode
{
Expand Down
7 changes: 2 additions & 5 deletions src/alpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <assert.h>
#include <string.h>

avifBool avifFillAlpha(const avifAlphaParams * params)
void avifFillAlpha(const avifAlphaParams * params)
{
if (params->dstDepth > 8) {
const uint16_t maxChannel = (uint16_t)((1 << params->dstDepth) - 1);
Expand All @@ -28,10 +28,9 @@ avifBool avifFillAlpha(const avifAlphaParams * params)
}
}
}
return AVIF_TRUE;
}

avifBool avifReformatAlpha(const avifAlphaParams * params)
void avifReformatAlpha(const avifAlphaParams * params)
{
const int srcMaxChannel = (1 << params->srcDepth) - 1;
const int dstMaxChannel = (1 << params->dstDepth) - 1;
Expand Down Expand Up @@ -113,8 +112,6 @@ avifBool avifReformatAlpha(const avifAlphaParams * params)
}
}
}

return AVIF_TRUE;
}

avifResult avifRGBImagePremultiplyAlpha(avifRGBImage * rgb)
Expand Down
8 changes: 4 additions & 4 deletions src/reformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,11 @@ avifResult avifImageRGBToYUV(avifImage * image, const avifRGBImage * rgb)
params.srcOffsetBytes = state.rgb.offsetBytesA;
params.srcPixelBytes = state.rgb.pixelBytes;

AVIF_CHECKERR(avifReformatAlpha(&params), AVIF_RESULT_REFORMAT_FAILED);
avifReformatAlpha(&params);
} else {
// libyuv does not fill alpha when converting from RGB to YUV so
// fill it regardless of the value of convertedWithLibYUV.
AVIF_CHECKERR(avifFillAlpha(&params), AVIF_RESULT_REFORMAT_FAILED);
avifFillAlpha(&params);
}
}
return AVIF_RESULT_OK;
Expand Down Expand Up @@ -1357,9 +1357,9 @@ static avifResult avifImageYUVToRGBImpl(const avifImage * image, avifRGBImage *
params.srcOffsetBytes = 0;
params.srcPixelBytes = state->yuv.channelBytes;

AVIF_CHECKERR(avifReformatAlpha(&params), AVIF_RESULT_REFORMAT_FAILED);
avifReformatAlpha(&params);
} else {
AVIF_CHECKERR(avifFillAlpha(&params), AVIF_RESULT_REFORMAT_FAILED);
avifFillAlpha(&params);
}
}

Expand Down

0 comments on commit b4ddd63

Please sign in to comment.