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..e47debe --- /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", + { "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 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-gimi-ftyp.asm b/tests/gimi/valid-gimi-ftyp.asm new file mode 100644 index 0000000..f97984d --- /dev/null +++ b/tests/gimi/valid-gimi-ftyp.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-gimi-ftyp.ref b/tests/gimi/valid-gimi-ftyp.ref new file mode 100644 index 0000000..ebd5a91 --- /dev/null +++ b/tests/gimi/valid-gimi-ftyp.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 ""