mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
68 lines
13 KiB
HTML
68 lines
13 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
|
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Math Functions</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script><script language=JavaScript src="../../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
|
|
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
|
|
|
|
<!-- Generated by Natural Docs, version 1.52 -->
|
|
<!-- http://www.naturaldocs.org -->
|
|
|
|
<!-- saved from url=(0026)http://www.naturaldocs.org -->
|
|
|
|
|
|
|
|
|
|
<div id=Content><div class="CSection"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="Math_Functions"></a>Math Functions</h1><div class=CBody><p>Package of useful macros and functions e.g. for fixedpoint operations.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#Math_Functions" >Math Functions</a></td><td class=SDescription>Package of useful macros and functions e.g. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Fixedpoint_Macros" >Fixedpoint Macros</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#D2_FIX4(x)" >D2_FIX4(x)</a></td><td class=SDescription>Integer to n:4 fixedpoint conversion</td></tr><tr class="SMacro SIndent2"><td class=SEntry><a href="#D2_INT4(x)" >D2_INT4(x)</a></td><td class=SDescription>n:4 to integer conversion</td></tr><tr class="SMacro SIndent2 SMarked"><td class=SEntry><a href="#D2_FLOOR4(x)" >D2_FLOOR4(x)</a></td><td class=SDescription>n:4 fixedpoint unsigned floor (round towards -inf)</td></tr><tr class="SMacro SIndent2"><td class=SEntry><a href="#D2_CEIL4(x)" >D2_CEIL4(x)</a></td><td class=SDescription>n:4 fixedpoint unsigned ceil (round towards +inf)</td></tr><tr class="SMacro SIndent2 SMarked"><td class=SEntry><a href="#D2_FRAC4(x)" >D2_FRAC4(x)</a></td><td class=SDescription>n:4 fixedpoint fractional part only</td></tr><tr class="SMacro SIndent2"><td class=SEntry><a href="#D2_FIX16(x)" >D2_FIX16(x)</a></td><td class=SDescription>integer to n:16 fixedpoint conversion</td></tr><tr class="SMacro SIndent2 SMarked"><td class=SEntry><a href="#D2_INT16(x)" >D2_INT16(x)</a></td><td class=SDescription>n:16 to integer conversion</td></tr><tr class="SMacro SIndent2"><td class=SEntry><a href="#D2_FLOOR16(x)" >D2_FLOOR16(x)</a></td><td class=SDescription>n:16 fixedpoint unsigned floor (round towards -inf)</td></tr><tr class="SMacro SIndent2 SMarked"><td class=SEntry><a href="#D2_CEIL16(x)" >D2_CEIL16(x)</a></td><td class=SDescription>n:16 fixedpoint unsigned ceil (round towards +inf)</td></tr><tr class="SMacro SIndent2"><td class=SEntry><a href="#D2_FRAC16(x)" >D2_FRAC16(x)</a></td><td class=SDescription>n:16 fixedpoint fractional part only</td></tr><tr class="SMacro SIndent2 SMarked"><td class=SEntry><a href="#D2_EPSILON" >D2_EPSILON</a></td><td class=SDescription>Smallest representable positive number (all fixedpoint formats)</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Math_Functions" >Math Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#d2_sqrt" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">d2_sqrt</a></td><td class=SDescription>Minimalistic 32->16 bit integer square root (no hw divide/multiply needed) unrolled for speed.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#d2_pow2mask" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">d2_pow2mask</a></td><td class=SDescription>Find next larger power of two minus 1</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
|
|
|
|
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Fixedpoint_Macros"></a>Fixedpoint Macros</h3></div></div>
|
|
|
|
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="D2_FIX4(x)"></a>D2_FIX4(x)</h3><div class=CBody><p>Integer to n:4 fixedpoint conversion</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_INT4(x)"></a>D2_INT4(x)</h3><div class=CBody><p>n:4 to integer conversion</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_FLOOR4(x)"></a>D2_FLOOR4(x)</h3><div class=CBody><p>n:4 fixedpoint unsigned floor (round towards -inf)</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_CEIL4(x)"></a>D2_CEIL4(x)</h3><div class=CBody><p>n:4 fixedpoint unsigned ceil (round towards +inf)</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_FRAC4(x)"></a>D2_FRAC4(x)</h3><div class=CBody><p>n:4 fixedpoint fractional part only</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_FIX16(x)"></a>D2_FIX16(x)</h3><div class=CBody><p>integer to n:16 fixedpoint conversion</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_INT16(x)"></a>D2_INT16(x)</h3><div class=CBody><p>n:16 to integer conversion</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_FLOOR16(x)"></a>D2_FLOOR16(x)</h3><div class=CBody><p>n:16 fixedpoint unsigned floor (round towards -inf)</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_CEIL16(x)"></a>D2_CEIL16(x)</h3><div class=CBody><p>n:16 fixedpoint unsigned ceil (round towards +inf)</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_FRAC16(x)"></a>D2_FRAC16(x)</h3><div class=CBody><p>n:16 fixedpoint fractional part only</p></div></div></div>
|
|
|
|
<div class="CMacro"><div class=CTopic><h3 class=CTitle><a name="D2_EPSILON"></a>D2_EPSILON</h3><div class=CBody><p>Smallest representable positive number (all fixedpoint formats)</p></div></div></div>
|
|
|
|
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Math_Functions"></a>Math Functions</h3></div></div>
|
|
|
|
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="d2_sqrt"></a>d2_sqrt</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>D2_EXTERN d2_s32 d2_sqrt(</td><td class="PType prettyprint " nowrap>d2_u32 </td><td class="PParameter prettyprint " nowrap>x</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Minimalistic 32->16 bit integer square root (no hw divide/multiply needed) unrolled for speed.</p><h4 class=CHeading>parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x</td><td class=CDLDescription>fixedpoint number</td></tr></table><h4 class=CHeading>returns</h4><p>the square root of x</p></div></div></div>
|
|
|
|
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="d2_pow2mask"></a>d2_pow2mask</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>D2_EXTERN d2_u32 d2_pow2mask(</td><td class="PType prettyprint " nowrap>d2_u32 </td><td class="PParameter prettyprint " nowrap>x</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Find next larger power of two minus 1</p><p>E.g. given number x=73 -> next larger power of two is 128, the result is 128 minus 1 = 127 (number with all bits set)</p><h4 class=CHeading>parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>x</td><td class=CDLDescription>positive number</td></tr></table><h4 class=CHeading>returns</h4><p>the next larger number of two minus 1 of x</p></div></div></div>
|
|
|
|
</div><!--Content-->
|
|
|
|
|
|
<div id=Footer>© 2016 by TES Electronic Solutions · <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
|
|
|
|
|
|
<div id=Menu><div class=MEntry><div class=MFile><a href="../doc/overview-txt.html">Driver Overview</a></div></div><div class=MEntry><div class=MFile><a href="../doc/limitations-txt.html">Limitations</a></div></div><div class=MEntry><div class=MFile><a href="dave_driver-h.html">Basic Types</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">API</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="../code/dave_driver-c.html">Basic Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_viewport-c.html">Viewport Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_context-c.html">Context Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_texture-c.html">Texture Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_render-c.html">Rendering Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_blit-c.html">Blit Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_rbuffer-c.html">Render Buffers</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_perfcount-c.html">Profiling</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_utility-c.html">Utility Functions</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_64bitoperation-c.html">Functions for 64bit operations</a></div></div><div class=MEntry><div class=MFile><a href="../code/dave_dlist-c.html">Dlist Functions</a></div></div><div class=MEntry><div class=MFile id=MSelected>Math Functions</div></div><div class=MEntry><div class=MFile><a href="dave_errorcodes-h.html">Errorcodes</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Index</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MIndex><a href="../../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Types.html">Types</a></div></div></div></div></div><script type="text/javascript"><!--
|
|
var searchPanel = new SearchPanel("searchPanel", "HTML", "../../search");
|
|
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Functions">Functions</option><option value="Types">Types</option></select></div></div><!--Menu-->
|
|
|
|
|
|
|
|
<!--START_ND_TOOLTIPS-->
|
|
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>D2_EXTERN d2_s32 d2_sqrt(</td><td class="PType prettyprint " nowrap>d2_u32 </td><td class="PParameter prettyprint " nowrap>x</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Minimalistic 32->16 bit integer square root (no hw divide/multiply needed) unrolled for speed.</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>D2_EXTERN d2_u32 d2_pow2mask(</td><td class="PType prettyprint " nowrap>d2_u32 </td><td class="PParameter prettyprint " nowrap>x</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Find next larger power of two minus 1</div></div><!--END_ND_TOOLTIPS-->
|
|
|
|
|
|
|
|
|
|
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
|
|
|
|
|
|
<script language=JavaScript><!--
|
|
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html> |