Update contrib.
3 * Eric Anholt. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 //Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
31 #include <liboil/liboilclasses.h>
32 #include <liboil/liboilfunction.h>
38 #ifdef ENABLE_BROKEN_IMPLS
44 static const struct _MMXData {
45 union m64_int mmx_4x0080;
47 .mmx_4x0080.ull = 0x0080008000800080ULL,
50 #define MC(x) (c.mmx_##x.m64)
53 recon8x8_intra_mmx (uint8_t *dest, int ds, int16_t *change)
56 __m64 offset = MC(4x0080);
59 __m64 mm0, mm1, c0, c1;
60 c0 = ((__m64 *)change)[0];
61 c1 = ((__m64 *)change)[1];
62 mm0 = _mm_adds_pi16(c0, offset);
63 mm1 = _mm_adds_pi16(c1, offset);
64 *(__m64 *)dest = _mm_packs_pu16(mm0, mm1);
71 OIL_DEFINE_IMPL_FULL (recon8x8_intra_mmx, recon8x8_intra, OIL_IMPL_FLAG_MMX);
75 recon8x8_inter_mmx (uint8_t *dest, int ds, uint8_t *src, int ss,
76 int16_t *change, int dss)
82 __m64 mm0, mm1, c0, c1;
83 c0 = ((__m64 *)change)[0];
84 c1 = ((__m64 *)change)[1];
85 mm0 = _mm_unpacklo_pi8(*(__m64 *)src, _mm_setzero_si64());
86 mm1 = _mm_unpackhi_pi8(*(__m64 *)src, _mm_setzero_si64());
87 mm0 = _mm_adds_pi16(mm0, c0);
88 mm1 = _mm_adds_pi16(mm1, c1);
89 *(__m64 *)dest = _mm_packs_pu16(mm0, mm1);
98 OIL_DEFINE_IMPL_FULL (recon8x8_inter_mmx, recon8x8_inter, OIL_IMPL_FLAG_MMX);
101 recon8x8_inter2_mmx (uint8_t *dest, int ds, uint8_t *s1, int ss1, uint8_t *s2,
102 int ss2, int16_t *change)
106 for (i = 8; i; i--) {
107 __m64 mm0, mm1, c0, c1;
109 _mm_unpacklo_pi8(*(__m64 *)s1, _mm_setzero_si64()),
110 _mm_unpacklo_pi8(*(__m64 *)s2, _mm_setzero_si64()));
112 _mm_unpackhi_pi8(*(__m64 *)s1, _mm_setzero_si64()),
113 _mm_unpackhi_pi8(*(__m64 *)s2, _mm_setzero_si64()));
114 c0 = ((__m64 *)change)[0];
115 c1 = ((__m64 *)change)[1];
116 mm0 = _mm_srli_pi16(mm0, 1);
117 mm1 = _mm_srli_pi16(mm1, 1);
118 mm0 = _mm_adds_pi16(mm0, c0);
119 mm1 = _mm_adds_pi16(mm1, c1);
120 *(__m64 *)dest = _mm_packs_pu16(mm0, mm1);
129 OIL_DEFINE_IMPL_FULL (recon8x8_inter2_mmx, recon8x8_inter2, OIL_IMPL_FLAG_MMX);
134 OilFunctionImpl* __oil_function_impl_recon8x8_intra_mmx() {
135 return &_oil_function_impl_recon8x8_intra_mmx;
141 OilFunctionImpl* __oil_function_impl_recon8x8_inter_mmx() {
142 return &_oil_function_impl_recon8x8_inter_mmx;
148 OilFunctionImpl* __oil_function_impl_recon8x8_inter2_mmx() {
149 return &_oil_function_impl_recon8x8_inter2_mmx;