Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avif: Ignore still picture rules for Image Sequences #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/specs/avif/avif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ void probeAV1ImageItem(Box const& root, IReport* out, uint32_t itemId, BoxReader
return;
}
}

bool isAvifImageSequence(Box const& root)
{
// If the file contains the 'moov' box, then it is an AVIF image sequence.
for(auto& box: root.children)
if(box.fourcc == FOURCC("moov"))
return true;

return false;
}
} // namespace

std::initializer_list<RuleDesc> rulesAvifGeneral =
Expand Down Expand Up @@ -221,6 +231,10 @@ std::initializer_list<RuleDesc> rulesAvifGeneral =
"The AV1 Image Item Data should have its still_picture flag set to 1.",
[] (Box const& root, IReport* out)
{
// This rule does not apply for AVIF image sequences.
if(isAvifImageSequence(root))
return;

auto const av1ImageItemIDs = findImageItems(root, FOURCC("av01"));

for(auto itemId : av1ImageItemIDs)
Expand All @@ -243,6 +257,10 @@ std::initializer_list<RuleDesc> rulesAvifGeneral =
"The AV1 Image Item Data should have its reduced_still_picture_header flag set to 1.",
[] (Box const& root, IReport* out)
{
// This rule does not apply for AVIF image sequences.
if(isAvifImageSequence(root))
return;

auto const av1ImageItemIDs = findImageItems(root, FOURCC("av01"));

for(auto itemId : av1ImageItemIDs)
Expand Down
7 changes: 1 addition & 6 deletions tests/avif/invalid-avis-pict.ref
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ https://aomediacodec.github.io/av1-avif/
[avif][Rule #1] Error: [ItemId=4] AV1 Sample shall be marked as sync (showFrame=0, keyFrame=0)
[avif][Rule #2] Error: [ItemId=3] Expected 1 sequence Header OBU in Image Item Data but found 0
[avif][Rule #2] Error: [ItemId=4] Expected 1 sequence Header OBU in Image Item Data but found 0
[avif][Rule #4] Warning: [ItemId=3] reduced_still_picture_header flag set to 0
[avif][Rule #4] Warning: [ItemId=4] reduced_still_picture_header flag set to 0
[avif][Rule #10] Error: Primary item that is an AV1 image item found, but no track with 'pict' handler found.
[avif][Rule #11] Error: The mono_chrome field in the Sequence Header OBU shall be set to 1 (item_ID=3)
[avif][Rule #11] Error: The color_range field in the Sequence Header OBU shall be set to 1 (item_ID=3)

========================================
[avif] 7 error(s), 2 warning(s).
[avif] 7 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:
Expand All @@ -27,9 +25,6 @@ The AV1 Image Item Data shall be identical to the content of an AV1 Sample marke
[avif][Rule #2] Section 2.1
The AV1 Image Item Data shall have exactly one Sequence Header OBU.

[avif][Rule #4] Section 2.1
The AV1 Image Item Data should have its reduced_still_picture_header flag set to 1.

[avif][Rule #10] Section 3
The track handler for an AV1 Image Sequence shall be 'pict'.

Expand Down
10 changes: 1 addition & 9 deletions tests/avif/invalid-profile-track.ref
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,19 @@ Specification description: AVIF v1.0.0, 19 February 2019
https://aomediacodec.github.io/av1-avif/

[avif][Rule #1] Error: [ItemId=1] AV1 Sample shall be marked as sync (showFrame=0, keyFrame=0)
[avif][Rule #3] Warning: [ItemId=1] still_picture flag set to 0
[avif][Rule #4] Warning: [ItemId=1] reduced_still_picture_header flag set to 0
[avif][Rule #10] Error: Track with 'pict' handler found, but no primary item that is an AV1 image item found.
[avif][Rule #17] Error: Item ID=1 (image item): Baseline Profile requires AV1 Main Profile
[avif][Rule #17] Error: Item ID=2 (image sequence): Baseline Profile requires AV1 Main Profile

========================================
[avif] 4 error(s), 2 warning(s).
[avif] 4 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[avif][Rule #1] Section 2.1
The AV1 Image Item Data shall be identical to the content of an AV1 Sample marked as sync

[avif][Rule #3] Section 2.1
The AV1 Image Item Data should have its still_picture flag set to 1.

[avif][Rule #4] Section 2.1
The AV1 Image Item Data should have its reduced_still_picture_header flag set to 1.

[avif][Rule #10] Section 3
The track handler for an AV1 Image Sequence shall be 'pict'.

Expand Down