2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 0
PenaltyBreakBeforeFirstCallParameter: 9999
PenaltyBreakComment: 0
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 0
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.0] - 2021-02-22

### Added
* Image grid encoding
* Premultiplied alpha support (tongyuantongyu)
* avifenc: Image grid encoding (`-g`, `--grid`)
* avifenc: Harvest framerate from y4m headers as the "default", if present
* avifenc: Recognize the Y4M format string "C420mpeg2" (wantehchang)
* Basic deduplication when writing mdat chunks

### Changed
* avifenc: Adjusted min/max/speed/fps defaults
* Better handling for export headers (tongyuantongyu)
* Use procedure specified in H.273 to quantize YUV (tongyuantongyu)
* Impose a maximum of 4096 bytes on searchSampleSize (wantehchang, fixes oss-fuzz perf issue / timeout)
* Update aom.cmd: v2.0.2
* Update dav1d.cmd: 0.8.2
* Update libgav1.cmd: 4a89dc3 / lts_2020_09_23
* Update rav1e.cmd: 0.4
* Update svt.cmd/svt.sh: v0.8.6
* Force libjpeg to output in RGB Colorspace (bugfix)
* Minor other compilation/linking/formatting/comment fixes

## [0.8.4] - 2020-11-23

### Added
Expand Down Expand Up @@ -552,7 +575,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.8.4...HEAD
[Unreleased]: https://github.com/AOMediaCodec/libavif/compare/v0.9.0...HEAD
[0.9.0]: https://github.com/AOMediaCodec/libavif/compare/v0.8.4...v0.9.0
[0.8.4]: https://github.com/AOMediaCodec/libavif/compare/v0.8.3...v0.8.4
[0.8.3]: https://github.com/AOMediaCodec/libavif/compare/v0.8.2...v0.8.3
[0.8.2]: https://github.com/AOMediaCodec/libavif/compare/v0.8.1...v0.8.2
Expand Down
33 changes: 28 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.5)
# and find_package()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")

project(libavif LANGUAGES C VERSION 0.8.4)
project(libavif LANGUAGES C VERSION 0.9.0)

# Set C99 as the default
set(CMAKE_C_STANDARD 99)
Expand All @@ -19,7 +19,7 @@ set(CMAKE_C_STANDARD 99)
# Increment MINOR. Set PATCH to 0
# If the source code was changed, but there were no interface changes:
# Increment PATCH.
set(LIBRARY_VERSION_MAJOR 9)
set(LIBRARY_VERSION_MAJOR 10)
set(LIBRARY_VERSION_MINOR 0)
set(LIBRARY_VERSION_PATCH 0)
set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
Expand Down Expand Up @@ -137,11 +137,17 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
add_definitions(-Wno-poison-system-directories)
endif()
# MINGW declares printf with __attribute__ ((__unused__)) in stdio.h.
# It is out of our control so we just ignore it.
# See https://sourceforge.net/p/mingw-w64/bugs/868/
if(MINGW)
add_definitions(-Wno-used-but-marked-unused)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
MESSAGE(STATUS "libavif: Enabling warnings for GCC")
add_definitions(-Wall -Wextra)
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
MESSAGE(STATUS "libavif: Enabling warnings for MS CL")
MESSAGE(STATUS "libavif: Enabling warnings for MSVC")
add_definitions(
/Wall # All warnings
/wd4255 # Disable: no function prototype given
Expand All @@ -153,6 +159,13 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
/wd4820 # Disable: bytes padding added after data member
/wd4996 # Disable: potentially unsafe stdlib methods
/wd5045 # Disable: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
# This tells MSVC to read source code as UTF-8 and assume console can only use ASCII (minimal safe).
# libavif uses ANSI API to print to console, which is not portable between systems using different
# languages and results in mojibake unless we only use codes shared by every code page: ASCII.
# A C4556 warning will be generated on violation.
# Commonly used /utf-8 flag assumes UTF-8 for both source and console, which is usually not the case.
# Warnings can be suppressed but there will still be random characters printed to the console.
/source-charset:utf-8 /execution-charset:us-ascii
)
else()
MESSAGE(FATAL_ERROR "libavif: Unknown compiler, bailing out")
Expand Down Expand Up @@ -296,7 +309,7 @@ if(AVIF_CODEC_RAV1E)
endif()

