2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
24 #include <tbb/parallel_for.h>
\r
28 namespace internal {
\r
30 static void* fast_memcpy(void* dest, const void* source, size_t count)
\r
32 assert(count % (16*8) == 0);
\r
33 assert(dest != nullptr);
\r
34 assert(source != nullptr);
\r
44 movdqa xmm0, [esi+00h];
\r
45 movdqa xmm1, [esi+10h];
\r
46 movdqa xmm2, [esi+20h];
\r
47 movdqa xmm3, [esi+30h];
\r
49 movntdq [edi+00h], xmm0;
\r
50 movntdq [edi+10h], xmm1;
\r
51 movntdq [edi+20h], xmm2;
\r
52 movntdq [edi+30h], xmm3;
\r
54 movdqa xmm4, [esi+40h];
\r
55 movdqa xmm5, [esi+50h];
\r
56 movdqa xmm6, [esi+60h];
\r
57 movdqa xmm7, [esi+70h];
\r
59 movntdq [edi+40h], xmm4;
\r
60 movntdq [edi+50h], xmm5;
\r
61 movntdq [edi+60h], xmm6;
\r
62 movntdq [edi+70h], xmm7;
\r
64 lea edi, [edi+80h];
\r
65 lea esi, [esi+80h];
\r
75 static void* fast_memcpy(void* dest, const void* source, size_t num)
\r
77 tbb::affinity_partitioner partitioner;
\r
78 tbb::parallel_for(tbb::blocked_range<size_t>(0, num/128), [&](const tbb::blocked_range<size_t>& r)
\r
80 internal::fast_memcpy(reinterpret_cast<char*>(dest) + r.begin()*128, reinterpret_cast<const char*>(source) + r.begin()*128, r.size()*128);
\r