projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix broken test.
[dcpomatic.git]
/
hacks
/
dump_j2k.py
diff --git
a/hacks/dump_j2k.py
b/hacks/dump_j2k.py
index 0d211b1a195683eebbbd9ecd30652cf62db1526c..79d2af9dc2a8e53429fd838e73706351f0b5dee2 100644
(file)
--- a/
hacks/dump_j2k.py
+++ b/
hacks/dump_j2k.py
@@
-27,6
+27,14
@@
def require(f, data, what):
raise Exception()
print what
raise Exception()
print what
+def dump(f, n, p):
+ print '\t %s' % p,
+ for i in range(0, n):
+ print '%02x' % ord(f.read(1)),
+ if (i % 16) == 15:
+ print '\n\t %s' % p,
+ print '\n'
+
f = open(sys.argv[1], 'rb')
require(f, [0xff, 0x4f], 'SOC')
f = open(sys.argv[1], 'rb')
require(f, [0xff, 0x4f], 'SOC')
@@
-71,7
+79,7
@@
if coding_style & 1:
require(f, [0xff, 0x5C], 'QCD')
size = read_16(f)
print '\tlength', size
require(f, [0xff, 0x5C], 'QCD')
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'QCD'
)
tile_part_length = None
tile_part_length = None
@@
-81,27
+89,27
@@
while True:
print 'COC'
size = read_16(f)
print '\tlength', size
print 'COC'
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'COC'
)
elif r == [0xff, 0x5c]:
print 'QCD'
size = read_16(f)
print '\tlength', size
elif r == [0xff, 0x5c]:
print 'QCD'
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'QCD'
)
elif r == [0xff, 0x5d]:
print 'QCC'
size = read_16(f)
print '\tlength', size
elif r == [0xff, 0x5d]:
print 'QCC'
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'QCC'
)
elif r == [0xff, 0x64]:
print 'COM'
size = read_16(f)
print '\tlength', size
elif r == [0xff, 0x64]:
print 'COM'
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'COM'
)
elif r == [0xff, 0x55]:
print 'TLM'
size = read_16(f)
print '\tlength', size
elif r == [0xff, 0x55]:
print 'TLM'
size = read_16(f)
print '\tlength', size
-
f.seek(size - 2, 1
)
+
dump(f, size - 2, 'TLM'
)
elif r == [0xff, 0x90]:
print 'SOT'
size = read_16(f)
elif r == [0xff, 0x90]:
print 'SOT'
size = read_16(f)
@@
-113,7
+121,7
@@
while True:
print '\tnumber of tile-parts', read_8(f)
elif r == [0xff, 0x93]:
print 'SOD'
print '\tnumber of tile-parts', read_8(f)
elif r == [0xff, 0x93]:
print 'SOD'
-
f.seek(tile_part_length - 14, 1
)
+
dump(f, tile_part_length - 14, 'SOD'
)
elif r == [0xff, 0xd9]:
print 'EOC'
sys.exit(0)
elif r == [0xff, 0xd9]:
print 'EOC'
sys.exit(0)