~medibuntu-maintainers/mplayer/medibuntu.oneiric

« back to all changes in this revision

Viewing changes to libavcodec/ppc/h264_altivec.c

  • Committer: Gauvain Pocentek
  • Date: 2010-09-25 09:39:02 UTC
  • mfrom: (66.1.6 maverick)
  • Revision ID: gauvain@images-20100925093902-9q2akz3ls3qzhaaw
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* merge from debian, remaining changes:
  - build depend against, lame, x264, xvid
* debian/patches/60eval-api.patch, backport patch from upstream to
  unbreak compilation for eval.h move not yet in 0.6
* gmplayer is gone now, please see smplayer as alternative frontend.
  LP: #503537, #493088, #467534, #467524, #460326, #390399, #285570,
      #208680, #118709, #513065, #459595, #455913, #179918, #65165.
* enable the mencoder package
* sort build depends alphabetically
* enable dvdnav support, Closes: #582508, #488226, LP: #611749
* prepare new upload
* no longer build mplayer-gui, it doesn't build anymore with shared
  swscale
* merge from debian/experimental, remaining changes:
  - build depend against, lame, x264, xvid
  - enable mencoder and mplayer-gui
* ensure that quilt patches are actually applied
* New Upstream Version, LP: #539315
* Build (against) again the System FFmpeg 
* tighten dependency on FFmpeg 0.6
* remove patches merged upstream
* remove 22disable-xscreensaver.patch
* refresh patches
* readd x264, xvid and mp3lame support, LP: #606125
* remove old parallel building mechanism, fixes FTBFS
* New upstream version
* compile against internal ffmpeg for now, LP: #587203, #588097
* recompile for directfb transtion, LP: #587163
* remove patches that were merged upstream
* avoid removing DOCS/html directory. it is included in release
  tarball
* convert to source Format: 3.0 (quilt)
* refreshed patches
* remove files that are included in upstream tarball
* rework debian/rules file
  - support parallel building
  - merge build rules for mplayer and mencoder package
  - remove unreferenced COMMON_CONFIGURE_FLAGS macro
  - rename DEB_BUILD_CONFIGURE -> CONFIGURE_FLAGS
  - don't build documentation - release tarballs have them prebuilt
  - build HTML documentation only if not already avaiable in the build
    tree
  - remove remaining references to debian/strip.sh from debian/rules
