summaryrefslogtreecommitdiff
path: root/data/frames
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2025-04-04 03:12:26 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2025-04-04 03:32:30 +0300
commitce2c37356c674e5893f80786616355b4659b43ad (patch)
tree8da7297a20bcee66f73eaddcd42a84483a0b30d1 /data/frames
parenta4c13e7ce77b86cf36bc6b0a79220b97f8b2a1b8 (diff)
Convert from make to meson
Meson makes cross compilation easier. Replace the make-based build system with meson. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'data/frames')
-rw-r--r--data/frames/.gitignore3
-rw-r--r--data/frames/Makefile17
-rwxr-xr-xdata/frames/gen-lut.py58
-rw-r--r--data/frames/meson.build28
4 files changed, 64 insertions, 42 deletions
diff --git a/data/frames/.gitignore b/data/frames/.gitignore
deleted file mode 100644
index 2c0a1ff..0000000
--- a/data/frames/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-
-*.bin
diff --git a/data/frames/Makefile b/data/frames/Makefile
deleted file mode 100644
index 026cbdd..0000000
--- a/data/frames/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-
-frames=$(patsubst %.pnm.gz,%.pnm,$(wildcard *.pnm.gz))
-
-all:
- ./gen-lut.py
-
-clean:
- @rm -f *.bin
-
-%.pnm: %.pnm.gz
- gzip -dk $<
-
-install: $(frames)
- mkdir -p $(INSTALL_DIR)/frames/
- mv $(frames) $(INSTALL_DIR)/frames/
- cp *.bin $(INSTALL_DIR)/frames/
diff --git a/data/frames/gen-lut.py b/data/frames/gen-lut.py
index c3591f9..bd371a4 100755
--- a/data/frames/gen-lut.py
+++ b/data/frames/gen-lut.py
@@ -2,37 +2,38 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: 2016 Renesas Electronics Corporation
+import argparse
import math
import sys
-clu_configs = (
- ('zero', {
+clu_configs = {
+ 'zero': {
'scale': 0.0,
'a': 0.0,
'freq': 1.0,
'weights': (1.0, 1.0, 1.0)
- } ),
- ('identity', {
+ },
+ 'identity': {
'scale': 1.0,
'a': 0.0,
'freq': 1.0,
'weights': (1.0, 1.0, 1.0)
- } ),
+ },
# Keep the three weights different to generate an anisothropic
# look up table.
- ('wave', {
+ 'wave': {
'scale': 1.0,
'a': 0.1,
'freq': 3.0,
'weights': (1.0, 2.0, 3.0)
- } ),
-)
+ },
+}
-lut_configs = (
- ('zero', 0.0, 1.0, 1.0, 1.0),
- ('identity', 1.0, 1.0, 1.0, 1.0),
- ('gamma', 1.0, 0.5, 1.0, 2.0),
-)
+lut_configs = {
+ 'zero': (0.0, 1.0, 1.0, 1.0),
+ 'identity': (1.0, 1.0, 1.0, 1.0),
+ 'gamma': (1.0, 0.5, 1.0, 2.0),
+}
def clu_value(x, y, z, scale, a, freq, weights):
x = x / 16.
@@ -54,9 +55,9 @@ def generate_clu(config):
for z in range(17):
for y in range(17):
for x in range(17):
- clu.extend(clu_value(x, y, z, **config[1]))
+ clu.extend(clu_value(x, y, z, **config))
- open('clu-%s.bin' % config[0], 'wb').write(clu)
+ return clu
def gamma(vin, gamma, scale):
@@ -65,18 +66,31 @@ def gamma(vin, gamma, scale):
def generate_lut(config):
lut = bytearray()
for i in range(256):
- lut.extend([gamma(i, g, config[1]) for g in config[2:]])
+ lut.extend([gamma(i, g, config[0]) for g in config[1:]])
lut.append(0)
- open('lut-%s.bin' % config[0], 'wb').write(lut)
+ return lut
def main(argv):
- for config in clu_configs:
- generate_clu(config)
-
- for config in lut_configs:
- generate_lut(config)
+ # Parse command line arguments
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--output', '-o', metavar='file', type=str,
+ help='Output file name. Defaults to standard output if not specified.')
+ parser.add_argument('--type', '-t', dest='table_type', type=str, required=True,
+ choices=['clu', 'lut'], help='Select the look up table type.')
+ parser.add_argument('table', type=str,
+ help='Table contents')
+ args = parser.parse_args(argv[1:])
+
+ out = open(args.output, 'wb')
+
+ if args.table_type == 'clu':
+ table = generate_clu(clu_configs[args.table])
+ else:
+ table = generate_lut(lut_configs[args.table])
+
+ out.write(table)
return 0
diff --git a/data/frames/meson.build b/data/frames/meson.build
new file mode 100644
index 0000000..f4ec8e3
--- /dev/null
+++ b/data/frames/meson.build
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: CC0-1.0
+
+gen_lut = find_program('./gen-lut.py')
+gzip = find_program('gzip')
+
+tables = [
+ ['clu', 'identity'],
+ ['clu', 'wave'],
+ ['clu', 'zero'],
+ ['lut', 'gamma'],
+ ['lut', 'identity'],
+ ['lut', 'zero'],
+]
+
+foreach table : tables
+ name = '@0@-@1@.bin'.format(table[0], table[1])
+ custom_target(output : name,
+ command : [gen_lut, '-o', '@OUTPUT@', '-t', table[0], table[1]],
+ install : true,
+ install_dir : 'frames')
+endforeach
+
+custom_target(input : files('frame-reference-1024x768.pnm.gz'),
+ output : 'frame-reference-1024x768.pnm',
+ capture : true,
+ command : [gzip, '-cd', '@INPUT@'],
+ install : true,
+ install_dir : 'frames')