Skip to content

Commit

Permalink
Use NPY for testing jxl-oxide
Browse files Browse the repository at this point in the history
  • Loading branch information
tirr-c authored and mo271 committed Jul 31, 2023
1 parent c11230a commit 1d47eeb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/dumps/dump_jxl-dec.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/update_dumps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ python3 ./third_party/conformance/scripts/conformance.py --decoder "./third_part
# djxl via png
python3 ./third_party/conformance/scripts/conformance.py --decoder "python3 scripts/wrap_png.py --decoder './third_party/libjxl/build/tools/djxl %s %s --bits_per_sample 16'" --corpus $CORPUS --results=$DUMP_PATH/dump_djxl_via_png.json --lax
# jxl-oxide
python3 ./third_party/conformance/scripts/conformance.py --decoder "python3 scripts/wrap_png.py --decoder '/home/jon/.cargo/bin/jxl-dec %s -o %s -f png16'" --corpus $CORPUS --results=$DUMP_PATH/dump_jxl-dec.json --lax
python3 ./third_party/conformance/scripts/conformance.py --decoder "python3 scripts/wrap_jxl_oxide.py --decoder 'jxl-dec %s --icc-output %s -o %s -f npy'" --corpus $CORPUS --results=$DUMP_PATH/dump_jxl-dec.json --lax
# jxlatte
python3 ./third_party/conformance/scripts/conformance.py --decoder "python3 scripts/wrap_png.py --decoder 'java -jar ./third_party/jxlatte/build/java/jxlatte.jar %s %s --png-depth=16'" --corpus $CORPUS --results=$DUMP_PATH/dump_jxlatte.json --lax
# j40
Expand Down
61 changes: 61 additions & 0 deletions scripts/wrap_jxl_oxide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
import sys
import subprocess
import argparse
import shlex
import json
import os

def write_metadata(args):
with open(args.metadata_out, 'w') as f:
json.dump({"frames": [ { "name": "", } ], }, f)

# Skip for now
def write_orig_icc(args):
return


def write_reconstruct_jpg(args):
with open(args.output, 'w') as f:
pass

def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('input',
metavar='INPUT',
help='path to the input .jxl file')
parser.add_argument('output',
metavar='OUTPUT',
help='path to the output .npy file')
parser.add_argument('--decoder_format',
metavar='DECODER',
required=True,
help='path to the decoder binary assuming that the three %s syntax')
parser.add_argument('--orig_icc_out',
metavar='ORIG_ICC_OUT',
help='path to the original ICC output')
parser.add_argument('--metadata_out',
metavar='METADATA_OUT',
help='path to the metadata output')
parser.add_argument('--icc_out',
metavar='ICC_OUT',
help='path to the ICC output')
parser.add_argument('--norender_spotcolors',
action='store_true',
help='flag to disable rendering of spot colors')
parser.add_argument('--output_flag',
metavar='OUTPUT_FLAG',
help='the name of hte flag used by the decoder to communicate the output file')

args = parser.parse_args()

if args.output.endswith('.jpg'):
write_reconstruct_jpg(args)
return

subprocess.run(shlex.split(args.decoder_format % (args.input, args.icc_out, args.output)), check=True)
write_metadata(args)
write_orig_icc(args)

if __name__ == "__main__":
main()

0 comments on commit 1d47eeb

Please sign in to comment.