forked from pool/libavif
Takashi Iwai
8f4446d8f2
This will allow us to add AVIF image support to darktable. OBS-URL: https://build.opensuse.org/request/show/753261 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/libavif?expand=0&rev=1
57 lines
2.1 KiB
Diff
57 lines
2.1 KiB
Diff
From cbcf62c2200be83b85b48059c819ae708216ccec Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@cryptomilk.org>
|
|
Date: Tue, 19 Nov 2019 16:35:03 +0100
|
|
Subject: [PATCH] codec: Support building with libaom 1.0.0
|
|
|
|
---
|
|
src/codec_aom.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/codec_aom.c b/src/codec_aom.c
|
|
index 090dbbd..b718551 100644
|
|
--- a/src/codec_aom.c
|
|
+++ b/src/codec_aom.c
|
|
@@ -126,7 +126,9 @@ static avifBool aomCodecGetNextImage(avifCodec * codec, avifImage * image)
|
|
break;
|
|
case AOM_IMG_FMT_YV12:
|
|
case AOM_IMG_FMT_AOMYV12:
|
|
+#ifdef AOM_IMG_FMT_YV1216
|
|
case AOM_IMG_FMT_YV1216:
|
|
+#endif
|
|
yuvFormat = AVIF_PIXEL_FORMAT_YV12;
|
|
break;
|
|
case AOM_IMG_FMT_NONE:
|
|
@@ -246,8 +248,11 @@ static avifBool aomCodecEncodeImage(avifCodec * codec, avifImage * image, avifEn
|
|
// Speed 8: RealTime CpuUsed 6
|
|
// Speed 9: RealTime CpuUsed 7
|
|
// Speed 10: RealTime CpuUsed 8
|
|
- unsigned int aomUsage = AOM_USAGE_GOOD_QUALITY;
|
|
+ unsigned int aomUsage = 0;
|
|
int aomCpuUsed = -1;
|
|
+
|
|
+#ifdef AOM_USAGE_GOOD_QUALITY
|
|
+ aomUsage = AOM_USAGE_GOOD_QUALITY;
|
|
if (encoder->speed != AVIF_SPEED_DEFAULT) {
|
|
if (encoder->speed < 8) {
|
|
aomUsage = AOM_USAGE_GOOD_QUALITY;
|
|
@@ -257,6 +262,7 @@ static avifBool aomCodecEncodeImage(avifCodec * codec, avifImage * image, avifEn
|
|
aomCpuUsed = AVIF_CLAMP(encoder->speed - 2, 6, 8);
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
int yShift = 0;
|
|
aom_img_fmt_t aomFormat = avifImageCalcAOMFmt(image, alpha, &yShift);
|
|
@@ -300,9 +306,11 @@ static avifBool aomCodecEncodeImage(avifCodec * codec, avifImage * image, avifEn
|
|
if (lossless) {
|
|
aom_codec_control(&aomEncoder, AV1E_SET_LOSSLESS, 1);
|
|
}
|
|
+#ifdef AOM_CTRL_AV1E_SET_ROW_MT
|
|
if (encoder->maxThreads > 1) {
|
|
aom_codec_control(&aomEncoder, AV1E_SET_ROW_MT, 1);
|
|
}
|
|
+#endif
|
|
if (encoder->tileRowsLog2 != 0) {
|
|
int tileRowsLog2 = AVIF_CLAMP(encoder->tileRowsLog2, 0, 6);
|
|
aom_codec_control(&aomEncoder, AV1E_SET_TILE_ROWS, tileRowsLog2);
|