set(AVIF_CODEC_INCLUDES ${AVIF_CODEC_INCLUDES}
"${CMAKE_CURRENT_SOURCE_DIR}/ext/rav1e/target/release/include"
"${CMAKE_CURRENT_SOURCE_DIR}/ext/rav1e/target/release"
)
set(AVIF_CODEC_LIBRARIES ${AVIF_CODEC_LIBRARIES} ${LIB_FILENAME})
else()
Expand Down Expand Up @@ -388,7 +401,8 @@ add_library(avif ${AVIF_SRCS})
set_target_properties(avif
PROPERTIES
VERSION ${LIBRARY_VERSION}
SOVERSION ${LIBRARY_SOVERSION})
SOVERSION ${LIBRARY_SOVERSION}
C_VISIBILITY_PRESET hidden)
target_compile_definitions(avif
PRIVATE ${AVIF_PLATFORM_DEFINITIONS} ${AVIF_CODEC_DEFINITIONS})
target_link_libraries(avif
Expand All @@ -397,6 +411,15 @@ target_include_directories(avif
PUBLIC $<BUILD_INTERFACE:${libavif_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${AVIF_PLATFORM_INCLUDES} ${AVIF_CODEC_INCLUDES})
set(AVIF_PKG_CONFIG_EXTRA_CFLAGS "")
if(BUILD_SHARED_LIBS)
target_compile_definitions(avif PUBLIC AVIF_DLL
PRIVATE AVIF_BUILDING_SHARED_LIBS)
set(AVIF_PKG_CONFIG_EXTRA_CFLAGS " -DAVIF_DLL")
if(AVIF_LOCAL_LIBGAV1)
set_target_properties(avif PROPERTIES LINKER_LANGUAGE "CXX")
endif()
endif()

option(AVIF_BUILD_EXAMPLES "Build avif Examples." OFF)
if(AVIF_BUILD_EXAMPLES)
Expand Down
31 changes: 13 additions & 18 deletions apps/avifdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,18 @@ static int info(const char * inputFilename)
result = avifDecoderParse(decoder);
if (result == AVIF_RESULT_OK) {
printf("Image decoded: %s\n", inputFilename);
avifContainerDump(decoder);

printf(" * %" PRIu64 " timescales per second, %2.2f seconds (%" PRIu64 " timescales), %d frame%s\n",
decoder->timescale,
decoder->duration,
decoder->durationInTimescales,
decoder->imageCount,
(decoder->imageCount == 1) ? "" : "s");
printf(" * Frames:\n");

int frameIndex = 0;
avifBool firstImage = AVIF_TRUE;
while (avifDecoderNextImage(decoder) == AVIF_RESULT_OK) {
if (firstImage) {
firstImage = AVIF_FALSE;
avifImageDump(decoder->image);

printf(" * %" PRIu64 " timescales per second, %2.2f seconds (%" PRIu64 " timescales), %d frame%s\n",
decoder->timescale,
decoder->duration,
decoder->durationInTimescales,
decoder->imageCount,
(decoder->imageCount == 1) ? "" : "s");
printf(" * Frames:\n");
}

printf(" * Decoded frame [%d] [pts %2.2f (%" PRIu64 " timescales)] [duration %2.2f (%" PRIu64 " timescales)]\n",
frameIndex,
decoder->imageTiming.pts,
Expand Down Expand Up @@ -214,7 +209,7 @@ int main(int argc, char * argv[])
if (decodeResult == AVIF_RESULT_OK) {
printf("Image decoded: %s\n", inputFilename);
printf("Image details:\n");
avifImageDump(avif);
avifImageDump(avif, 0, 0);

if (ignoreICC && (avif->icc.size > 0)) {
printf("[--ignore-icc] Discarding ICC profile.\n");
Expand All @@ -226,15 +221,15 @@ int main(int argc, char * argv[])
fprintf(stderr, "Cannot determine output file extension: %s\n", outputFilename);
returnCode = 1;
} else if (outputFormat == AVIF_APP_FILE_FORMAT_Y4M) {
if (!y4mWrite(avif, outputFilename)) {
if (!y4mWrite(outputFilename, avif)) {
returnCode = 1;
}
} else if (outputFormat == AVIF_APP_FILE_FORMAT_JPEG) {
if (!avifJPEGWrite(avif, outputFilename, jpegQuality, chromaUpsampling)) {
if (!avifJPEGWrite(outputFilename, avif, jpegQuality, chromaUpsampling)) {
returnCode = 1;
}
} else if (outputFormat == AVIF_APP_FILE_FORMAT_PNG) {
if (!avifPNGWrite(avif, outputFilename, requestedDepth, chromaUpsampling)) {
if (!avifPNGWrite(outputFilename, avif, requestedDepth, chromaUpsampling)) {
returnCode = 1;
}
} else {
Expand Down
Loading