* remove copied vdpau headers
* copy in mencoder.c from upstream
* enable mplayer-gui (Closes: #579925) and mencoder packages. 
  (Closes: #396954, #400940, #580168)
* Fix rtsp vulnerability. Patch applied by DSA. Closes: #581245
* Fix another integer overflow, Closes: #524805
* prepare new upload
* sync libao2/ao_pulse.c with svn r30062, Closes: #558196, #580113
* make configure use pkg-config for fribidi checks. Closes: #582784,
  LP: #556200
* document 23mplayer-debug-printf.patch
* avoid mentioning of GTK frontend in mplayer description
* improve package descriptions of mplayer-doc and mplayer-dbg
* medium urgency because of fixed security issue
* fix SVN_VERION regex in debian rules to unbreak get-orig-source
  target. Closes: #582369
* forcefully disable arts support. Closes: #581225
* Remove mencoder from Depends in mplayer-dbg package.
* new upstream snapshot from rc3 branch.
* remove patches applied upstream:
  
  - 24_enable_fontconfig_by_default.diff
  - 30_add_gmplayer_man_rules.diff
  - 40_improve_desktop_file.patch
  - 41_fix_forcedsubsonly.patch
  - 50_fix_crashes_with_invalid_SDPs.patch
  - 50_fix_initial_volume_setting_pulse_output.patch
  - 61-malloc-bsd.patch
  - 62-disable-vidix-on-kfreebsd-amd64.patch
  - 63-sys-kd-include.patch
* don't install apport hook
* gross hack to avoid building mplayer-nogui and mplayer-gui packages
* add md5sum to remove to avoid spurious conffile prompt, Closes: #568272
* Make mplayer build on kFreeBSD (backports from upstream), Closes: #578622
  - Revert obscure hack that disables the malloc.h check on certain BSD
    platforms. 
  - disable vidix on kFreeBSD-amd64
  - rename 'struct keypad' -> 'struct m_keypad' to avoid FTBFS on
    kFreeBSD/amd64
* enable fontconfig by default. (Closes: #573257)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "libavcodec/dsputil.h"
22
22
#include "libavcodec/h264data.h"
23
 
 
24
 
#include "gcc_fixes.h"
 
23
#include "libavcodec/h264dsp.h"
25
24
 
26
25
#include "dsputil_ppc.h"
27
26
#include "dsputil_altivec.h"
33
32
 
34
33
#define OP_U8_ALTIVEC                          PUT_OP_U8_ALTIVEC
35
34
#define PREFIX_h264_chroma_mc8_altivec         put_h264_chroma_mc8_altivec
 
35
#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   put_no_rnd_vc1_chroma_mc8_altivec
36
36
#define PREFIX_h264_chroma_mc8_num             altivec_put_h264_chroma_mc8_num
37
37
#define PREFIX_h264_qpel16_h_lowpass_altivec   put_h264_qpel16_h_lowpass_altivec
38
38
#define PREFIX_h264_qpel16_h_lowpass_num       altivec_put_h264_qpel16_h_lowpass_num
43
43
#include "h264_template_altivec.c"
44
44
#undef OP_U8_ALTIVEC
45
45
#undef PREFIX_h264_chroma_mc8_altivec
 
46
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
46
47
#undef PREFIX_h264_chroma_mc8_num
47
48
#undef PREFIX_h264_qpel16_h_lowpass_altivec
48
49
#undef PREFIX_h264_qpel16_h_lowpass_num
53
54
 
54
55
#define OP_U8_ALTIVEC                          AVG_OP_U8_ALTIVEC
55
56
#define PREFIX_h264_chroma_mc8_altivec         avg_h264_chroma_mc8_altivec
 
57
#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   avg_no_rnd_vc1_chroma_mc8_altivec
56
58
#define PREFIX_h264_chroma_mc8_num             altivec_avg_h264_chroma_mc8_num
57
59
#define PREFIX_h264_qpel16_h_lowpass_altivec   avg_h264_qpel16_h_lowpass_altivec
58
60
#define PREFIX_h264_qpel16_h_lowpass_num       altivec_avg_h264_qpel16_h_lowpass_num
63
65
#include "h264_template_altivec.c"
64
66
#undef OP_U8_ALTIVEC
65
67
#undef PREFIX_h264_chroma_mc8_altivec
 
68
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
66
69
#undef PREFIX_h264_chroma_mc8_num
67
70
#undef PREFIX_h264_qpel16_h_lowpass_altivec
68
71
#undef PREFIX_h264_qpel16_h_lowpass_num
77
80
}\
78
81
\
79
82
static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \
80
 
    DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\
 
83
    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
81
84
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
82
85
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
83
86
}\
87
90
}\
88
91
\
89
92
static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
90
 
    DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\
 
93
    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
91
94
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
92
95
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\
93
96
}\
94
97
\
95
98
static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
96
 
    DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\
 
99
    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
97
100
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
98
101
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
99
102
}\
103
106
}\
104
107
\
105
108
static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
106
 
    DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\
 
109
    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
107
110
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
108
111
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\
109
112
}\
110
113
\
111
114
static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
112
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
113
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
 
115
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
116
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
114
117
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
115
118
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
116
119
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
117
120
}\
118
121
\
119
122
static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
120
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
121
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
 
123
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
124
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
122
125
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
123
126
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
124
127
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
125
128
}\
126
129
\
127
130
static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
128
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
129
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
 
