]> git.cworth.org Git - apitrace/commitdiff
retracediff: Dump mismtached float images to stdout.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 16 Sep 2013 13:59:33 +0000 (14:59 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 16 Sep 2013 13:59:33 +0000 (14:59 +0100)
Should have an option in the future, as it will be too verbose in general.

scripts/retracediff.py

index 71e9f06473d38f38dd2e9f8259ad1b1104b10bef..18a97f63c158ee5473ca9b329198bc7397985c85 100755 (executable)
@@ -179,6 +179,17 @@ def read_pnm(stream):
     return image, comment
 
 
+def dumpNumpyImage(output, pixels):
+    height, width, channels = pixels.shape
+    for y in range(height):
+        output.write('  ')
+        for x in range(width):
+            for c in range(channels):
+                output.write('%0.9g,' % pixels[y, x, c])
+            output.write('  ')
+        output.write('\n')
+
+
 def parse_env(optparser, entries):
     '''Translate a list of NAME=VALUE entries into an environment dictionary.'''
 
@@ -328,6 +339,10 @@ def main():
                     highligher.normal()
 
                 if mismatch:
+                    if numpyImages:
+                        dumpNumpyImage(output, refImage)
+                        output.write("->\n")
+                        dumpNumpyImage(output, srcImage)
                     if options.diff_prefix and not numpyImages:
                         prefix = os.path.join(options.diff_prefix, '%010u' % callNo)
                         prefix_dir = os.path.dirname(prefix)