Skip to content

Commit

Permalink
AVIF_ENABLE_EXPERIMENTAL_MINI instead of METAV1 (AOMediaCodec#2376)
Browse files Browse the repository at this point in the history
Update the experimental prototype implementation to the latest
specification draft.
  • Loading branch information
y-guyon authored Aug 9, 2024
1 parent 5b59345 commit 0c33338
Show file tree
Hide file tree
Showing 16 changed files with 544 additions and 483 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-static-old-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
working-directory: ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON $env:AVIF_CMAKE_C_COMPILER $env:AVIF_CMAKE_CXX_COMPILER
- name: Build libavif (ninja)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON $env:AVIF_CMAKE_C_COMPILER $env:AVIF_CMAKE_CXX_COMPILER
- name: Build libavif (ninja)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_METAV1=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ The changes are relative to the previous release, unless the baseline is specifi
* avifenc: Allow large images to be encoded.
* Fix empty CMAKE_CXX_FLAGS_RELEASE if -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF
is specified. https://github.com/AOMediaCodec/libavif/issues/2365.
* Renamed AVIF_ENABLE_EXPERIMENTAL_METAV1 to AVIF_ENABLE_EXPERIMENTAL_MINI and
updated the experimental reduced header feature to the latest specification
draft.

## [1.1.1] - 2024-07-30

Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ option(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R "Enable experimental YCgCo-R matrix code
option(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP
"Enable experimental gain map code (for HDR images that look good both on HDR and SDR displays)" OFF
)
option(AVIF_ENABLE_EXPERIMENTAL_METAV1 "Enable experimental reduced header" OFF)
option(AVIF_ENABLE_EXPERIMENTAL_MINI "Enable experimental reduced header" OFF)
option(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM "Enable experimental sample transform code" OFF)

set(AVIF_PKG_CONFIG_EXTRA_LIBS_PRIVATE "")
Expand Down Expand Up @@ -365,8 +365,8 @@ if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
endif()

if(AVIF_ENABLE_EXPERIMENTAL_METAV1)
add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_METAV1)
if(AVIF_ENABLE_EXPERIMENTAL_MINI)
add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_MINI)
endif()

