annotate snow.h @ 3455:cc4b4ea83e29 libavcodec

--enable/disable parsers. Warning: some combinations are broken.
author mru
date Sun, 09 Jul 2006 12:02:15 +0000
parents fb245e797c5d
children 6310389a9688
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
1 /*
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
2 * Copyright (C) 2004 Michael Niedermayer <michaelni@gmx.at>
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
3 * Copyright (C) 2006 Robert Edele <yartrebo@earthlink.net>
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
4 *
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
9 *
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
13 * Lesser General Public License for more details.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
14 *
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
18 */
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
19
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
20 #ifndef _SNOW_H
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
21 #define _SNOW_H
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
22
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
23 #include "dsputil.h"
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
24
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
25 #define MID_STATE 128
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
26
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
27 #define MAX_DECOMPOSITIONS 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
28 #define MAX_PLANES 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
29 #define QSHIFT 5
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
30 #define QROOT (1<<QSHIFT)
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
31 #define LOSSLESS_QLOG -128
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
32 #define FRAC_BITS 8
3314
aea2230e6033 Snow multiple reference frames
lorenm
parents: 3223
diff changeset
33 #define MAX_REF_FRAMES 8
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
34
3206
c1add9fe5c65 Snow mmx + sse2 part 2
corey
parents: 3198
diff changeset
35 #define LOG2_OBMC_MAX 8
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
36 #define OBMC_MAX (1<<(LOG2_OBMC_MAX))
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
37
3326
fb245e797c5d Snow: cosmetics
lorenm
parents: 3323
diff changeset
38 #define DWT_97 0
fb245e797c5d Snow: cosmetics
lorenm
parents: 3323
diff changeset
39 #define DWT_53 1
fb245e797c5d Snow: cosmetics
lorenm
parents: 3323
diff changeset
40 #define DWT_X 2
fb245e797c5d Snow: cosmetics
lorenm
parents: 3323
diff changeset
41
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
42 /** Used to minimize the amount of memory used in order to optimize cache performance. **/
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
43 struct slice_buffer_s {
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
44 DWTELEM * * line; ///< For use by idwt and predict_slices.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
45 DWTELEM * * data_stack; ///< Used for internal purposes.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
46 int data_stack_top;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
47 int line_count;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
48 int line_width;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
49 int data_count;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
50 DWTELEM * base_buffer; ///< Buffer that this structure is caching.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
51 };
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
52
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
53 #define liftS lift
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
54 #define lift5 lift
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
55 #if 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
56 #define W_AM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
57 #define W_AO 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
58 #define W_AS 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
59
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
60 #undef liftS
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
61 #define W_BM 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
62 #define W_BO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
63 #define W_BS 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
65 #define W_CM 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
66 #define W_CO 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
67 #define W_CS 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
68
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
69 #define W_DM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
70 #define W_DO 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
71 #define W_DS 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
72 #elif 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
73 #define W_AM 55
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
74 #define W_AO 16
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
75 #define W_AS 5
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
76
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
77 #define W_BM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
78 #define W_BO 32
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
79 #define W_BS 6
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
80
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
81 #define W_CM 127
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
82 #define W_CO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
83 #define W_CS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
84
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
85 #define W_DM 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
86 #define W_DO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
87 #define W_DS 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
88 #elif 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
89 #define W_AM 97
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
90 #define W_AO 32
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
91 #define W_AS 6
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
92
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
93 #define W_BM 63
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
94 #define W_BO 512
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
95 #define W_BS 10
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
96
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
97 #define W_CM 13
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
98 #define W_CO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
99 #define W_CS 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
100
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
101 #define W_DM 15
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
102 #define W_DO 16
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
103 #define W_DS 5
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
104
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
105 #else
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
106
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
107 #define W_AM 203
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
108 #define W_AO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
109 #define W_AS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
110
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
111 #define W_BM 217
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
112 #define W_BO 2048
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
113 #define W_BS 12
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
114
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
115 #define W_CM 113
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
116 #define W_CO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
117 #define W_CS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
118
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
119 #define W_DM 227
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
120 #define W_DO 128
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
121 #define W_DS 9
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
122 #endif
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
123
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
124 extern void ff_snow_vertical_compose97i(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width);
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
125 extern void ff_snow_horizontal_compose97i(DWTELEM *b, int width);
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
126 extern void ff_snow_inner_add_yblock(uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
127
3323
87c54a3f8d19 Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents: 3314
diff changeset
128 int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
87c54a3f8d19 Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents: 3314
diff changeset
129 int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
87c54a3f8d19 Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
lorenm
parents: 3314
diff changeset
130
3223
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
131
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
132 /* C bits used by mmx/sse2/altivec */
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
133
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
134 static always_inline void snow_interleave_line_header(int * i, int width, DWTELEM * low, DWTELEM * high){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
135 (*i) = (width) - 2;
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
136
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
137 if (width & 1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
138 low[(*i)+1] = low[((*i)+1)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
139 (*i)--;
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
140 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
141 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
142
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
143 static always_inline void snow_interleave_line_footer(int * i, DWTELEM * low, DWTELEM * high){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
144 for (; (*i)>=0; (*i)-=2){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
145 low[(*i)+1] = high[(*i)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
146 low[*i] = low[(*i)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
147 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
148 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
149
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
150 static always_inline void snow_horizontal_compose_lift_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
151 for(; i<w; i++){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
152 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
153 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
154
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
155 if((width^lift_high)&1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
156 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
157 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
158 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
159
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
160 static always_inline void snow_horizontal_compose_liftS_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
161 for(; i<w; i++){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
162 dst[i] = src[i] - (((-(ref[i] + ref[(i+1)])+W_BO) - 4 * src[i]) >> W_BS);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
163 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
164
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
165 if(width&1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
166 dst[w] = src[w] - (((-2 * ref[w] + W_BO) - 4 * src[w]) >> W_BS);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
167 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
168 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
169
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
170 #endif