summaryrefslogtreecommitdiff
path: root/src/android/jpeg/encoder_libjpeg.cpp
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-09-02 09:44:11 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-06 15:27:21 +0200
commit22ccbe2e5cdf00d6352b19d07e274105967161c5 (patch)
tree42be445acc296919910dfa46ad96454705b192e8 /src/android/jpeg/encoder_libjpeg.cpp
parent4c992d6975b0135ec61b3239ceeaef2ea3125387 (diff)
ipa: ipu3: Move the AWB stats structures
The structure Ipu3AwbCell describes the AWB stats layout on the kernel side. We will need it to be used by the AGC algorithm to be introduced later, so let's make it visible from ipa::ipu3::algorithms and not only for the AWB class. The IspStatsRegion will be needed by AGC too, so let's move it in the same namespace too. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/jpeg/encoder_libjpeg.cpp')
0 files changed, 0 insertions, 0 deletions
>64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
# SPDX-License-Identifier: BSD-2-Clause

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?'