00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #include "avcodec.h"
00030 #include "dsputil.h"
00031 #include "dwt.h"
00032 #include "ivi_common.h"
00033 #include "ivi_dsp.h"
00034
00035 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
00036 const int dst_pitch, const int num_bands)
00037 {
00038 int x, y, indx;
00039 int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2;
00040 int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
00041 int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
00042 int32_t pitch, back_pitch;
00043 const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
00044
00045
00046 pitch = plane->bands[0].pitch;
00047
00048
00049 back_pitch = 0;
00050
00051
00052 b0_ptr = plane->bands[0].buf;
00053 b1_ptr = plane->bands[1].buf;
00054 b2_ptr = plane->bands[2].buf;
00055 b3_ptr = plane->bands[3].buf;
00056
00057 for (y = 0; y < plane->height; y += 2) {
00058
00059 if (y+2 >= plane->height)
00060 pitch= 0;
00061
00062 if (num_bands > 0) {
00063 b0_1 = b0_ptr[0];
00064 b0_2 = b0_ptr[pitch];
00065 }
00066
00067 if (num_bands > 1) {
00068 b1_1 = b1_ptr[back_pitch];
00069 b1_2 = b1_ptr[0];
00070 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch];
00071 }
00072
00073 if (num_bands > 2) {
00074 b2_2 = b2_ptr[0];
00075 b2_3 = b2_2;
00076 b2_5 = b2_ptr[pitch];
00077 b2_6 = b2_5;
00078 }
00079
00080 if (num_bands > 3) {
00081 b3_2 = b3_ptr[back_pitch];
00082 b3_3 = b3_2;
00083 b3_5 = b3_ptr[0];
00084 b3_6 = b3_5;
00085 b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch];
00086 b3_9 = b3_8;
00087 }
00088
00089 for (x = 0, indx = 0; x < plane->width; x+=2, indx++) {
00090 if (x+2 >= plane->width) {
00091 b0_ptr --;
00092 b1_ptr --;
00093 b2_ptr --;
00094 b3_ptr --;
00095 }
00096
00097
00098
00099 b2_1 = b2_2;
00100 b2_2 = b2_3;
00101 b2_4 = b2_5;
00102 b2_5 = b2_6;
00103 b3_1 = b3_2;
00104 b3_2 = b3_3;
00105 b3_4 = b3_5;
00106 b3_5 = b3_6;
00107 b3_7 = b3_8;
00108 b3_8 = b3_9;
00109
00110 p0 = p1 = p2 = p3 = 0;
00111
00112
00113 if (num_bands > 0) {
00114 tmp0 = b0_1;
00115 tmp2 = b0_2;
00116 b0_1 = b0_ptr[indx+1];
00117 b0_2 = b0_ptr[pitch+indx+1];
00118 tmp1 = tmp0 + b0_1;
00119
00120 p0 = tmp0 << 4;
00121 p1 = tmp1 << 3;
00122 p2 = (tmp0 + tmp2) << 3;
00123 p3 = (tmp1 + tmp2 + b0_2) << 2;
00124 }
00125
00126
00127 if (num_bands > 1) {
00128 tmp0 = b1_2;
00129 tmp1 = b1_1;
00130 b1_2 = b1_ptr[indx+1];
00131 b1_1 = b1_ptr[back_pitch+indx+1];
00132
00133 tmp2 = tmp1 - tmp0*6 + b1_3;
00134 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
00135
00136 p0 += (tmp0 + tmp1) << 3;
00137 p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
00138 p2 += tmp2 << 2;
00139 p3 += (tmp2 + b1_3) << 1;
00140 }
00141
00142
00143 if (num_bands > 2) {
00144 b2_3 = b2_ptr[indx+1];
00145 b2_6 = b2_ptr[pitch+indx+1];
00146
00147 tmp0 = b2_1 + b2_2;
00148 tmp1 = b2_1 - b2_2*6 + b2_3;
00149
00150 p0 += tmp0 << 3;
00151 p1 += tmp1 << 2;
00152 p2 += (tmp0 + b2_4 + b2_5) << 2;
00153 p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
00154 }
00155
00156
00157 if (num_bands > 3) {
00158 b3_6 = b3_ptr[indx+1];
00159 b3_3 = b3_ptr[back_pitch+indx+1];
00160
00161 tmp0 = b3_1 + b3_4;
00162 tmp1 = b3_2 + b3_5;
00163 tmp2 = b3_3 + b3_6;
00164
00165 b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
00166
00167 p0 += (tmp0 + tmp1) << 2;
00168 p1 += (tmp0 - tmp1*6 + tmp2) << 1;
00169 p2 += (b3_7 + b3_8) << 1;
00170 p3 += b3_7 - b3_8*6 + b3_9;
00171 }
00172
00173
00174 dst[x] = av_clip_uint8((p0 >> 6) + 128);
00175 dst[x+1] = av_clip_uint8((p1 >> 6) + 128);
00176 dst[dst_pitch+x] = av_clip_uint8((p2 >> 6) + 128);
00177 dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128);
00178 }
00179
00180 dst += dst_pitch << 1;
00181
00182 back_pitch = -pitch;
00183
00184 b0_ptr += pitch + 1;
00185 b1_ptr += pitch + 1;
00186 b2_ptr += pitch + 1;
00187 b3_ptr += pitch + 1;
00188 }
00189 }
00190
00191 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
00192 const int dst_pitch, const int num_bands)
00193 {
00194 int x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
00195 const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
00196 int32_t pitch;
00197
00198
00199 pitch = plane->bands[0].pitch;
00200
00201
00202 b0_ptr = plane->bands[0].buf;
00203 b1_ptr = plane->bands[1].buf;
00204 b2_ptr = plane->bands[2].buf;
00205 b3_ptr = plane->bands[3].buf;
00206
00207 for (y = 0; y < plane->height; y += 2) {
00208 for (x = 0, indx = 0; x < plane->width; x += 2, indx++) {
00209
00210 b0 = b0_ptr[indx];
00211 b1 = b1_ptr[indx];
00212 b2 = b2_ptr[indx];
00213 b3 = b3_ptr[indx];
00214
00215
00216 p0 = (b0 + b1 + b2 + b3 + 2) >> 2;
00217 p1 = (b0 + b1 - b2 - b3 + 2) >> 2;
00218 p2 = (b0 - b1 + b2 - b3 + 2) >> 2;
00219 p3 = (b0 - b1 - b2 + b3 + 2) >> 2;
00220
00221
00222 dst[x] = av_clip_uint8(p0 + 128);
00223 dst[x + 1] = av_clip_uint8(p1 + 128);
00224 dst[dst_pitch + x] = av_clip_uint8(p2 + 128);
00225 dst[dst_pitch + x + 1] = av_clip_uint8(p3 + 128);
00226 }
00227
00228 dst += dst_pitch << 1;
00229
00230 b0_ptr += pitch;
00231 b1_ptr += pitch;
00232 b2_ptr += pitch;
00233 b3_ptr += pitch;
00234 }
00235 }
00236
00238 #define IVI_HAAR_BFLY(s1, s2, o1, o2, t) \
00239 t = (s1 - s2) >> 1;\
00240 o1 = (s1 + s2) >> 1;\
00241 o2 = t;\
00242
00243
00244 #define INV_HAAR8(s1, s5, s3, s7, s2, s4, s6, s8,\
00245 d1, d2, d3, d4, d5, d6, d7, d8,\
00246 t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
00247 t1 = s1 << 1; t5 = s5 << 1;\
00248 IVI_HAAR_BFLY(t1, t5, t1, t5, t0); IVI_HAAR_BFLY(t1, s3, t1, t3, t0);\
00249 IVI_HAAR_BFLY(t5, s7, t5, t7, t0); IVI_HAAR_BFLY(t1, s2, t1, t2, t0);\
00250 IVI_HAAR_BFLY(t3, s4, t3, t4, t0); IVI_HAAR_BFLY(t5, s6, t5, t6, t0);\
00251 IVI_HAAR_BFLY(t7, s8, t7, t8, t0);\
00252 d1 = COMPENSATE(t1);\
00253 d2 = COMPENSATE(t2);\
00254 d3 = COMPENSATE(t3);\
00255 d4 = COMPENSATE(t4);\
00256 d5 = COMPENSATE(t5);\
00257 d6 = COMPENSATE(t6);\
00258 d7 = COMPENSATE(t7);\
00259 d8 = COMPENSATE(t8); }
00260
00262 #define INV_HAAR4(s1, s3, s5, s7) {\
00263 HAAR_BFLY(s1, s5); HAAR_BFLY(s1, s3); HAAR_BFLY(s5, s7);\
00264 s1 = COMPENSATE(s1);\
00265 s3 = COMPENSATE(s3);\
00266 s5 = COMPENSATE(s5);\
00267 s7 = COMPENSATE(s7); }
00268
00269 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
00270 const uint8_t *flags)
00271 {
00272 int i, shift, sp1, sp2, sp3, sp4;
00273 const int32_t *src;
00274 int32_t *dst;
00275 int tmp[64];
00276 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
00277
00278
00279 #define COMPENSATE(x) (x)
00280 src = in;
00281 dst = tmp;
00282 for (i = 0; i < 8; i++) {
00283 if (flags[i]) {
00284
00285 shift = !(i & 4);
00286 sp1 = src[ 0] << shift;
00287 sp2 = src[ 8] << shift;
00288 sp3 = src[16] << shift;
00289 sp4 = src[24] << shift;
00290 INV_HAAR8( sp1, sp2, sp3, sp4,
00291 src[32], src[40], src[48], src[56],
00292 dst[ 0], dst[ 8], dst[16], dst[24],
00293 dst[32], dst[40], dst[48], dst[56],
00294 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00295 } else
00296 dst[ 0] = dst[ 8] = dst[16] = dst[24] =
00297 dst[32] = dst[40] = dst[48] = dst[56] = 0;
00298
00299 src++;
00300 dst++;
00301 }
00302 #undef COMPENSATE
00303
00304
00305 #define COMPENSATE(x) (x)
00306 src = tmp;
00307 for (i = 0; i < 8; i++) {
00308 if ( !src[0] && !src[1] && !src[2] && !src[3]
00309 && !src[4] && !src[5] && !src[6] && !src[7]) {
00310 memset(out, 0, 8 * sizeof(out[0]));
00311 } else {
00312 INV_HAAR8(src[0], src[1], src[2], src[3],
00313 src[4], src[5], src[6], src[7],
00314 out[0], out[1], out[2], out[3],
00315 out[4], out[5], out[6], out[7],
00316 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00317 }
00318 src += 8;
00319 out += pitch;
00320 }
00321 #undef COMPENSATE
00322 }
00323
00324 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
00325 int blk_size)
00326 {
00327 int x, y;
00328 int16_t dc_coeff;
00329
00330 dc_coeff = (*in + 0) >> 3;
00331
00332 for (y = 0; y < blk_size; out += pitch, y++) {
00333 for (x = 0; x < blk_size; x++)
00334 out[x] = dc_coeff;
00335 }
00336 }
00337
00339 #define IVI_SLANT_BFLY(s1, s2, o1, o2, t) \
00340 t = s1 - s2;\
00341 o1 = s1 + s2;\
00342 o2 = t;\
00343
00344
00345 #define IVI_IREFLECT(s1, s2, o1, o2, t) \
00346 t = ((s1 + s2*2 + 2) >> 2) + s1;\
00347 o2 = ((s1*2 - s2 + 2) >> 2) - s2;\
00348 o1 = t;\
00349
00350
00351 #define IVI_SLANT_PART4(s1, s2, o1, o2, t) \
00352 t = s2 + ((s1*4 - s2 + 4) >> 3);\
00353 o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\
00354 o1 = t;\
00355
00356
00357 #define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7,\
00358 d1, d2, d3, d4, d5, d6, d7, d8,\
00359 t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
00360 IVI_SLANT_PART4(s4, s5, t4, t5, t0);\
00361 \
00362 IVI_SLANT_BFLY(s1, t5, t1, t5, t0); IVI_SLANT_BFLY(s2, s6, t2, t6, t0);\
00363 IVI_SLANT_BFLY(s7, s3, t7, t3, t0); IVI_SLANT_BFLY(t4, s8, t4, t8, t0);\
00364 \
00365 IVI_SLANT_BFLY(t1, t2, t1, t2, t0); IVI_IREFLECT (t4, t3, t4, t3, t0);\
00366 IVI_SLANT_BFLY(t5, t6, t5, t6, t0); IVI_IREFLECT (t8, t7, t8, t7, t0);\
00367 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
00368 IVI_SLANT_BFLY(t5, t8, t5, t8, t0); IVI_SLANT_BFLY(t6, t7, t6, t7, t0);\
00369 d1 = COMPENSATE(t1);\
00370 d2 = COMPENSATE(t2);\
00371 d3 = COMPENSATE(t3);\
00372 d4 = COMPENSATE(t4);\
00373 d5 = COMPENSATE(t5);\
00374 d6 = COMPENSATE(t6);\
00375 d7 = COMPENSATE(t7);\
00376 d8 = COMPENSATE(t8);}
00377
00379 #define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4, t0, t1, t2, t3, t4) {\
00380 IVI_SLANT_BFLY(s1, s2, t1, t2, t0); IVI_IREFLECT (s4, s3, t4, t3, t0);\
00381 \
00382 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
00383 d1 = COMPENSATE(t1);\
00384 d2 = COMPENSATE(t2);\
00385 d3 = COMPENSATE(t3);\
00386 d4 = COMPENSATE(t4);}
00387
00388 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
00389 {
00390 int i;
00391 const int32_t *src;
00392 int32_t *dst;
00393 int tmp[64];
00394 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
00395
00396 #define COMPENSATE(x) (x)
00397 src = in;
00398 dst = tmp;
00399 for (i = 0; i < 8; i++) {
00400 if (flags[i]) {
00401 IVI_INV_SLANT8(src[0], src[8], src[16], src[24], src[32], src[40], src[48], src[56],
00402 dst[0], dst[8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56],
00403 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00404 } else
00405 dst[0] = dst[8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0;
00406
00407 src++;
00408 dst++;
00409 }
00410 #undef COMPENSATE
00411
00412 #define COMPENSATE(x) ((x + 1)>>1)
00413 src = tmp;
00414 for (i = 0; i < 8; i++) {
00415 if (!src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) {
00416 memset(out, 0, 8*sizeof(out[0]));
00417 } else {
00418 IVI_INV_SLANT8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
00419 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
00420 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00421 }
00422 src += 8;
00423 out += pitch;
00424 }
00425 #undef COMPENSATE
00426 }
00427
00428 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
00429 {
00430 int i;
00431 const int32_t *src;
00432 int32_t *dst;
00433 int tmp[16];
00434 int t0, t1, t2, t3, t4;
00435
00436 #define COMPENSATE(x) (x)
00437 src = in;
00438 dst = tmp;
00439 for (i = 0; i < 4; i++) {
00440 if (flags[i]) {
00441 IVI_INV_SLANT4(src[0], src[4], src[8], src[12],
00442 dst[0], dst[4], dst[8], dst[12],
00443 t0, t1, t2, t3, t4);
00444 } else
00445 dst[0] = dst[4] = dst[8] = dst[12] = 0;
00446
00447 src++;
00448 dst++;
00449 }
00450 #undef COMPENSATE
00451
00452 #define COMPENSATE(x) ((x + 1)>>1)
00453 src = tmp;
00454 for (i = 0; i < 4; i++) {
00455 if (!src[0] && !src[1] && !src[2] && !src[3]) {
00456 out[0] = out[1] = out[2] = out[3] = 0;
00457 } else {
00458 IVI_INV_SLANT4(src[0], src[1], src[2], src[3],
00459 out[0], out[1], out[2], out[3],
00460 t0, t1, t2, t3, t4);
00461 }
00462 src += 4;
00463 out += pitch;
00464 }
00465 #undef COMPENSATE
00466 }
00467
00468 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
00469 {
00470 int x, y;
00471 int16_t dc_coeff;
00472
00473 dc_coeff = (*in + 1) >> 1;
00474
00475 for (y = 0; y < blk_size; out += pitch, y++) {
00476 for (x = 0; x < blk_size; x++)
00477 out[x] = dc_coeff;
00478 }
00479 }
00480
00481 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
00482 {
00483 int i;
00484 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
00485
00486 #define COMPENSATE(x) ((x + 1)>>1)
00487 for (i = 0; i < 8; i++) {
00488 if (!in[0] && !in[1] && !in[2] && !in[3] && !in[4] && !in[5] && !in[6] && !in[7]) {
00489 memset(out, 0, 8*sizeof(out[0]));
00490 } else {
00491 IVI_INV_SLANT8( in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7],
00492 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
00493 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00494 }
00495 in += 8;
00496 out += pitch;
00497 }
00498 #undef COMPENSATE
00499 }
00500
00501 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
00502 {
00503 int x, y;
00504 int16_t dc_coeff;
00505
00506 dc_coeff = (*in + 1) >> 1;
00507
00508 for (x = 0; x < blk_size; x++)
00509 out[x] = dc_coeff;
00510
00511 out += pitch;
00512
00513 for (y = 1; y < blk_size; out += pitch, y++) {
00514 for (x = 0; x < blk_size; x++)
00515 out[x] = 0;
00516 }
00517 }
00518
00519 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
00520 {
00521 int i, row2, row4, row8;
00522 int t0, t1, t2, t3, t4, t5, t6, t7, t8;
00523
00524 row2 = pitch << 1;
00525 row4 = pitch << 2;
00526 row8 = pitch << 3;
00527
00528 #define COMPENSATE(x) ((x + 1)>>1)
00529 for (i = 0; i < 8; i++) {
00530 if (flags[i]) {
00531 IVI_INV_SLANT8(in[0], in[8], in[16], in[24], in[32], in[40], in[48], in[56],
00532 out[0], out[pitch], out[row2], out[row2 + pitch], out[row4],
00533 out[row4 + pitch], out[row4 + row2], out[row8 - pitch],
00534 t0, t1, t2, t3, t4, t5, t6, t7, t8);
00535 } else {
00536 out[0] = out[pitch] = out[row2] = out[row2 + pitch] = out[row4] =
00537 out[row4 + pitch] = out[row4 + row2] = out[row8 - pitch] = 0;
00538 }
00539
00540 in++;
00541 out++;
00542 }
00543 #undef COMPENSATE
00544 }
00545
00546 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
00547 {
00548 int x, y;
00549 int16_t dc_coeff;
00550
00551 dc_coeff = (*in + 1) >> 1;
00552
00553 for (y = 0; y < blk_size; out += pitch, y++) {
00554 out[0] = dc_coeff;
00555 for (x = 1; x < blk_size; x++)
00556 out[x] = 0;
00557 }
00558 }
00559
00560 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
00561 const uint8_t *flags)
00562 {
00563 int x, y;
00564
00565 for (y = 0; y < 8; out += pitch, in += 8, y++)
00566 for (x = 0; x < 8; x++)
00567 out[x] = in[x];
00568 }
00569
00570 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
00571 int blk_size)
00572 {
00573 int y;
00574
00575 out[0] = in[0];
00576 memset(out + 1, 0, 7*sizeof(out[0]));
00577 out += pitch;
00578
00579 for (y = 1; y < 8; out += pitch, y++)
00580 memset(out, 0, 8*sizeof(out[0]));
00581 }
00582
00583 #define IVI_MC_TEMPLATE(size, suffix, OP) \
00584 void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_buf, \
00585 uint32_t pitch, int mc_type) \
00586 { \
00587 int i, j; \
00588 const int16_t *wptr; \
00589 \
00590 switch (mc_type) { \
00591 case 0: \
00592 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) { \
00593 for (j = 0; j < size; j++) {\
00594 OP(buf[j], ref_buf[j]); \
00595 } \
00596 } \
00597 break; \
00598 case 1: \
00599 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) \
00600 for (j = 0; j < size; j++) \
00601 OP(buf[j], (ref_buf[j] + ref_buf[j+1]) >> 1); \
00602 break; \
00603 case 2: \
00604 wptr = ref_buf + pitch; \
00605 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
00606 for (j = 0; j < size; j++) \
00607 OP(buf[j], (ref_buf[j] + wptr[j]) >> 1); \
00608 break; \
00609 case 3: \
00610 wptr = ref_buf + pitch; \
00611 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
00612 for (j = 0; j < size; j++) \
00613 OP(buf[j], (ref_buf[j] + ref_buf[j+1] + wptr[j] + wptr[j+1]) >> 2); \
00614 break; \
00615 } \
00616 } \
00617
00618 #define OP_PUT(a, b) (a) = (b)
00619 #define OP_ADD(a, b) (a) += (b)
00620
00621 IVI_MC_TEMPLATE(8, _no_delta, OP_PUT)
00622 IVI_MC_TEMPLATE(8, _delta, OP_ADD)
00623 IVI_MC_TEMPLATE(4, _no_delta, OP_PUT)
00624 IVI_MC_TEMPLATE(4, _delta, OP_ADD)