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
145145 inverse);
146146 }
147147
148−static 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
180148 static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
181149 int dst_step, int src_step, int ref_step,
182150 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
210178 inverse);
211179 }
212180
213−static 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−
247181 static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)
248182 {
249183 const int width2 = width >> 1;
@@ -256,41 +190,8 @@ static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width) · 6 unmodified lines
256190 }
257191 if (width & 1)
258192 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
291193 lift(b + w2, temp + w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);
292194 lift(b, temp, b + w2, 1, 1, 1, width, 1, 2, 2, 0, 0);
293−#endif /* 0 */
294195 }
295196
296197 static 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
371272 int i;
372273
373274 for (i = 0; i < width; i++)
374−#ifdef liftS
375− b1[i] -= (W_BM * (b0[i] + b2[i]) + W_BO) >> W_BS;
376−#else
377275 b1[i] = (16 * 4 * b1[i] - 4 * (b0[i] + b2[i]) + W_BO * 5 + (5 << 27)) /
378276 (5 * 16) - (1 << 23);
379−#endif
380277 }
381278
382279 static 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
580477 void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
581478 {
582479 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
591480 int x;
481+
592482 temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
593483 for (x = 1; x < (width >> 1); x++) {
594484 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
610500 b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
611501 } else
612502 b[x - 1] = temp[x - 1] + 3 * b[x - 2];
613−#endif
614503 }
615504
616505 static 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
637526 int i;
638527
639528 for (i = 0; i < width; i++)
640−#ifdef liftS
641− b1[i] += (W_BM * (b0[i] + b2[i]) + W_BO) >> W_BS;
642−#else
643529 b1[i] += (W_BM * (b0[i] + b2[i]) + 4 * b1[i] + W_BO) >> W_BS;
644−#endif
645530 }
646531
647532 static 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
662547 for (i = 0; i < width; i++) {
663548 b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
664549 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
668550 b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
669−#endif
670551 b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
671552 }
672553 }
libavcodec/dwt.h+0−52
@@ -63,7 +63,6 @@ typedef struct DWTContext { · 62 unmodified lines
6363 #define DWT_53 1
6464
6565 #define liftS lift
66−#if 1
6766 #define W_AM 3
6867 #define W_AO 0
6968 #define W_AS 1
@@ -80,57 +79,6 @@ typedef struct DWTContext { · 10 unmodified lines
8079 #define W_DM 3
8180 #define W_DO 4
8281 #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
13482
13583 #define slice_buffer_get_line(slice_buf, line_num) \
13684 ((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