~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/ppc/snow_altivec.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Altivec optimized snow DSP utils
 
2
 * AltiVec-optimized snow DSP utils
3
3
 * Copyright (c) 2006 Luca Barbato <lu_zero@gentoo.org>
4
4
 *
5
5
 * This file is part of FFmpeg.
17
17
 * You should have received a copy of the GNU Lesser General Public
18
18
 * License along with FFmpeg; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 
 *
21
 
 *
22
20
 */
23
21
 
24
 
#include "../dsputil.h"
 
22
#include "dsputil.h"
25
23
 
26
24
#include "gcc_fixes.h"
27
25
#include "dsputil_altivec.h"
28
 
#include "../snow.h"
 
26
#include "snow.h"
29
27
 
30
28
#undef NDEBUG
31
29
#include <assert.h>
60
58
 
61
59
//altivec code
62
60
 
63
 
void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width)
 
61
void ff_snow_horizontal_compose97i_altivec(IDWTELEM *b, int width)
64
62
{
 
63
#if 0
65
64
    const int w2= (width+1)>>1;
66
 
    DECLARE_ALIGNED_16(DWTELEM, temp[(width>>1)]);
 
65
    DECLARE_ALIGNED_16(IDWTELEM, temp[(width>>1)]);
67
66
    const int w_l= (width>>1);
68
67
    const int w_r= w2 - 1;
69
68
    int i;
70
 
    vector signed int t1, t2, x, y, tmp1, tmp2;
71
 
    vector signed int *vbuf, *vtmp;
 
69
    vector signed short t1, t2, x, y, tmp1, tmp2;
 
70
    vector signed short *vbuf, *vtmp;
72
71
    vector unsigned char align;
73
72
 
74
 
 
75
 
 
76
73
    { // Lift 0
77
 
        DWTELEM * const ref = b + w2 - 1;
78
 
        DWTELEM b_0 = b[0];
79
 
        vbuf = (vector signed int *)b;
 
74
        IDWTELEM * const ref = b + w2 - 1;
 
75
        IDWTELEM b_0 = b[0];
 
76
        vector signed short v7 = vec_splat_s16(7);
 
77
        vbuf = (vector signed short *)b;
80
78
 
81
79
        tmp1 = vec_ld (0, ref);
82
80
        align = vec_lvsl (0, ref);
83
81
        tmp2 = vec_ld (15, ref);
84
 
        t1= vec_perm(tmp1, tmp2, align);
85
 
 
86
 
        i = 0;
 
82
        t1 = vec_perm(tmp1, tmp2, align);
87
83
 
88
84
        for (i=0; i<w_l-15; i+=16) {
89
85
#if 0
90
 
        b[i+0] = b[i+0] - ((3 * (ref[i+0] + ref[i+1]) + 4) >> 3);
 
86
/*        b[i+0] = b[i+0] - ((3 * (ref[i+0] + ref[i+1]) + 4) >> 3);
91
87
        b[i+1] = b[i+1] - ((3 * (ref[i+1] + ref[i+2]) + 4) >> 3);
92
88
        b[i+2] = b[i+2] - ((3 * (ref[i+2] + ref[i+3]) + 4) >> 3);
93
 
        b[i+3] = b[i+3] - ((3 * (ref[i+3] + ref[i+4]) + 4) >> 3);
 
89
        b[i+3] = b[i+3] - ((3 * (ref[i+3] + ref[i+4]) + 4) >> 3);*/
 
90
        b[i+0] = b[i+0] + ((7 * (ref[i+0] + ref[i+1])-1) >> 8);
94
91
#else
95
92
 
96
 
        tmp1 = vec_ld (0, ref+4+i);
97
 
        tmp2 = vec_ld (15, ref+4+i);
98
 
 
99
 
        t2 = vec_perm(tmp1, tmp2, align);
100
 
 
101
 
        y = vec_add(t1,vec_sld(t1,t2,4));
102
 
        y = vec_add(vec_add(y,y),y);
103
 
 
104
93
        tmp1 = vec_ld (0, ref+8+i);
105
 
 
106
 
        y = vec_add(y, vec_splat_s32(4));
107
 
        y = vec_sra(y, vec_splat_u32(3));
108
 
 
109
94
        tmp2 = vec_ld (15, ref+8+i);
110
95
 
 
96
        t2 = vec_perm(tmp1, tmp2, align);
 
97
 
 
98
        y = vec_add(t1, vec_sld(t1,t2,2));
 
99
//        y = vec_add(vec_add(y,y),y);
 
100
 
 
101
        tmp1 = vec_ld (0, ref+12+i);
 
102
 
 
103
        y = vec_add(y, vec_splat_s32(4));
 
104
        y = vec_sra(y, vec_splat_u32(3));
 
105
 
 
106
        tmp2 = vec_ld (15, ref+12+i);
 
107
 
111
108
        *vbuf = vec_sub(*vbuf, y);
112
109
 
113
 
        t1=t2;
 
110
        t1 = t2;
114
111
 
115
112
        vbuf++;
116
113
 
164
161
        vbuf++;
165
162
 
166
163
#endif
 
164
 
167
165
        }
168
166
 
169
167
        snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
365
363
        }
366
364
 
367
365
    }
 
366
#endif
368
367
}
369
368
 
370
369
void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width)
524
523
    vector signed int *v = (vector signed int *)vbuf, *d;
525
524
 
526
525
    for(y=0; y<b_h; y++){
527
 
        //FIXME ugly missue of obmc_stride
 
526
        //FIXME ugly misuse of obmc_stride
528
527
 
529
528
        uint8_t *obmc1= obmc + y*obmc_stride;
530
529
        uint8_t *obmc2= obmc1+ (obmc_stride>>1);
590
589
    vector signed int *v = (vector signed int *)vbuf, *d;
591
590
 
592
591
    for(y=0; y<b_h; y++){
593
 
        //FIXME ugly missue of obmc_stride
 
592
        //FIXME ugly misuse of obmc_stride
594
593
 
595
594
        uint8_t *obmc1= obmc + y*obmc_stride;
596
595
        uint8_t *obmc2= obmc1+ (obmc_stride>>1);
673
672
    vector signed int *v = (vector signed int *)vbuf, *d;
674
673
 
675
674
    for(y=0; y<b_h; y++){
676
 
        //FIXME ugly missue of obmc_stride
 
675
        //FIXME ugly misuse of obmc_stride
677
676
 
678
677
        uint8_t *obmc1= obmc + y*obmc_stride;
679
678
        uint8_t *obmc2= obmc1+ (obmc_stride>>1);
719
718
    vector signed int *v = (vector signed int *)vbuf, *d;
720
719
 
721
720
    for(y=0; y<b_h; y++){
722
 
        //FIXME ugly missue of obmc_stride
 
721
        //FIXME ugly misuse of obmc_stride
723
722
 
724
723
        uint8_t *obmc1= obmc + y*obmc_stride;
725
724
        uint8_t *obmc2= obmc1+ (obmc_stride>>1);
782
781
 
783
782
void snow_init_altivec(DSPContext* c, AVCodecContext *avctx)
784
783
{
 
784
#if 0
785
785
        c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec;
786
786
        c->vertical_compose97i = ff_snow_vertical_compose97i_altivec;
787
787
        c->inner_add_yblock = ff_snow_inner_add_yblock_altivec;
 
788
#endif
788
789
}