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

Initial GIMI spec #90

Open
wants to merge 3 commits 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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SRCS_CW+=src/specs/av1_isobmff/av1_isobmff.cpp
SRCS_CW+=src/specs/avif/avif.cpp src/specs/avif/profiles.cpp src/specs/avif/utils.cpp
SRCS_CW+=src/specs/isobmff/isobmff.cpp
SRCS_CW+=src/specs/heif/heif.cpp
SRCS_CW+=src/specs/gimi/gimi.cpp
SRCS_CW+=src/specs/miaf/miaf.cpp src/specs/miaf/audio.cpp src/specs/miaf/brands.cpp\
src/specs/miaf/derivations.cpp src/specs/miaf/colours.cpp src/specs/miaf/num_pixels.cpp\
src/specs/miaf/profiles.cpp
Expand Down
55 changes: 55 additions & 0 deletions src/specs/gimi/gimi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "core/fourcc.h"
#include "core/spec.h"

#include <cstring>

static const SpecDesc specGimi = {
"gimi",
"GEOINT Imagery Media for ISR - NGA.STND.0076",
{ "isobmff" },
{
{ "Requirement NGA.STND.0076_1.0-02\n"
"An NGA.STND.0076_1.0 file shall include the 'geo1' brand in the\n"
"compatible brands list.\n",
[](Box const &root, IReport *out) {
if(root.children.empty() || root.children[0].fourcc != FOURCC("ftyp")) {
out->error("'ftyp' box not found");
return;
}

auto &ftypBox = root.children[0];

bool found = false;

for(auto &brand : ftypBox.syms)
if(!strcmp(brand.name, "compatible_brand") && brand.value == FOURCC("geo1"))
found = true;

if(!found)
out->error("'geo1' brand not found in 'ftyp' box");
} },
{ "Requirement NGA.STND.0076_1.0-03\n"
"An NGA.STND.0076_1.0 file shall include the 'unif' brand in the\n"
"compatible brands list.\n",
[](Box const &root, IReport *out) {
if(root.children.empty() || root.children[0].fourcc != FOURCC("ftyp")) {
out->error("'ftyp' box not found");
return;
}

auto &ftypBox = root.children[0];

bool found = false;

for(auto &brand : ftypBox.syms)
if(!strcmp(brand.name, "compatible_brand") && brand.value == FOURCC("unif"))
found = true;

if(!found)
out->error("'unif' brand not found in 'ftyp' box");
} },
},
isIsobmff,
};

static auto const registered = registerSpec(&specGimi);
16 changes: 16 additions & 0 deletions tests/gimi/invalid-no-geo1-brand.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24))

ftyp_start:
dd BE(ftyp_end - ftyp_start)
dd "ftyp"
db 0x61, 0x76, 0x69, 0x73 ; "major_brand(32)" ('avis')
db 0x00, 0x00, 0x00, 0x00 ; "minor_version(32)"
db 0x6D, 0x69, 0x66, 0x31 ; "compatible_brand(32)" ('mif1')
db 0x61, 0x76, 0x69, 0x66 ; "compatible_brand(32)" ('avif')
db 0x61, 0x76, 0x30, 0x31 ; "compatible_brand(32)" ('av01')
db 0x61, 0x76, 0x69, 0x73 ; "compatible_brand(32)" ('avis')
db 0x6D, 0x73, 0x66, 0x31 ; "compatible_brand(32)" ('msf1')
db 0x69, 0x73, 0x6F, 0x37 ; "compatible_brand(32)" ('iso7')
db 0x6D, 0x69, 0x61, 0x66 ; "compatible_brand(32)" ('miaf')
db 0x4D, 0x41, 0x31, 0x42 ; "compatible_brand(32)" ('MA1B')
ftyp_end:
36 changes: 36 additions & 0 deletions tests/gimi/invalid-no-geo1-brand.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
+--------------------------------------+
| gimi validation |
+--------------------------------------+

Specification description: GEOINT Imagery Media for ISR - NGA.STND.0076

[gimi][Rule #0] Error: 'geo1' brand not found in 'ftyp' box
[gimi][Rule #1] Error: 'unif' brand not found in 'ftyp' box

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

===== Involved rules descriptions:

[gimi][Rule #0] Requirement NGA.STND.0076_1.0-02
An NGA.STND.0076_1.0 file shall include the 'geo1' brand in the
compatible brands list.


[gimi][Rule #1] Requirement NGA.STND.0076_1.0-03
An NGA.STND.0076_1.0 file shall include the 'unif' brand in the
compatible brands list.


+--------------------------------------+
| isobmff validation |
+--------------------------------------+

Specification description: ISO Base Media File Format
MPEG-4 part 12 - ISO/IEC 14496-12 - m17277 (6th+FDAM1+FDAM2+COR1-R4)

========================================
[isobmff] No errors.
========================================

17 changes: 17 additions & 0 deletions tests/gimi/valid-gimi-ftyp.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24))

ftyp_start:
dd BE(ftyp_end - ftyp_start)
dd "ftyp"
db 0x61, 0x76, 0x69, 0x73 ; "major_brand(32)" ('avis')
db 0x00, 0x00, 0x00, 0x00 ; "minor_version(32)"
db 0x6D, 0x69, 0x66, 0x31 ; "compatible_brand(32)" ('mif1')
db 0x61, 0x76, 0x69, 0x66 ; "compatible_brand(32)" ('avif')
db 0x61, 0x76, 0x30, 0x31 ; "compatible_brand(32)" ('av01')
db 0x61, 0x76, 0x69, 0x73 ; "compatible_brand(32)" ('avis')
db 0x6D, 0x73, 0x66, 0x31 ; "compatible_brand(32)" ('msf1')
db 0x67, 0x65, 0x6F, 0x31 ; "compatible_brand(32)" ('geo1')
db 0x75, 0x6E, 0x69, 0x66 ; "compatible_brand(32)" ('unif')
db 0x6D, 0x69, 0x61, 0x66 ; "compatible_brand(32)" ('miaf')
db 0x4D, 0x41, 0x31, 0x42 ; "compatible_brand(32)" ('MA1B')
ftyp_end:
21 changes: 21 additions & 0 deletions tests/gimi/valid-gimi-ftyp.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
+--------------------------------------+
| gimi validation |
+--------------------------------------+

Specification description: GEOINT Imagery Media for ISR - NGA.STND.0076

========================================
[gimi] No errors.
========================================

+--------------------------------------+
| isobmff validation |
+--------------------------------------+

Specification description: ISO Base Media File Format
MPEG-4 part 12 - ISO/IEC 14496-12 - m17277 (6th+FDAM1+FDAM2+COR1-R4)

========================================
[isobmff] No errors.
========================================

1 change: 1 addition & 0 deletions tests/run
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function main
run_test check_rules_folder heif mp4 ""
run_test check_rules_folder miaf hif ""
run_test check_rules_folder avif avif ""
run_test check_rules_folder gimi gimi ""
run_test check_rules_folder av1hdr10plus obu "| grep -v isobmff"
run_test check_rules_folder av1hdr10plus mp4 "| grep isobmff"
run_test check_rules_folder av1isobmff mp4 ""
Expand Down