From 828325c33e393b07a374a0e664505622c772395c Mon Sep 17 00:00:00 2001 From: Joe Drago Date: Fri, 26 Jul 2019 10:45:39 -0700 Subject: [PATCH 1/3] Exposed tile encoding to avifEncoder --- CHANGELOG.md | 2 ++ include/avif/avif.h | 4 ++++ src/codec_aom.c | 12 ++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb7fa3598..005c5b25da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Exposed tile encoding to avifEncoder ## [0.3.5] - 2019-07-25 ### Changed diff --git a/include/avif/avif.h b/include/avif/avif.h index 32dcf9542a..8d441ddfcb 100644 --- a/include/avif/avif.h +++ b/include/avif/avif.h @@ -402,12 +402,16 @@ avifResult avifDecoderReset(avifDecoder * decoder); // * if avifEncoderWrite() returns AVIF_RESULT_OK, output must be freed with avifRawDataFree() // * if (maxThreads < 2), multithreading is disabled // * quality range: [AVIF_BEST_QUALITY - AVIF_WORST_QUALITY] +// * To enable tiling, set tileRowsLog2 > 0 and/or tileColsLog2 > 0. +// Tiling values range [0-6], where the value indicates a request for 2^n tiles in that dimension. typedef struct avifEncoder { // settings int maxThreads; int minQuantizer; int maxQuantizer; + int tileRowsLog2; + int tileColsLog2; // stats from the most recent write avifIOStats ioStats; diff --git a/src/codec_aom.c b/src/codec_aom.c index 879e8e2e00..e77bb550de 100644 --- a/src/codec_aom.c +++ b/src/codec_aom.c @@ -317,8 +317,8 @@ static avifBool encodeOBU(avifImage * image, avifBool alphaOnly, avifEncoder * e // * 3 - CSP_RESERVED outputConfig->chromaSamplePosition = 0; - int minQuantizer = encoder->minQuantizer; - int maxQuantizer = encoder->maxQuantizer; + int minQuantizer = AVIF_CLAMP(encoder->minQuantizer, 0, 63); + int maxQuantizer = AVIF_CLAMP(encoder->maxQuantizer, 0, 63); if (alphaOnly) { minQuantizer = AVIF_QUANTIZER_LOSSLESS; maxQuantizer = AVIF_QUANTIZER_LOSSLESS; @@ -341,6 +341,14 @@ static avifBool encodeOBU(avifImage * image, avifBool alphaOnly, avifEncoder * e if (encoder->maxThreads > 1) { aom_codec_control(&aomEncoder, AV1E_SET_ROW_MT, 1); } + if (encoder->tileRowsLog2 != 0) { + int tileRowsLog2 = AVIF_CLAMP(encoder->tileRowsLog2, 0, 6); + aom_codec_control(&aomEncoder, AV1E_SET_TILE_ROWS, tileRowsLog2); + } + if (encoder->tileColsLog2 != 0) { + int tileColsLog2 = AVIF_CLAMP(encoder->tileColsLog2, 0, 6); + aom_codec_control(&aomEncoder, AV1E_SET_TILE_COLUMNS, tileColsLog2); + } uint32_t uvHeight = image->height >> yShift; aom_image_t * aomImage = aom_img_alloc(NULL, aomFormat, image->width, image->height, 16); From 503af0ef8c0b22b369bc2880b4baf05d46dba4f5 Mon Sep 17 00:00:00 2001 From: Joe Drago Date: Fri, 26 Jul 2019 10:46:07 -0700 Subject: [PATCH 2/3] v0.3.6 --- include/avif/avif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/avif/avif.h b/include/avif/avif.h index 8d441ddfcb..731ae8d9ed 100644 --- a/include/avif/avif.h +++ b/include/avif/avif.h @@ -16,7 +16,7 @@ extern "C" { #define AVIF_VERSION_MAJOR 0 #define AVIF_VERSION_MINOR 3 -#define AVIF_VERSION_PATCH 5 +#define AVIF_VERSION_PATCH 6 #define AVIF_VERSION (AVIF_VERSION_MAJOR * 10000) + (AVIF_VERSION_MINOR * 100) + AVIF_VERSION_PATCH typedef int avifBool; From 73e6689d125c75d336af44e63eb9001cce66dbdc Mon Sep 17 00:00:00 2001 From: Joe Drago Date: Fri, 26 Jul 2019 10:47:11 -0700 Subject: [PATCH 3/3] Update changelog for v0.3.6 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 005c5b25da..1df241f82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.3.6] - 2019-07-25 ### Added - Exposed tile encoding to avifEncoder @@ -133,7 +135,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Constants `AVIF_VERSION`, `AVIF_VERSION_MAJOR`, `AVIF_VERSION_MINOR`, `AVIF_VERSION_PATCH` - `avifVersion()` function -[Unreleased]: https://github.com/AOMediaCodec/libavif/compare/v0.3.5...HEAD +[Unreleased]: https://github.com/AOMediaCodec/libavif/compare/v0.3.6...HEAD +[0.3.6]: https://github.com/AOMediaCodec/libavif/compare/v0.3.5...v0.3.6 [0.3.5]: https://github.com/AOMediaCodec/libavif/compare/v0.3.4...v0.3.5 [0.3.4]: https://github.com/AOMediaCodec/libavif/compare/v0.3.3...v0.3.4 [0.3.3]: https://github.com/AOMediaCodec/libavif/compare/v0.3.2...v0.3.3