Skip to content

Commit

Permalink
Use kFilterBilinear with libyuv when allowed
Browse files Browse the repository at this point in the history
The condition for determining whether kFilterNone or kFilterBilinear
should be used was changed incorrectly in commit 95d96ea
(Refactor YUV->RGB conversion with libyuv), causing
AVIF_CHROMA_UPSAMPLING_AUTOMATIC to not use kFilterBilinear with libyuv.
Fix the condition by reverting to the original code.

Fix AOMediaCodec#1475.
  • Loading branch information
wantehchang committed Jul 25, 2023
1 parent 424b0f9 commit 8b7e2d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/reformat_libyuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,10 @@ avifResult avifImageYUVToRGBLibYUV(const avifImage * image, avifRGBImage * rgb,
int libyuvResult = -1;
int uPlaneIndex = isYVU ? AVIF_CHAN_V : AVIF_CHAN_U;
int vPlaneIndex = isYVU ? AVIF_CHAN_U : AVIF_CHAN_V;
const enum FilterMode filter = nearestNeighborFilterAllowed(rgb->chromaUpsampling) ? kFilterNone : kFilterBilinear;
const enum FilterMode filter =
((rgb->chromaUpsampling == AVIF_CHROMA_UPSAMPLING_FASTEST) || (rgb->chromaUpsampling == AVIF_CHROMA_UPSAMPLING_NEAREST))
? kFilterNone
: kFilterBilinear;
if (lcf.yuvToRgbMatrixFilterHighBitDepth != NULL) {
libyuvResult = lcf.yuvToRgbMatrixFilterHighBitDepth((const uint16_t *)image->yuvPlanes[AVIF_CHAN_Y],
image->yuvRowBytes[AVIF_CHAN_Y] / 2,
Expand Down

0 comments on commit 8b7e2d6

Please sign in to comment.