<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Advanced mixing audio streams for heterogeneous computer systems in telecommunications</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>A.A. Kolpakov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ju.A. Kropotov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Murom institute (branch) VlSU</institution>
          ,
          <addr-line>Orlovskaya st., 23, 602264, Murom, Vladimir region</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2017</year>
      </pub-date>
      <fpage>32</fpage>
      <lpage>36</lpage>
      <abstract>
        <p>This paper presents an algorithm enhanced mixing of audio streams for computation on GPUs, which combines multiple stages of mixing by using two-pass rendering, which significantly reduces the switching time between buffers. Methods of computer experimental comparative studies were carried out evaluating the performance of the developed algorithm. The purpose of the present paper is development of an efficient algorithm for mixing audio streams for processing on GPUs. The method of transfer operations computing on graphics processors with the use of Shader programs was developed. Novel features presented solutions is using a two-pass rendering. The results showed that the application of the developed algorithm leads to an increase in computational performance up to 6 times. Presented solution can be implemented as software in the telecommunications multiprocessor systems.</p>
      </abstract>
      <kwd-group>
        <kwd>two-pass rendering</kwd>
        <kwd>algorithm for increasing productivity</kwd>
        <kwd>parallel computing</kwd>
        <kwd>heterogeneous computing systems</kwd>
        <kwd>graphics processors</kwd>
        <kwd>mixing of audio data</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>3. The structure of the developed algorithm</title>
      <p>,</p>
      <p>M i,t  M t  ui,t ,
где u k,t – the sample vector; i.e. the vector of samples obtained by microphone k in time t;</p>
      <p>M t – resulting mixing vector.</p>
      <p>The second stage is echo cancellation, which in its basic form consists in excluding the sample of the i-th device from the
final vector [8]. This stage is represented in the form
где M i,t – resulting mixing vector for the i-th device;</p>
      <p>ui,t – sample of the i-th device.</p>
      <p>For the correctness of the resulting vector M i,t , it is necessary that its dimension be equal to the dimension of the incoming
vectors. However, after stages 1 and 2, the vector M i,t may be overcrowded, leading to unwanted noise [9]. In order to use the
original vector of large dimensions M i,t , it is necessary to compress it for further use. This is done in the third stage by the
formula</p>
      <p>
        M i,t  M i,t  fraci,t ,
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
where fraci,t – attenuation factor for the i-th device. This coefficient must be calculated automatically, starting from the
maximum compressed sample. The search for the maximum among the compressed samples occurs in the fourth stage, and the
correction of the attenuation coefficient is made on the fifth stage.
      </p>
      <p>
        A block diagram of the basic mixing algorithm is shown in fig. 1.
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
      </p>
      <sec id="sec-2-1">
        <title>Begin</title>
        <p>n
M t   uk,t
k0</p>
      </sec>
      <sec id="sec-2-2">
        <title>Processing of source samples</title>
        <p>M i,t  M t  ui,t
M i,t  M i,t  fraci,t
i = [0…n]</p>
      </sec>
      <sec id="sec-2-3">
        <title>Output of the source vector End</title>
        <p>
           n1 
mi    u j  ui   fraci . (
          <xref ref-type="bibr" rid="ref5">5</xref>
          )
 j0 
        </p>
        <p>
          Since the fourth step uses a different measurement than the first three, it cannot be combined within the framework of formula
(
          <xref ref-type="bibr" rid="ref5">5</xref>
          ). A block diagram of the extended mixing algorithm is shown in fig. 2.
        </p>
        <p>Begin</p>
        <p>Processing of source</p>
        <p>samples
 n1 
mi    u j  ui   fraci
 j0 </p>
        <p>Max(M i,t )</p>
      </sec>
      <sec id="sec-2-4">
        <title>Output of the source vector</title>
        <p>End</p>
      </sec>
      <sec id="sec-2-5">
        <title>Correction of</title>
        <p>fraci,t</p>
        <p>Usually, calculations can be combined according to general criteria when their projections do not coincide and they do not
have intersections. Therefore, if these calculations are denoted as A1=(Xl,P1,f1) and A2=(X2, P2, f2), then they can be combined
as shown below.</p>
        <p>
           f1 ( X 1, p), p  P ,
X  X1, X 2 , P  P1  P2 , f ( X 1 , X 2 , p)   f 2 ( X 2 , p), p  P1 . (
          <xref ref-type="bibr" rid="ref6">6</xref>
          )
2
        </p>
        <p>
          As seen from (
          <xref ref-type="bibr" rid="ref6">6</xref>
          ), the main algorithm is checking the coordinates of each pixel to select the module's execution function.
Since the GPU executes all branches before selecting the desired one, each branch will be executed for each pixel, which will
take a long time.
        </p>
        <p>The developed algorithm presents an alternative method for executing a large number of functions, which outputs data of
