title> <meta name='generator' content='cgit v1.2.1'/> <meta name='robots' content='index, nofollow'/> <link rel='stylesheet' type='text/css' href='/cgit-css/cgit.css'/> <link rel='shortcut icon' href='/favicon.ico'/> <link rel='alternate' title='Atom feed' href='https://git.libcamera.org/libcamera/libcamera.git/atom/src/ipa/libipa/histogram.h?h=v0.1.0' type='application/atom+xml'/> <link rel='vcs-git' href='https://git.libcamera.org/libcamera/libcamera.git' title='libcamera/libcamera.git Git repository'/> </head> <body> <div id='cgit'><table id='header'> <tr> <td class='logo' rowspan='2'><a href='/'><img src='/logo.png' alt='cgit logo'/></a></td> <td class='main'><a href='/'>index</a> : <a title='libcamera/libcamera.git' href='/libcamera/libcamera.git/'>libcamera/libcamera.git</a></td><td class='form'><form method='get'> <input type='hidden' name='id' value='e9b6b362820338d0546563444e7b1767f5c7044c'/><select name='h' onchange='this.form.submit();'> <option value='master'>master</option> </select> <input type='submit' value='switch'/></form></td></tr> <tr><td class='sub'>libcamera official repository</td><td class='sub right'>git repository hosting on libcamera.org</td></tr></table> <table class='tabs'><tr><td> <a href='/libcamera/libcamera.git/?h=v0.1.0'>summary</a><a href='/libcamera/libcamera.git/refs/?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>refs</a><a href='/libcamera/libcamera.git/log/src/ipa/libipa/histogram.h?h=v0.1.0'>log</a><a class='active' href='/libcamera/libcamera.git/tree/src/ipa/libipa/histogram.h?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>tree</a><a href='/libcamera/libcamera.git/commit/src/ipa/libipa/histogram.h?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>commit</a><a href='/libcamera/libcamera.git/diff/src/ipa/libipa/histogram.h?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>diff</a></td><td class='form'><form class='right' method='get' action='/libcamera/libcamera.git/log/src/ipa/libipa/histogram.h'> <input type='hidden' name='h' value='v0.1.0'/><input type='hidden' name='id' value='e9b6b362820338d0546563444e7b1767f5c7044c'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/libcamera/libcamera.git/tree/?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>root</a>/<a href='/libcamera/libcamera.git/tree/src?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>src</a>/<a href='/libcamera/libcamera.git/tree/src/ipa?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>ipa</a>/<a href='/libcamera/libcamera.git/tree/src/ipa/libipa?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>libipa</a>/<a href='/libcamera/libcamera.git/tree/src/ipa/libipa/histogram.h?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>histogram.h</a></div><div class='content'>blob: 164d4603395eb46aa131ce266ae7bd57e3f66848 (<a href='/libcamera/libcamera.git/plain/src/ipa/libipa/histogram.h?h=v0.1.0&id=e9b6b362820338d0546563444e7b1767f5c7044c'>plain</a>) <table summary='blob content' class='blob'> <tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a> <a id='n2' href='#n2'>2</a> <a id='n3' href='#n3'>3</a> <a id='n4' href='#n4'>4</a> <a id='n5' href='#n5'>5</a> <a id='n6' href='#n6'>6</a> <a id='n7' href='#n7'>7</a> <a id='n8' href='#n8'>8</a> <a id='n9' href='#n9'>9</a> <a id='n10' href='#n10'>10</a> <a id='n11' href='#n11'>11</a> <a id='n12' href='#n12'>12</a> <a id='n13' href='#n13'>13</a> <a id='n14' href='#n14'>14</a> <a id='n15' href='#n15'>15</a> <a id='n16' href='#n16'>16</a> <a id='n17' href='#n17'>17</a> <a id='n18' href='#n18'>18</a> <a id='n19' href='#n19'>19</a> <a id='n20' href='#n20'>20</a> <a id='n21' href='#n21'>21</a> <a id='n22' href='#n22'>22</a> <a id='n23' href='#n23'>23</a> <a id='n24' href='#n24'>24</a> <a id='n25' href='#n25'>25</a> <a id='n26' href='#n26'>26</a> <a id='n27' href='#n27'>27</a> <a id='n28' href='#n28'>28</a> <a id='n29' href='#n29'>29</a> <a id='n30' href='#n30'>30</a> <a id='n31' href='#n31'>31</a> <a id='n32' href='#n32'>32</a> <a id='n33' href='#n33'>33</a> <a id='n34' href='#n34'>34</a> <a id='n35' href='#n35'>35</a> <a id='n36' href='#n36'>36</a> <a id='n37' href='#n37'>37</a> <a id='n38' href='#n38'>38</a> </pre></td> <td class='lines'><pre><code><span class="hl com">/* SPDX-License-Identifier: BSD-2-Clause */</span> <span class="hl com">/*</span> <span class="hl com"> * Copyright (C) 2019, Raspberry Pi (Trading) Limited</span> <span class="hl com"> *</span> <span class="hl com"> * histogram.h - histogram calculation interface</span> <span class="hl com"> */</span> <span class="hl ppc">#pragma once</span> <span class="hl ppc">#include <assert.h></span> <span class="hl ppc">#include <limits.h></span> <span class="hl ppc">#include <stdint.h></span> <span class="hl ppc">#include <vector></span> <span class="hl ppc">#include <libcamera/base/span.h></span> <span class="hl kwa">namespace</span> libcamera <span class="hl opt">{</span> <span class="hl kwa">namespace</span> ipa <span class="hl opt">{</span> <span class="hl kwc">class</span> Histogram <span class="hl opt">{</span> <span class="hl kwc">public</span><span class="hl opt">:</span> <span class="hl kwd">Histogram</span><span class="hl opt">(</span>Span<span class="hl opt"><</span><span class="hl kwb">const uint32_t</span><span class="hl opt">></span> data<span class="hl opt">);</span> <span class="hl kwb">size_t</span> <span class="hl kwd">bins</span><span class="hl opt">()</span> <span class="hl kwb">const</span> <span class="hl opt">{</span> <span class="hl kwa">return</span> cumulative_<span class="hl opt">.</span><span class="hl kwd">size</span><span class="hl opt">() -</span> <span class="hl num">1</span><span class="hl opt">; }</span> <span class="hl kwb">uint64_t</span> <span class="hl kwd">total</span><span class="hl opt">()</span> <span class="hl kwb">const</span> <span class="hl opt">{</span> <span class="hl kwa">return</span> cumulative_<span class="hl opt">[</span>cumulative_<span class="hl opt">.</span><span class="hl kwd">size</span><span class="hl opt">() -</span> <span class="hl num">1</span><span class="hl opt">]; }</span> <span class="hl kwb">uint64_t</span> <span class="hl kwd">cumulativeFrequency</span><span class="hl opt">(</span><span class="hl kwb">double</span> bin<span class="hl opt">)</span> <span class="hl kwb">const</span><span class="hl opt">;</span> <span class="hl kwb">double</span> <span class="hl kwd">quantile</span><span class="hl opt">(</span><span class="hl kwb">double</span> q<span class="hl opt">,</span> <span class="hl kwb">uint32_t</span> first <span class="hl opt">=</span> <span class="hl num">0</span><span class="hl opt">,</span> <span class="hl kwb">uint32_t</span> last <span class="hl opt">=</span> UINT_MAX<span class="hl opt">)</span> <span class="hl kwb">const</span><span class="hl opt">;</span> <span class="hl kwb">double</span> <span class="hl kwd">interQuantileMean</span><span class="hl opt">(</span><span class="hl kwb">double</span> lowQuantile<span class="hl opt">,</span> <span class="hl kwb">double</span> hiQuantile<span class="hl opt">)</span> <span class="hl kwb">const</span><span class="hl opt">;</span> <span class="hl kwc">private</span><span class="hl opt">:</span> <span class="hl kwc">std</span><span class="hl opt">::</span>vector<span class="hl opt"><</span><span class="hl kwb">uint64_t</span><span class="hl opt">></span> cumulative_<span class="hl opt">;</span> <span class="hl opt">};</span> <span class="hl opt">}</span> <span class="hl com">/* namespace ipa */</span> <span class="hl opt">}</span> <span class="hl com">/* namespace libcamera */</span>