6 #include <schroedinger/schro.h>
7 #include <schroedinger/schroorc.h>
8 #include <schroedinger/schrovirtframe.h>
11 static void schro_iwt_desl_9_3 (SchroFrameData
*fd
, int16_t *tmp
);
12 static void schro_iwt_5_3 (SchroFrameData
*fd
, int16_t *tmp
);
13 static void schro_iwt_13_5 (SchroFrameData
*fd
, int16_t *tmp
);
14 static void schro_iwt_haar0 (SchroFrameData
*fd
, int16_t *tmp
);
15 static void schro_iwt_haar1 (SchroFrameData
*fd
, int16_t *tmp
);
16 static void schro_iwt_fidelity (SchroFrameData
*fd
, int16_t *tmp
);
17 static void schro_iwt_daub_9_7 (SchroFrameData
*fd
, int16_t *tmp
);
19 static void schro_iwt_desl_9_3_s32 (SchroFrameData
*fd
, int32_t *tmp
);
20 static void schro_iwt_5_3_s32 (SchroFrameData
*fd
, int32_t *tmp
);
21 static void schro_iwt_13_5_s32 (SchroFrameData
*fd
, int32_t *tmp
);
22 static void schro_iwt_haar0_s32 (SchroFrameData
*fd
, int32_t *tmp
);
23 static void schro_iwt_haar1_s32 (SchroFrameData
*fd
, int32_t *tmp
);
24 static void schro_iwt_fidelity_s32 (SchroFrameData
*fd
, int32_t *tmp
);
25 static void schro_iwt_daub_9_7_s32 (SchroFrameData
*fd
, int32_t *tmp
);
27 static void schro_iiwt_desl_9_3 (SchroFrameData
*dest
, SchroFrameData
*src
,
29 static void schro_iiwt_5_3 (SchroFrameData
*dest
, SchroFrameData
*src
,
31 static void schro_iiwt_13_5 (SchroFrameData
*dest
, SchroFrameData
*src
,
33 static void schro_iiwt_haar0 (SchroFrameData
*dest
, SchroFrameData
*src
,
35 static void schro_iiwt_haar1 (SchroFrameData
*dest
, SchroFrameData
*src
,
37 static void schro_iiwt_fidelity (SchroFrameData
*dest
, SchroFrameData
*src
,
39 static void schro_iiwt_daub_9_7 (SchroFrameData
*dest
, SchroFrameData
*src
,
42 static void schro_iiwt_desl_9_3_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
44 static void schro_iiwt_5_3_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
46 static void schro_iiwt_13_5_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
48 static void schro_iiwt_haar0_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
50 static void schro_iiwt_haar1_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
52 static void schro_iiwt_fidelity_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
54 static void schro_iiwt_daub_9_7_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
58 /* Forward transform splitter function */
61 schro_wavelet_transform_2d (SchroFrameData
* fd
, int filter
, int16_t * tmp
)
63 if ((SCHRO_FRAME_FORMAT_DEPTH (fd
->format
) ==
64 SCHRO_FRAME_FORMAT_DEPTH_S16
)) {
66 case SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7
:
67 schro_iwt_desl_9_3 (fd
, tmp
);
69 case SCHRO_WAVELET_LE_GALL_5_3
:
70 schro_iwt_5_3 (fd
, tmp
);
72 case SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7
:
73 schro_iwt_13_5 (fd
, tmp
);
75 case SCHRO_WAVELET_HAAR_0
:
76 schro_iwt_haar0 (fd
, tmp
);
78 case SCHRO_WAVELET_HAAR_1
:
79 schro_iwt_haar1 (fd
, tmp
);
81 case SCHRO_WAVELET_FIDELITY
:
82 schro_iwt_fidelity (fd
, tmp
);
84 case SCHRO_WAVELET_DAUBECHIES_9_7
:
85 schro_iwt_daub_9_7 (fd
, tmp
);
92 case SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7
:
93 schro_iwt_desl_9_3_s32 (fd
, (orc_int32
*)tmp
);
95 case SCHRO_WAVELET_LE_GALL_5_3
:
96 schro_iwt_5_3_s32 (fd
, (orc_int32
*)tmp
);
98 case SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7
:
99 schro_iwt_13_5_s32 (fd
, (orc_int32
*)tmp
);
101 case SCHRO_WAVELET_HAAR_0
:
102 schro_iwt_haar0_s32 (fd
, (orc_int32
*)tmp
);
104 case SCHRO_WAVELET_HAAR_1
:
105 schro_iwt_haar1_s32 (fd
, (orc_int32
*)tmp
);
107 case SCHRO_WAVELET_FIDELITY
:
108 schro_iwt_fidelity_s32 (fd
, (orc_int32
*)tmp
);
110 case SCHRO_WAVELET_DAUBECHIES_9_7
:
111 schro_iwt_daub_9_7_s32 (fd
, (orc_int32
*)tmp
);
119 /* Inverse transform splitter function */
122 schro_wavelet_inverse_transform_2d (SchroFrameData
* fd_dest
,
123 SchroFrameData
*fd_src
, int filter
, int16_t * tmp
)
126 if ((SCHRO_FRAME_FORMAT_DEPTH (fd_dest
->format
) ==
127 SCHRO_FRAME_FORMAT_DEPTH_S16
)) {
128 SCHRO_ASSERT (SCHRO_FRAME_FORMAT_DEPTH (fd_src
->format
) ==
129 SCHRO_FRAME_FORMAT_DEPTH_S16
);
132 case SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7
:
133 schro_iiwt_desl_9_3 (fd_dest
, fd_src
, tmp
);
135 case SCHRO_WAVELET_LE_GALL_5_3
:
136 schro_iiwt_5_3 (fd_dest
, fd_src
, tmp
);
138 case SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7
:
139 schro_iiwt_13_5 (fd_dest
, fd_src
, tmp
);
141 case SCHRO_WAVELET_HAAR_0
:
142 schro_iiwt_haar0 (fd_dest
, fd_src
, tmp
);
144 case SCHRO_WAVELET_HAAR_1
:
145 schro_iiwt_haar1 (fd_dest
, fd_src
, tmp
);
147 case SCHRO_WAVELET_FIDELITY
:
148 schro_iiwt_fidelity (fd_dest
, fd_src
, tmp
);
150 case SCHRO_WAVELET_DAUBECHIES_9_7
:
151 schro_iiwt_daub_9_7 (fd_dest
, fd_src
, tmp
);
156 } else if ((SCHRO_FRAME_FORMAT_DEPTH (fd_dest
->format
) ==
157 SCHRO_FRAME_FORMAT_DEPTH_S32
)) {
158 SCHRO_ASSERT (SCHRO_FRAME_FORMAT_DEPTH (fd_src
->format
) ==
159 SCHRO_FRAME_FORMAT_DEPTH_S32
);
162 case SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7
:
163 schro_iiwt_desl_9_3_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
165 case SCHRO_WAVELET_LE_GALL_5_3
:
166 schro_iiwt_5_3_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
168 case SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7
:
169 schro_iiwt_13_5_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
171 case SCHRO_WAVELET_HAAR_0
:
172 schro_iiwt_haar0_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
174 case SCHRO_WAVELET_HAAR_1
:
175 schro_iiwt_haar1_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
177 case SCHRO_WAVELET_FIDELITY
:
178 schro_iiwt_fidelity_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
180 case SCHRO_WAVELET_DAUBECHIES_9_7
:
181 schro_iiwt_daub_9_7_s32 (fd_dest
, fd_src
, (int32_t *)tmp
);
190 /* some utility functions */
193 extend_1_2 (orc_int16
*data
, int n
)
197 data
[n
] = data
[n
- 1];
198 data
[n
+ 1] = data
[n
- 1];
202 extend_2_1 (orc_int16
*data
, int n
)
207 data
[n
] = data
[n
- 1];
211 extend_1_1 (orc_int16
*data
, int n
)
215 data
[n
] = data
[n
- 1];
219 extend_1_0 (orc_int16
*data
, int n
)
225 extend_2_2 (orc_int16
*data
, int n
)
230 data
[n
] = data
[n
- 1];
231 data
[n
+1] = data
[n
- 1];
234 #define extend_4_3 extend_4_4
235 #define extend_3_4 extend_4_4
237 extend_4_4 (orc_int16
*data
, int n
)
244 data
[n
] = data
[n
- 1];
245 data
[n
+1] = data
[n
- 1];
246 data
[n
+2] = data
[n
- 1];
247 data
[n
+3] = data
[n
- 1];
250 #define extend_1_0_s32 extend_4_4_s32
251 #define extend_1_1_s32 extend_4_4_s32
252 #define extend_2_2_s32 extend_4_4_s32
253 #define extend_1_2_s32 extend_4_4_s32
254 #define extend_2_1_s32 extend_4_4_s32
255 #define extend_4_3_s32 extend_4_4_s32
256 #define extend_3_4_s32 extend_4_4_s32
258 extend_4_4_s32 (orc_int32
*data
, int n
)
265 data
[n
] = data
[n
- 1];
266 data
[n
+1] = data
[n
- 1];
267 data
[n
+2] = data
[n
- 1];
268 data
[n
+3] = data
[n
- 1];
272 join (orc_int16
*dest
, orc_int16
*src1
, orc_int16
*src2
, int width
)
274 orc_memcpy (dest
, src1
, width
/ 2 * sizeof (int16_t));
275 orc_memcpy (dest
+ width
/ 2, src2
, width
/ 2 * sizeof (int16_t));
279 join_s32 (orc_int32
*dest
, orc_int32
*src1
, orc_int32
*src2
, int width
)
281 orc_memcpy (dest
, src1
, width
/ 2 * sizeof (int32_t));
282 orc_memcpy (dest
+ width
/ 2, src2
, width
/ 2 * sizeof (int32_t));
285 /* Forward, 16-bit, Wavelet #0: Deslauriers-Dubuc 9,7 */
288 wavelet_iwt_desl_9_3_horiz (SchroFrameData
* fd
, int i
, orc_int16
*tmp
)
290 int width
= fd
->width
;
291 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
292 int16_t *hi
= tmp
+ 4;
293 int16_t *lo
= tmp
+ width
/2 + 12;
295 orc_deinterleave2_lshift1_s16 (hi
, lo
, line
, width
/ 2);
296 extend_1_2 (hi
, width
/2);
297 orc_mas4_horiz_sub_s16_1991_ip (lo
, hi
- 1, 1 << 3, 4, width
/2);
298 extend_1_0 (lo
, width
/2);
299 orc_add2_rshift_add_s16_22 (hi
, lo
- 1, width
/2);
300 join (line
, hi
, lo
, width
);
304 wavelet_iwt_desl_9_3_vert_odd (SchroFrameData
*fd
, int i
)
306 int width
= fd
->width
;
307 int height
= fd
->height
;
310 if (i
< 3 || i
>= height
- 3) {
311 orc_mas4_vert_sub_s16_1991 (
312 SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
313 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 3, 0, height
- 2)),
314 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 1, 0, height
- 2)),
315 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
+ 1, 0, height
- 2)),
316 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
+ 3, 0, height
- 2)), 1 << 3, 4, width
);
318 orc_mas4_vert_sub_s16_1991 (
319 SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
320 SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 3),
321 SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1),
322 SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1),
323 SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 3), 1 << 3, 4, width
);
329 wavelet_iwt_desl_9_3_vert_even (SchroFrameData
*fd
, int i
)
331 int width
= fd
->width
;
337 lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
339 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
341 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
343 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+1);
345 orc_add2_rshift_add_s16_22_vert (lo
, hi1
, hi2
, width
);
350 schro_iwt_desl_9_3 (SchroFrameData
*fd
, int16_t * tmp
)
355 for(i
=-6;i
<fd
->height
;i
++) {
357 if (j
>= 0 && j
< fd
->height
) {
358 wavelet_iwt_desl_9_3_horiz (fd
, j
, tmp
);
362 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
363 wavelet_iwt_desl_9_3_vert_odd (fd
, j
);
367 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
368 wavelet_iwt_desl_9_3_vert_even (fd
, j
);
374 /* Forward, 16-bit, Wavelet #1: LeGall 5,3 */
377 wavelet_iwt_5_3_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
379 int width
= fd
->width
;
380 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
381 int16_t *hi
= tmp
+ 4;
382 int16_t *lo
= tmp
+ width
/2 + 12;
384 orc_deinterleave2_lshift1_s16 (hi
, lo
, line
, width
/ 2);
385 extend_1_1 (hi
, width
/2);
386 orc_add2_rshift_sub_s16_11 (lo
, hi
, width
/2);
387 extend_1_1 (lo
, width
/2);
388 orc_add2_rshift_add_s16_22 (hi
, lo
- 1, width
/2);
389 join (line
, hi
, lo
, width
);
393 wavelet_iwt_5_3_vert_odd (SchroFrameData
* fd
, int i
)
400 hi
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
401 lo1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1);
402 if (i
+ 1 < fd
->height
) {
403 lo2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
408 orc_add2_rshift_sub_s16_11_vert (hi
, lo1
, lo2
, fd
->width
);
413 wavelet_iwt_5_3_vert_even (SchroFrameData
*fd
, int i
)
420 lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
422 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
424 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1);
426 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
428 orc_add2_rshift_add_s16_22_vert (lo
, hi1
, hi2
, fd
->width
);
433 schro_iwt_5_3 (SchroFrameData
*fd
, int16_t * tmp
)
438 for(i
=-2;i
<fd
->height
;i
++) {
440 if (j
>= 0 && j
< fd
->height
) {
441 wavelet_iwt_5_3_horiz (fd
, j
, tmp
);
445 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
446 wavelet_iwt_5_3_vert_odd (fd
, j
);
450 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
451 wavelet_iwt_5_3_vert_even (fd
, j
);
457 /* Forward, 16-bit, Wavelet #2: Deslauriers-Dubuc 13,7 */
460 wavelet_iwt_13_5_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
462 int width
= fd
->width
;
463 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
464 int16_t *hi
= tmp
+ 4;
465 int16_t *lo
= tmp
+ width
/2 + 12;
467 orc_deinterleave2_lshift1_s16 (hi
, lo
, line
, width
/ 2);
468 extend_1_2 (hi
, width
/2);
469 orc_mas4_horiz_sub_s16_1991_ip (lo
, hi
- 1, 1 << 3, 4, width
/2);
470 extend_2_1 (lo
, width
/2);
471 orc_mas4_horiz_add_s16_1991_ip (hi
, lo
- 2, 1 << 4, 5, width
/2);
472 join (line
, hi
, lo
, width
);
476 wavelet_iwt_13_5_vert_odd (SchroFrameData
*fd
, int i
)
478 int16_t *dest
, *s1
, *s2
, *s3
, *s4
;
481 if (i
< 3 || i
>= fd
->height
- 3) {
482 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 3, 0, fd
->height
- 2));
483 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 1, 0, fd
->height
- 2));
484 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 1, 0, fd
->height
- 2));
485 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 3, 0, fd
->height
- 2));
487 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 3);
488 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
489 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
490 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 3);
492 dest
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
493 orc_mas4_vert_sub_s16_1991 (dest
, s1
, s2
, s3
, s4
, 1 << 3, 4, fd
->width
);
498 wavelet_iwt_13_5_vert_even (SchroFrameData
*fd
, int i
)
500 int16_t *dest
, *s1
, *s2
, *s3
, *s4
;
503 if (i
< 3 || i
>= fd
->height
- 3) {
504 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 3, 1, fd
->height
- 1));
505 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 1, 1, fd
->height
- 1));
506 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 1, 1, fd
->height
- 1));
507 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 3, 1, fd
->height
- 1));
509 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 3);
510 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
511 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
512 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 3);
514 dest
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
515 orc_mas4_vert_add_s16_1991 (dest
, s1
, s2
, s3
, s4
, 1 << 4, 5, fd
->width
);
520 schro_iwt_13_5 (SchroFrameData
*fd
, int16_t * tmp
)
525 for(i
=-6;i
<fd
->height
;i
++) {
527 if (j
>= 0 && j
< fd
->height
) {
528 wavelet_iwt_13_5_horiz (fd
, j
, tmp
);
532 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
533 wavelet_iwt_13_5_vert_odd (fd
, j
);
537 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
538 wavelet_iwt_13_5_vert_even (fd
, j
);
543 /* Forward, 16-bit, Wavelet #3,4: Haar 0 and Haar 1 */
546 wavelet_iwt_haar_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
548 int width
= fd
->width
;
549 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
550 int16_t *hi
= tmp
+ width
/ 2;
553 orc_haar_deint_split_s16 (lo
, hi
, line
, width
/ 2);
554 join (line
, hi
, lo
, width
);
558 wavelet_iwt_haar_shift1_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
560 int width
= fd
->width
;
561 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
562 int16_t *hi
= tmp
+ width
/ 2;
565 orc_haar_deint_lshift1_split_s16 (lo
, hi
, line
, width
/ 2);
566 join (line
, hi
, lo
, width
);
570 wavelet_iwt_haar_vert (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
572 int16_t *hi
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
573 int16_t *lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
575 orc_haar_split_s16_op (hi
, lo
, tmp
, tmp
+ fd
->width
, fd
->width
);
579 schro_iwt_haar0 (SchroFrameData
*fd
, int16_t * tmp
)
583 for(i
=0;i
<fd
->height
;i
+=2) {
584 wavelet_iwt_haar_horiz (fd
, i
, tmp
);
585 wavelet_iwt_haar_horiz (fd
, i
+1, tmp
+ fd
->width
);
587 wavelet_iwt_haar_vert (fd
, i
, tmp
);
592 schro_iwt_haar1 (SchroFrameData
*fd
, int16_t * tmp
)
596 for(i
=0;i
<fd
->height
;i
+=2) {
597 wavelet_iwt_haar_shift1_horiz (fd
, i
, tmp
);
598 wavelet_iwt_haar_shift1_horiz (fd
, i
+1, tmp
+ fd
->width
);
600 wavelet_iwt_haar_vert (fd
, i
, tmp
);
604 /* Forward, 16-bit, Wavelet #5: Fidelity */
607 mas8_add_s16 (int16_t * dest
, const int16_t * src
, const int16_t * weights
,
608 int offset
, int shift
, int n
)
611 for (i
= 0; i
< n
; i
++) {
613 x
+= src
[i
+ 0] * weights
[0];
614 x
+= src
[i
+ 1] * weights
[1];
615 x
+= src
[i
+ 2] * weights
[2];
616 x
+= src
[i
+ 3] * weights
[3];
617 x
+= src
[i
+ 4] * weights
[4];
618 x
+= src
[i
+ 5] * weights
[5];
619 x
+= src
[i
+ 6] * weights
[6];
620 x
+= src
[i
+ 7] * weights
[7];
621 dest
[i
] += x
>> shift
;
626 schro_split_ext_fidelity (int16_t * hi
, int16_t * lo
, int n
)
628 static const int16_t stage1_weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
629 static const int16_t stage2_weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
632 mas8_add_s16 (hi
, lo
- 4, stage1_weights
, 128, 8, n
);
634 mas8_add_s16 (lo
, hi
- 3, stage2_weights
, 127, 8, n
);
638 wavelet_iwt_fidelity_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
640 int width
= fd
->width
;
641 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
642 int16_t *hi
= tmp
+ 4;
643 int16_t *lo
= tmp
+ width
/2 + 12;
645 orc_deinterleave2_s16 (hi
, lo
, line
, width
/ 2);
646 schro_split_ext_fidelity (hi
, lo
, width
/ 2);
647 join (line
, hi
, lo
, width
);
651 mas8_vert_add_s16_2 (int16_t * dest
, const int16_t * src
,
652 int16_t ** s
, const int *weights
, int offset
, int shift
, int n
)
656 for (i
= 0; i
< n
; i
++) {
658 for (j
= 0; j
< 8; j
++) {
659 x
+= s
[j
][i
] * weights
[j
];
661 dest
[i
] = src
[i
] + (x
>> shift
);
666 wavelet_iwt_fidelity_vert_odd (SchroFrameData
*fd
, int i
)
668 int width
= fd
->width
;
669 int height
= fd
->height
;
674 static const int weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
675 for (j
= 0; j
< 8; j
++) {
676 s
[j
] = SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 7 + j
* 2, 0, height
- 2));
678 mas8_vert_add_s16_2 (SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
679 SCHRO_FRAME_DATA_GET_LINE (fd
, i
), s
,
680 weights
, 127, 8, width
);
685 wavelet_iwt_fidelity_vert_even (SchroFrameData
*fd
, int i
)
687 int width
= fd
->width
;
688 int height
= fd
->height
;
693 static const int weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
694 for (j
= 0; j
< 8; j
++) {
695 s
[j
] = SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 7 + j
* 2, 1, height
- 1));
697 mas8_vert_add_s16_2 (SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
698 SCHRO_FRAME_DATA_GET_LINE (fd
, i
), s
,
699 weights
, 128, 8, width
);
704 schro_iwt_fidelity (SchroFrameData
*fd
, int16_t * tmp
)
709 for(i
=-14;i
<fd
->height
;i
++) {
711 if (j
>= 0 && j
< fd
->height
) {
712 wavelet_iwt_fidelity_horiz (fd
, j
, tmp
);
716 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
717 wavelet_iwt_fidelity_vert_even (fd
, j
);
721 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
722 wavelet_iwt_fidelity_vert_odd (fd
, j
);
727 /* Forward, 16-bit, Wavelet #6: Daubechies 9,7 */
730 schro_split_ext_daub97 (int16_t * hi
, int16_t * lo
, int n
)
733 orc_mas2_sub_s16_ip (lo
, hi
, 6497, 2048, 12, n
);
735 orc_mas2_sub_s16_ip (hi
, lo
- 1, 217, 2048, 12, n
);
737 orc_mas2_add_s16_ip (lo
, hi
, 3616, 2048, 12, n
);
739 orc_mas2_add_s16_ip (hi
, lo
- 1, 1817, 2048, 12, n
);
743 wavelet_iwt_daub97_horiz (SchroFrameData
*fd
, int i
, orc_int16
*tmp
)
745 int width
= fd
->width
;
746 int16_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
747 int16_t *hi
= tmp
+ 4;
748 int16_t *lo
= tmp
+ width
/2 + 12;
750 orc_deinterleave2_lshift1_s16 (hi
, lo
, line
, width
/ 2);
751 schro_split_ext_daub97 (hi
, lo
, width
/ 2);
752 join (line
, hi
, lo
, width
);
756 wavelet_iwt_daub97_vert1_odd (SchroFrameData
*fd
, int i
)
758 int width
= fd
->width
;
764 hi
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
765 lo1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
766 if (i
+ 1 < fd
->height
) {
767 lo2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
772 orc_mas2_sub_s16_op (hi
, hi
, lo1
, lo2
, 6497, 2048, 12, width
);
777 wavelet_iwt_daub97_vert1_even (SchroFrameData
*fd
, int i
)
779 int width
= fd
->width
;
785 lo
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
787 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
789 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
791 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
793 orc_mas2_sub_s16_op (lo
, lo
, hi1
, hi2
, 217, 2048, 12, width
);
798 wavelet_iwt_daub97_vert2_odd (SchroFrameData
*fd
, int i
)
800 int width
= fd
->width
;
806 hi
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
807 lo1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
808 if (i
+ 1 < fd
->height
) {
809 lo2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
814 orc_mas2_add_s16_op (hi
, hi
, lo1
, lo2
, 3616, 2048, 12, width
);
819 wavelet_iwt_daub97_vert2_even (SchroFrameData
*fd
, int i
)
821 int width
= fd
->width
;
827 lo
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
829 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
831 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
833 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
835 orc_mas2_add_s16_op (lo
, lo
, hi1
, hi2
, 1817, 2048, 12, width
);
840 schro_iwt_daub_9_7 (SchroFrameData
*fd
, int16_t * tmp
)
845 for(i
=-4;i
<fd
->height
;i
++) {
847 if (j
>= 0 && j
< fd
->height
) {
848 wavelet_iwt_daub97_horiz (fd
, j
, tmp
);
852 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
853 wavelet_iwt_daub97_vert1_odd (fd
, j
);
857 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
858 wavelet_iwt_daub97_vert1_even (fd
, j
);
862 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
863 wavelet_iwt_daub97_vert2_odd (fd
, j
);
867 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
868 wavelet_iwt_daub97_vert2_even (fd
, j
);
873 /* Forward, 32-bit, Wavelet #0: Deslauriers-Dubuc 9,7 */
876 wavelet_iwt_desl_9_3_horiz_s32 (SchroFrameData
* fd
, int i
, orc_int32
*tmp
)
878 int width
= fd
->width
;
879 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
880 int32_t *hi
= tmp
+ 4;
881 int32_t *lo
= tmp
+ width
/2 + 12;
883 orc_deinterleave2_lshift1_s32 (hi
, lo
, line
, width
/ 2);
884 extend_1_2_s32 (hi
, width
/2);
885 orc_mas4_horiz_sub_s32_1991_ip (lo
, hi
- 1, 1 << 3, 4, width
/2);
886 extend_1_0_s32 (lo
, width
/2);
887 orc_add2_rshift_add_s32_22 (hi
, lo
- 1, width
/2);
888 join_s32 (line
, hi
, lo
, width
);
892 wavelet_iwt_desl_9_3_vert_odd_s32 (SchroFrameData
*fd
, int i
)
894 int width
= fd
->width
;
895 int height
= fd
->height
;
898 if (i
< 3 || i
>= height
- 3) {
899 orc_mas4_vert_sub_s32_1991 (
900 SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
901 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 3, 0, height
- 2)),
902 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 1, 0, height
- 2)),
903 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
+ 1, 0, height
- 2)),
904 SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
+ 3, 0, height
- 2)), 1 << 3, 4, width
);
906 orc_mas4_vert_sub_s32_1991 (
907 SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
908 SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 3),
909 SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1),
910 SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1),
911 SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 3), 1 << 3, 4, width
);
917 wavelet_iwt_desl_9_3_vert_even_s32 (SchroFrameData
*fd
, int i
)
919 int width
= fd
->width
;
925 lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
927 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
929 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
931 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+1);
933 orc_add2_rshift_add_s32_22_vert (lo
, hi1
, hi2
, width
);
938 schro_iwt_desl_9_3_s32 (SchroFrameData
*fd
, int32_t * tmp
)
943 for(i
=-6;i
<fd
->height
;i
++) {
945 if (j
>= 0 && j
< fd
->height
) {
946 wavelet_iwt_desl_9_3_horiz_s32 (fd
, j
, tmp
);
950 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
951 wavelet_iwt_desl_9_3_vert_odd_s32 (fd
, j
);
955 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
956 wavelet_iwt_desl_9_3_vert_even_s32 (fd
, j
);
962 /* Forward, 32-bit, Wavelet #1: LeGall 5,3 */
965 wavelet_iwt_5_3_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
967 int width
= fd
->width
;
968 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
969 int32_t *hi
= tmp
+ 4;
970 int32_t *lo
= tmp
+ width
/2 + 12;
972 orc_deinterleave2_lshift1_s32 (hi
, lo
, line
, width
/ 2);
973 extend_1_1_s32 (hi
, width
/2);
974 orc_add2_rshift_sub_s32_11 (lo
, hi
, width
/2);
975 extend_1_1_s32 (lo
, width
/2);
976 orc_add2_rshift_add_s32_22 (hi
, lo
- 1, width
/2);
977 join_s32 (line
, hi
, lo
, width
);
981 wavelet_iwt_5_3_vert_odd_s32 (SchroFrameData
* fd
, int i
)
988 hi
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
989 lo1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1);
990 if (i
+ 1 < fd
->height
) {
991 lo2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
996 orc_add2_rshift_sub_s32_11_vert (hi
, lo1
, lo2
, fd
->width
);
1001 wavelet_iwt_5_3_vert_even_s32 (SchroFrameData
*fd
, int i
)
1008 lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1010 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
1012 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
- 1);
1014 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
1016 orc_add2_rshift_add_s32_22_vert (lo
, hi1
, hi2
, fd
->width
);
1021 schro_iwt_5_3_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1026 for(i
=-6;i
<fd
->height
;i
++) {
1028 if (j
>= 0 && j
< fd
->height
) {
1029 wavelet_iwt_5_3_horiz_s32 (fd
, j
, tmp
);
1033 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
1034 wavelet_iwt_5_3_vert_odd_s32 (fd
, j
);
1038 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
1039 wavelet_iwt_5_3_vert_even_s32 (fd
, j
);
1045 /* Forward, 32-bit, Wavelet #2: Deslauriers-Dubuc 13,7 */
1048 wavelet_iwt_13_5_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1050 int width
= fd
->width
;
1051 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1052 int32_t *hi
= tmp
+ 4;
1053 int32_t *lo
= tmp
+ width
/2 + 12;
1055 orc_deinterleave2_lshift1_s32 (hi
, lo
, line
, width
/ 2);
1056 extend_1_2_s32 (hi
, width
/2);
1057 orc_mas4_horiz_sub_s32_1991_ip (lo
, hi
- 1, 1 << 3, 4, width
/2);
1058 extend_2_1_s32 (lo
, width
/2);
1059 orc_mas4_horiz_add_s32_1991_ip (hi
, lo
- 2, 1 << 4, 5, width
/2);
1060 join_s32 (line
, hi
, lo
, width
);
1064 wavelet_iwt_13_5_vert_odd_s32 (SchroFrameData
*fd
, int i
)
1066 int32_t *dest
, *s1
, *s2
, *s3
, *s4
;
1069 if (i
< 3 || i
>= fd
->height
- 3) {
1070 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 3, 0, fd
->height
- 2));
1071 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 1, 0, fd
->height
- 2));
1072 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 1, 0, fd
->height
- 2));
1073 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 3, 0, fd
->height
- 2));
1075 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 3);
1076 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
1077 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
1078 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 3);
1080 dest
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1081 orc_mas4_vert_sub_s32_1991 (dest
, s1
, s2
, s3
, s4
, 1 << 3, 4, fd
->width
);
1086 wavelet_iwt_13_5_vert_even_s32 (SchroFrameData
*fd
, int i
)
1088 int32_t *dest
, *s1
, *s2
, *s3
, *s4
;
1091 if (i
< 3 || i
>= fd
->height
- 3) {
1092 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 3, 1, fd
->height
- 1));
1093 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
- 1, 1, fd
->height
- 1));
1094 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 1, 1, fd
->height
- 1));
1095 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, CLAMP (i
+ 3, 1, fd
->height
- 1));
1097 s1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 3);
1098 s2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
1099 s3
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
1100 s4
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 3);
1102 dest
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1103 orc_mas4_vert_add_s32_1991 (dest
, s1
, s2
, s3
, s4
, 1 << 4, 5, fd
->width
);
1108 schro_iwt_13_5_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1113 for(i
=-6;i
<fd
->height
;i
++) {
1115 if (j
>= 0 && j
< fd
->height
) {
1116 wavelet_iwt_13_5_horiz_s32 (fd
, j
, tmp
);
1120 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
1121 wavelet_iwt_13_5_vert_odd_s32 (fd
, j
);
1125 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
1126 wavelet_iwt_13_5_vert_even_s32 (fd
, j
);
1131 /* Forward, 32-bit, Wavelet #3,4: Haar 0 and Haar 1 */
1134 wavelet_iwt_haar_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1136 int width
= fd
->width
;
1137 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1138 int32_t *hi
= tmp
+ width
/ 2;
1141 orc_haar_deint_split_s32 (lo
, hi
, line
, width
/ 2);
1142 join_s32 (line
, hi
, lo
, width
);
1146 wavelet_iwt_haar_shift1_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1148 int width
= fd
->width
;
1149 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1150 int32_t *hi
= tmp
+ width
/ 2;
1153 orc_haar_deint_lshift1_split_s32 (lo
, hi
, line
, width
/ 2);
1154 join_s32 (line
, hi
, lo
, width
);
1158 wavelet_iwt_haar_vert_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1160 int32_t *hi
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1161 int32_t *lo
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
1163 orc_haar_split_s32_op (hi
, lo
, tmp
, tmp
+ fd
->width
, fd
->width
);
1167 schro_iwt_haar0_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1171 for(i
=0;i
<fd
->height
;i
+=2) {
1172 wavelet_iwt_haar_horiz_s32 (fd
, i
, tmp
);
1173 wavelet_iwt_haar_horiz_s32 (fd
, i
+1, tmp
+ fd
->width
);
1175 wavelet_iwt_haar_vert_s32 (fd
, i
, tmp
);
1180 schro_iwt_haar1_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1184 for(i
=0;i
<fd
->height
;i
+=2) {
1185 wavelet_iwt_haar_shift1_horiz_s32 (fd
, i
, tmp
);
1186 wavelet_iwt_haar_shift1_horiz_s32 (fd
, i
+1, tmp
+ fd
->width
);
1188 wavelet_iwt_haar_vert_s32 (fd
, i
, tmp
);
1192 /* Forward, 32-bit, Wavelet #5: Fidelity */
1195 mas8_add_s32 (int32_t * dest
, const int32_t * src
, const int32_t * weights
,
1196 int offset
, int shift
, int n
)
1199 for (i
= 0; i
< n
; i
++) {
1201 x
+= src
[i
+ 0] * weights
[0];
1202 x
+= src
[i
+ 1] * weights
[1];
1203 x
+= src
[i
+ 2] * weights
[2];
1204 x
+= src
[i
+ 3] * weights
[3];
1205 x
+= src
[i
+ 4] * weights
[4];
1206 x
+= src
[i
+ 5] * weights
[5];
1207 x
+= src
[i
+ 6] * weights
[6];
1208 x
+= src
[i
+ 7] * weights
[7];
1209 dest
[i
] += x
>> shift
;
1214 schro_split_ext_fidelity_s32 (int32_t * hi
, int32_t * lo
, int n
)
1216 static const int32_t stage1_weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
1217 static const int32_t stage2_weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
1219 extend_4_3_s32 (lo
, n
);
1220 mas8_add_s32 (hi
, lo
- 4, stage1_weights
, 128, 8, n
);
1221 extend_3_4_s32 (hi
, n
);
1222 mas8_add_s32 (lo
, hi
- 3, stage2_weights
, 127, 8, n
);
1226 wavelet_iwt_fidelity_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1228 int width
= fd
->width
;
1229 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1230 int32_t *hi
= tmp
+ 4;
1231 int32_t *lo
= tmp
+ width
/2 + 12;
1233 orc_deinterleave2_s32 (hi
, lo
, line
, width
/ 2);
1234 schro_split_ext_fidelity_s32 (hi
, lo
, width
/ 2);
1235 join_s32 (line
, hi
, lo
, width
);
1239 mas8_vert_add_s32_2 (int32_t * dest
, const int32_t * src
,
1240 int32_t ** s
, const int32_t *weights
, int offset
, int shift
, int n
)
1244 for (i
= 0; i
< n
; i
++) {
1246 for (j
= 0; j
< 8; j
++) {
1247 x
+= s
[j
][i
] * weights
[j
];
1249 dest
[i
] = src
[i
] + (x
>> shift
);
1254 wavelet_iwt_fidelity_vert_odd_s32 (SchroFrameData
*fd
, int i
)
1256 int width
= fd
->width
;
1257 int height
= fd
->height
;
1262 static const int32_t weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
1263 for (j
= 0; j
< 8; j
++) {
1264 s
[j
] = SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 7 + j
* 2, 0, height
- 2));
1266 mas8_vert_add_s32_2 (SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
1267 SCHRO_FRAME_DATA_GET_LINE (fd
, i
), s
,
1268 weights
, 127, 8, width
);
1273 wavelet_iwt_fidelity_vert_even_s32 (SchroFrameData
*fd
, int i
)
1275 int width
= fd
->width
;
1276 int height
= fd
->height
;
1281 static const int32_t weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
1282 for (j
= 0; j
< 8; j
++) {
1283 s
[j
] = SCHRO_FRAME_DATA_GET_LINE (fd
, CLAMP (i
- 7 + j
* 2, 1, height
- 1));
1285 mas8_vert_add_s32_2 (SCHRO_FRAME_DATA_GET_LINE (fd
, i
),
1286 SCHRO_FRAME_DATA_GET_LINE (fd
, i
), s
,
1287 weights
, 128, 8, width
);
1292 schro_iwt_fidelity_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1297 for(i
=-14;i
<fd
->height
;i
++) {
1299 if (j
>= 0 && j
< fd
->height
) {
1300 wavelet_iwt_fidelity_horiz_s32 (fd
, j
, tmp
);
1304 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
1305 wavelet_iwt_fidelity_vert_even_s32 (fd
, j
);
1309 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
1310 wavelet_iwt_fidelity_vert_odd_s32 (fd
, j
);
1315 /* Forward, 32-bit, Wavelet #6: Daubechies 9,7 */
1318 schro_split_ext_daub97_s32 (int32_t * hi
, int32_t * lo
, int n
)
1320 extend_1_1_s32 (hi
, n
);
1321 orc_mas2_sub_s32_ip (lo
, hi
, 6497, 2048, 12, n
);
1322 extend_1_1_s32 (lo
, n
);
1323 orc_mas2_sub_s32_ip (hi
, lo
- 1, 217, 2048, 12, n
);
1324 extend_1_1_s32 (hi
, n
);
1325 orc_mas2_add_s32_ip (lo
, hi
, 3616, 2048, 12, n
);
1326 extend_1_1_s32 (lo
, n
);
1327 orc_mas2_add_s32_ip (hi
, lo
- 1, 1817, 2048, 12, n
);
1331 wavelet_iwt_daub97_horiz_s32 (SchroFrameData
*fd
, int i
, orc_int32
*tmp
)
1333 int width
= fd
->width
;
1334 int32_t *line
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
);
1335 int32_t *hi
= tmp
+ 4;
1336 int32_t *lo
= tmp
+ width
/2 + 12;
1338 orc_deinterleave2_lshift1_s32 (hi
, lo
, line
, width
/ 2);
1339 schro_split_ext_daub97_s32 (hi
, lo
, width
/ 2);
1340 join_s32 (line
, hi
, lo
, width
);
1344 wavelet_iwt_daub97_vert1_odd_s32 (SchroFrameData
*fd
, int i
)
1346 int width
= fd
->width
;
1352 hi
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1353 lo1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
1354 if (i
+ 1 < fd
->height
) {
1355 lo2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
1360 orc_mas2_sub_s32_op (hi
, hi
, lo1
, lo2
, 6497, 2048, 12, width
);
1365 wavelet_iwt_daub97_vert1_even_s32 (SchroFrameData
*fd
, int i
)
1367 int width
= fd
->width
;
1373 lo
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1375 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
1377 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
1379 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
1381 orc_mas2_sub_s32_op (lo
, lo
, hi1
, hi2
, 217, 2048, 12, width
);
1386 wavelet_iwt_daub97_vert2_odd_s32 (SchroFrameData
*fd
, int i
)
1388 int width
= fd
->width
;
1394 hi
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1395 lo1
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
- 1);
1396 if (i
+ 1 < fd
->height
) {
1397 lo2
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
+ 1);
1402 orc_mas2_add_s32_op (hi
, hi
, lo1
, lo2
, 3616, 2048, 12, width
);
1407 wavelet_iwt_daub97_vert2_even_s32 (SchroFrameData
*fd
, int i
)
1409 int width
= fd
->width
;
1415 lo
= SCHRO_FRAME_DATA_GET_LINE(fd
, i
);
1417 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, 1);
1419 hi1
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
-1);
1421 hi2
= SCHRO_FRAME_DATA_GET_LINE (fd
, i
+ 1);
1423 orc_mas2_add_s32_op (lo
, lo
, hi1
, hi2
, 1817, 2048, 12, width
);
1428 schro_iwt_daub_9_7_s32 (SchroFrameData
*fd
, int32_t * tmp
)
1433 for(i
=-4;i
<fd
->height
;i
++) {
1435 if (j
>= 0 && j
< fd
->height
) {
1436 wavelet_iwt_daub97_horiz_s32 (fd
, j
, tmp
);
1440 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
1441 wavelet_iwt_daub97_vert1_odd_s32 (fd
, j
);
1445 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
1446 wavelet_iwt_daub97_vert1_even_s32 (fd
, j
);
1450 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 1) {
1451 wavelet_iwt_daub97_vert2_odd_s32 (fd
, j
);
1455 if (j
>= 0 && j
< fd
->height
&& (j
&1) == 0) {
1456 wavelet_iwt_daub97_vert2_even_s32 (fd
, j
);
1462 /* Reverse transforms */
1464 /* Reverse, 16-bit, Wavelet #0: Deslauriers-Dubuc 9,7 */
1467 schro_synth_ext_desl93 (int16_t * hi
, int16_t * lo
, int n
)
1470 orc_add2_rshift_sub_s16_22 (hi
, lo
- 1, n
);
1472 orc_mas4_horiz_add_s16_1991_ip (lo
, hi
- 1, 1 << 3, 4, n
);
1476 schro_iiwt_desl_9_3 (SchroFrameData
*dest
, SchroFrameData
*src
, int16_t * tmp
)
1481 for(i
=-7;i
<dest
->height
;i
++){
1483 if (j
== CLAMP(j
,0,src
->height
-1)) {
1488 lo
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
1490 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, 1);
1492 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
1494 hi2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+1);
1496 orc_add2_rshift_sub_s16_22_vert (lo
, hi1
, hi2
, src
->width
);
1501 if (j
== CLAMP(j
,0,src
->height
-1)) {
1503 if (j
< 3 || j
>= src
->height
- 3) {
1504 orc_mas4_vert_add_s16_1991 (
1505 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
1506 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
- 3, 0, src
->height
- 2)),
1507 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
- 1, 0, src
->height
- 2)),
1508 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
+ 1, 0, src
->height
- 2)),
1509 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
+ 3, 0, src
->height
- 2)),
1510 1 << 3, 4, src
->width
);
1512 orc_mas4_vert_add_s16_1991 (
1513 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
1514 SCHRO_FRAME_DATA_GET_LINE (src
, j
- 3),
1515 SCHRO_FRAME_DATA_GET_LINE (src
, j
- 1),
1516 SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 1),
1517 SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 3),
1518 1 << 3, 4, src
->width
);
1524 /* horizontal wavelet */
1525 if (j
== CLAMP(j
,0,src
->height
-1)) {
1526 int16_t *hi
= tmp
+ 4;
1527 int16_t *lo
= tmp
+ src
->width
/2 + 12;
1529 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, 0, j
),
1530 src
->width
/ 2 * sizeof (int16_t));
1531 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, src
->width
/2, j
),
1532 src
->width
/ 2 * sizeof (int16_t));
1533 schro_synth_ext_desl93 (hi
, lo
, src
->width
/ 2);
1534 orc_interleave2_rrshift1_s16 (
1535 SCHRO_FRAME_DATA_GET_PIXEL_S16 (dest
, 0, j
), hi
, lo
, src
->width
/ 2);
1540 /* Reverse, 16-bit, Wavelet #1: LeGall 5,3 */
1543 schro_synth_ext_53 (int16_t * hi
, int16_t * lo
, int n
)
1546 orc_add2_rshift_sub_s16_22 (hi
, lo
- 1, n
);
1548 orc_add2_rshift_add_s16_11 (lo
, hi
, n
);
1552 schro_iiwt_5_3 (SchroFrameData
*dest
, SchroFrameData
*src
, int16_t * tmp
)
1557 for(i
=-2;i
<dest
->height
;i
++){
1559 if (j
== CLAMP(j
,0,src
->height
-1)) {
1564 lo
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
1566 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, 1);
1568 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
1570 hi2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+1);
1572 orc_add2_rshift_sub_s16_22_vert (lo
, hi1
, hi2
, src
->width
);
1577 if (j
== CLAMP(j
,0,src
->height
-1)) {
1582 hi
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
1583 lo1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
1584 if (j
+ 1 < src
->height
) {
1585 lo2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 1);
1590 orc_add2_rshift_add_s16_11_op (SCHRO_FRAME_DATA_GET_LINE (src
, j
),
1591 hi
, lo1
, lo2
, src
->width
);
1596 /* horizontal wavelet */
1597 if (j
== CLAMP(j
,0,src
->height
-1)) {
1598 int16_t *hi
= tmp
+ 4;
1599 int16_t *lo
= tmp
+ src
->width
/2 + 12;
1602 SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, 0, j
),
1603 src
->width
/ 2 * sizeof (int16_t));
1605 SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, src
->width
/2, j
),
1606 src
->width
/ 2 * sizeof (int16_t));
1607 schro_synth_ext_53 (hi
, lo
, src
->width
/ 2);
1608 orc_interleave2_rrshift1_s16 (
1609 SCHRO_FRAME_DATA_GET_PIXEL_S16 (dest
, 0, j
), hi
, lo
, src
->width
/ 2);
1614 /* Reverse, 16-bit, Wavelet #2: */
1617 schro_synth_ext_135 (int16_t * hi
, int16_t * lo
, int n
)
1620 orc_mas4_horiz_sub_s16_1991_ip (hi
, lo
- 2, 1 << 4, 5, n
);
1622 orc_mas4_horiz_add_s16_1991_ip (lo
, hi
- 1, 1 << 3, 4, n
);
1626 schro_iiwt_13_5 (SchroFrameData
*dest
, SchroFrameData
*src
,
1631 int16_t *srcline
, *s1
, *s2
, *s3
, *s4
;
1632 int height
= src
->height
;
1633 int width
= src
->width
;
1635 #define ROW(x) SCHRO_FRAME_DATA_GET_LINE (src, (x))
1636 for(i
=-8;i
<dest
->height
;i
++){
1638 if (j
== CLAMP(j
,0,src
->height
-1)) {
1640 if (j
< 3 || j
>= height
- 3) {
1641 s1
= ROW (CLAMP (j
- 3, 1, height
- 1));
1642 s2
= ROW (CLAMP (j
- 1, 1, height
- 1));
1644 s3
= ROW (CLAMP (j
+ 1, 1, height
- 1));
1645 s4
= ROW (CLAMP (j
+ 3, 1, height
- 1));
1653 orc_mas4_vert_sub_s16_1991 (srcline
, s1
, s2
, s3
, s4
, 1 << 4, 5, width
);
1658 if (j
== CLAMP(j
,0,src
->height
-1)) {
1660 if (j
< 3 || j
>= height
- 3) {
1661 s1
= ROW (CLAMP (j
- 3, 0, height
- 2));
1662 s2
= ROW (CLAMP (j
- 1, 0, height
- 2));
1664 s3
= ROW (CLAMP (j
+ 1, 0, height
- 2));
1665 s4
= ROW (CLAMP (j
+ 3, 0, height
- 2));
1673 orc_mas4_vert_add_s16_1991 (srcline
, s1
, s2
, s3
, s4
, 1 << 3, 4, width
);
1679 if (j
== CLAMP(j
,0,src
->height
-1)) {
1680 int16_t *hi
= tmp
+ 4;
1681 int16_t *lo
= tmp
+ width
/2 + 12;
1683 srcline
= SCHRO_FRAME_DATA_GET_LINE(dest
, j
);
1685 orc_memcpy (hi
, srcline
, width
/ 2 * sizeof (int16_t));
1686 orc_memcpy (lo
, srcline
+ width
/ 2, width
/ 2 * sizeof (int16_t));
1687 schro_synth_ext_135 (hi
, lo
, width
/ 2);
1688 orc_interleave2_rrshift1_s16 (
1689 SCHRO_FRAME_DATA_GET_LINE(dest
, j
), hi
, lo
, width
/ 2);
1695 /* Reverse, 16-bit, Wavelet #3,4: Haar 0 and Haar 1 */
1698 schro_iiwt_haar0 (SchroFrameData
*dest
, SchroFrameData
*src
, int16_t * tmp
)
1702 int width
= src
->width
;
1704 for(i
=-8;i
<dest
->height
;i
++){
1706 if (j
== CLAMP(j
,0,src
->height
-1)) {
1708 orc_haar_synth_s16 (
1709 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
1710 SCHRO_FRAME_DATA_GET_LINE (src
, j
+1),
1716 if (j
== CLAMP(j
,0,src
->height
-1)) {
1717 int16_t *hi
= tmp
+ 4;
1718 int16_t *lo
= tmp
+ width
/2 + 12;
1720 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_LINE(dest
,j
),
1721 width
/ 2 * sizeof (int16_t));
1722 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, src
->width
/2, j
),
1723 width
/ 2 * sizeof (int16_t));
1724 orc_haar_synth_int_s16 (
1725 SCHRO_FRAME_DATA_GET_PIXEL_S16(dest
, 0, j
), lo
, hi
,
1732 schro_iiwt_haar1 (SchroFrameData
*dest
, SchroFrameData
*src
,
1737 int width
= src
->width
;
1739 for(i
=-8;i
<dest
->height
;i
++){
1741 if (j
== CLAMP(j
,0,src
->height
-1)) {
1743 orc_haar_synth_s16 (
1744 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
1745 SCHRO_FRAME_DATA_GET_LINE (src
, j
+1),
1751 if (j
== CLAMP(j
,0,src
->height
-1)) {
1752 int16_t *hi
= tmp
+ 4;
1753 int16_t *lo
= tmp
+ width
/2 + 12;
1755 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_LINE(dest
,j
),
1756 width
/ 2 * sizeof (int16_t));
1757 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S16(src
, src
->width
/2, j
),
1758 width
/ 2 * sizeof (int16_t));
1759 orc_haar_synth_rrshift1_int_s16 (
1760 SCHRO_FRAME_DATA_GET_PIXEL_S16(dest
, 0, j
), lo
, hi
,
1766 /* Reverse, 16-bit, Wavelet #5: Fidelity */
1769 schro_synth_ext_fidelity (int16_t * hi
, int16_t * lo
, int n
)
1771 static const int16_t stage1_weights
[] = { -2, 10, -25, 81, 81, -25, 10, -2 };
1772 static const int16_t stage2_weights
[] =
1773 { 8, -21, 46, -161, -161, 46, -21, 8 };
1776 mas8_add_s16 (lo
, hi
- 3, stage1_weights
, 128, 8, n
);
1778 mas8_add_s16 (hi
, lo
- 4, stage2_weights
, 127, 8, n
);
1782 wavelet_iiwt_fidelity_horiz (SchroFrame
* frame
, void *_dest
, int component
,
1785 int16_t *dest
= _dest
;
1786 int width
= frame
->components
[component
].width
;
1787 int16_t *tmp
= frame
->virt_priv2
;
1788 int16_t *src
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1789 int16_t *hi
= tmp
+ 4;
1790 int16_t *lo
= tmp
+ width
/2 + 12;
1792 orc_memcpy (hi
, src
, width
/ 2 * sizeof (int16_t));
1793 orc_memcpy (lo
, src
+ width
/ 2, width
/ 2 * sizeof (int16_t));
1794 schro_synth_ext_fidelity (hi
, lo
, width
/ 2);
1795 orc_interleave2_s16 (dest
, hi
, lo
, width
/ 2);
1799 mas8_vert_sub_s16_2 (int16_t * dest
, const int16_t * src
,
1800 int16_t ** s
, const int *weights
, int offset
, int shift
, int n
)
1804 for (i
= 0; i
< n
; i
++) {
1806 for (j
= 0; j
< 8; j
++) {
1807 x
+= s
[j
][i
] * weights
[j
];
1809 dest
[i
] = src
[i
] - (x
>> shift
);
1814 wavelet_iiwt_fidelity_vert (SchroFrame
* frame
, void *_dest
, int component
,
1817 int16_t *dest
= _dest
;
1818 int width
= frame
->components
[component
].width
;
1819 int height
= frame
->components
[component
].height
;
1824 static const int weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
1826 schro_virt_frame_get_line (frame->virt_frame1, component, (x))
1828 schro_virt_frame_get_line (frame, component, (x))
1829 for (j
= 0; j
< 8; j
++) {
1830 s
[j
] = ROW (CLAMP (i
- 7 + j
* 2, 0, height
- 2));
1832 mas8_vert_sub_s16_2 (dest
, ROW (i
), s
, weights
, 127, 8, width
);
1834 static const int weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
1835 for (j
= 0; j
< 8; j
++) {
1836 s
[j
] = ROW2 (CLAMP (i
- 7 + j
* 2, 1, height
- 1));
1838 mas8_vert_sub_s16_2 (dest
, ROW (i
), s
, weights
, 128, 8, width
);
1845 schro_iiwt_fidelity (SchroFrameData
*dest
, SchroFrameData
*src
,
1853 frame
= schro_frame_new ();
1855 frame
->format
= SCHRO_FRAME_FORMAT_S16_444
;
1856 frame
->width
= src
->width
;
1857 frame
->height
= src
->height
;
1859 frame
->components
[0].format
= SCHRO_FRAME_FORMAT_S16_444
;
1860 frame
->components
[0].width
= src
->width
;
1861 frame
->components
[0].height
= src
->height
;
1862 frame
->components
[0].stride
= src
->stride
;
1863 frame
->components
[0].data
= src
->data
;
1865 vf1
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
1866 vf1
->virt_frame1
= frame
;
1867 vf1
->render_line
= wavelet_iiwt_fidelity_vert
;
1869 vf2
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
1870 vf2
->virt_frame1
= vf1
;
1871 vf2
->virt_priv2
= tmp
;
1872 vf2
->render_line
= wavelet_iiwt_fidelity_horiz
;
1874 frame2
= schro_frame_new ();
1876 frame2
->format
= SCHRO_FRAME_FORMAT_S16_444
;
1877 frame2
->width
= dest
->width
;
1878 frame2
->height
= dest
->height
;
1880 frame2
->components
[0].format
= SCHRO_FRAME_FORMAT_S16_444
;
1881 frame2
->components
[0].width
= dest
->width
;
1882 frame2
->components
[0].height
= dest
->height
;
1883 frame2
->components
[0].stride
= dest
->stride
;
1884 frame2
->components
[0].data
= dest
->data
;
1886 schro_virt_frame_render (vf2
, frame2
);
1888 schro_frame_unref (vf2
);
1889 schro_frame_unref (frame2
);
1892 /* Reverse, 16-bit, Wavelet #6: Daubechies 9,7 */
1895 schro_synth_ext_daub97 (int16_t * hi
, int16_t * lo
, int n
)
1898 orc_mas2_sub_s16_ip (hi
, lo
- 1, 1817, 2048, 12, n
);
1900 orc_mas2_sub_s16_ip (lo
, hi
, 3616, 2048, 12, n
);
1902 orc_mas2_add_s16_ip (hi
, lo
- 1, 217, 2048, 12, n
);
1904 orc_mas2_add_s16_ip (lo
, hi
, 6497, 2048, 12, n
);
1908 wavelet_iiwt_daub97_horiz (SchroFrame
* frame
, void *_dest
, int component
,
1911 int16_t *dest
= _dest
;
1912 int width
= frame
->components
[component
].width
;
1913 int16_t *tmp
= frame
->virt_priv2
;
1914 int16_t *src
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1915 int16_t *hi
= tmp
+ 4;
1916 int16_t *lo
= tmp
+ width
/2 + 12;
1918 orc_memcpy (hi
, src
, width
/ 2 * sizeof (int16_t));
1919 orc_memcpy (lo
, src
+ width
/ 2, width
/ 2 * sizeof (int16_t));
1920 schro_synth_ext_daub97 (hi
, lo
, width
/ 2);
1921 orc_interleave2_rrshift1_s16 (dest
, hi
, lo
, width
/ 2);
1925 wavelet_iiwt_daub97_vert1 (SchroFrame
* frame
, void *_dest
, int component
,
1928 int16_t *dest
= _dest
;
1929 int width
= frame
->components
[component
].width
;
1935 hi
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1936 lo1
= schro_virt_frame_get_line (frame
, component
, i
- 1);
1937 if (i
+ 1 < frame
->height
) {
1938 lo2
= schro_virt_frame_get_line (frame
, component
, i
+ 1);
1943 orc_mas2_add_s16_op (dest
, hi
, lo1
, lo2
, 6497, 2048, 12, width
);
1948 lo
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1950 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, 1);
1952 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
- 1);
1954 hi2
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
+ 1);
1956 orc_mas2_add_s16_op (dest
, lo
, hi1
, hi2
, 217, 2048, 12, width
);
1961 wavelet_iiwt_daub97_vert2 (SchroFrame
* frame
, void *_dest
, int component
,
1964 int16_t *dest
= _dest
;
1965 int width
= frame
->components
[component
].width
;
1971 hi
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1972 lo1
= schro_virt_frame_get_line (frame
, component
, i
- 1);
1973 if (i
+ 1 < frame
->height
) {
1974 lo2
= schro_virt_frame_get_line (frame
, component
, i
+ 1);
1979 orc_mas2_sub_s16_op (dest
, hi
, lo1
, lo2
, 3616, 2048, 12, width
);
1984 lo
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
1986 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, 1);
1988 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
- 1);
1990 hi2
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
+ 1);
1992 orc_mas2_sub_s16_op (dest
, lo
, hi1
, hi2
, 1817, 2048, 12, width
);
1997 schro_iiwt_daub_9_7 (SchroFrameData
*dest
, SchroFrameData
*src
,
2006 frame
= schro_frame_new ();
2008 frame
->format
= SCHRO_FRAME_FORMAT_S16_444
;
2009 frame
->width
= src
->width
;
2010 frame
->height
= src
->height
;
2012 frame
->components
[0].format
= SCHRO_FRAME_FORMAT_S16_444
;
2013 frame
->components
[0].width
= src
->width
;
2014 frame
->components
[0].height
= src
->height
;
2015 frame
->components
[0].stride
= src
->stride
;
2016 frame
->components
[0].data
= src
->data
;
2018 vf1
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2019 vf1
->virt_frame1
= frame
;
2020 vf1
->virt_priv2
= tmp
;
2021 vf1
->render_line
= wavelet_iiwt_daub97_vert2
;
2023 vf2
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2024 vf2
->virt_frame1
= vf1
;
2025 vf2
->virt_priv2
= tmp
;
2026 vf2
->render_line
= wavelet_iiwt_daub97_vert1
;
2028 vf3
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2029 vf3
->virt_frame1
= vf2
;
2030 vf3
->virt_priv2
= tmp
;
2031 vf3
->render_line
= wavelet_iiwt_daub97_horiz
;
2033 frame2
= schro_frame_new ();
2035 frame2
->format
= SCHRO_FRAME_FORMAT_S16_444
;
2036 frame2
->width
= dest
->width
;
2037 frame2
->height
= dest
->height
;
2039 frame2
->components
[0].format
= SCHRO_FRAME_FORMAT_S16_444
;
2040 frame2
->components
[0].width
= dest
->width
;
2041 frame2
->components
[0].height
= dest
->height
;
2042 frame2
->components
[0].stride
= dest
->stride
;
2043 frame2
->components
[0].data
= dest
->data
;
2045 schro_virt_frame_render (vf3
, frame2
);
2047 schro_frame_unref (vf3
);
2048 schro_frame_unref (frame2
);
2051 /* 32 bit versions */
2053 /* Reverse, 32-bit, Wavelet #0: Deslauriers-Dubuc 9,7 */
2056 schro_synth_ext_desl93_s32 (int32_t * hi
, int32_t * lo
, int n
)
2058 extend_2_2_s32 (lo
, n
);
2059 orc_add2_rshift_sub_s32_22 (hi
, lo
- 1, n
);
2060 extend_2_2_s32 (hi
, n
);
2061 orc_mas4_horiz_add_s32_1991_ip (lo
, hi
- 1, 1 << 3, 4, n
);
2065 schro_iiwt_desl_9_3_s32 (SchroFrameData
*dest
, SchroFrameData
*src
, int32_t * tmp
)
2070 for(i
=-7;i
<dest
->height
;i
++){
2072 if (j
== CLAMP(j
,0,src
->height
-1)) {
2077 lo
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
2079 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, 1);
2081 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
2083 hi2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+1);
2085 orc_add2_rshift_sub_s32_22_op (SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2086 lo
, hi1
, hi2
, src
->width
);
2091 if (j
== CLAMP(j
,0,src
->height
-1)) {
2093 if (j
< 3 || j
>= src
->height
- 3) {
2094 orc_mas4_vert_add_s32_1991_op (
2095 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2096 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2097 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
- 3, 0, src
->height
- 2)),
2098 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
- 1, 0, src
->height
- 2)),
2099 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
+ 1, 0, src
->height
- 2)),
2100 SCHRO_FRAME_DATA_GET_LINE (src
, CLAMP (j
+ 3, 0, src
->height
- 2)),
2101 1 << 3, 4, src
->width
);
2103 orc_mas4_vert_add_s32_1991_op (
2104 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2105 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2106 SCHRO_FRAME_DATA_GET_LINE (src
, j
- 3),
2107 SCHRO_FRAME_DATA_GET_LINE (src
, j
- 1),
2108 SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 1),
2109 SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 3),
2110 1 << 3, 4, src
->width
);
2116 /* horizontal wavelet */
2117 if (j
== CLAMP(j
,0,src
->height
-1)) {
2118 int32_t *hi
= tmp
+ 4;
2119 int32_t *lo
= tmp
+ src
->width
/2 + 12;
2121 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, 0, j
),
2122 src
->width
/ 2 * sizeof (int32_t));
2123 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, src
->width
/2, j
),
2124 src
->width
/ 2 * sizeof (int32_t));
2125 schro_synth_ext_desl93_s32 (hi
, lo
, src
->width
/ 2);
2126 orc_interleave2_rrshift1_s32 (
2127 SCHRO_FRAME_DATA_GET_PIXEL_S32 (dest
, 0, j
), hi
, lo
, src
->width
/ 2);
2132 /* Reverse, 32-bit, Wavelet #1: LeGall 5,3 */
2135 schro_synth_ext_53_s32 (int32_t * hi
, int32_t * lo
, int n
)
2137 extend_1_1_s32 (lo
, n
);
2138 orc_add2_rshift_sub_s32_22 (hi
, lo
- 1, n
);
2139 extend_1_1_s32 (hi
, n
);
2140 orc_add2_rshift_add_s32_11 (lo
, hi
, n
);
2144 schro_iiwt_5_3_s32 (SchroFrameData
*dest
, SchroFrameData
*src
, int32_t * tmp
)
2149 for(i
=-2;i
<dest
->height
;i
++){
2151 if (j
== CLAMP(j
,0,src
->height
-1)) {
2156 lo
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
2158 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, 1);
2160 hi1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
2162 hi2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+1);
2164 orc_add2_rshift_sub_s32_22_op (SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2165 lo
, hi1
, hi2
, src
->width
);
2170 if (j
== CLAMP(j
,0,src
->height
-1)) {
2175 hi
= SCHRO_FRAME_DATA_GET_LINE (src
, j
);
2176 lo1
= SCHRO_FRAME_DATA_GET_LINE (src
, j
-1);
2177 if (j
+ 1 < src
->height
) {
2178 lo2
= SCHRO_FRAME_DATA_GET_LINE (src
, j
+ 1);
2183 orc_add2_rshift_add_s32_11_op (SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2184 hi
, lo1
, lo2
, src
->width
);
2189 /* horizontal wavelet */
2190 if (j
== CLAMP(j
,0,src
->height
-1)) {
2191 int32_t *hi
= tmp
+ 4;
2192 int32_t *lo
= tmp
+ src
->width
/2 + 12;
2195 SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, 0, j
),
2196 src
->width
/ 2 * sizeof (int32_t));
2198 SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, src
->width
/2, j
),
2199 src
->width
/ 2 * sizeof (int32_t));
2200 schro_synth_ext_53_s32 (hi
, lo
, src
->width
/ 2);
2201 orc_interleave2_rrshift1_s32 (
2202 SCHRO_FRAME_DATA_GET_PIXEL_S32 (dest
, 0, j
), hi
, lo
, src
->width
/ 2);
2207 /* Reverse, 32-bit, Wavelet #2: */
2210 schro_synth_ext_135_s32 (int32_t * hi
, int32_t * lo
, int n
)
2212 extend_2_1_s32 (lo
, n
);
2213 orc_mas4_horiz_sub_s32_1991_ip (hi
, lo
- 2, 1 << 4, 5, n
);
2214 extend_1_2_s32 (hi
, n
);
2215 orc_mas4_horiz_add_s32_1991_ip (lo
, hi
- 1, 1 << 3, 4, n
);
2219 schro_iiwt_13_5_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
2224 int32_t *srcline
, *s1
, *s2
, *s3
, *s4
;
2225 int height
= src
->height
;
2226 int width
= src
->width
;
2228 #define ROW(x) SCHRO_FRAME_DATA_GET_LINE (src, (x))
2229 for(i
=-8;i
<dest
->height
;i
++){
2231 if (j
== CLAMP(j
,0,src
->height
-1)) {
2233 if (j
< 3 || j
>= height
- 3) {
2234 s1
= ROW (CLAMP (j
- 3, 1, height
- 1));
2235 s2
= ROW (CLAMP (j
- 1, 1, height
- 1));
2237 s3
= ROW (CLAMP (j
+ 1, 1, height
- 1));
2238 s4
= ROW (CLAMP (j
+ 3, 1, height
- 1));
2246 orc_mas4_vert_sub_s32_1991_op (srcline
,
2247 srcline
, s1
, s2
, s3
, s4
, 1 << 4, 5, width
);
2252 if (j
== CLAMP(j
,0,src
->height
-1)) {
2254 if (j
< 3 || j
>= height
- 3) {
2255 s1
= ROW (CLAMP (j
- 3, 0, height
- 2));
2256 s2
= ROW (CLAMP (j
- 1, 0, height
- 2));
2258 s3
= ROW (CLAMP (j
+ 1, 0, height
- 2));
2259 s4
= ROW (CLAMP (j
+ 3, 0, height
- 2));
2267 orc_mas4_vert_add_s32_1991_op (srcline
,
2268 srcline
, s1
, s2
, s3
, s4
, 1 << 3, 4, width
);
2274 if (j
== CLAMP(j
,0,src
->height
-1)) {
2275 int32_t *hi
= tmp
+ 4;
2276 int32_t *lo
= tmp
+ width
/2 + 12;
2278 srcline
= SCHRO_FRAME_DATA_GET_LINE(dest
, j
);
2280 orc_memcpy (hi
, srcline
, width
/ 2 * sizeof (int32_t));
2281 orc_memcpy (lo
, srcline
+ width
/ 2, width
/ 2 * sizeof (int32_t));
2282 schro_synth_ext_135_s32 (hi
, lo
, width
/ 2);
2283 orc_interleave2_rrshift1_s32 (
2284 SCHRO_FRAME_DATA_GET_LINE(dest
, j
), hi
, lo
, width
/ 2);
2290 /* Reverse, 32-bit, Wavelet #3,4: Haar 0 and Haar 1 */
2293 schro_iiwt_haar0_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
2298 int width
= src
->width
;
2300 for(i
=-8;i
<dest
->height
;i
++){
2302 if (j
== CLAMP(j
,0,src
->height
-1)) {
2304 orc_haar_synth_s32 (
2305 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2306 SCHRO_FRAME_DATA_GET_LINE (src
, j
+1),
2312 if (j
== CLAMP(j
,0,src
->height
-1)) {
2313 int32_t *hi
= tmp
+ 4;
2314 int32_t *lo
= tmp
+ width
/2 + 12;
2316 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_LINE(dest
,j
),
2317 width
/ 2 * sizeof (int32_t));
2318 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, src
->width
/2, j
),
2319 width
/ 2 * sizeof (int32_t));
2320 orc_haar_synth_int_s32 (
2321 SCHRO_FRAME_DATA_GET_PIXEL_S32(dest
, 0, j
), lo
, hi
,
2328 schro_iiwt_haar1_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
2333 int width
= src
->width
;
2335 for(i
=-8;i
<dest
->height
;i
++){
2337 if (j
== CLAMP(j
,0,src
->height
-1)) {
2339 orc_haar_synth_s32 (
2340 SCHRO_FRAME_DATA_GET_LINE (src
, j
),
2341 SCHRO_FRAME_DATA_GET_LINE (src
, j
+1),
2347 if (j
== CLAMP(j
,0,src
->height
-1)) {
2348 int32_t *hi
= tmp
+ 4;
2349 int32_t *lo
= tmp
+ width
/2 + 12;
2351 orc_memcpy (lo
, SCHRO_FRAME_DATA_GET_LINE(dest
,j
),
2352 width
/ 2 * sizeof (int32_t));
2353 orc_memcpy (hi
, SCHRO_FRAME_DATA_GET_PIXEL_S32(src
, src
->width
/2, j
),
2354 width
/ 2 * sizeof (int32_t));
2355 orc_haar_synth_rrshift1_int_s32 (
2356 SCHRO_FRAME_DATA_GET_PIXEL_S32(dest
, 0, j
), lo
, hi
,
2362 /* Reverse, 32-bit, Wavelet #5: Fidelity */
2365 /* already defined as part of forward transform */
2367 mas8_add_s32 (int32_t * dest
, const int32_t * src
, const int32_t * weights
,
2368 int offset
, int shift
, int n
)
2371 for (i
= 0; i
< n
; i
++) {
2373 x
+= src
[i
+ 0] * weights
[0];
2374 x
+= src
[i
+ 1] * weights
[1];
2375 x
+= src
[i
+ 2] * weights
[2];
2376 x
+= src
[i
+ 3] * weights
[3];
2377 x
+= src
[i
+ 4] * weights
[4];
2378 x
+= src
[i
+ 5] * weights
[5];
2379 x
+= src
[i
+ 6] * weights
[6];
2380 x
+= src
[i
+ 7] * weights
[7];
2381 dest
[i
] += x
>> shift
;
2387 schro_synth_ext_fidelity_s32 (int32_t * hi
, int32_t * lo
, int n
)
2389 static const int32_t stage1_weights
[] = { -2, 10, -25, 81, 81, -25, 10, -2 };
2390 static const int32_t stage2_weights
[] =
2391 { 8, -21, 46, -161, -161, 46, -21, 8 };
2393 extend_3_4_s32 (hi
, n
);
2394 mas8_add_s32 (lo
, hi
- 3, stage1_weights
, 128, 8, n
);
2395 extend_4_3_s32 (lo
, n
);
2396 mas8_add_s32 (hi
, lo
- 4, stage2_weights
, 127, 8, n
);
2400 wavelet_iiwt_fidelity_horiz_s32 (SchroFrame
* frame
, void *_dest
, int component
,
2403 int32_t *dest
= _dest
;
2404 int width
= frame
->components
[component
].width
;
2405 int32_t *tmp
= frame
->virt_priv2
;
2406 int32_t *src
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2407 int32_t *hi
= tmp
+ 4;
2408 int32_t *lo
= tmp
+ width
/2 + 12;
2410 orc_memcpy (hi
, src
, width
/ 2 * sizeof (int32_t));
2411 orc_memcpy (lo
, src
+ width
/ 2, width
/ 2 * sizeof (int32_t));
2412 schro_synth_ext_fidelity_s32 (hi
, lo
, width
/ 2);
2413 orc_interleave2_s32 (dest
, hi
, lo
, width
/ 2);
2417 mas8_vert_sub_s32_2 (int32_t * dest
, const int32_t * src
,
2418 int32_t ** s
, const int *weights
, int offset
, int shift
, int n
)
2422 for (i
= 0; i
< n
; i
++) {
2424 for (j
= 0; j
< 8; j
++) {
2425 x
+= s
[j
][i
] * weights
[j
];
2427 dest
[i
] = src
[i
] - (x
>> shift
);
2432 wavelet_iiwt_fidelity_vert_s32 (SchroFrame
* frame
, void *_dest
, int component
,
2435 int32_t *dest
= _dest
;
2436 int width
= frame
->components
[component
].width
;
2437 int height
= frame
->components
[component
].height
;
2442 static const int weights
[] = { 2, -10, 25, -81, -81, 25, -10, 2 };
2444 schro_virt_frame_get_line (frame->virt_frame1, component, (x))
2446 schro_virt_frame_get_line (frame, component, (x))
2447 for (j
= 0; j
< 8; j
++) {
2448 s
[j
] = ROW (CLAMP (i
- 7 + j
* 2, 0, height
- 2));
2450 mas8_vert_sub_s32_2 (dest
, ROW (i
), s
, weights
, 127, 8, width
);
2452 static const int weights
[] = { -8, 21, -46, 161, 161, -46, 21, -8 };
2453 for (j
= 0; j
< 8; j
++) {
2454 s
[j
] = ROW2 (CLAMP (i
- 7 + j
* 2, 1, height
- 1));
2456 mas8_vert_sub_s32_2 (dest
, ROW (i
), s
, weights
, 128, 8, width
);
2463 schro_iiwt_fidelity_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
2471 frame
= schro_frame_new ();
2473 frame
->format
= SCHRO_FRAME_FORMAT_S32_444
;
2474 frame
->width
= src
->width
;
2475 frame
->height
= src
->height
;
2477 frame
->components
[0].format
= SCHRO_FRAME_FORMAT_S32_444
;
2478 frame
->components
[0].width
= src
->width
;
2479 frame
->components
[0].height
= src
->height
;
2480 frame
->components
[0].stride
= src
->stride
;
2481 frame
->components
[0].data
= src
->data
;
2483 vf1
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2484 vf1
->virt_frame1
= frame
;
2485 vf1
->render_line
= wavelet_iiwt_fidelity_vert_s32
;
2487 vf2
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2488 vf2
->virt_frame1
= vf1
;
2489 vf2
->virt_priv2
= tmp
;
2490 vf2
->render_line
= wavelet_iiwt_fidelity_horiz_s32
;
2492 frame2
= schro_frame_new ();
2494 frame2
->format
= SCHRO_FRAME_FORMAT_S32_444
;
2495 frame2
->width
= dest
->width
;
2496 frame2
->height
= dest
->height
;
2498 frame2
->components
[0].format
= SCHRO_FRAME_FORMAT_S32_444
;
2499 frame2
->components
[0].width
= dest
->width
;
2500 frame2
->components
[0].height
= dest
->height
;
2501 frame2
->components
[0].stride
= dest
->stride
;
2502 frame2
->components
[0].data
= dest
->data
;
2504 schro_virt_frame_render (vf2
, frame2
);
2506 schro_frame_unref (vf2
);
2507 schro_frame_unref (frame2
);
2510 /* Reverse, 32-bit, Wavelet #6: Daubechies 9,7 */
2513 schro_synth_ext_daub97_s32 (int32_t * hi
, int32_t * lo
, int n
)
2515 extend_1_1_s32 (lo
, n
);
2516 orc_mas2_sub_s32_ip (hi
, lo
- 1, 1817, 2048, 12, n
);
2517 extend_1_1_s32 (hi
, n
);
2518 orc_mas2_sub_s32_ip (lo
, hi
, 3616, 2048, 12, n
);
2519 extend_1_1_s32 (lo
, n
);
2520 orc_mas2_add_s32_ip (hi
, lo
- 1, 217, 2048, 12, n
);
2521 extend_1_1_s32 (hi
, n
);
2522 orc_mas2_add_s32_ip (lo
, hi
, 6497, 2048, 12, n
);
2526 wavelet_iiwt_daub97_horiz_s32 (SchroFrame
* frame
, void *_dest
, int component
,
2529 int32_t *dest
= _dest
;
2530 int width
= frame
->components
[component
].width
;
2531 int32_t *tmp
= frame
->virt_priv2
;
2532 int32_t *src
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2533 int32_t *hi
= tmp
+ 4;
2534 int32_t *lo
= tmp
+ width
/2 + 12;
2536 orc_memcpy (hi
, src
, width
/ 2 * sizeof (int32_t));
2537 orc_memcpy (lo
, src
+ width
/ 2, width
/ 2 * sizeof (int32_t));
2538 schro_synth_ext_daub97_s32 (hi
, lo
, width
/ 2);
2539 orc_interleave2_rrshift1_s32 (dest
, hi
, lo
, width
/ 2);
2543 wavelet_iiwt_daub97_vert1_s32 (SchroFrame
* frame
, void *_dest
, int component
,
2546 int32_t *dest
= _dest
;
2547 int width
= frame
->components
[component
].width
;
2553 hi
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2554 lo1
= schro_virt_frame_get_line (frame
, component
, i
- 1);
2555 if (i
+ 1 < frame
->height
) {
2556 lo2
= schro_virt_frame_get_line (frame
, component
, i
+ 1);
2561 orc_mas2_add_s32_op (dest
, hi
, lo1
, lo2
, 6497, 2048, 12, width
);
2566 lo
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2568 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, 1);
2570 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
- 1);
2572 hi2
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
+ 1);
2574 orc_mas2_add_s32_op (dest
, lo
, hi1
, hi2
, 217, 2048, 12, width
);
2579 wavelet_iiwt_daub97_vert2_s32 (SchroFrame
* frame
, void *_dest
, int component
,
2582 int32_t *dest
= _dest
;
2583 int width
= frame
->components
[component
].width
;
2589 hi
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2590 lo1
= schro_virt_frame_get_line (frame
, component
, i
- 1);
2591 if (i
+ 1 < frame
->height
) {
2592 lo2
= schro_virt_frame_get_line (frame
, component
, i
+ 1);
2597 orc_mas2_sub_s32_op (dest
, hi
, lo1
, lo2
, 3616, 2048, 12, width
);
2602 lo
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
);
2604 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, 1);
2606 hi1
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
- 1);
2608 hi2
= schro_virt_frame_get_line (frame
->virt_frame1
, component
, i
+ 1);
2610 orc_mas2_sub_s32_op (dest
, lo
, hi1
, hi2
, 1817, 2048, 12, width
);
2615 schro_iiwt_daub_9_7_s32 (SchroFrameData
*dest
, SchroFrameData
*src
,
2624 frame
= schro_frame_new ();
2626 frame
->format
= SCHRO_FRAME_FORMAT_S32_444
;
2627 frame
->width
= src
->width
;
2628 frame
->height
= src
->height
;
2630 frame
->components
[0].format
= SCHRO_FRAME_FORMAT_S32_444
;
2631 frame
->components
[0].width
= src
->width
;
2632 frame
->components
[0].height
= src
->height
;
2633 frame
->components
[0].stride
= src
->stride
;
2634 frame
->components
[0].data
= src
->data
;
2636 vf1
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2637 vf1
->virt_frame1
= frame
;
2638 vf1
->virt_priv2
= tmp
;
2639 vf1
->render_line
= wavelet_iiwt_daub97_vert2_s32
;
2641 vf2
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2642 vf2
->virt_frame1
= vf1
;
2643 vf2
->virt_priv2
= tmp
;
2644 vf2
->render_line
= wavelet_iiwt_daub97_vert1_s32
;
2646 vf3
= schro_frame_new_virtual (NULL
, frame
->format
, src
->width
, src
->height
);
2647 vf3
->virt_frame1
= vf2
;
2648 vf3
->virt_priv2
= tmp
;
2649 vf3
->render_line
= wavelet_iiwt_daub97_horiz_s32
;
2651 frame2
= schro_frame_new ();
2653 frame2
->format
= SCHRO_FRAME_FORMAT_S32_444
;
2654 frame2
->width
= dest
->width
;
2655 frame2
->height
= dest
->height
;
2657 frame2
->components
[0].format
= SCHRO_FRAME_FORMAT_S32_444
;
2658 frame2
->components
[0].width
= dest
->width
;
2659 frame2
->components
[0].height
= dest
->height
;
2660 frame2
->components
[0].stride
= dest
->stride
;
2661 frame2
->components
[0].data
= dest
->data
;
2663 schro_virt_frame_render (vf3
, frame2
);
2665 schro_frame_unref (vf3
);
2666 schro_frame_unref (frame2
);