if(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM)
Expand Down
10 changes: 5 additions & 5 deletions apps/avifenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ static void syntaxLong(void)
printf(" -j,--jobs J : Number of jobs (worker threads). Use \"all\" to potentially use as many cores as possible (default: all)\n");
printf(" --no-overwrite : Never overwrite existing output file\n");
printf(" -o,--output FILENAME : Instead of using the last filename given as output, use this filename\n");
#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
printf(" --metav1 : Use reduced header if possible\n");
#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI)
printf(" --mini : Use reduced header if possible (experimental, backward-incompatible)\n");
#endif
printf(" -l,--lossless : Set all defaults to encode losslessly, and emit warnings when settings/input don't allow for it\n");
printf(" -d,--depth D : Output depth [8,10,12]. (JPEG/PNG only; For y4m or stdin, depth is retained)\n");
Expand Down Expand Up @@ -1477,10 +1477,10 @@ int main(int argc, char * argv[])
} else if (!strcmp(arg, "-o") || !strcmp(arg, "--output")) {
NEXTARG();
outputFilename = arg;
#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
} else if (!strcmp(arg, "--metav1")) {
#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI)
} else if (!strcmp(arg, "--mini")) {
settings.headerFormat = AVIF_HEADER_REDUCED;
#endif // AVIF_ENABLE_EXPERIMENTAL_METAV1
#endif // AVIF_ENABLE_EXPERIMENTAL_MINI
} else if (!strcmp(arg, "-d") || !strcmp(arg, "--depth")) {
NEXTARG();
input.requestedDepth = atoi(arg);
Expand Down
6 changes: 3 additions & 3 deletions include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ typedef enum avifHeaderFormat
{
// AVIF file with an "avif" brand, a MetaBox and all its required boxes for maximum compatibility.
AVIF_HEADER_FULL,
#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
// AVIF file with a "mif3" brand and a MetaBox with version 1 to reduce the encoded file size.
// This is based on the w23988 "Low-overhead image file format" MPEG proposal for HEIF.
#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI)
// AVIF file with a "mif3" brand and a MinimizedImageBox to reduce the encoded file size.
// This is based on the w24144 "Low-overhead image file format" MPEG proposal for HEIF.
// WARNING: Experimental feature. Produces files that are incompatible with older decoders.
AVIF_HEADER_REDUCED,
#endif
Expand Down
29 changes: 2 additions & 27 deletions include/avif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,31 +418,6 @@ avifBool avifIsAlpha(avifItemCategory itemCategory);
(AVIF_ITEM_SAMPLE_TRANSFORM_INPUT_0_ALPHA + AVIF_SAMPLE_TRANSFORM_MAX_NUM_EXTRA_INPUT_IMAGE_ITEMS - 1)
#endif

// ---------------------------------------------------------------------------

#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
// HEIF pixel_format field meaning in MetaBox with version 1
typedef enum avifMetaV1PixelFormat
{
AVIF_METAV1_PIXEL_FORMAT_FLOAT16 = 0, // binary16 as defined by IEEE 754-2008
AVIF_METAV1_PIXEL_FORMAT_FLOAT32 = 1, // binary32 as defined by IEEE 754-2008
AVIF_METAV1_PIXEL_FORMAT_FLOAT64 = 2, // binary64 as defined by IEEE 754-2008
AVIF_METAV1_PIXEL_FORMAT_UINT4 = 3,
AVIF_METAV1_PIXEL_FORMAT_UINT5 = 4,
AVIF_METAV1_PIXEL_FORMAT_UINT6 = 5,
AVIF_METAV1_PIXEL_FORMAT_UINT7 = 6,
AVIF_METAV1_PIXEL_FORMAT_UINT8 = 7,
AVIF_METAV1_PIXEL_FORMAT_UINT9 = 8,
AVIF_METAV1_PIXEL_FORMAT_UINT10 = 9,
AVIF_METAV1_PIXEL_FORMAT_UINT11 = 10,
AVIF_METAV1_PIXEL_FORMAT_UINT12 = 11,
AVIF_METAV1_PIXEL_FORMAT_UINT13 = 12,
AVIF_METAV1_PIXEL_FORMAT_UINT14 = 13,
AVIF_METAV1_PIXEL_FORMAT_UINT15 = 14,
AVIF_METAV1_PIXEL_FORMAT_UINT16 = 15,
} avifMetaV1PixelFormat;
#endif // AVIF_ENABLE_EXPERIMENTAL_METAV1

// ---------------------------------------------------------------------------
// Grid AVIF images

Expand All @@ -462,11 +437,11 @@ AVIF_NODISCARD avifBool avifAreGridDimensionsValid(avifPixelFormat yuvFormat,
// image->imir on success. Returns AVIF_RESULT_INVALID_EXIF_PAYLOAD on failure.
avifResult avifImageExtractExifOrientationToIrotImir(avifImage * image);

#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI)
// Returns the Exif orientation in [1-8] as defined in JEITA CP-3451C section 4.6.4.A Orientation
// corresponding to image->irot and image->imir.
uint8_t avifImageIrotImirToExifOrientation(const avifImage * image);
#endif // AVIF_ENABLE_EXPERIMENTAL_METAV1
#endif // AVIF_ENABLE_EXPERIMENTAL_MINI

// ---------------------------------------------------------------------------
// avifCodecDecodeInput
Expand Down
4 changes: 2 additions & 2 deletions src/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ avifResult avifImageExtractExifOrientationToIrotImir(avifImage * image)
return AVIF_RESULT_OK;
}

#if defined(AVIF_ENABLE_EXPERIMENTAL_METAV1)
#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI)
uint8_t avifImageIrotImirToExifOrientation(const avifImage * image)
{
if (!(image->transformFlags & AVIF_TRANSFORM_IROT) || image->irot.angle == 0) {
Expand Down Expand Up @@ -188,7 +188,7 @@ uint8_t avifImageIrotImirToExifOrientation(const avifImage * image)
// image->imir.axis == 1
return 5; // The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
}
#endif // AVIF_ENABLE_EXPERIMENTAL_METAV1
#endif // AVIF_ENABLE_EXPERIMENTAL_MINI

avifResult avifImageSetMetadataExif(avifImage * image, const uint8_t * exif, size_t exifSize)
{
Expand Down
Loading

0 comments on commit 0c33338

Please sign in to comment.