131
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
132
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
130
133
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
131
134
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
132
135
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
133
136
}\
134
137
\
135
138
static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
136
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
137
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
 
139
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
140
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
138
141
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
139
142
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
140
143
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
141
144
}\
142
145
\
143
146
static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
144
 
    DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\
 
147
    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
145
148
    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\
146
149
}\
147
150
\
148
151
static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
149
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
150
 
    DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\
151
 
    DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\
 
152
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
153
    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
 
154
    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
152
155
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
153
156
    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
154
157
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
155
158
}\
156
159
\
157
160
static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
158
 
    DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\
159
 
    DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\
160
 
    DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\
 
161
    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
 
162
    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
 
163
    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
161
164
    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
162
165
    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
163
166
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
164
167
}\
165
168
\
166
169
static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
167
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
168
 
    DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\
169
 
    DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\
 
170
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
 
171
    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
 
172
    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
170
173
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
171
174
    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
172
175
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
173
176
}\
174
177
\
175
178
static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
176
 
    DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\
177
 
    DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\
178
 
    DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\
 
179
    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
 
180
    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
 
181
    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
179
182
    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
180
183
    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
181
184
    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
182
185
}\
183
186
 
184
 
/* this code assume that stride % 16 == 0 */
185
 
void put_no_rnd_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
186
 
   DECLARE_ALIGNED_16(signed int, ABCD[4]) =
187
 
                        {((8 - x) * (8 - y)),
188
 
                             ((x) * (8 - y)),
189
 
                         ((8 - x) * (y)),
190
 
                             ((x) * (y))};
191
 
    register int i;
192
 
    vec_u8 fperm;
193
 
    const vec_s32 vABCD = vec_ld(0, ABCD);
194
 
    const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
195
 
    const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
196
 
    const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
197
 
    const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
198
 
    LOAD_ZERO;
199
 
    const vec_s16 v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4));
200
 
    const vec_u16 v6us  = vec_splat_u16(6);
201
 
    register int loadSecond     = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
202
 
    register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
203
 
 
204
 
    vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1;
205
 
    vec_u8 vsrc0uc, vsrc1uc;
206
 
    vec_s16 vsrc0ssH, vsrc1ssH;
207
 
    vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
208
 
    vec_s16 vsrc2ssH, vsrc3ssH, psum;
209
 
    vec_u8 vdst, ppsum, fsum;
210
 
 
211
 
    if (((unsigned long)dst) % 16 == 0) {
212
 
        fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
213
 
                           0x14, 0x15, 0x16, 0x17,
214
 
                           0x08, 0x09, 0x0A, 0x0B,
215
 
                           0x0C, 0x0D, 0x0E, 0x0F};
216
 
    } else {
217
 
        fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
218
 
                           0x04, 0x05, 0x06, 0x07,
219
 
                           0x18, 0x19, 0x1A, 0x1B,
220
 
                           0x1C, 0x1D, 0x1E, 0x1F};
221
 
    }
222
 
 
223
 
    vsrcAuc = vec_ld(0, src);
224
 
 
225
 
    if (loadSecond)
226
 
        vsrcBuc = vec_ld(16, src);
227
 
    vsrcperm0 = vec_lvsl(0, src);
228
 
    vsrcperm1 = vec_lvsl(1, src);
229
 
 
230
 
    vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
231
 
    if (reallyBadAlign)
232
 
        vsrc1uc = vsrcBuc;
233
 
    else
234
 
        vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
235
 
 
236
 
    vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc0uc);
237
 
    vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc1uc);
238
 
 
239
 
    if (!loadSecond) {// -> !reallyBadAlign
240
 
        for (i = 0 ; i < h ; i++) {
241
 
 
242
 
 
243
 
            vsrcCuc = vec_ld(stride + 0, src);
244
 
 
245
 
            vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
246
 
            vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
247
 
 
248
 
            vsrc2ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc2uc);
249
 
            vsrc3ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc3uc);
