~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to libfreerdp/primitives/prim_shift_opt.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.1.9) (9.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20141111122050-wyr8hrnwco9fcmum
Tags: 1.1.0~git20140921.1.440916e+dfsg1-2ubuntu1
* Merge with Debian unstable, remaining changes
  - Disable ffmpeg support
* Disable gstreamer support, this relies on gstreamer 0.10 and we don't want
  to add any more deps on that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* FreeRDP: A Remote Desktop Protocol Client
 
2
 * Shift operations.
 
3
 * vi:ts=4 sw=4:
 
4
 *
 
5
 * (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
 
6
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 
7
 * not use this file except in compliance with the License. You may obtain
 
8
 * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 
9
 * Unless required by applicable law or agreed to in writing, software
 
10
 * distributed under the License is distributed on an "AS IS" BASIS,
 
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 
12
 * or implied. See the License for the specific language governing
 
13
 * permissions and limitations under the License.
 
14
 */
 
15
 
 
16
#ifdef HAVE_CONFIG_H
 
17
#include "config.h"
 
18
#endif
 
19
 
 
20
#include <freerdp/types.h>
 
21
#include <freerdp/primitives.h>
 
22
#include <winpr/sysinfo.h>
 
23
 
 
24
#ifdef WITH_SSE2
 
25
#include <emmintrin.h>
 
26
#include <pmmintrin.h>
 
27
#endif /* WITH_SSE2 */
 
28
 
 
29
#ifdef WITH_IPP
 
30
#include <ipps.h>
 
31
#endif /* WITH_IPP */
 
32
 
 
33
#include "prim_internal.h"
 
34
#include "prim_templates.h"
 
35
#include "prim_shift.h"
 
36
 
 
37
 
 
38
#ifdef WITH_SSE2
 
39
# if !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS)
 
40
/* ------------------------------------------------------------------------- */
 
41
SSE3_SCD_ROUTINE(sse2_lShiftC_16s, INT16, general_lShiftC_16s,
 
42
        _mm_slli_epi16, *dptr++ = *sptr++ << val)
 
43
/* ------------------------------------------------------------------------- */
 
44
SSE3_SCD_ROUTINE(sse2_rShiftC_16s, INT16, general_rShiftC_16s,
 
45
        _mm_srai_epi16, *dptr++ = *sptr++ >> val)
 
46
/* ------------------------------------------------------------------------- */
 
47
SSE3_SCD_ROUTINE(sse2_lShiftC_16u, UINT16, general_lShiftC_16u,
 
48
        _mm_slli_epi16, *dptr++ = *sptr++ << val)
 
49
/* ------------------------------------------------------------------------- */
 
50
SSE3_SCD_ROUTINE(sse2_rShiftC_16u, UINT16, general_rShiftC_16u,
 
51
        _mm_srli_epi16, *dptr++ = *sptr++ >> val)
 
52
# endif /* !defined(WITH_IPP) || defined(ALL_PRIMITIVES_VERSIONS) */
 
53
#endif
 
54
 
 
55
 
 
56
/* Note: the IPP version will have to call ippLShiftC_16s or ippRShiftC_16s
 
57
 * depending on the sign of val.  To avoid using the deprecated inplace
 
58
 * routines, a wrapper can use the src for the dest.
 
59
 */
 
60
 
 
61
/* ------------------------------------------------------------------------- */
 
62
void primitives_init_shift_opt(primitives_t *prims)
 
63
{
 
64
#if defined(WITH_IPP)
 
65
        prims->lShiftC_16s = (__lShiftC_16s_t) ippsLShiftC_16s;
 
66
        prims->rShiftC_16s = (__rShiftC_16s_t) ippsRShiftC_16s;
 
67
        prims->lShiftC_16u = (__lShiftC_16u_t) ippsLShiftC_16u;
 
68
        prims->rShiftC_16u = (__rShiftC_16u_t) ippsRShiftC_16u;
 
69
#elif defined(WITH_SSE2)
 
70
        if (IsProcessorFeaturePresent(PF_SSE2_INSTRUCTIONS_AVAILABLE)
 
71
                        && IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
 
72
        {
 
73
                prims->lShiftC_16s = sse2_lShiftC_16s;
 
74
                prims->rShiftC_16s = sse2_rShiftC_16s;
 
75
                prims->lShiftC_16u = sse2_lShiftC_16u;
 
76
                prims->rShiftC_16u = sse2_rShiftC_16u;
 
77
        }
 
78
#endif
 
79
}
 
80