History

dwt: Remove unused code.

Diego Biurrun committed 15 years ago

Commit 1ce5dce1 parent 88386fe2 files · +1 −172Browse files

Unified · Split

2 files
  1. libavcodec/dwt.c +1 −120
  2. libavcodec/dwt.h +0 −52
libavcodec/dwt.c+1−120
@@ -145,38 +145,6 @@ static av_always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, · 144 unmodified lines
145 inverse);145 inverse);
146}146}
147 147
148static av_always_inline void inv_lift(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref,
149 int dst_step, int src_step, int ref_step,
150 int width, int mul, int add, int shift,
151 int highpass, int inverse)
152{
153 const int mirror_left = !highpass;
154 const int mirror_right = (width & 1) ^ highpass;
155 const int w = (width >> 1) - 1 + (highpass & width);
156 int i;
157
158#define LIFT(src, ref, inv) ((src) + ((inv) ? -(ref) : +(ref)))
159 if (mirror_left) {
160 dst[0] = LIFT(src[0], ((mul * 2 * ref[0] + add) >> shift), inverse);
161 dst += dst_step;
162 src += src_step;
163 }
164
165 for (i = 0; i < w; i++)
166 dst[i * dst_step] = LIFT(src[i * src_step],
167 ((mul * (ref[i * ref_step] +
168 ref[(i + 1) * ref_step]) +
169 add) >> shift),
170 inverse);
171
172 if (mirror_right) {
173 dst[w * dst_step] = LIFT(src[w * src_step],
174 ((mul * 2 * ref[w * ref_step] + add) >> shift),
175 inverse);
176 }
177}
178
179#ifndef liftS
180static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,148static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
181 int dst_step, int src_step, int ref_step,149 int dst_step, int src_step, int ref_step,
182 int width, int mul, int add, int shift,150 int width, int mul, int add, int shift,
@@ -210,40 +178,6 @@ static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, · 27 unmodified lines
210 inverse);178 inverse);
211}179}
212 180
213static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src,
214 IDWTELEM *ref, int dst_step,
215 int src_step, int ref_step,
216 int width, int mul, int add, int shift,
217 int highpass, int inverse)
218{
219 const int mirror_left = !highpass;
220 const int mirror_right = (width & 1) ^ highpass;
221 const int w = (width >> 1) - 1 + (highpass & width);
222 int i;
223
224 assert(shift == 4);
225#define LIFTS(src, ref, inv) \
226 ((inv) ? (src) + (((ref) + 4 * (src)) >> shift) \
227 : -((-16 * (src) + (ref) + add / \
228 4 + 1 + (5 << 25)) / (5 * 4) - (1 << 23)))
229 if (mirror_left) {
230 dst[0] = LIFTS(src[0], mul * 2 * ref[0] + add, inverse);
231 dst += dst_step;
232 src += src_step;
233 }
234
235 for (i = 0; i < w; i++)
236 dst[i * dst_step] = LIFTS(src[i * src_step],
237 mul * (ref[i * ref_step] +
238 ref[(i + 1) * ref_step]) + add,
239 inverse);
240
241 if (mirror_right)
242 dst[w * dst_step] = LIFTS(src[w * src_step],
243 mul * 2 * ref[w * ref_step] + add, inverse);
244}
245#endif /* ! liftS */
246
247static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)181static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)
248{182{
249 const int width2 = width >> 1;183 const int width2 = width >> 1;
@@ -256,41 +190,8 @@ static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width) · 6 unmodified lines
256 }190 }
257 if (width & 1)191 if (width & 1)
258 temp[x] = b[2 * x];192 temp[x] = b[2 * x];
259#if 0
260 {
261 int A1, A2, A3, A4;
262 A2 = temp[1];
263 A4 = temp[0];
264 A1 = temp[0 + width2];
265 A1 -= (A2 + A4) >> 1;
266 A4 += (A1 + 1) >> 1;
267 b[0 + width2] = A1;
268 b[0] = A4;
269 for (x = 1; x + 1 < width2; x += 2) {
270 A3 = temp[x + width2];
271 A4 = temp[x + 1];
272 A3 -= (A2 + A4) >> 1;
273 A2 += (A1 + A3 + 2) >> 2;
274 b[x + width2] = A3;
275 b[x] = A2;
276
277 A1 = temp[x + 1 + width2];
278 A2 = temp[x + 2];
279 A1 -= (A2 + A4) >> 1;
280 A4 += (A1 + A3 + 2) >> 2;
281 b[x + 1 + width2] = A1;
282 b[x + 1] = A4;
283 }
284 A3 = temp[width - 1];
285 A3 -= A2;
286 A2 += (A1 + A3 + 2) >> 2;
287 b[width - 1] = A3;
288 b[width2 - 1] = A2;
289 }
290#else
291 lift(b + w2, temp + w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);193 lift(b + w2, temp + w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);
292 lift(b, temp, b + w2, 1, 1, 1, width, 1, 2, 2, 0, 0);194 lift(b, temp, b + w2, 1, 1, 1, width, 1, 2, 2, 0, 0);
293#endif /* 0 */
294}195}
295 196
296static void vertical_decompose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,197static void vertical_decompose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
@@ -371,12 +272,8 @@ static void vertical_decompose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, · 74 unmodified lines
371 int i;272 int i;
372 273
373 for (i = 0; i < width; i++)274 for (i = 0; i < width; i++)
374#ifdef liftS
375 b1[i] -= (W_BM * (b0[i] + b2[i]) + W_BO) >> W_BS;
376#else
377 b1[i] = (16 * 4 * b1[i] - 4 * (b0[i] + b2[i]) + W_BO * 5 + (5 << 27)) /275 b1[i] = (16 * 4 * b1[i] - 4 * (b0[i] + b2[i]) + W_BO * 5 + (5 << 27)) /
378 (5 * 16) - (1 << 23);276 (5 * 16) - (1 << 23);
379#endif
380}277}
381 278
382static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,279static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
@@ -580,15 +477,8 @@ static void av_unused spatial_compose53i(IDWTELEM *buffer, IDWTELEM *temp, · 197 unmodified lines
580void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)477void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
581{478{
582 const int w2 = (width + 1) >> 1;479 const int w2 = (width + 1) >> 1;
583
584#if 0 //maybe more understadable but slower
585 inv_lift(temp, b, b + w2, 2, 1, 1, width, W_DM, W_DO, W_DS, 0, 1);
586 inv_lift(temp + 1, b + w2, temp, 2, 1, 2, width, W_CM, W_CO, W_CS, 1, 1);
587
588 inv_liftS(b, temp, temp + 1, 2, 2, 2, width, W_BM, W_BO, W_BS, 0, 1);
589 inv_lift(b + 1, temp + 1, b, 2, 2, 2, width, W_AM, W_AO, W_AS, 1, 0);
590#else
591 int x;480 int x;
481
592 temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);482 temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
593 for (x = 1; x < (width >> 1); x++) {483 for (x = 1; x < (width >> 1); x++) {
594 temp[2 * x] = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 3);484 temp[2 * x] = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 3);
@@ -610,7 +500,6 @@ void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width) · 15 unmodified lines
610 b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);500 b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
611 } else501 } else
612 b[x - 1] = temp[x - 1] + 3 * b[x - 2];502 b[x - 1] = temp[x - 1] + 3 * b[x - 2];
613#endif
614}503}
615 504
616static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,505static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
@@ -637,11 +526,7 @@ static void vertical_compose97iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, · 20 unmodified lines
637 int i;526 int i;
638 527
639 for (i = 0; i < width; i++)528 for (i = 0; i < width; i++)
640#ifdef liftS
641 b1[i] += (W_BM * (b0[i] + b2[i]) + W_BO) >> W_BS;
642#else
643 b1[i] += (W_BM * (b0[i] + b2[i]) + 4 * b1[i] + W_BO) >> W_BS;529 b1[i] += (W_BM * (b0[i] + b2[i]) + 4 * b1[i] + W_BO) >> W_BS;
644#endif
645}530}
646 531
647static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,532static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
@@ -662,11 +547,7 @@ void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, · 14 unmodified lines
662 for (i = 0; i < width; i++) {547 for (i = 0; i < width; i++) {
663 b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;548 b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
664 b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;549 b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;
665#ifdef liftS
666 b2[i] += (W_BM * (b1[i] + b3[i]) + W_BO) >> W_BS;
667#else
668 b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;550 b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
669#endif
670 b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;551 b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
671 }552 }
672}553}
libavcodec/dwt.h+0−52
@@ -63,7 +63,6 @@ typedef struct DWTContext { · 62 unmodified lines
63#define DWT_53 163#define DWT_53 1
64 64
65#define liftS lift65#define liftS lift
66#if 1
67#define W_AM 366#define W_AM 3
68#define W_AO 067#define W_AO 0
69#define W_AS 168#define W_AS 1
@@ -80,57 +79,6 @@ typedef struct DWTContext { · 10 unmodified lines
80#define W_DM 379#define W_DM 3
81#define W_DO 480#define W_DO 4
82#define W_DS 381#define W_DS 3
83#elif 0
84#define W_AM 55
85#define W_AO 16
86#define W_AS 5
87
88#define W_BM 3
89#define W_BO 32
90#define W_BS 6
91
92#define W_CM 127
93#define W_CO 64
94#define W_CS 7
95
96#define W_DM 7
97#define W_DO 8
98#define W_DS 4
99#elif 0
100#define W_AM 97
101#define W_AO 32
102#define W_AS 6
103
104#define W_BM 63
105#define W_BO 512
106#define W_BS 10
107
108#define W_CM 13
109#define W_CO 8
110#define W_CS 4
111
112#define W_DM 15
113#define W_DO 16
114#define W_DS 5
115
116#else
117
118#define W_AM 203
119#define W_AO 64
120#define W_AS 7
121
122#define W_BM 217
123#define W_BO 2048
124#define W_BS 12
125
126#define W_CM 113
127#define W_CO 64
128#define W_CS 7
129
130#define W_DM 227
131#define W_DO 128
132#define W_DS 9
133#endif
134 82
135#define slice_buffer_get_line(slice_buf, line_num) \83#define slice_buffer_get_line(slice_buf, line_num) \
136 ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] \84 ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t