250
 
 
251
 
            psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0));
252
 
            psum = vec_mladd(vB, vsrc1ssH, psum);
253
 
            psum = vec_mladd(vC, vsrc2ssH, psum);
254
 
            psum = vec_mladd(vD, vsrc3ssH, psum);
255
 
            psum = vec_add(v28ss, psum);
256
 
            psum = vec_sra(psum, v6us);
257
 
 
258
 
            vdst = vec_ld(0, dst);
259
 
            ppsum = (vec_u8)vec_packsu(psum, psum);
260
 
            fsum = vec_perm(vdst, ppsum, fperm);
261
 
 
262
 
            vec_st(fsum, 0, dst);
263
 
 
264
 
            vsrc0ssH = vsrc2ssH;
265
 
            vsrc1ssH = vsrc3ssH;
266
 
 
267
 
            dst += stride;
268
 
            src += stride;
269
 
        }
270
 
    } else {
271
 
        vec_u8 vsrcDuc;
272
 
        for (i = 0 ; i < h ; i++) {
273
 
            vsrcCuc = vec_ld(stride + 0, src);
274
 
            vsrcDuc = vec_ld(stride + 16, src);
275
 
 
276
 
            vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
277
 
            if (reallyBadAlign)
278
 
                vsrc3uc = vsrcDuc;
279
 
            else
280
 
                vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
281
 
 
282
 
            vsrc2ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc2uc);
283
 
            vsrc3ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc3uc);
284
 
 
285
 
            psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0));
286
 
            psum = vec_mladd(vB, vsrc1ssH, psum);
287
 
            psum = vec_mladd(vC, vsrc2ssH, psum);
288
 
            psum = vec_mladd(vD, vsrc3ssH, psum);
289
 
            psum = vec_add(v28ss, psum);
290
 
            psum = vec_sr(psum, v6us);
291
 
 
292
 
            vdst = vec_ld(0, dst);
293
 
            ppsum = (vec_u8)vec_pack(psum, psum);
294
 
            fsum = vec_perm(vdst, ppsum, fperm);
295
 
 
296
 
            vec_st(fsum, 0, dst);
297
 
 
298
 
            vsrc0ssH = vsrc2ssH;
299
 
            vsrc1ssH = vsrc3ssH;
300
 
 
301
 
            dst += stride;
302
 
            src += stride;
303
 
        }
304
 
    }
305
 
}
306
 
 
307
187
static inline void put_pixels16_l2_altivec( uint8_t * dst, const uint8_t * src1,
308
188
                                    const uint8_t * src2, int dst_stride,
309
189
                                    int src_stride1, int h)
552
432
    vec_st( hv, 0, dest );                                     \
553
433
 }
554
434
 
555
 
