2
2
* Copyright (c) 2004 Romain Dolbeau <romain@dolbeau.org>
4
* This file is part of FFmpeg.
4
* This file is part of Libav.
6
* FFmpeg is free software; you can redistribute it and/or
6
* Libav is free software; you can redistribute it and/or
7
7
* modify it under the terms of the GNU Lesser General Public
8
8
* License as published by the Free Software Foundation; either
9
9
* version 2.1 of the License, or (at your option) any later version.
11
* FFmpeg is distributed in the hope that it will be useful,
11
* Libav is distributed in the hope that it will be useful,
12
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
14
* Lesser General Public License for more details.
16
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with FFmpeg; if not, write to the Free Software
17
* License along with Libav; if not, write to the Free Software
18
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#include "libavutil/cpu.h"
21
22
#include "libavcodec/dsputil.h"
22
23
#include "libavcodec/h264data.h"
23
24
#include "libavcodec/h264dsp.h"
25
#include "dsputil_ppc.h"
26
26
#include "dsputil_altivec.h"
27
27
#include "util_altivec.h"
28
28
#include "types_altivec.h"
33
33
#define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC
34
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
35
#define PREFIX_h264_chroma_mc8_num altivec_put_h264_chroma_mc8_num
37
36
#define PREFIX_h264_qpel16_h_lowpass_altivec put_h264_qpel16_h_lowpass_altivec
38
37
#define PREFIX_h264_qpel16_h_lowpass_num altivec_put_h264_qpel16_h_lowpass_num
43
42
#include "h264_template_altivec.c"
44
43
#undef OP_U8_ALTIVEC
45
44
#undef PREFIX_h264_chroma_mc8_altivec
46
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
47
45
#undef PREFIX_h264_chroma_mc8_num
48
46
#undef PREFIX_h264_qpel16_h_lowpass_altivec
49
47
#undef PREFIX_h264_qpel16_h_lowpass_num
55
53
#define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC
56
54
#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
58
55
#define PREFIX_h264_chroma_mc8_num altivec_avg_h264_chroma_mc8_num
59
56
#define PREFIX_h264_qpel16_h_lowpass_altivec avg_h264_qpel16_h_lowpass_altivec
60
57
#define PREFIX_h264_qpel16_h_lowpass_num altivec_avg_h264_qpel16_h_lowpass_num
65
62
#include "h264_template_altivec.c"
66
63
#undef OP_U8_ALTIVEC
67
64
#undef PREFIX_h264_chroma_mc8_altivec
68
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
69
65
#undef PREFIX_h264_chroma_mc8_num
70
66
#undef PREFIX_h264_qpel16_h_lowpass_altivec
71
67
#undef PREFIX_h264_qpel16_h_lowpass_num
971
967
void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
969
if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
974
970
c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
975
971
c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_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;
979
973
#define dspfunc(PFX, IDX, NUM) \
980
974
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
1003
997
void ff_h264dsp_init_ppc(H264DSPContext *c)
1005
if (has_altivec()) {
999
if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
1006
1000
c->h264_idct_add = ff_h264_idct_add_altivec;
1007
1001
c->h264_idct_add8 = ff_h264_idct_add8_altivec;
1008
1002
c->h264_idct_add16 = ff_h264_idct_add16_altivec;