Revision ccf22d3e

View differences:

libavcodec/ppc/check_altivec.c
43 43
 * is present.
44 44
 */
45 45

  
46
int has_altivec(void)
46
int mm_support(void)
47 47
{
48
#if HAVE_ALTIVEC
48 49
#ifdef __AMIGAOS4__
49 50
    ULONG result = 0;
50 51
    extern struct ExecIFace *IExec;
51 52

  
52 53
    IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
53
    if (result == VECTORTYPE_ALTIVEC) return 1;
54
    if (result == VECTORTYPE_ALTIVEC)
55
        return AV_CPU_FLAG_ALTIVEC;
54 56
    return 0;
55 57
#elif defined(__APPLE__) || defined(__OpenBSD__)
56 58
#ifdef __OpenBSD__
......
64 66

  
65 67
    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
66 68

  
67
    if (err == 0) return has_vu != 0;
69
    if (err == 0)
70
        return has_vu ? AV_CPU_FLAG_ALTIVEC : 0;
68 71
    return 0;
69 72
#elif CONFIG_RUNTIME_CPUDETECT
70 73
    int proc_ver;
......
76 79
        proc_ver == 0x0039 || proc_ver == 0x003c ||
77 80
        proc_ver == 0x0044 || proc_ver == 0x0045 ||
78 81
        proc_ver == 0x0070)
79
        return 1;
82
        return AV_CPU_FLAG_ALTIVEC;
80 83
    return 0;
81 84
#else
82 85
    // Since we were compiled for AltiVec, just assume we have it
83 86
    // until someone comes up with a proper way (not involving signal hacks).
84
    return 1;
87
    return AV_CPU_FLAG_ALTIVEC;
85 88
#endif /* __AMIGAOS4__ */
89
#endif /* HAVE_ALTIVEC */
90
    return 0;
86 91
}
87 92

  
libavcodec/ppc/dsputil_altivec.h
30 30

  
31 31
void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
32 32

  
33
int has_altivec(void);
34

  
35 33
void fdct_altivec(int16_t *block);
36 34
void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
37 35
                  int x16, int y16, int rounder);
libavcodec/ppc/dsputil_ppc.c
23 23
#include "libavcodec/dsputil.h"
24 24
#include "dsputil_altivec.h"
25 25

  
26
int mm_support(void)
27
{
28
    int result = 0;
29
#if HAVE_ALTIVEC
30
    if (has_altivec()) {
31
        result |= AV_CPU_FLAG_ALTIVEC;
32
    }
33
#endif /* result */
34
    return result;
35
}
36

  
37 26
/* ***** WARNING ***** WARNING ***** WARNING ***** */
38 27
/*
39 28
clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a
......
179 168
#if HAVE_ALTIVEC
180 169
    if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
181 170

  
182
    if (has_altivec()) {
171
    if (mm_support() & AV_CPU_FLAG_ALTIVEC) {
183 172
        dsputil_init_altivec(c, avctx);
184 173
        if(CONFIG_VC1_DECODER)
185 174
            vc1dsp_init_altivec(c, avctx);
libavcodec/ppc/h264_altivec.c
969 969

  
970 970
void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
971 971

  
972
    if (has_altivec()) {
972
    if (mm_support() & AV_CPU_FLAG_ALTIVEC) {
973 973
        c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
974 974
        c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
975 975
        c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
......
1001 1001

  
1002 1002
void ff_h264dsp_init_ppc(H264DSPContext *c)
1003 1003
{
1004
    if (has_altivec()) {
1004
    if (mm_support() & AV_CPU_FLAG_ALTIVEC) {
1005 1005
        c->h264_idct_add = ff_h264_idct_add_altivec;
1006 1006
        c->h264_idct_add8 = ff_h264_idct_add8_altivec;
1007 1007
        c->h264_idct_add16 = ff_h264_idct_add16_altivec;
libavcodec/ppc/mpegvideo_altivec.c
570 570

  
571 571
void MPV_common_init_altivec(MpegEncContext *s)
572 572
{
573
    if (!has_altivec()) return;
573
    if (!(mm_support() & AV_CPU_FLAG_ALTIVEC)) return;
574 574

  
575 575
    if (s->avctx->lowres==0) {
576 576
        if ((s->avctx->idct_algo == FF_IDCT_AUTO) ||
libavcodec/ppc/vp8dsp_altivec.c
265 265

  
266 266
av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c)
267 267
{
268
    if (!has_altivec())
268
    if (!(mm_support() & AV_CPU_FLAG_ALTIVEC))
269 269
        return;
270 270

  
271 271
    c->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_altivec;

Also available in: Unified diff