annotate ivi_dsp.c @ 11310:1ff8ae765206 libavcodec

Strides in Indeo 5 reconstruction filter should be signed, this way it works on 64-bit archs too. Patch by Jindich Makovika ($lastname without last letter and hek, gmail)
author kostya
date Sat, 27 Feb 2010 14:08:06 +0000
parents 3b79a8709f43
children 0f0cd6b5791f
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 /**
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
24 * @file libavcodec/ivi_dsp.c
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"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
31 #include "ivi_common.h"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
32 #include "ivi_dsp.h"
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
33
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
34 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
35 const int dst_pitch, const int num_bands)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
36 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
37 int x, y, indx;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
38 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
39 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
40 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
41 int32_t pitch, back_pitch;
11054
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
42 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
43
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
44 /* all bands should have the same pitch */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
45 pitch = plane->bands[0].pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
46
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
47 /* 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
48 back_pitch = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
49
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
50 /* get pointers to the wavelet bands */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
51 b0_ptr = plane->bands[0].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
52 b1_ptr = plane->bands[1].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
53 b2_ptr = plane->bands[2].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
54 b3_ptr = plane->bands[3].buf;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
55
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
56 for (y = 0; y < plane->height; y += 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
57 /* load storage variables with values */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
58 if (num_bands > 0) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
59 b0_1 = b0_ptr[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
60 b0_2 = b0_ptr[pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
61 }
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 if (num_bands > 1) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
64 b1_1 = b1_ptr[back_pitch];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
65 b1_2 = b1_ptr[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
66 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
67 }
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 if (num_bands > 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
70 b2_2 = b2_ptr[0]; // b2[x, y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
71 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
72 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
73 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
74 }
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 if (num_bands > 3) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
77 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
78 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
79 b3_5 = b3_ptr[0]; // b3[x ,y ]
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
80 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
81 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
82 b3_9 = b3_8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
83 }
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 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
86 /* some values calculated in the previous iterations can */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
87 /* 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
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 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
96 b3_7 = b3_8; // vert_HPF(x-1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
97 b3_8 = b3_9; // vert_HPF(x )
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
98
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
99 p0 = p1 = p2 = p3 = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
100
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
101 /* 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
102 if (num_bands > 0) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
103 tmp0 = b0_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
104 tmp2 = b0_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
105 b0_1 = b0_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
106 b0_2 = b0_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
107 tmp1 = tmp0 + b0_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
108
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
109 p0 = tmp0 << 4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
110 p1 = tmp1 << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
111 p2 = (tmp0 + tmp2) << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
112 p3 = (tmp1 + tmp2 + b0_2) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
113 }
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 /* 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
116 if (num_bands > 1) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
117 tmp0 = b1_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
118 tmp1 = b1_1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
119 b1_2 = b1_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
120 b1_1 = b1_ptr[back_pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
121
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
122 tmp2 = tmp1 - tmp0*6 + b1_3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
123 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
124
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
125 p0 += (tmp0 + tmp1) << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
126 p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
127 p2 += tmp2 << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
128 p3 += (tmp2 + b1_3) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
129 }
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 /* 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
132 if (num_bands > 2) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
133 b2_3 = b2_ptr[indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
134 b2_6 = b2_ptr[pitch+indx+1];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
135
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
136 tmp0 = b2_1 + b2_2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
137 tmp1 = b2_1 - b2_2*6 + b2_3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
138
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
139 p0 += tmp0 << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
140 p1 += tmp1 << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
141 p2 += (tmp0 + b2_4 + b2_5) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
142 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
143 }
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 /* 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
146 if (num_bands > 3) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
147 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
148 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
149
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
150 tmp0 = b3_1 + b3_4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
151 tmp1 = b3_2 + b3_5;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
152 tmp2 = b3_3 + b3_6;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
153
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
154 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
155
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
156 p0 += (tmp0 + tmp1) << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
157 p1 += (tmp0 - tmp1*6 + tmp2) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
158 p2 += (b3_7 + b3_8) << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
159 p3 += b3_7 - b3_8*6 + b3_9;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
160 }
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 /* output four pixels */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
163 dst[x] = av_clip_uint8((p0 >> 6) + 128);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
164 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
165 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
166 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
167 }// for x
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
168
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
169 dst += dst_pitch << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
170
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
171 back_pitch = -pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
172
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
173 b0_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
174 b1_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
175 b2_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
176 b3_ptr += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
177 }
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 /** butterfly operation for the inverse slant transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
181 #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
182 t = s1 - s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
183 o1 = s1 + s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
184 o2 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
185
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
186 /** 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
187 #define IVI_IREFLECT(s1, s2, o1, o2, t) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
188 t = ((s1 + s2*2 + 2) >> 2) + s1;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
189 o2 = ((s1*2 - s2 + 2) >> 2) - s2;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
190 o1 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
191
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
192 /** 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
193 #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
194 t = s2 + ((s1*4 - s2 + 4) >> 3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
195 o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
196 o1 = t;\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
197
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
198 /** inverse slant8 transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
199 #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
200 d1, d2, d3, d4, d5, d6, d7, d8,\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
201 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
202 IVI_SLANT_PART4(s4, s5, t4, t5, t0);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
203 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
204 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
205 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
206 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
207 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
208 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
209 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
210 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
211 d1 = COMPENSATE(t1);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
212 d2 = COMPENSATE(t2);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
213 d3 = COMPENSATE(t3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
214 d4 = COMPENSATE(t4);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
215 d5 = COMPENSATE(t5);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
216 d6 = COMPENSATE(t6);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
217 d7 = COMPENSATE(t7);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
218 d8 = COMPENSATE(t8);}
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
219
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
220 /** inverse slant4 transform */
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
221 #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
222 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
223 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
224 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
225 d1 = COMPENSATE(t1);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
226 d2 = COMPENSATE(t2);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
227 d3 = COMPENSATE(t3);\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
228 d4 = COMPENSATE(t4);}
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
229
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
230 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
231 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
232 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
233 const int32_t *src;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
234 int32_t *dst;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
235 int tmp[64];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
236 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
237
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
238 #define COMPENSATE(x) (x)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
239 src = in;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
240 dst = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
241 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
242 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
243 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
244 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
245 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
246 } else
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
247 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
248
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
249 src++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
250 dst++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
251 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
252 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
253
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
254 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
255 src = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
256 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
257 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
258 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
259 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
260 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
261 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
262 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
263 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
264 src += 8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
265 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
266 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
267 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
268 }
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 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
271 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
272 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
273 const int32_t *src;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
274 int32_t *dst;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
275 int tmp[16];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
276 int t0, t1, t2, t3, t4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
277
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
278 #define COMPENSATE(x) (x)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
279 src = in;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
280 dst = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
281 for (i = 0; i < 4; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
282 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
283 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
284 dst[0], dst[4], dst[8], dst[12],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
285 t0, t1, t2, t3, t4);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
286 } else
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
287 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
288
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
289 src++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
290 dst++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
291 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
292 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
293
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
294 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
295 src = tmp;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
296 for (i = 0; i < 4; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
297 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
298 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
299 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
300 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
301 out[0], out[1], out[2], out[3],
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
302 t0, t1, t2, t3, t4);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
303 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
304 src += 4;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
305 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
306 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
307 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
308 }
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 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
311 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
312 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
313 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
314
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
315 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
316
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
317 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
318 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
319 out[x] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
320 }
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 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
324 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
325 int i;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
326 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
327
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
328 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
329 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
330 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
331 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
332 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
333 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
334 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
335 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
336 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
337 in += 8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
338 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
339 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
340 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
341 }
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 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
344 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
345 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
346 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
347
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
348 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
349
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
350 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
351 out[x] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
352
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
353 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
354
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
355 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
356 for (x = 0; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
357 out[x] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
358 }
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 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
362 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
363 int i, row2, row4, row8;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
364 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
365
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
366 row2 = pitch << 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
367 row4 = pitch << 2;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
368 row8 = pitch << 3;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
369
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
370 #define COMPENSATE(x) ((x + 1)>>1)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
371 for (i = 0; i < 8; i++) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
372 if (flags[i]) {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
373 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
374 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
375 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
376 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
377 } else {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
378 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
379 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
380 }
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 in++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
383 out++;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
384 }
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
385 #undef COMPENSATE
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
386 }
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 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
389 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
390 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
391 int16_t dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
392
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
393 dc_coeff = (*in + 1) >> 1;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
394
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
395 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
396 out[0] = dc_coeff;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
397 for (x = 1; x < blk_size; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
398 out[x] = 0;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
399 }
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 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
403 const uint8_t *flags)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
404 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
405 int x, y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
406
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
407 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
408 for (x = 0; x < 8; x++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
409 out[x] = in[x];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
410 }
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 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
413 int blk_size)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
414 {
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
415 int y;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
416
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
417 out[0] = in[0];
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
418 memset(out + 1, 0, 7*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
419 out += pitch;
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
420
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
421 for (y = 1; y < 8; out += pitch, y++)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
422 memset(out, 0, 8*sizeof(out[0]));
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
423 }
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 #define IVI_MC_TEMPLATE(size, suffix, OP) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
426 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
427 uint32_t pitch, int mc_type) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
428 { \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
429 int i, j; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
430 const int16_t *wptr; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
431 \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
432 switch (mc_type) { \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
433 case 0: /* fullpel (no interpolation) */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
434 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
435 for (j = 0; j < size; j++) {\
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
436 OP(buf[j], ref_buf[j]); \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
437 } \
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 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
440 case 1: /* horizontal halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
441 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
442 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
443 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
444 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
445 case 2: /* vertical halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
446 wptr = ref_buf + pitch; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
447 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
448 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
449 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
450 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
451 case 3: /* vertical and horizontal halfpel interpolation */ \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
452 wptr = ref_buf + pitch; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
453 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
454 for (j = 0; j < size; j++) \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
455 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
456 break; \
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
457 } \
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 #define OP_PUT(a, b) (a) = (b)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
461 #define OP_ADD(a, b) (a) += (b)
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
462
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
463 IVI_MC_TEMPLATE(8, _no_delta, OP_PUT);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
464 IVI_MC_TEMPLATE(8, _delta, OP_ADD);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
465 IVI_MC_TEMPLATE(4, _no_delta, OP_PUT);
3b79a8709f43 Indeo Video Interactive 4 and 5 common code and DSP functions.
kostya
parents:
diff changeset
466 IVI_MC_TEMPLATE(4, _delta, OP_ADD);