summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa')
0 files changed, 0 insertions, 0 deletions
702fb87f124'>md_parser.hpp
blob: 70d054b2c01399ee9f68d87714fe0e32f718a315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
114
115
116
117
118
119
120
121
122
123
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (C) 2019, Raspberry Pi (Trading) Limited
 *
 * md_parser.hpp - image sensor metadata parser interface
 */
#pragma once

#include <stdint.h>

/* Camera metadata parser class. Usage as shown below.

Setup:

Usually the metadata parser will be made as part of the CamHelper class so
application code doesn't have to worry which to kind to instantiate. But for
the sake of example let's suppose we're parsing imx219 metadata.

MdParser *parser = new MdParserImx219();  // for example
parser->SetBitsPerPixel(bpp);
parser->SetLineLengthBytes(pitch);
parser->SetNumLines(2);

Note 1: if you don't know how many lines there are, you can use SetBufferSize
instead to limit the total buffer size.

Note 2: if you don't know the line length, you can leave the line length unset
(or set to zero) and the parser will hunt for the line start instead. In this
case SetBufferSize *must* be used so that the parser won't run off the end of
the buffer.

Then on every frame:

if (parser->Parse(data) != MdParser::OK)
    much badness;
unsigned int exposure_lines, gain_code
if (parser->GetExposureLines(exposure_lines) != MdParser::OK)
    exposure was not found;
if (parser->GetGainCode(parser, gain_code) != MdParser::OK)
    gain code was not found;

(Note that the CamHelper class converts to/from exposure lines and time,
and gain_code / actual gain.)

If you suspect your embedded data may have changed its layout, change any line
lengths, number of lines, bits per pixel etc. that are different, and
then:

parser->Reset();

before calling Parse again. */

namespace RPi {

// Abstract base class from which other metadata parsers are derived.

class MdParser