summaryrefslogtreecommitdiff
path: root/opcodes/tableimix.xml
blob: 59c4a06b37c549c6e64d8c1f1e6f5c21bd8f16f6 (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
<refentry id="tableimix">
<indexterm id="IndexTableimix"><primary>tableimix</primary></indexterm>
  <refentryinfo><title>Table Control:Read/Write Opreations</title></refentryinfo>
  <refmeta>
    <refentrytitle>tableimix</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>tableimix</refname>
    <refpurpose>
      Mixes two tables.
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Mixes two tables.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>tableimix</command> idft, idoff, ilen, is1ft, is1off, is1g, is2ft, is2off, is2g</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>idft</emphasis> -- Destination function table.
    </para>

    <para>
      <emphasis>idoff</emphasis> -- Offset to start writing from. Can be negative.
    </para>

    <para>
      <emphasis>ilen</emphasis> -- Number of write operations to perform. Negative means work backwards.
    </para>

    <para>
      <emphasis>is1ft</emphasis>, <emphasis>is2ft</emphasis> -- Source function tables. These can be the same as the destination table, if care is exercised about direction of copying data.
    </para>

    <para>
      <emphasis>is1off</emphasis>, <emphasis>is2off</emphasis> -- Offsets to start reading from in source tables.
    </para>

    <para>
      <emphasis>is1g</emphasis>, <emphasis>is2g</emphasis> -- Gains to apply when reading from the source tables. The results are added and the sum is written to the destination table.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>tableimix</emphasis> -- This opcode mixes from two tables, with separate gains into the destination table. Writing is done for <emphasis>ilen</emphasis> locations, usually stepping forward through the table - if <emphasis>ilen</emphasis> is positive. If it is negative, then the writing and reading order is backwards - towards lower indexes in the tables. This bi-directional option makes it easy to shift the contents of a table sideways by reading from it and writing back to it with a different offset.
    </para>

    <para>
      If <emphasis>ilen</emphasis> is 0, no writing occurs. Note that the internal integer value of <emphasis>ilen</emphasis> is derived from the ANSI C floor() function - which returns the next most negative integer. Hence a fractional negative <emphasis>ilen</emphasis> value of -2.3 would create an internal length of 3, and cause the copying to start from the offset locations and proceed for two locations to the left.
    </para>

    <para>
      The total index for table reading and writing is calculated from the starting offset for each table, plus the index value, which starts at 0 and then increments (or decrements) by 1 as mixing proceeds.
    </para>

    <para>
      These total indexes can potentially be very large, since there is no restriction on the offset or the <emphasis>ilen</emphasis>. However each total index for each table is ANDed with a length mask (such as 0000 0111 for a table of length 8) to form a final index which is actually used for reading or writing. So no reading or writing can occur outside the tables. This is the same as <quote>wrap</quote> mode in table read and write. These opcodes do not read or write the guardpoint. If a table has been rewritten with one of these, then if it has a guardpoint which is supposed to contain the same value as the location 0, then call <link linkend="tableigpw"><citetitle>tableigpw</citetitle></link> afterwards.
    </para>

    <para>
      The indexes and offsets are all in table steps - they are not normalized to 0 - 1. So for a table of length 256, <emphasis>ilen</emphasis> should be set to 256 if all the table was to be read or written.
    </para>

    <para>
      The tables do not need to be the same length - wrapping occurs individually for each table.
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="tablecopy"><citetitle>tablecopy</citetitle></link>,
      <link linkend="tablegpw"><citetitle>tablegpw</citetitle></link>,
      <link linkend="tablemix"><citetitle>tablemix</citetitle></link>,
      <link linkend="tableicopy"><citetitle>tableicopy</citetitle></link>,
      <link linkend="tableigpw"><citetitle>tableigpw</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: Robin Whittle</member>
        <member>Australia</member>
        <member>May 1997</member>
      </simplelist>
    </para>
    <para>New in version 3.47</para>
  </refsect1>
</refentry>