annotate ivi_dsp.c @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11054
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
1 /*
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
2 * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
3 *
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
4 * Copyright (c) 2009 Maxim Poliakovski
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
5 *
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
6 * This file is part of FFmpeg.
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
7 *
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
12 *
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
16 * Lesser General Public License for more details.
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
17 *
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
21 */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
22
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
23 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 11485
diff changeset
24 * @file
11054
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
25 * DSP functions (inverse transforms, motion compensation, wavelet recompostions)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
26 * for Indeo Video Interactive codecs.
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
27 */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
28
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
29 #include "avcodec.h"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
30 #include "dsputil.h"
11485
0f0cd6b5791f Separate DWT from snow and dsputil
mru
parents: 11310
diff changeset
31 #include "dwt.h"
11054
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
32 #include "ivi_common.h"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
33 #include "ivi_dsp.h"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
34
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
35 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
36 const int dst_pitch, const int num_bands)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
37 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
38 int x, y, indx;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
39 int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
40 int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
41 int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
11310
1ff8ae765206 Strides in Indeo 5 reconstruction filter should be signed,
kostya
parents: 11054
diff changeset
42 int32_t pitch, back_pitch;
11054
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
43 const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
44
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
45 /* all bands should have the same pitch */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
46 pitch = plane->bands[0].pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
47
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
48 /* pixels at the position "y-1" will be set to pixels at the "y" for the 1st iteration */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
49 back_pitch = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
50
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
51 /* get pointers to the wavelet bands */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
52 b0_ptr = plane->bands[0].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
53 b1_ptr = plane->bands[1].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
54 b2_ptr = plane->bands[2].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
55 b3_ptr = plane->bands[3].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
56
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
57 for (y = 0; y < plane->height; y += 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
58 /* load storage variables with values */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
59 if (num_bands > 0) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
60 b0_1 = b0_ptr[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
61 b0_2 = b0_ptr[pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
62 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
63
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
64 if (num_bands > 1) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
65 b1_1 = b1_ptr[back_pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
66 b1_2 = b1_ptr[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
67 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
68 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
69
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
70 if (num_bands > 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
71 b2_2 = b2_ptr[0]; // b2[x, y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
72 b2_3 = b2_2; // b2[x+1,y ] = b2[x,y]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
73 b2_5 = b2_ptr[pitch]; // b2[x ,y+1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
74 b2_6 = b2_5; // b2[x+1,y+1] = b2[x,y+1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
75 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
76
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
77 if (num_bands > 3) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
78 b3_2 = b3_ptr[back_pitch]; // b3[x ,y-1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
79 b3_3 = b3_2; // b3[x+1,y-1] = b3[x ,y-1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
80 b3_5 = b3_ptr[0]; // b3[x ,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
81 b3_6 = b3_5; // b3[x+1,y ] = b3[x ,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
82 b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
83 b3_9 = b3_8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
84 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
85
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
86 for (x = 0, indx = 0; x < plane->width; x+=2, indx++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
87 /* some values calculated in the previous iterations can */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
88 /* be reused in the next ones, so do appropriate copying */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
89 b2_1 = b2_2; // b2[x-1,y ] = b2[x, y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
90 b2_2 = b2_3; // b2[x ,y ] = b2[x+1,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
91 b2_4 = b2_5; // b2[x-1,y+1] = b2[x ,y+1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
92 b2_5 = b2_6; // b2[x ,y+1] = b2[x+1,y+1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
93 b3_1 = b3_2; // b3[x-1,y-1] = b3[x ,y-1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
94 b3_2 = b3_3; // b3[x ,y-1] = b3[x+1,y-1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
95 b3_4 = b3_5; // b3[x-1,y ] = b3[x ,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
96 b3_5 = b3_6; // b3[x ,y ] = b3[x+1,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
97 b3_7 = b3_8; // vert_HPF(x-1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
98 b3_8 = b3_9; // vert_HPF(x )
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
99
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
100 p0 = p1 = p2 = p3 = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
101
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
102 /* process the LL-band by applying LPF both vertically and horizontally */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
103 if (num_bands > 0) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
104 tmp0 = b0_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
105 tmp2 = b0_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
106 b0_1 = b0_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
107 b0_2 = b0_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
108 tmp1 = tmp0 + b0_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
109
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
110 p0 = tmp0 << 4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
111 p1 = tmp1 << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
112 p2 = (tmp0 + tmp2) << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
113 p3 = (tmp1 + tmp2 + b0_2) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
114 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
115
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
116 /* process the HL-band by applying HPF vertically and LPF horizontally */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
117 if (num_bands > 1) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
118 tmp0 = b1_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
119 tmp1 = b1_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
120 b1_2 = b1_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
121 b1_1 = b1_ptr[back_pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
122
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
123 tmp2 = tmp1 - tmp0*6 + b1_3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
124 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
125
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
126 p0 += (tmp0 + tmp1) << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
127 p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
128 p2 += tmp2 << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
129 p3 += (tmp2 + b1_3) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
130 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
131
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
132 /* process the LH-band by applying LPF vertically and HPF horizontally */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
133 if (num_bands > 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
134 b2_3 = b2_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
135 b2_6 = b2_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
136
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
137 tmp0 = b2_1 + b2_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
138 tmp1 = b2_1 - b2_2*6 + b2_3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
139
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
140 p0 += tmp0 << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
141 p1 += tmp1 << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
142 p2 += (tmp0 + b2_4 + b2_5) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
143 p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
144 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
145
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
146 /* process the HH-band by applying HPF both vertically and horizontally */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
147 if (num_bands > 3) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
148 b3_6 = b3_ptr[indx+1]; // b3[x+1,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
149 b3_3 = b3_ptr[back_pitch+indx+1]; // b3[x+1,y-1]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
150
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
151 tmp0 = b3_1 + b3_4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
152 tmp1 = b3_2 + b3_5;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
153 tmp2 = b3_3 + b3_6;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
154
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
155 b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
156
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
157 p0 += (tmp0 + tmp1) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
158 p1 += (tmp0 - tmp1*6 + tmp2) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
159 p2 += (b3_7 + b3_8) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
160 p3 += b3_7 - b3_8*6 + b3_9;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
161 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
162
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
163 /* output four pixels */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
164 dst[x] = av_clip_uint8((p0 >> 6) + 128);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
165 dst[x+1] = av_clip_uint8((p1 >> 6) + 128);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
166 dst[dst_pitch+x] = av_clip_uint8((p2 >> 6) + 128);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
167 dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
168 }// for x
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
169
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
170 dst += dst_pitch << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
171
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
172 back_pitch = -pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
173
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
174 b0_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
175 b1_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
176 b2_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
177 b3_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
178 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
179 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
180
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
181 /** butterfly operation for the inverse slant transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
182 #define IVI_SLANT_BFLY(s1, s2, o1, o2, t) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
183 t = s1 - s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
184 o1 = s1 + s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
185 o2 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
186
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
187 /** This is a reflection a,b = 1/2, 5/4 for the inverse slant transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
188 #define IVI_IREFLECT(s1, s2, o1, o2, t) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
189 t = ((s1 + s2*2 + 2) >> 2) + s1;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
190 o2 = ((s1*2 - s2 + 2) >> 2) - s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
191 o1 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
192
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
193 /** This is a reflection a,b = 1/2, 7/8 for the inverse slant transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
194 #define IVI_SLANT_PART4(s1, s2, o1, o2, t) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
195 t = s2 + ((s1*4 - s2 + 4) >> 3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
196 o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
197 o1 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
198
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
199 /** inverse slant8 transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
200 #define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7,\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
201 d1, d2, d3, d4, d5, d6, d7, d8,\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
202 t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
203 IVI_SLANT_PART4(s4, s5, t4, t5, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
204 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
205 IVI_SLANT_BFLY(s1, t5, t1, t5, t0); IVI_SLANT_BFLY(s2, s6, t2, t6, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
206 IVI_SLANT_BFLY(s7, s3, t7, t3, t0); IVI_SLANT_BFLY(t4, s8, t4, t8, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
207 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
208 IVI_SLANT_BFLY(t1, t2, t1, t2, t0); IVI_IREFLECT (t4, t3, t4, t3, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
209 IVI_SLANT_BFLY(t5, t6, t5, t6, t0); IVI_IREFLECT (t8, t7, t8, t7, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
210 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
211 IVI_SLANT_BFLY(t5, t8, t5, t8, t0); IVI_SLANT_BFLY(t6, t7, t6, t7, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
212 d1 = COMPENSATE(t1);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
213 d2 = COMPENSATE(t2);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
214 d3 = COMPENSATE(t3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
215 d4 = COMPENSATE(t4);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
216 d5 = COMPENSATE(t5);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
217 d6 = COMPENSATE(t6);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
218 d7 = COMPENSATE(t7);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
219 d8 = COMPENSATE(t8);}
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
220
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
221 /** inverse slant4 transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
222 #define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4, t0, t1, t2, t3, t4) {\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
223 IVI_SLANT_BFLY(s1, s2, t1, t2, t0); IVI_IREFLECT (s4, s3, t4, t3, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
224 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
225 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
226 d1 = COMPENSATE(t1);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
227 d2 = COMPENSATE(t2);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
228 d3 = COMPENSATE(t3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
229 d4 = COMPENSATE(t4);}
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
230
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
231 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
232 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
233 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
234 const int32_t *src;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
235 int32_t *dst;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
236 int tmp[64];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
237 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
238
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
239 #define COMPENSATE(x) (x)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
240 src = in;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
241 dst = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
242 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
243 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
244 IVI_INV_SLANT8(src[0], src[8], src[16], src[24], src[32], src[40], src[48], src[56],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
245 dst[0], dst[8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
246 t0, t1, t2, t3, t4, t5, t6, t7, t8);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
247 } else
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
248 dst[0] = dst[8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
249
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
250 src++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
251 dst++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
252 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
253 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
254
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
255 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
256 src = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
257 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
258 if (!src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
259 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
260 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
261 IVI_INV_SLANT8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
262 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
263 t0, t1, t2, t3, t4, t5, t6, t7, t8);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
264 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
265 src += 8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
266 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
267 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
268 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
269 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
270
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
271 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
272 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
273 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
274 const int32_t *src;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
275 int32_t *dst;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
276 int tmp[16];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
277 int t0, t1, t2, t3, t4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
278
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
279 #define COMPENSATE(x) (x)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
280 src = in;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
281 dst = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
282 for (i = 0; i < 4; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
283 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
284 IVI_INV_SLANT4(src[0], src[4], src[8], src[12],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
285 dst[0], dst[4], dst[8], dst[12],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
286 t0, t1, t2, t3, t4);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
287 } else
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
288 dst[0] = dst[4] = dst[8] = dst[12] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
289
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
290 src++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
291 dst++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
292 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
293 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
294
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
295 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
296 src = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
297 for (i = 0; i < 4; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
298 if (!src[0] && !src[1] && !src[2] && !src[3]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
299 out[0] = out[1] = out[2] = out[3] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
300 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
301 IVI_INV_SLANT4(src[0], src[1], src[2], src[3],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
302 out[0], out[1], out[2], out[3],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
303 t0, t1, t2, t3, t4);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
304 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
305 src += 4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
306 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
307 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
308 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
309 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
310
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
311 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
312 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
313 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
314 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
315
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
316 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
317
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
318 for (y = 0; y < blk_size; out += pitch, y++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
319 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
320 out[x] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
321 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
322 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
323
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
324 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
325 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
326 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
327 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
328
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
329 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
330 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
331 if (!in[0] && !in[1] && !in[2] && !in[3] && !in[4] && !in[5] && !in[6] && !in[7]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
332 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
333 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
334 IVI_INV_SLANT8( in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
335 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
336 t0, t1, t2, t3, t4, t5, t6, t7, t8);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
337 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
338 in += 8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
339 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
340 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
341 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
342 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
343
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
344 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
345 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
346 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
347 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
348
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
349 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
350
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
351 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
352 out[x] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
353
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
354 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
355
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
356 for (y = 1; y < blk_size; out += pitch, y++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
357 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
358 out[x] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
359 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
360 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
361
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
362 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
363 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
364 int i, row2, row4, row8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
365 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
366
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
367 row2 = pitch << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
368 row4 = pitch << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
369 row8 = pitch << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
370
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
371 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
372 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
373 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
374 IVI_INV_SLANT8(in[0], in[8], in[16], in[24], in[32], in[40], in[48], in[56],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
375 out[0], out[pitch], out[row2], out[row2 + pitch], out[row4],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
376 out[row4 + pitch], out[row4 + row2], out[row8 - pitch],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
377 t0, t1, t2, t3, t4, t5, t6, t7, t8);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
378 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
379 out[0] = out[pitch] = out[row2] = out[row2 + pitch] = out[row4] =
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
380 out[row4 + pitch] = out[row4 + row2] = out[row8 - pitch] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
381 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
382
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
383 in++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
384 out++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
385 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
386 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
387 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
388
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
389 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
390 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
391 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
392 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
393
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
394 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
395
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
396 for (y = 0; y < blk_size; out += pitch, y++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
397 out[0] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
398 for (x = 1; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
399 out[x] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
400 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
401 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
402
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
403 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
404 const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
405 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
406 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
407
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
408 for (y = 0; y < 8; out += pitch, in += 8, y++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
409 for (x = 0; x < 8; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
410 out[x] = in[x];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
411 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
412
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
413 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
414 int blk_size)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
415 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
416 int y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
417
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
418 out[0] = in[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
419 memset(out + 1, 0, 7*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
420 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
421
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
422 for (y = 1; y < 8; out += pitch, y++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
423 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
424 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
425
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
426 #define IVI_MC_TEMPLATE(size, suffix, OP) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
427 void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_buf, \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
428 uint32_t pitch, int mc_type) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
429 { \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
430 int i, j; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
431 const int16_t *wptr; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
432 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
433 switch (mc_type) { \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
434 case 0: /* fullpel (no interpolation) */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
435 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) { \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
436 for (j = 0; j < size; j++) {\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
437 OP(buf[j], ref_buf[j]); \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
438 } \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
439 } \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
440 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
441 case 1: /* horizontal halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
442 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
443 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
444 OP(buf[j], (ref_buf[j] + ref_buf[j+1]) >> 1); \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
445 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
446 case 2: /* vertical halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
447 wptr = ref_buf + pitch; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
448 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
449 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
450 OP(buf[j], (ref_buf[j] + wptr[j]) >> 1); \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
451 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
452 case 3: /* vertical and horizontal halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
453 wptr = ref_buf + pitch; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
454 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
455 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
456 OP(buf[j], (ref_buf[j] + ref_buf[j+1] + wptr[j] + wptr[j+1]) >> 2); \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
457 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
458 } \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
459 } \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
460
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
461 #define OP_PUT(a, b) (a) = (b)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
462 #define OP_ADD(a, b) (a) += (b)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
463
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
464 IVI_MC_TEMPLATE(8, _no_delta, OP_PUT);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
465 IVI_MC_TEMPLATE(8, _delta, OP_ADD);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
466 IVI_MC_TEMPLATE(4, _no_delta, OP_PUT);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
467 IVI_MC_TEMPLATE(4, _delta, OP_ADD);