{ "version": 2.0, "target": "bcm2835", "algorithms": [ { "rpi.black_level": { "black_level": 4096 } }, { "rpi.dpc": { } }, { "rpi.lux": { "reference_shutter_speed": 27685, "reference_gain": 1.0, "reference_aperture": 1.0, "reference_lux": 998, "reference_Y": 12744 } }, { "rpi.noise": { "reference_constant": 0, "reference_slope": 3.67 } }, { "rpi.geq": { "offset": 204, "slope": 0.01633 } }, { "rpi.sdn": { } }, { "rpi.awb": { "priors": [ { "lux": 0, "prior": [ 2000, 1.0, 3000, 0.0, 13000, 0.0 ] }, { "lux": 800, "prior": [ 2000, 0.0, 6000, 2.0, 13000, 2.0 ] }, { "lux": 1500, "prior": [ 2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0 ] } ], "modes": { "auto": { "lo": 2500, "hi": 8000 }, "incandescent": { "lo": 2500, "hi": 3000 }, "tungsten": { "lo": 3000, "hi": 3500 }, "fluorescent": { "lo": 4000, "hi": 4700 }, "indoor": { "lo": 3000, "hi": 5000 }, "daylight": { "lo": 5500, "hi": 6500 }, "cloudy": { "lo": 7000, "hi": 8600 } }, "bayes": 1, "ct_curve": [ 2498.0, 0.9309, 0.3599, 2911.0, 0.8682, 0.4283, 2919.0, 0.8358, 0.4621, 3627.0, 0.7646, 0.5327, 4600.0, 0.6079, 0.6721, 5716.0, 0.5712, 0.7017, 8575.0, 0.4331, 0.8037 ], "sensitivity_r": 1.05, "sensitivity_b": 1.05, "transverse_pos": 0.04791, "transverse_neg": 0.04881 } }, { "rpi.agc": { "metering_modes": { "centre-weighted": { "weights": [ 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0 ] }, "spot": { "weights": [ 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, "matrix": { "weights": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] } }, "exposure_modes": { "normal": { "shutter": [ 100, 10000, 30000, 60000, 66666 ], "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ] }, "short": { "shutter": [ 100, 5000, 10000, 20000, 33333 ], "gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ] }, "long": { "shutter": [ 100, 10000, 30000, 60000, 120000 ], "gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ] } }, "constraint_modes": { "normal": [ { "bound": "LOWER", "q_lo": 0.98, "q_hi": 1.0, "y_target": [ 0, 0.5, 1000, 0.5 ] } ], "highlight": [ { "bound": "LOWER", "q_lo": 0.98, "q_hi": 1.0, "y_target": [ 0, 0.5, 1000, 0.5 ] }, { "bound": "UPPER", "q_lo": 0.98, "q_hi": 1.0, "y_target": [ 0, 0.8, 1000, 0.8 ] } ], "shadows": [ { "bound": "LOWER", "q_lo": 0.0, "q_hi": 0.5, "y_target": [ 0, 0.17, 1000, 0.17 ] } ] }, "y_target": [ import re import sys import os if len(sys.argv) != 2: print("Usage: {} <infile>".format(sys.argv[0])) sys.exit() infile = sys.argv[1] insplit = os.path.splitext(infile) outfile = insplit[0] + '_parsed' + insplit[1] frame_re = re.compile(r'frame (\d+) started') delays = { 'Analogue Gain': 1, 'Exposure': 2, 'Vertical Blanking': 2 } ctrl_action = { 'Write': {}, 'Get': {}, 'Queue': {}, 'No-op': {} } ctrl_re = { 'Write': re.compile(r'Setting (.*?) to (\d+) at index (\d+)'), 'No-op': re.compile(r'Queue is empty, (.*?) (.*?) (.*?)'), 'Get': re.compile(r'Reading (.*?) to (\d+) at index (\d+)'), 'Queue': re.compile(r'Queuing (.*?) to (\d+) at index (\d+)') } frame_num = -1 max_delay = 0 for k, d in delays.items(): if max_delay < d: max_delay = d with open(infile) as f: lines = f.readlines() for line in lines: r = frame_re.search(line) if r: frame_num = int(r.group(1)) for (key, re) in ctrl_re.items(): r = re.search(line) if r: ctrl_action[key][(frame_num, r.group(1))] = (r.group(2), r.group(3)) with open(outfile, 'wt') as f: queueIndex = 1 f.write('{:<10}{:<15}{:<12}{:<18}{}\n'.format('Frame', 'Action', 'Gain', 'Exposure', 'Vblank')) for frame in range(0, frame_num + 1): for (k, a) in ctrl_action.items(): str = '{:<10}{:<10}'.format(frame, k) for c in delays.keys(): # Tabulate all results str += '{:>5} {:<10}'.format(a[(frame, c)][0] if (frame, c) in a.keys() else '---', '[' + (a[(frame, c)][1] if (frame, c) in a.keys() else '-') + ']') f.write(str.strip() + '\n') # Test the write -> get matches the set delay. for (frame, c) in ctrl_action['Write'].keys(): set_value = ctrl_action['Write'][(frame, c)][0] delay_frame = frame + delays[c] if (delay_frame <= frame_num): if (delay_frame, c) in ctrl_action['Get']: get_value = ctrl_action['Get'][(delay_frame, c)][0] if get_value != set_value: print('Error: {} written at frame {} to value {} != {} at frame {}' .format(c, frame, set_value, get_value, delay_frame)) else: print('Warning: {} written at frame {} to value {} did not get logged on frame {} - dropped frame?' .format(c, frame, set_value, delay_frame)) # Test the queue -> write matches the set delay. for (frame, c) in ctrl_action['Queue'].keys(): set_value = ctrl_action['Queue'][(frame, c)][0] delay_frame = frame + max_delay - delays[c] + 1 if (delay_frame <= frame_num): if (delay_frame, c) in ctrl_action['Write']: write_value = ctrl_action['Write'][(delay_frame, c)][0] if write_value != set_value: print('Info: {} queued at frame {} to value {} != {} written at frame {}' ' - lagging behind or double queue on a single frame!' .format(c, frame, set_value, write_value, delay_frame)) else: print('Warning: {} queued at frame {} to value {} did not get logged on frame {} - dropped frame?' .format(c, frame, set_value, delay_frame)) # Test the get -> write matches the set delay going backwards. for (frame, c) in ctrl_action['Get'].keys(): get_value = ctrl_action['Get'][(frame, c)][0] delay_frame = frame - delays[c] if (delay_frame >= 6): if (delay_frame, c) in ctrl_action['Write']: write_value = ctrl_action['Write'][(delay_frame, c)][0] if get_value != write_value: print('Info: {} got at frame {} to value {} != {} written at frame {}' ' - lagging behind or double queue on a single frame!' .format(c, frame, get_value, write_value, delay_frame)) else: print('Warning: {} got at frame {} to value {} did not get written on frame {}' .format(c, frame, get_value, delay_frame))