different lengths to a single render buffer using multithreaded rendering. Here the main rule is to move the projection by
modifying the projection matrix, so that the computational area of each function is limited to the required area, rather than the
entire buffer.</p>
        <p>
          Depending on the pixel, it can have a different amount of information without loss of versatility. w denote the total number of
pixels needed to store L bytes. Thus, the render buffer can be represented as (w+1)*n. 3D model of the developed algorithm is a
rectangle, which lies in the plane Z. It has the dimensions: 2w/(w+1) units in width and 2 units in height. Coordinates of vertices
– (-1,-1,0), (1-2/(w+1),-1,0), (
          <xref ref-type="bibr" rid="ref1">-1,1,0</xref>
          ), (1-2/(w+1),1,0).
        </p>
        <p>
          At the first rendering pass, a unit matrix is chosen as the projection matrix. This ensures that the projection matches the 3D
model. After converting the visible area, in this pass the formula (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ) is applied to perform the first three steps of the mixing.
Transformations of the 3D model, produced in the first three steps, are shown in Fig. 3.
        </p>
        <sec id="sec-2-5-1">
          <title>Texture P2</title>
        </sec>
        <sec id="sec-2-5-2">
          <title>Texture P1</title>
          <p>X  X 1 , X</p>
          <p>2</p>
          <p>P  P1  P2
f ( X1, X 2 , p)   f1( X1, p), p  P1</p>
          <p> f2 ( X 2 , p), p  P2</p>
          <p>In the second rendering pass, the projection is shifted to the left by L pixels. At the same time, the shader program switches to
the search mode of the maximum sample. In this pass, only one column can be written, since most parts of the projection lie
outside the render buffer and will be automatically ignored by the GPU. Since the clipping of the projection was performed at
the beginning of the render, this method calls the function only for the correct pixels, and not for the entire buffer. The actions
performed on the second pass of the algorithm are shown in fig. 4.</p>
        </sec>
        <sec id="sec-2-5-3">
          <title>Recorded area</title>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>4. Using a single-texture algorithm</title>
      <p>As noted above, both pass algorithms requires as input data samples every n sequences. Each sequence must have its own
unique texture. Total needed n texture dimension L. This multi-textural technology is not suitable for audio mixing. First, each
sound source requires its own texture. Therefore, additional passes may be required. Secondly, loading a lot of small textures is
much slower than loading a single large one.</p>
      <p>In the developed algorithm, it is proposed to load a single texture. As an example, the first pass of the algorithm is presented.
The input contains n samples of sequences of size L bytes and n attenuation coefficients. Two textured RGBA format buffers are
used. Texture T1 has the dimension [L/4]*n and stores all sample sequences in a line. Texture T2 has a dimension of 1*n and
stores the attenuation coefficients. The coordinates of all the textures are given in Table 1.</p>
      <p>Audio mixing is performed independently for each pixel. The pixel's texture coordinates (x, y) are calculated by interpolating
the vertex texture coordinates. Based on Table 1, the texture coordinate for T1 or pt.t0 should be (X, Y), and for T2 or pt.t1 –
(0.5, Y). Pt.t0 refers to the sample for which the current mixing transformations are made, this sample is called the "aiming
point". To exclude the appearance of an echo, the other texture coordinate of ptCur is restricted by accessing T1 instead of pt.t0.
The x component of the ptCur texture is identical to the pt.t0 texture, and the y component is calculated from a cyclic variable
that designates each sound source. In the loop, the position register v is used to skip the "aiming point". Finally, the attenuation
coefficients are read from the texture pt.t1. Since the coefficient is stored in the first byte, the sample is produced only by the
blue component.</p>
    </sec>
    <sec id="sec-4">
      <title>5. Experimental study of the developed algorithm</title>
      <p>Test input data for mixing are sequences of 320 samples. All samples are generated randomly. Test bench configuration: CPU
Intel Core i3-4130, 4 GB RAM, graphics card NVIDIA GeForce GT730. The number of M sequences was varied. The results for
the basic and developed algorithms at the output are identical. The results of an experimental study of the dependence of the
mixing time t on the number of sequences M are shown in fig. 5.</p>
      <p>As can be seen from the test results shown in Fig. 5, application of the advanced algorithm of audio mixing allows to increase
productivity of computer system in 5-6 times [9].</p>
      <p>Table 2 shows the results of measuring the average running time of the algorithm t for 8 random sequences of 320 samples.
During the measurement, 1000 processing cycles were carried out, for each of which new random sequences of samples were
generated. For the results obtained, the dispersion of the output sequences is calculated, the values of which are also given in
Table 2.</p>
      <p>As can be seen from the test results presented in Table 2, the variance of the output sequences for the basic algorithm is
substantially higher than for the developed one [12,13]. This is due to the fact that 32-bit numbers are used for the calculations in
the GPU, whereas for the calculations on the central processor – 64-bit. Application of the developed algorithm in a
heterogeneous computer system reduces the processing time to 0.22226 x 10-3 s instead of 1.351 x 10-3 s – the time of data
processing by the basic algorithm.</p>
    </sec>
    <sec id="sec-5">
      <title>6. Conclusion References</title>
      <p>This paper presents an algorithm for the extended downmix audio streams for computing on GPU. Its main advantage is the
