annotate alpha/mpegvideo_alpha.c @ 12130:917a70cf7681 libavcodec

Document that and why subtitle decoders do not support direct-rendering.
author reimar
date Sat, 10 Jul 2010 23:35:15 +0000
parents 2d6a70824dfe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
10 * version 2.1 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
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
12 * FFmpeg 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
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
15 * 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
16 *
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
20 */
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
21
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 5010
diff changeset
22 #include "libavcodec/dsputil.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 5010
diff changeset
23 #include "libavcodec/mpegvideo.h"
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
24 #include "asm.h"
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
25
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
26 static void dct_unquantize_h263_axp(DCTELEM *block, int n_coeffs,
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
27 uint64_t qscale, uint64_t qadd)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
28 {
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
29 uint64_t qmul = qscale << 1;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
30 uint64_t correction = WORD_VEC(qmul * 255 >> 8);
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
31 int i;
732
bf4304c46cda * Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents: 729
diff changeset
32
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
33 qadd = WORD_VEC(qadd);
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
34
732
bf4304c46cda * Fix dct_unquantize_h263_axp for changed block_last_index indexing.
mellum
parents: 729
diff changeset
35 for(i = 0; i <= n_coeffs; block += 4, i += 4) {
8616
225104b68cbb Alpha: fix dct_unquantize_h263_inter/intra_axp()
mru
parents: 6763
diff changeset
36 uint64_t levels, negmask, zeros, add, sub;
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
37
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
38 levels = ldq(block);
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
39 if (levels == 0)
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
40 continue;
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
41
515
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
42 #ifdef __alpha_max__
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
43 /* 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
44 detection. */
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
45 negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
46 negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */
515
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
47 #else
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
48 negmask = cmpbge(WORD_VEC(0x7fff), levels);
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
49 negmask &= (negmask >> 1) | (1 << 7);
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
50 negmask = zap(-1, negmask);
86f73263a61c Make dct_unquantize_h263 work on systems without MVI extension.
mellum
parents: 514
diff changeset
51 #endif
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
52
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
53 zeros = cmpbge(0, levels);
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
54 zeros &= zeros >> 1;
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
55 /* 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
56 zapping the lower byte suffices. */
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 *= qmul;
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
59 levels -= correction & (negmask << 16);
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
60
8616
225104b68cbb Alpha: fix dct_unquantize_h263_inter/intra_axp()
mru
parents: 6763
diff changeset
61 add = qadd & ~negmask;
225104b68cbb Alpha: fix dct_unquantize_h263_inter/intra_axp()
mru
parents: 6763
diff changeset
62 sub = qadd & negmask;
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
63 /* Set qadd to 0 for levels == 0. */
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
64 add = zap(add, zeros);
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
65 levels += add;
8616
225104b68cbb Alpha: fix dct_unquantize_h263_inter/intra_axp()
mru
parents: 6763
diff changeset
66 levels -= sub;
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
67
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
68 stq(levels, block);
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
69 }
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
70 }
514
c9f724e3a797 Update and activate dct_unquantize_h263_mvi. Thanks to Mns Rullgrd
mellum
parents: 505
diff changeset
71
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
72 static void dct_unquantize_h263_intra_axp(MpegEncContext *s, DCTELEM *block,
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
73 int n, int qscale)
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
74 {
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
75 int n_coeffs;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
76 uint64_t qadd;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
77 DCTELEM block0 = block[0];
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
78
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
79 if (!s->h263_aic) {
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
80 if (n < 4)
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
81 block0 *= s->y_dc_scale;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
82 else
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
83 block0 *= s->c_dc_scale;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
84 qadd = (qscale - 1) | 1;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
85 } else {
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
86 qadd = 0;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
87 }
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
88
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
89 if(s->ac_pred)
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
90 n_coeffs = 63;
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
91 else
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
92 n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
93
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
94 dct_unquantize_h263_axp(block, n_coeffs, qscale, qadd);
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
95
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
96 block[0] = block0;
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
97 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
98
1693
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
99 static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block,
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
100 int n, int qscale)
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
101 {
8617
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
102 int n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
2d6a70824dfe Alpha: factor common parts from dct_unquantize_h263_intra/inter_axp
mru
parents: 8616
diff changeset
103 dct_unquantize_h263_axp(block, n_coeffs, qscale, (qscale - 1) | 1);
1693
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
104 }
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
105
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
106 void MPV_common_init_axp(MpegEncContext *s)
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
107 {
1693
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
108 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_axp;
61cebcb5a997 100l (forgot alpha & ppc)
michael
parents: 1465
diff changeset
109 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_axp;
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
110 }