annotate snow.h @ 3291:454de57e45cf libavcodec

reinit quant matrices if pps is overwritten by another of the same pps_id.
author lorenm
date Fri, 05 May 2006 18:08:01 +0000
parents 8f048c3295ff
children aea2230e6033
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
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
33
3206
c1add9fe5c65 Snow mmx + sse2 part 2
corey
parents: 3198
diff changeset
34 #define LOG2_OBMC_MAX 8
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
35 #define OBMC_MAX (1<<(LOG2_OBMC_MAX))
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
36
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
37 /** 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
38 struct slice_buffer_s {
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
39 DWTELEM * * line; ///< For use by idwt and predict_slices.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
40 DWTELEM * * data_stack; ///< Used for internal purposes.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
41 int data_stack_top;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
42 int line_count;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
43 int line_width;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
44 int data_count;
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
45 DWTELEM * base_buffer; ///< Buffer that this structure is caching.
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
46 };
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
47
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
48 #define liftS lift
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
49 #define lift5 lift
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
50 #if 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
51 #define W_AM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
52 #define W_AO 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
53 #define W_AS 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
54
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
55 #undef liftS
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
56 #define W_BM 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
57 #define W_BO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
58 #define W_BS 4
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 #define W_CM 1
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
61 #define W_CO 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
62 #define W_CS 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
63
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
64 #define W_DM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
65 #define W_DO 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
66 #define W_DS 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
67 #elif 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
68 #define W_AM 55
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
69 #define W_AO 16
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
70 #define W_AS 5
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
71
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
72 #define W_BM 3
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
73 #define W_BO 32
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
74 #define W_BS 6
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
75
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
76 #define W_CM 127
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
77 #define W_CO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
78 #define W_CS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
79
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
80 #define W_DM 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
81 #define W_DO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
82 #define W_DS 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
83 #elif 0
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
84 #define W_AM 97
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
85 #define W_AO 32
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
86 #define W_AS 6
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
87
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
88 #define W_BM 63
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
89 #define W_BO 512
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
90 #define W_BS 10
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
91
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
92 #define W_CM 13
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
93 #define W_CO 8
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
94 #define W_CS 4
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
95
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
96 #define W_DM 15
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
97 #define W_DO 16
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
98 #define W_DS 5
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
99
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
100 #else
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
101
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
102 #define W_AM 203
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
103 #define W_AO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
104 #define W_AS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
105
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
106 #define W_BM 217
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
107 #define W_BO 2048
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
108 #define W_BS 12
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
109
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
110 #define W_CM 113
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
111 #define W_CO 64
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
112 #define W_CS 7
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
113
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
114 #define W_DM 227
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
115 #define W_DO 128
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
116 #define W_DS 9
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
117 #endif
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 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
120 extern void ff_snow_horizontal_compose97i(DWTELEM *b, int width);
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
121 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
122
3223
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
123
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
124 /* C bits used by mmx/sse2/altivec */
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
125
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
126 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
127 (*i) = (width) - 2;
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
128
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
129 if (width & 1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
130 low[(*i)+1] = low[((*i)+1)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
131 (*i)--;
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
132 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
133 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
134
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
135 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
136 for (; (*i)>=0; (*i)-=2){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
137 low[(*i)+1] = high[(*i)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
138 low[*i] = low[(*i)>>1];
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
139 }
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 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
143 for(; i<w; i++){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
144 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
145 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
146
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
147 if((width^lift_high)&1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
148 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
149 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
150 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
151
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
152 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
153 for(; i<w; i++){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
154 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
155 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
156
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
157 if(width&1){
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
158 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
159 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
160 }
8f048c3295ff altivec support for snow
lu_zero
parents: 3206
diff changeset
161
3198
6b9f0c4fbdbe First part of a series of speed-enchancing patches.
gpoirier
parents:
diff changeset
162 #endif