mirror of
https://github.com/wader/fq.git
synced 2024-11-23 00:57:15 +03:00
Merge pull request #921 from wader/mp4-jp2-boxes
mp4: JPEG200 boxes jp2h and ihdr
This commit is contained in:
commit
5cbda8fbb0
@ -1798,6 +1798,27 @@ func decodeBox(ctx *decodeContext, d *decode.D, typ string) {
|
||||
default:
|
||||
d.FieldRawLen("message_data", d.BitsLeft())
|
||||
}
|
||||
case "jp2h":
|
||||
decodeBoxes(ctx, d)
|
||||
case "ihdr":
|
||||
d.FieldU32("width")
|
||||
d.FieldU32("height")
|
||||
d.FieldU16("nc")
|
||||
d.FieldU8("bpc", scalar.UintActualAdd(1))
|
||||
d.FieldU8("c", scalar.UintMapSymStr{
|
||||
0: "uncompressed",
|
||||
1: "modified_huffman",
|
||||
2: "modified_read",
|
||||
3: "modified_modified_read",
|
||||
4: "jbig_bi_level",
|
||||
5: "jpeg",
|
||||
6: "jpeg_ls",
|
||||
7: "jpeg_2000",
|
||||
8: "jbig2",
|
||||
9: "jbig",
|
||||
})
|
||||
d.FieldU8("unk_c")
|
||||
d.FieldU8("ipr")
|
||||
|
||||
default:
|
||||
// there are at least 4 ways to encode udta metadata in mov/mp4 files.
|
||||
|
BIN
format/mp4/testdata/test.jp2
vendored
Normal file
BIN
format/mp4/testdata/test.jp2
vendored
Normal file
Binary file not shown.
42
format/mp4/testdata/test.jp2.fqtest
vendored
Normal file
42
format/mp4/testdata/test.jp2.fqtest
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# gm convert "xc:#000000" test.jp2
|
||||
$ fq dv test.jp2
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: test.jp2 (mp4) 0x0-0xf9 (249)
|
||||
| | | boxes[0:4]: 0x0-0xf9 (249)
|
||||
| | | [0]{}: box 0x0-0xc (12)
|
||||
0x00|00 00 00 0c |.... | size: 12 0x0-0x4 (4)
|
||||
0x00| 6a 50 20 20 | jP | type: "jP " (JPEG 2000 Signature) 0x4-0x8 (4)
|
||||
0x00| 0d 0a 87 0a | .... | data: raw bits 0x8-0xc (4)
|
||||
| | | [1]{}: box 0xc-0x20 (20)
|
||||
0x00| 00 00 00 14| ....| size: 20 0xc-0x10 (4)
|
||||
0x10|66 74 79 70 |ftyp | type: "ftyp" (File type and compatibility) 0x10-0x14 (4)
|
||||
0x10| 6a 70 32 20 | jp2 | major_brand: "jp2" 0x14-0x18 (4)
|
||||
0x10| 00 00 00 00 | .... | minor_version: 0 0x18-0x1c (4)
|
||||
| | | brands[0:1]: 0x1c-0x20 (4)
|
||||
0x10| 6a 70 32 20| jp2 | [0]: "jp2" brand 0x1c-0x20 (4)
|
||||
| | | [2]{}: box 0x20-0x4d (45)
|
||||
0x20|00 00 00 2d |...- | size: 45 0x20-0x24 (4)
|
||||
0x20| 6a 70 32 68 | jp2h | type: "jp2h" (Header) 0x24-0x28 (4)
|
||||
| | | boxes[0:2]: 0x28-0x4d (37)
|
||||
| | | [0]{}: box 0x28-0x3e (22)
|
||||
0x20| 00 00 00 16 | .... | size: 22 0x28-0x2c (4)
|
||||
0x20| 69 68 64 72| ihdr| type: "ihdr" (Image Header) 0x2c-0x30 (4)
|
||||
0x30|00 00 00 01 |.... | width: 1 0x30-0x34 (4)
|
||||
0x30| 00 00 00 01 | .... | height: 1 0x34-0x38 (4)
|
||||
0x30| 00 01 | .. | nc: 1 0x38-0x3a (2)
|
||||
0x30| 0f | . | bpc: 16 0x3a-0x3b (1)
|
||||
0x30| 07 | . | c: "jpeg_2000" (7) 0x3b-0x3c (1)
|
||||
0x30| 00 | . | unk_c: 0 0x3c-0x3d (1)
|
||||
0x30| 00 | . | ipr: 0 0x3d-0x3e (1)
|
||||
| | | [1]{}: box 0x3e-0x4d (15)
|
||||
0x30| 00 00| ..| size: 15 0x3e-0x42 (4)
|
||||
0x40|00 0f |.. |
|
||||
0x40| 63 6f 6c 72 | colr | type: "colr" (Specifies the colourspace of the image) 0x42-0x46 (4)
|
||||
0x40| 01 00 00 00 | .... | parameter_type: "\x01\x00\x00\x00" 0x46-0x4a (4)
|
||||
0x40| 00 00 11 | ... | data: raw bits 0x4a-0x4d (3)
|
||||
| | | [3]{}: box 0x4d-0xf9 (172)
|
||||
0x40| 00 00 00| ...| size: 0 (Rest of file) 0x4d-0x51 (4)
|
||||
0x50|00 |. |
|
||||
0x50| 6a 70 32 63 | jp2c | type: "jp2c" (JPEG 2000 contiguous codestream) 0x51-0x55 (4)
|
||||
0x50| ff 4f ff 51 00 29 00 00 00 00 00| .O.Q.).....| data: raw bits 0x55-0xf9 (164)
|
||||
0x60|01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
* |until 0xf8.7 (end) (164) | |
|
Loading…
Reference in New Issue
Block a user