void ff_h264_idct8_add_altivec( uint8_t *dst, DCTELEM *dct, int stride ) {
 
435
static void ff_h264_idct8_add_altivec( uint8_t *dst, DCTELEM *dct, int stride ) {
556
436
    vec_s16 s0, s1, s2, s3, s4, s5, s6, s7;
557
437
    vec_s16 d0, d1, d2, d3, d4, d5, d6, d7;
558
438
    vec_s16 idct0, idct1, idct2, idct3, idct4, idct5, idct6, idct7;
601
481
    vec_s16 dc16;
602
482
    vec_u8 dcplus, dcminus, v0, v1, v2, v3, aligner;
603
483
    LOAD_ZERO;
604
 
    DECLARE_ALIGNED_16(int, dc);
 
484
    DECLARE_ALIGNED(16, int, dc);
605
485
    int i;
606
486
 
607
487
    dc = (block[0] + 32) >> 6;
711
591
static inline void write16x4(uint8_t *dst, int dst_stride,
712
592
                             register vec_u8 r0, register vec_u8 r1,
713
593
                             register vec_u8 r2, register vec_u8 r3) {
714
 
    DECLARE_ALIGNED_16(unsigned char, result[64]);
 
594
    DECLARE_ALIGNED(16, unsigned char, result)[64];
715
595
    uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
716
596
    int int_dst_stride = dst_stride/4;
717
597
 
891
771
}
892
772
 
893
773
#define h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0) {            \
894
 
    DECLARE_ALIGNED_16(unsigned char, temp[16]);                                             \
 
774
    DECLARE_ALIGNED(16, unsigned char, temp)[16];                                             \
895
775
    register vec_u8 alphavec;                                                              \
896
776
    register vec_u8 betavec;                                                               \
897
777
    register vec_u8 mask;                                                                  \
971
851
    vec_u8 vblock;
972
852
    vec_s16 vtemp, vweight, voffset, v0, v1;
973
853
    vec_u16 vlog2_denom;
974
 
    DECLARE_ALIGNED_16(int32_t, temp[4]);
 
854
    DECLARE_ALIGNED(16, int32_t, temp)[4];
975
855
    LOAD_ZERO;
976
856
 
977
857
    offset <<= log2_denom;
1017
897
    vec_u8 vsrc, vdst;
1018
898
    vec_s16 vtemp, vweights, vweightd, voffset, v0, v1, v2, v3;
1019
899
    vec_u16 vlog2_denom;
1020
 
    DECLARE_ALIGNED_16(int32_t, temp[4]);
 
900
    DECLARE_ALIGNED(16, int32_t, temp)[4];
1021
901
    LOAD_ZERO;
1022
902
 
1023
903
    offset = ((offset + 1) | 1) << log2_denom;
1092
972
 
1093
973
    if (has_altivec()) {
1094
974
        c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
1095
 
        c->put_no_rnd_h264_chroma_pixels_tab[0] = put_no_rnd_h264_chroma_mc8_altivec;
1096
975
        c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
1097
 
        c->h264_idct_add = ff_h264_idct_add_altivec;
1098
 
        c->h264_idct_add8 = ff_h264_idct_add8_altivec;
1099
 
        c->h264_idct_add16 = ff_h264_idct_add16_altivec;
1100
 
        c->h264_idct_add16intra = ff_h264_idct_add16intra_altivec;
1101
 
        c->h264_idct_dc_add= h264_idct_dc_add_altivec;
1102
 
        c->h264_idct8_dc_add = ff_h264_idct8_dc_add_altivec;
1103
 
        c->h264_idct8_add = ff_h264_idct8_add_altivec;
1104
 
        c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
1105
 
        c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
1106
 
        c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
 
976
        c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
 
977
        c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
1107
978
 
1108
979
#define dspfunc(PFX, IDX, NUM) \
1109
980
        c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
1126
997
        dspfunc(put_h264_qpel, 0, 16);
1127
998
        dspfunc(avg_h264_qpel, 0, 16);
1128
999
#undef dspfunc
 
1000
    }
 
1001
}
 
1002
 
 
1003
void ff_h264dsp_init_ppc(H264DSPContext *c)
 
1004
{
 
1005
    if (has_altivec()) {
 
1006
        c->h264_idct_add = ff_h264_idct_add_altivec;
 
1007
        c->h264_idct_add8 = ff_h264_idct_add8_altivec;
 
1008
        c->h264_idct_add16 = ff_h264_idct_add16_altivec;
 
1009
        c->h264_idct_add16intra = ff_h264_idct_add16intra_altivec;
 
1010
        c->h264_idct_dc_add= h264_idct_dc_add_altivec;
 
1011
        c->h264_idct8_dc_add = ff_h264_idct8_dc_add_altivec;
 
1012
        c->h264_idct8_add = ff_h264_idct8_add_altivec;
 
1013
        c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
 
1014
        c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
 
1015
        c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
1129
1016
 
1130
1017
        c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16x16_altivec;
1131
1018
        c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels16x8_altivec;