Rename new upsampling enum to something more accurate
diff --git a/include/avif/avif.h b/include/avif/avif.h
index 737e6af..5a71d52 100644
--- a/include/avif/avif.h
+++ b/include/avif/avif.h
@@ -385,20 +385,20 @@
uint32_t avifRGBFormatChannelCount(avifRGBFormat format);
avifBool avifRGBFormatHasAlpha(avifRGBFormat format);
-typedef enum avifRGBUpsampling
+typedef enum avifChromaUpsampling
{
- AVIF_UPSAMPLING_BILINEAR = 0, // Slower and pretter (default)
- AVIF_UPSAMPLING_NEAREST = 1 // Faster and uglier
-} avifRGBUpsampling;
+ AVIF_CHROMA_UPSAMPLING_BILINEAR = 0, // Slower and prettier (default)
+ AVIF_CHROMA_UPSAMPLING_NEAREST = 1 // Faster and uglier
+} avifChromaUpsampling;
typedef struct avifRGBImage
{
- uint32_t width; // must match associated avifImage
- uint32_t height; // must match associated avifImage
- uint32_t depth; // legal depths [8, 10, 12, 16]. if depth>8, pixels must be uint16_t internally
- avifRGBFormat format; // all channels are always full range
- avifRGBUpsampling upsampling; // How to upsample non-4:4:4 UV (ignored for 444) when converting to RGB.
- // Unused when converting to YUV. avifRGBImageSetDefaults() prefers quality over speed.
+ uint32_t width; // must match associated avifImage
+ uint32_t height; // must match associated avifImage
+ uint32_t depth; // legal depths [8, 10, 12, 16]. if depth>8, pixels must be uint16_t internally
+ avifRGBFormat format; // all channels are always full range
+ avifChromaUpsampling upsampling; // How to upsample non-4:4:4 UV (ignored for 444) when converting to RGB.
+ // Unused when converting to YUV. avifRGBImageSetDefaults() prefers quality over speed.
uint8_t * pixels;
uint32_t rowBytes;
diff --git a/src/avif.c b/src/avif.c
index 74ce6a3..b7b7795 100644
--- a/src/avif.c
+++ b/src/avif.c
@@ -352,7 +352,7 @@
rgb->height = image->height;
rgb->depth = image->depth;
rgb->format = AVIF_RGB_FORMAT_RGBA;
- rgb->upsampling = AVIF_UPSAMPLING_BILINEAR;
+ rgb->upsampling = AVIF_CHROMA_UPSAMPLING_BILINEAR;
rgb->pixels = NULL;
rgb->rowBytes = 0;
}
diff --git a/src/reformat.c b/src/reformat.c
index 05884d4..18e6b87 100644
--- a/src/reformat.c
+++ b/src/reformat.c
@@ -467,7 +467,7 @@
}
}
- if (rgb->upsampling == AVIF_UPSAMPLING_BILINEAR) {
+ if (rgb->upsampling == AVIF_CHROMA_UPSAMPLING_BILINEAR) {
// Bilinear filtering with weights
Cb = (unormFloatTableUV[unormU[0][0]] * (9.0f / 16.0f)) + (unormFloatTableUV[unormU[1][0]] * (3.0f / 16.0f)) +
(unormFloatTableUV[unormU[0][1]] * (3.0f / 16.0f)) + (unormFloatTableUV[unormU[1][1]] * (1.0f / 16.0f));
@@ -944,7 +944,7 @@
}
if ((image->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) || (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV400) ||
- (rgb->upsampling == AVIF_UPSAMPLING_NEAREST)) {
+ (rgb->upsampling == AVIF_CHROMA_UPSAMPLING_NEAREST)) {
// None of these fast paths currently support bilinear upsampling, so avoid all of them
// unless the YUV data isn't subsampled or they explicitly requested AVIF_UPSAMPLING_NEAREST.