From 712b9df3d792ad8d1a1be4d7372608b94bde5bbe Mon Sep 17 00:00:00 2001 From: dukesook Date: Mon, 20 Jan 2025 14:13:47 -0700 Subject: [PATCH 1/5] initial gimi.cpp file --- Makefile | 1 + src/specs/gimi/gimi.cpp | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/specs/gimi/gimi.cpp diff --git a/Makefile b/Makefile index 4fbd32f..bf6cf5e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/specs/gimi/gimi.cpp b/src/specs/gimi/gimi.cpp new file mode 100644 index 0000000..942a943 --- /dev/null +++ b/src/specs/gimi/gimi.cpp @@ -0,0 +1,55 @@ +#include "core/fourcc.h" +#include "core/spec.h" + +#include + +static const SpecDesc specGimi = { + "gimi", + "GEOINT Imagery Media for ISR - NGA.STND.0076_1.0_GIMI", + { "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); \ No newline at end of file From 5bcfb9e87f9431c44582faa19ea15f1e408a2b53 Mon Sep 17 00:00:00 2001 From: dukesook Date: Tue, 21 Jan 2025 11:17:20 -0700 Subject: [PATCH 2/5] initial tests for gimi --- src/specs/gimi/gimi.cpp | 2 +- tests/gimi/valid-brand-geo1.asm | 17 +++++++++++++++++ tests/gimi/valid-brand-geo1.ref | 21 +++++++++++++++++++++ tests/run | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/gimi/valid-brand-geo1.asm create mode 100644 tests/gimi/valid-brand-geo1.ref diff --git a/src/specs/gimi/gimi.cpp b/src/specs/gimi/gimi.cpp index 942a943..e47debe 100644 --- a/src/specs/gimi/gimi.cpp +++ b/src/specs/gimi/gimi.cpp @@ -5,7 +5,7 @@ static const SpecDesc specGimi = { "gimi", - "GEOINT Imagery Media for ISR - NGA.STND.0076_1.0_GIMI", + "GEOINT Imagery Media for ISR - NGA.STND.0076", { "isobmff" }, { { "Requirement NGA.STND.0076_1.0-02\n" diff --git a/tests/gimi/valid-brand-geo1.asm b/tests/gimi/valid-brand-geo1.asm new file mode 100644 index 0000000..f97984d --- /dev/null +++ b/tests/gimi/valid-brand-geo1.asm @@ -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: diff --git a/tests/gimi/valid-brand-geo1.ref b/tests/gimi/valid-brand-geo1.ref new file mode 100644 index 0000000..ebd5a91 --- /dev/null +++ b/tests/gimi/valid-brand-geo1.ref @@ -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. +======================================== + diff --git a/tests/run b/tests/run index 8df72ae..70ed5de 100755 --- a/tests/run +++ b/tests/run @@ -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 "" From 0188d4e62f4920da5ff1a057d3ab33c05bcfc130 Mon Sep 17 00:00:00 2001 From: dukesook Date: Tue, 21 Jan 2025 11:27:50 -0700 Subject: [PATCH 3/5] Gimi test case: no geo1 brand --- tests/gimi/invalid-no-geo1-brand.asm | 16 +++++++++ tests/gimi/invalid-no-geo1-brand.ref | 36 +++++++++++++++++++ ...lid-brand-geo1.asm => valid-gimi-ftyp.asm} | 0 ...lid-brand-geo1.ref => valid-gimi-ftyp.ref} | 0 4 files changed, 52 insertions(+) create mode 100644 tests/gimi/invalid-no-geo1-brand.asm create mode 100644 tests/gimi/invalid-no-geo1-brand.ref rename tests/gimi/{valid-brand-geo1.asm => valid-gimi-ftyp.asm} (100%) rename tests/gimi/{valid-brand-geo1.ref => valid-gimi-ftyp.ref} (100%) diff --git a/tests/gimi/invalid-no-geo1-brand.asm b/tests/gimi/invalid-no-geo1-brand.asm new file mode 100644 index 0000000..2a0989d --- /dev/null +++ b/tests/gimi/invalid-no-geo1-brand.asm @@ -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: \ No newline at end of file diff --git a/tests/gimi/invalid-no-geo1-brand.ref b/tests/gimi/invalid-no-geo1-brand.ref new file mode 100644 index 0000000..2ae5fd5 --- /dev/null +++ b/tests/gimi/invalid-no-geo1-brand.ref @@ -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. +======================================== + diff --git a/tests/gimi/valid-brand-geo1.asm b/tests/gimi/valid-gimi-ftyp.asm similarity index 100% rename from tests/gimi/valid-brand-geo1.asm rename to tests/gimi/valid-gimi-ftyp.asm diff --git a/tests/gimi/valid-brand-geo1.ref b/tests/gimi/valid-gimi-ftyp.ref similarity index 100% rename from tests/gimi/valid-brand-geo1.ref rename to tests/gimi/valid-gimi-ftyp.ref From bab5a553071fdca0e07cb8a5b7ff7b471f894240 Mon Sep 17 00:00:00 2001 From: dukesook Date: Wed, 22 Jan 2025 13:03:47 -0700 Subject: [PATCH 4/5] gimi: add first 10 rules (to be implemented later) --- src/specs/gimi/gimi.cpp | 55 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/specs/gimi/gimi.cpp b/src/specs/gimi/gimi.cpp index e47debe..d9af246 100644 --- a/src/specs/gimi/gimi.cpp +++ b/src/specs/gimi/gimi.cpp @@ -28,9 +28,9 @@ static const SpecDesc specGimi = { 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", + "An NGA.STND.0076_1.0 file shall include the 'unif' brand in the 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"); @@ -48,6 +48,57 @@ static const SpecDesc specGimi = { if(!found) out->error("'unif' brand not found in 'ftyp' box"); } }, + + { "Requirement NGA.STND.0076_1.0-04\n" + "An NGA.STND.0076 file shall include the 'unif' brand in the compatible brands list.", + [](Box const &root, IReport *out) { + /* TODO: The 'unif' brand indicates the unified implementation and handling of + IDs across file-scoped MetaBox items, tracks, track groups, and entity groups. + */ + } }, + + { "Requirement NGA.STND.0076_1.0-05\n" + "Where an NGA.STND.0076 file contains Still Imagery content, the file shall conform to the 'mif2' brand " + "requirements.", + [](Box const &root, IReport *out) { + /* TODO: The ‘mif2’ brand represents interoperability requirements for image and metadata items. ‘mif2’ + * represents a baseline for Still Imagery support in this standard. The HEIF standard documents the specifics + * of the branding differences.*/ + } }, + + { "Requirement NGA.STND.0076_1.0-06\n" + "Where an NGA.STND.0076 file contains Still Imagery content, the file shall include 'mif2' brand.", + [](Box const &root, IReport *out) { + /* TODO: */ + } }, + + { "Requirement NGA.STND.0076_1.0-07\n" + "Where an NGA.STND.0076 file contains image sequence content, the file shall conform to the requirements " + "associated with the 'msf1' brand.", + [](Box const &root, IReport *out) { + /* TODO: The 'msf1' brand indicates the presence of a HEIF defined image sequence.*/ + } }, + + { "Requirement NGA.STND.0076_1.0-08\n" + "Where an NGA.STND.0076 file contains image sequence content, the file shall include the 'msf1' brand.", + [](Box const &root, IReport *out) { + /* TODO: */ + } }, + + { "Requirement NGA.STND.0076_1.0-09\n" + "Where an NGA.STND.0076 file contains Motion Imagery content, the file shall conform to the requirements " + "associated with the 'isoa' brand.", + [](Box const &root, IReport *out) { + /* TODO: The ‘isoa’ brand represents interoperability requirements for the base format as well as Motion Imagery + * requirements for this standard. */ + } }, + + { "Requirement NGA.STND.0076_1.0-10\n" + "NGA.STND.0076_1.0-10 Where an NGA.STND.0076 file contains Motion Imagery content, the file shall include " + "the 'isoa' brand.", + [](Box const &root, IReport *out) { + /* TODO: */ + } }, }, isIsobmff, }; From e225d06d141d6638ce831b0498cf9a81d6cadee0 Mon Sep 17 00:00:00 2001 From: dukesook Date: Wed, 22 Jan 2025 13:14:09 -0700 Subject: [PATCH 5/5] gimi: 'use' root & out variables to temporarily bypass warnings --- src/specs/gimi/gimi.cpp | 15 +++++++++++++++ tests/gimi/invalid-no-geo1-brand.ref | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/specs/gimi/gimi.cpp b/src/specs/gimi/gimi.cpp index d9af246..4b4f505 100644 --- a/src/specs/gimi/gimi.cpp +++ b/src/specs/gimi/gimi.cpp @@ -52,6 +52,8 @@ static const SpecDesc specGimi = { { "Requirement NGA.STND.0076_1.0-04\n" "An NGA.STND.0076 file shall include the 'unif' brand in the compatible brands list.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: The 'unif' brand indicates the unified implementation and handling of IDs across file-scoped MetaBox items, tracks, track groups, and entity groups. */ @@ -61,6 +63,8 @@ static const SpecDesc specGimi = { "Where an NGA.STND.0076 file contains Still Imagery content, the file shall conform to the 'mif2' brand " "requirements.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: The ‘mif2’ brand represents interoperability requirements for image and metadata items. ‘mif2’ * represents a baseline for Still Imagery support in this standard. The HEIF standard documents the specifics * of the branding differences.*/ @@ -69,6 +73,8 @@ static const SpecDesc specGimi = { { "Requirement NGA.STND.0076_1.0-06\n" "Where an NGA.STND.0076 file contains Still Imagery content, the file shall include 'mif2' brand.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: */ } }, @@ -76,12 +82,16 @@ static const SpecDesc specGimi = { "Where an NGA.STND.0076 file contains image sequence content, the file shall conform to the requirements " "associated with the 'msf1' brand.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: The 'msf1' brand indicates the presence of a HEIF defined image sequence.*/ } }, { "Requirement NGA.STND.0076_1.0-08\n" "Where an NGA.STND.0076 file contains image sequence content, the file shall include the 'msf1' brand.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: */ } }, @@ -89,6 +99,8 @@ static const SpecDesc specGimi = { "Where an NGA.STND.0076 file contains Motion Imagery content, the file shall conform to the requirements " "associated with the 'isoa' brand.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: The ‘isoa’ brand represents interoperability requirements for the base format as well as Motion Imagery * requirements for this standard. */ } }, @@ -97,8 +109,11 @@ static const SpecDesc specGimi = { "NGA.STND.0076_1.0-10 Where an NGA.STND.0076 file contains Motion Imagery content, the file shall include " "the 'isoa' brand.", [](Box const &root, IReport *out) { + (void)root; + (void)out; /* TODO: */ } }, + }, isIsobmff, }; diff --git a/tests/gimi/invalid-no-geo1-brand.ref b/tests/gimi/invalid-no-geo1-brand.ref index 2ae5fd5..83b493c 100644 --- a/tests/gimi/invalid-no-geo1-brand.ref +++ b/tests/gimi/invalid-no-geo1-brand.ref @@ -19,8 +19,7 @@ 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. +An NGA.STND.0076_1.0 file shall include the 'unif' brand in the compatible brands list. +--------------------------------------+