combination of multiple stages of mixing by using a two-pass rendering, which significantly reduces the switching time between
buffers. The use of one texture for calculations increases the efficiency of I/O operations. Although I/O operations take
approximately half the computation time, experimental studies of the developed algorithm showed an increase in performance
up to 6 times.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Lindholm</surname>
            <given-names>E</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nickolls</surname>
            <given-names>J</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Oberman</surname>
            <given-names>S</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Montrym</surname>
            <given-names>J. NVIDIA</given-names>
          </string-name>
          <article-title>Tesla: A unified graphics and computing architecture</article-title>
          .
          <source>IEEE Micro</source>
          <year>2008</year>
          ;
          <volume>28</volume>
          (
          <issue>2</issue>
          ):
          <fpage>39</fpage>
          -
          <lpage>55</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Luebke</surname>
            <given-names>D</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Harris</surname>
            <given-names>M</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kruger</surname>
            <given-names>J</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Purcell</surname>
            <given-names>T</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Govindaraju</surname>
            <given-names>N</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Buck</surname>
            <given-names>I</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Woolley</surname>
            <given-names>C</given-names>
          </string-name>
          ,
          <article-title>Lefohn A</article-title>
          . GPGPU:
          <article-title>general purpose computation on graphics hardware</article-title>
          .
          <source>ACM SIG-GRAPH</source>
          . New York, USA: Course Notes,
          <year>2004</year>
          ; 33 p.
          <source>DOI: 10.1145/1103900</source>
          .110393.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Kolpakov</surname>
            <given-names>AA</given-names>
          </string-name>
          .
          <article-title>Theoretical evaluation of growth performance computing systems from the use of multiple computing devices. V mire nauchnykh otkrytii</article-title>
          <year>2012</year>
          ;
          <volume>1</volume>
          :
          <fpage>206</fpage>
          -
          <lpage>209</lpage>
          . (in Russian)
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Boreskov</given-names>
            <surname>AV</surname>
          </string-name>
          .
          <article-title>Shaders development and debugging</article-title>
          .
          <source>Sankt-Peterburg: BHV-Peterburg</source>
          ,
          <year>2006</year>
          ; 488 p.
          <article-title>(in Russian)</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Nekrasov</surname>
            <given-names>KA</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Potashnikov</surname>
            <given-names>SI</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Boyarchenkov</surname>
            <given-names>AS</given-names>
          </string-name>
          ,
          <article-title>Kupryazhkin AYa. Parallel computing for general purpose graphics processors: text book. Ministry of Education and Science of the Russian Federation</article-title>
          , Ural Federal University. Ekaterinburg : Publishing house of the Ural University,
          <year>2016</year>
          ; 104 p.
          <article-title>(in Russian)</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Kropotov</given-names>
            <surname>JuA</surname>
          </string-name>
          .
          <article-title>Experimental study of the law of distribution of probability of amplitudes of signals of systems of transmission of voice information</article-title>
          .
          <source>Proektirovanie i tekhnologiia elektronnykh sredstv</source>
          <year>2006</year>
          ;
          <volume>4</volume>
          :
          <fpage>37</fpage>
          -
          <lpage>42</lpage>
          . (in Russian)
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Belozyorov</surname>
            <given-names>AS</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Korobicyn</surname>
            <given-names>VV</given-names>
          </string-name>
          .
          <article-title>Implementation of computations on a graphics processor using Nvidia CUDA platform</article-title>
          .
          <source>Programmnye produkty i sistemy</source>
          <year>2010</year>
          ;
          <volume>1</volume>
          :
          <fpage>62</fpage>
          -
          <lpage>64</lpage>
          . (in Russian)
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Kropotov</surname>
            <given-names>JuA</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Belov</surname>
            <given-names>AA</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Proskuryakov</surname>
            <given-names>AJu</given-names>
          </string-name>
          ,
          <source>Kolpakov AA. Methods of Designing Telecommunication Information and Control Audio Exchange Systems in Difficult Noise Conditions. Sistemy upravleniia, sviazi i bezopasnosti</source>
          <year>2015</year>
          ;
          <volume>2</volume>
          :
          <fpage>165</fpage>
          -
          <lpage>183</lpage>
          . (in Russian)
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Ermolaev</surname>
            <given-names>VA</given-names>
          </string-name>
          ,
          <article-title>Kropotov JuA</article-title>
          .
          <article-title>Algorithms for processing acoustic signals in telecommunication systems by local parametric methods of analysis</article-title>
          .
          <source>Proceedings International Siberian Conference on Control and Communications (SIBCON)</source>
          ,
          <year>2015</year>
          . URL: http://ieeexplore.ieee.org/document/7147109/.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>