Mercurial > libavcodec.hg
annotate alpha/mpegvideo_alpha.c @ 1027:a0a7149be543 libavcodec
fixed dependancy generation (I want the case where SRC_PATH is not . to work too - very useful if you have different gcc versions to test at the same time...) - fixed -msse stuff
author | bellard |
---|---|
date | Wed, 22 Jan 2003 09:35:03 +0000 |
parents | 2f7da29ede37 |
children | f59c3f66363b |
rev | line source |
---|---|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
1 /* |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
2 * Alpha optimized DSP utils |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org> |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
18 */ |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
19 |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
20 #include "asm.h" |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
21 #include "../dsputil.h" |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
22 #include "../mpegvideo.h" |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
23 |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
732
diff
changeset
|
24 extern void simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
732
diff
changeset
|
25 extern void simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
732
diff
changeset
|
26 |
515
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
27 static void dct_unquantize_h263_axp(MpegEncContext *s, DCTELEM *block, |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
28 int n, int qscale) |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
29 { |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
30 int i, n_coeffs; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
31 uint64_t qmul, qadd; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
32 uint64_t correction; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
33 DCTELEM *orig_block = block; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
34 DCTELEM block0; |
505
7a976bf93394
Ugly hack to make the assembler accept MVI instructions.
mellum
parents:
429
diff
changeset
|
35 |
732
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
36 qadd = WORD_VEC((qscale - 1) | 1); |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
37 qmul = qscale << 1; |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
38 /* This mask kills spill from negative subwords to the next subword. */ |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
39 correction = WORD_VEC((qmul - 1) + 1); /* multiplication / addition */ |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
40 |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
41 if (s->mb_intra) { |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
42 if (!s->h263_aic) { |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
43 if (n < 4) |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
44 block0 = block[0] * s->y_dc_scale; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
45 else |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
46 block0 = block[0] * s->c_dc_scale; |
732
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
47 } else { |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
48 qadd = 0; |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
49 } |
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
50 n_coeffs = 63; // does not always use zigzag table |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
51 } else { |
729
fb7d96d818cf
Make compilable again after DCT cleanup. It gives wrong results,
mellum
parents:
515
diff
changeset
|
52 n_coeffs = s->intra_scantable.raster_end[s->block_last_index[n]]; |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
53 } |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
54 |
732
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
55 for(i = 0; i <= n_coeffs; block += 4, i += 4) { |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
56 uint64_t levels, negmask, zeros, add; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
57 |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
58 levels = ldq(block); |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
59 if (levels == 0) |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
60 continue; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
61 |
515
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
62 #ifdef __alpha_max__ |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
63 /* I don't think the speed difference justifies runtime |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
64 detection. */ |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
65 ASM_ACCEPT_MVI; |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
66 negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */ |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
67 negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */ |
515
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
68 #else |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
69 negmask = cmpbge(WORD_VEC(0x7fff), levels); |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
70 negmask &= (negmask >> 1) | (1 << 7); |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
71 negmask = zap(-1, negmask); |
86f73263a61c
Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents:
514
diff
changeset
|
72 #endif |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
73 |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
74 zeros = cmpbge(0, levels); |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
75 zeros &= zeros >> 1; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
76 /* zeros |= zeros << 1 is not needed since qadd <= 255, so |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
77 zapping the lower byte suffices. */ |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
78 |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
79 levels *= qmul; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
80 levels -= correction & (negmask << 16); |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
81 |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
82 /* Negate qadd for negative levels. */ |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
83 add = qadd ^ negmask; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
84 add += WORD_VEC(0x0001) & negmask; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
85 /* Set qadd to 0 for levels == 0. */ |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
86 add = zap(add, zeros); |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
87 |
514
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
88 levels += add; |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
89 |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
90 stq(levels, block); |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
91 } |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
92 |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
93 if (s->mb_intra && !s->h263_aic) |
c9f724e3a797
Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents:
505
diff
changeset
|
94 orig_block[0] = block0; |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
95 } |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
96 |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
97 void MPV_common_init_axp(MpegEncContext *s) |
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
98 { |
732
bf4304c46cda
* Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents:
729
diff
changeset
|
99 s->dct_unquantize_h263 = dct_unquantize_h263_axp; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
732
diff
changeset
|
100 s->idct_put = simple_idct_put_axp; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
732
diff
changeset
|
101 s->idct_add = simple_idct_add_axp; |
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff
changeset
|
102 } |