Alpha test images have multiple ipma boxes with same values of version and flags
baumanj opened this issue · comments
Per ISO 23008-12:2017 § 9.3.1 (emphasis added):
Each
ItemPropertyAssociation
box shall be ordered by increasingitem_ID
, and there shall be at most one association box for eachitem_ID
, in anyItemPropertyAssociation
box. The version 0 should be used unless 32-bititem_ID
values are needed; similarly, flags should be equal to 0 unless there are more than 127 properties in theItemPropertyContainerBox
. There shall be at most oneItemPropertyAssociationbox
with a given pair of values of version and flags.
Looking at plum-blossom-large.profile0.10bpc.yuv420.alpha-full.avif, we can see the entirety of the the iprp
box starting at byte offset 272 (0x110):
00000110: 0000 010d 6970 7270 0000 00d6 6970 636f ....iprp....ipco
00000120: 0000 0010 7061 7370 0000 0001 0000 0001 ....pasp........
00000130: 0000 0014 6973 7065 0000 0000 0000 0800 ....ispe........
00000140: 0000 0800 0000 0010 7069 7869 0000 0000 ........pixi....
00000150: 030a 0a0a 0000 0018 6176 3143 810c 4c00 ........av1C..L.
00000160: 0a0a 1b2a bfff ffe2 8086 8482 0000 0010 ...*............
00000170: 7061 7370 0000 0001 0000 0001 0000 0014 pasp............
00000180: 6973 7065 0000 0000 0000 0800 0000 0800 ispe............
00000190: 0000 000e 7069 7869 0000 0000 010a 0000 ....pixi........
000001a0: 0018 6176 3143 810c 5c00 0a0a 1b2a bfff ..av1C..\....*..
000001b0: ffe3 8086 84d0 0000 0038 6175 7843 0000 .........8auxC..
000001c0: 0000 7572 6e3a 6d70 6567 3a6d 7065 6742 ..urn:mpeg:mpegB
000001d0: 3a63 6963 703a 7379 7374 656d 733a 6175 :cicp:systems:au
000001e0: 7869 6c69 6172 793a 616c 7068 6100 0000 xiliary:alpha...
000001f0: 0017 6970 6d61 0000 0000 0000 0001 0001 ..ipma..........
00000200: 0401 0283 8400 0000 1869 706d 6100 0000 .........ipma...
00000210: 0000 0000 0100 0205 0506 8788 89 .............
The 4 bytes prior to iprp
(0000 010d
= 269) represent the length of the box, so we dump through offset 0000 021d
.
Looking more closely at the 2 ipma
boxes:
000001ee: 0000 0017 .... ; size: 23 bytes
000001f2: 6970 6d61 ipma
000001f6: 0000 0000 .... ; version: 0x00, flags: 0x000000
000001fa: 0000 0001 .... ; entry_count: 1
000001fe: 0001 0401 .... ; (2 bytes) item_ID: 1, (1 byte) association_count: 4, (1 bit) essential: 0, (7 bits) property_index: 1
00000202: 0283 84 ... ; (1 bit) essential: false, (7 bits) property_index: 2, (1 bit) essential: true, (7 bits) property_index: 3, (1 bit) essential: true, (7 bits) property_index: 4
00000205: 0000 0018 .... ; size = 24 bytes
00000209: 6970 6d61 ipma
0000020d: 0000 0000 .... ; version = 0x00, flags = 0x000000
00000211: 0000 0001 .... ; entry_count = 1
00000215: 0002 0505 .... ; (2 bytes) item_ID: 2, (1 byte) association_count: 5, (1 bit) essential: 0, (7 bits) property_index: 5
00000219: 0687 8889 .... ; (1 bit) essential: 0, (7 bits) property_index: 6, (1 bit) essential: true, (7 bits) property_index: 7, (1 bit) essential: true, (7 bits) property_index: 8, (1 bit) essential: true, (7 bits) property_index: 9
They're adjacent to one another as expected since an ItemPropertiesBox
(iprp
) box contains an array of ItemPropertyAssociation
(ipma
) boxes:
aligned(8) class ItemPropertiesBox extends Box('iprp') {
ItemPropertyContainerBox property_container;
ItemPropertyAssociation association[];
}
However, multiple ipma
boxes should only be used when they require different versions or flag values. Given that both of these ipma
boxes have version 0x00
and flags 0x000000
, they should be combined into a single iprp
box with 2 entries like so:
6970 6d61 ipma
0000 0000 .... ; version = 0x00, flags = 0x000000
0000 0002 .... ; entry_count = 2
0001 0401 .... ; (2 bytes) item_ID: 1, (1 byte) association_count: 4, (1 bit) essential: 0, (7 bits) property_index: 1
0283 8400 .... ; (1 bit) essential: false, (7 bits) property_index: 2, (1 bit) essential: true, (7 bits) property_index: 3, (1 bit) essential: true, (7 bits) property_index: 4, first byte of 2-byte item_ID…
0205 0506 .... ; (2 bytes) item_ID: 2, (1 byte) association_count: 5, (1 bit) essential: 0, (7 bits) property_index: 5, (1 bit) essential: 0, (7 bits) property_index: 6
8788 89 ... ; (7 bits) property_index: 7, (1 bit) essential: true, (7 bits) property_index: 8, (1 bit) essential: true, (7 bits) property_index: 9