1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
|
/* fixed mmx routines/enable compile with gcc-3
* Christoph Lampert <chl at math.uni-bonn.de>
* Fri Mar 14 12:03:48 CET 2003
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "mjpeg_types.h"
#include "global.h"
#include "motion.h"
/* pointers on SAD functions */
uint32_t (*calc_SAD) (uint8_t * , uint8_t * );
uint32_t (*calc_SAD_uv) (uint8_t * , uint8_t * );
uint32_t (*calc_SAD_half) (uint8_t * , uint8_t * ,uint8_t *);
/* global denoiser structure defined in main.c and global.h */
extern struct DNSR_GLOBAL denoiser;
struct DNSR_VECTOR vector;
struct DNSR_VECTOR varray44[8];
struct DNSR_VECTOR varray22[8];
/*****************************************************************************
* generate a lowpassfiltered and subsampled copy *
* of the source image (src) at the destination *
* image location. *
* Lowpass-filtering is important, as this subsampled *
* image is used for motion estimation and the result *
* is more reliable when filtered. *
*****************************************************************************/
void
subsample_frame (uint8_t * dst[3], uint8_t * src[3])
{
int x, y;
int w=denoiser.frame.w;
int h=denoiser.frame.h;
uint8_t *s = src[0];
uint8_t *s2 = src[0]+w;
uint8_t *d = dst[0];
/* subsample Y component */
for (y = 0; y < ((h+64)>>1); y += 1)
{
for (x = 0; x < w; x += 2)
{
*(d + (x>>1)) =
(
*(s + x ) +
*(s + x + 1) +
*(s2 + x ) +
*(s2 + x + 1) )>>2;
}
s+=w<<1;
s2+=w<<1;
d+=w;
}
#if 1
/* subsample U and V components */
s = src[1];
s2 = src[1]+(w>>1);
d = dst[1];
for (y = 0; y < ((h+64)>>2); y += 1)
{
for (x = 0; x < (w>>1); x += 2)
{
*(d + (x>>1)) =
(
*(s + x ) +
*(s + x + 1) +
*(s2 + x ) +
*(s2 + x + 1) )>>2;
}
s+=w;
s2+=w;
d+=w>>1;
}
s = src[2];
s2 = src[2]+(w>>1);
d = dst[2];
for (y = 0; y < ((h+64)>>2); y += 1)
{
for (x = 0; x < (w>>1); x += 2)
{
*(d + (x>>1)) =
(
*(s + x ) +
*(s + x + 1) +
*(s2 + x ) +
*(s2 + x + 1) )>>2;
}
s+=w;
s2+=w;
d+=w>>1;
}
#endif
}
/*********************************************************************
* *
* SAD-function for Y without MMX/MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_noaccel (uint8_t * frm, uint8_t * ref)
{
uint8_t dx = 0;
uint8_t dy = 0;
int32_t Y = 0;
uint32_t d = 0;
for(dy=0;dy<8;dy++)
for(dx=0;dx<8;dx++)
{
Y=*(frm+dx+dy*denoiser.frame.w)-*(ref+dx+dy*denoiser.frame.w);
d+=(Y<0)? -Y:Y;
}
return d;
}
/*********************************************************************
* *
* SAD-function for Y with MMX *
* *
*********************************************************************/
uint32_t
calc_SAD_mmx (uint8_t * frm, uint8_t * ref)
{
static uint16_t a[4];
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */\n"
" pxor %%mm7 , %%mm7; /* clear mm7 */\n"
" /* */\n"
".rept 8 ; /* Loop for 8 lines */\n"
" movq (%%esi), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n"
" movq (%%edi), %%mm2; /* 8 Pixels from reference frame to mm2 */\n"
" movq %%mm2 , %%mm3; /* hold a copy of mm2 in mm3 */\n"
" psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */\n"
" psubusb %%mm2 , %%mm1; /* positive differences between mm1 and mm3 */\n"
" paddusb %%mm3 , %%mm1; /* mm1 now contains abs(mm1-mm2) */\n"
" movq %%mm1 , %%mm2; /* copy mm1 to mm2 */\n"
" punpcklbw %%mm7 , %%mm1; /* unpack mm1 into mm1 and mm2 */\n"
" punpckhbw %%mm7 , %%mm2; /* */\n"
" paddusw %%mm1 , %%mm0; /* add mm1 (stored in mm1 and mm2...) */\n"
" paddusw %%mm2 , %%mm0; /* to mm0 */\n"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */\n"
" .endr /* end loop */\n"
" /* */\n"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n"
:"=g" (a)
:"S" (frm), "D" (ref), "c" (denoiser.frame.w)
);
#endif
#endif
return (uint32_t)(a[0]+a[1]+a[2]+a[3]);
}
/*********************************************************************
* *
* SAD-function for Y with MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_mmxe (uint8_t * frm, uint8_t * ref)
{
static uint32_t a;
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */\n"
" ; /* */\n"
" .rept 8 ; /* */\n"
" movq (%%esi), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n"
" psadbw (%%edi), %%mm1; /* 8 Pixels difference to mm1 */\n"
" paddusw %%mm1 , %%mm0; /* add result to mm0 */\n"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */\n"
" .endr ; /* */\n"
" /* */\n"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n"
:"=g" (a)
:"S" (frm), "D" (ref), "c" (denoiser.frame.w)
);
#endif
#endif
return a;
}
/*********************************************************************
* *
* SAD-function for UV without MMX/MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_uv_noaccel (uint8_t * frm, uint8_t * ref)
{
register uint8_t dx = 0;
register uint8_t dy = 0;
int32_t Y = 0;
uint32_t d = 0;
for(dy=0;dy<4;dy++)
for(dx=0;dx<4;dx++)
{
Y=*(frm+dx+dy*W2)-*(ref+dx+dy*W2);
d+=(Y<0)? -Y:Y;
}
return d;
}
/*********************************************************************
* *
* SAD-function for UV with MMX *
* *
*********************************************************************/
uint32_t
calc_SAD_uv_mmx (uint8_t * frm, uint8_t * ref)
{
static uint16_t a[4];
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */\n"
" pxor %%mm7 , %%mm7; /* clear mm7 */\n"
" /* */\n"
".rept 4 ; /* Loop for 4 lines */\n"
" movd (%%esi), %%mm1; /* 4 Pixels from filtered frame to mm1 */\n"
" movd (%%edi), %%mm2; /* 4 Pixels from reference frame to mm2 */\n"
" movq %%mm2 , %%mm3; /* hold a copy of mm2 in mm3 */\n"
" psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */\n"
" psubusb %%mm2 , %%mm1; /* positive differences between mm1 and mm3 */\n"
" paddusb %%mm3 , %%mm1; /* mm2 now contains abs(mm1-mm2) */\n"
" movq %%mm1 , %%mm2; /* copy mm1 to mm2 */\n"
" punpcklbw %%mm7 , %%mm1; /* unpack mm1 into mm1 and mm2 */\n"
" punpckhbw %%mm7 , %%mm2; /* */\n"
" paddusw %%mm1 , %%mm2; /* add mm1 (stored in mm1 and mm2...) */\n"
" paddusw %%mm2 , %%mm0; /* to mm0 */\n"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */\n"
" .endr /* end loop */\n"
" /* */\n"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n"
:"=g" (a)
:"S" (frm), "D" (ref), "c" (denoiser.frame.w/2)
);
#endif
#endif
return (uint32_t)(a[0]+a[1]+a[2]+a[3]);
}
/*********************************************************************
* *
* SAD-function for UV with MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_uv_mmxe (uint8_t * frm, uint8_t * ref)
{
static uint32_t a;
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */\n"
" ; /* */\n"
" .rept 4 ; /* */\n"
" movd (%%esi), %%mm1; /* 4 Pixels from filtered frame to mm1 */\n"
" movd (%%edi), %%mm2; /* 4 Pixels from filtered frame to mm2 */\n"
" psadbw %%mm2 , %%mm1; /* 4 Pixels difference to mm1 */\n"
" paddusw %%mm1 , %%mm0; /* add result to mm0 */\n"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */\n"
" .endr ; /* */\n"
" /* */\n"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n"
:"=g" (a)
:"S" (frm), "D" (ref), "c" (denoiser.frame.w/2)
);
#endif
#endif
return a;
}
/*********************************************************************
* *
* halfpel SAD-function for Y without MMX/MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_half_noaccel (uint8_t * ref, uint8_t * frm1, uint8_t * frm2)
{
uint8_t dx = 0;
uint8_t dy = 0;
int32_t Y = 0;
uint32_t d = 0;
for(dy=0;dy<8;dy++)
for(dx=0;dx<8;dx++)
{
Y=((*(frm1+dx+dy*denoiser.frame.w)+*(frm2+dx+dy*denoiser.frame.w))>>1)-*(ref+dx+dy*denoiser.frame.w);
d+=(Y<0)? -Y:Y;
}
return d;
}
/*********************************************************************
* *
* halfpel SAD-function for Y with MMX *
* *
*********************************************************************/
uint32_t
calc_SAD_half_mmx (uint8_t * ref, uint8_t * frm1, uint8_t * frm2)
{
static uint32_t a;
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */"
" pcmpeqw %%mm6 , %%mm6; /* Build 7f7f7f7f7f7f7f in a register */"
" psrlw $9 , %%mm6; /* */"
" packuswb %%mm6 , %%mm6; /* */"
" ; /* */"
" .rept 8 ; /* */"
" movq (%%esi), %%mm1; /* 8 Pixels from filtered frame to mm1 */"
" movq (%%edi), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */"
" movq (%%eax), %%mm3; /* reference to mm3 */"
" psrlq $1 , %%mm1; /* average source pixels */"
" psrlq $1 , %%mm2; /* shift right by one (divide by two) */"
" pand %%mm6 , %%mm1; /* kill downshifted bits */"
" pand %%mm6 , %%mm2; /* kill downshifted bits */"
" paddusw %%mm2 , %%mm1; /* add up ... */"
" movq %%mm3 , %%mm4; /* copy reference to mm4 */"
" psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */"
" psubusb %%mm4 , %%mm1; /* positive differences between mm1 and mm3 */"
" paddusb %%mm3 , %%mm1; /* mm1 now contains abs(mm1-mm2) */"
" paddusw %%mm1 , %%mm0; /* add result to mm0 */"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */"
" addl %%ecx , %%ecx; /* add framewidth to frameaddress */"
" .endr ; /* */"
" /* */"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */"
:"=g" (a)
:"S" (frm1),"D" (frm2), "a" (ref), "c" (denoiser.frame.w)
);
#endif
#endif
return a;
}
/*********************************************************************
* *
* halfpel SAD-function for Y with MMXE *
* *
*********************************************************************/
uint32_t
calc_SAD_half_mmxe (uint8_t * ref, uint8_t * frm1, uint8_t * frm2)
{
static uint32_t a;
#ifdef ARCH_X86
#ifdef HAVE_ASM_MMX
__asm__ __volatile__
(
" pxor %%mm0 , %%mm0; /* clear mm0 */\n"
" ; /* */\n"
" .rept 8 ; /* */\n"
" movq (%%esi), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n"
" movq (%%edi), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */\n"
" movq (%%eax), %%mm3; /* 8 Pixels from reference frame to mm3 */\n"
" pavgb %%mm2 , %%mm1; /* average source pixels */\n"
" psadbw %%mm3 , %%mm1; /* 8 Pixels difference to mm1 */\n"
" paddusw %%mm1 , %%mm0; /* add result to mm0 */\n"
" addl %%ecx , %%esi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%edi; /* add framewidth to frameaddress */\n"
" addl %%ecx , %%eax; /* add framewidth to frameaddress */\n"
" .endr ; /* */\n"
" /* */\n"
" movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n"
:"=g" (a)
:"S" (frm1),"D" (frm2), "a" (ref), "c" (denoiser.frame.w)
);
#endif
#endif
return a;
}
/*********************************************************************
* *
* Estimate Motion Vectors in 4 times subsampled frames *
* *
*********************************************************************/
void
mb_search_44 (uint16_t x, uint16_t y)
{
uint32_t best_SAD=0x00ffffff;
uint32_t SAD=0x00ffffff;
uint32_t SAD_uv=0x00ffffff;
uint8_t radius = denoiser.radius>>2; /* search radius /4 in pixels */
int32_t MB_ref_offset = denoiser.frame.w * (y>>2) + (x>>2);
int32_t MB_avg_offset;
int32_t MB_ref_offset_uv = (denoiser.frame.w>>1) * (y>>3) + (x>>3);
int32_t MB_avg_offset_uv;
int32_t last_uv_offset=0;
int16_t xx;
int16_t yy;
SAD = calc_SAD ( denoiser.frame.sub4ref[Yy]+MB_ref_offset,
denoiser.frame.sub4avg[Yy]+MB_ref_offset );
SAD += calc_SAD_uv ( denoiser.frame.sub4ref[Cr]+MB_ref_offset_uv,
denoiser.frame.sub4avg[Cr]+MB_ref_offset_uv );
SAD += calc_SAD_uv ( denoiser.frame.sub4ref[Cb]+MB_ref_offset_uv,
denoiser.frame.sub4avg[Cb]+MB_ref_offset_uv );
for(yy=-radius;yy<radius;yy++) {
for(xx=-radius;xx<radius;xx++)
{
MB_avg_offset = MB_ref_offset+(xx)+(yy*denoiser.frame.w);
MB_avg_offset_uv = MB_ref_offset_uv+(xx>>1)+((yy>>1)*(denoiser.frame.w>>1));
SAD = calc_SAD ( denoiser.frame.sub4ref[Yy]+MB_ref_offset,
denoiser.frame.sub4avg[Yy]+MB_avg_offset );
if(MB_ref_offset_uv != last_uv_offset)
{
last_uv_offset=MB_ref_offset_uv;
SAD_uv = calc_SAD_uv ( denoiser.frame.sub4ref[Cr]+MB_ref_offset_uv,
denoiser.frame.sub4avg[Cr]+MB_avg_offset_uv );
SAD_uv += calc_SAD_uv ( denoiser.frame.sub4ref[Cb]+MB_ref_offset_uv,
denoiser.frame.sub4avg[Cb]+MB_avg_offset_uv );
}
SAD += SAD_uv;
SAD += xx*xx + yy*yy; /* favour center matches... */
if(SAD<=best_SAD)
{
best_SAD = SAD;
vector.x = xx;
vector.y = yy;
}
}
}
}
/*********************************************************************
* *
* Estimate Motion Vectors in 2 times subsampled frames *
* *
*********************************************************************/
void
mb_search_22 (uint16_t x, uint16_t y)
{
uint32_t best_SAD=0x00ffffff;
uint32_t SAD=0x00ffffff;
uint32_t SAD_uv=0x00ffffff;
int32_t MB_ref_offset = denoiser.frame.w * (y>>1) + (x>>1);
int32_t MB_avg_offset;
int32_t MB_ref_offset_uv = (denoiser.frame.w>>1) * (y>>2) + (x>>2);
int32_t MB_avg_offset_uv;
int32_t last_uv_offset=0;
int16_t xx;
int16_t yy;
int16_t vx=vector.x<<1;
int16_t vy=vector.y<<1;
/* motion-vectors from 44 can/will be wrong by +/- 3 pixels */
for(yy=-2;yy<2;yy++)
for(xx=-2;xx<2;xx++)
{
MB_avg_offset=MB_ref_offset+(xx+vx)+((yy+vy)*denoiser.frame.w);
MB_avg_offset_uv = MB_ref_offset_uv+((xx+vx)>>2)+((yy+vy)>>2)*(denoiser.frame.w>>1);
SAD = calc_SAD ( denoiser.frame.sub2ref[0]+MB_ref_offset,
denoiser.frame.sub2avg[0]+MB_avg_offset );
if(MB_ref_offset_uv != last_uv_offset)
{
last_uv_offset=MB_ref_offset_uv;
SAD_uv = calc_SAD_uv ( denoiser.frame.sub2ref[1]+MB_ref_offset_uv,
denoiser.frame.sub2avg[1]+MB_avg_offset_uv );
SAD_uv += calc_SAD_uv ( denoiser.frame.sub2ref[2]+MB_ref_offset_uv,
denoiser.frame.sub2avg[2]+MB_avg_offset_uv );
}
SAD += SAD_uv;
if(SAD<=best_SAD)
{
best_SAD = SAD;
varray22[2]=varray22[1];
varray22[1]=varray22[0];
varray22[0].x = xx+vx;
varray22[0].y = yy+vy;
vector.x = xx+vx;
vector.y = yy+vy;
}
}
}
/*********************************************************************
* *
* Estimate Motion Vectors in not subsampled frames *
* *
*********************************************************************/
void
mb_search_11 (uint16_t x, uint16_t y)
{
uint32_t best_SAD = 0x00ffffff;
uint32_t SAD=0x00ffffff;
int32_t MB_ref_offset = denoiser.frame.w * (y) + (x);
int32_t MB_avg_offset;
int16_t xx;
int16_t yy;
int16_t vx=vector.x<<1;
int16_t vy=vector.y<<1;
/* motion-vectors from 22 can/will be wrong by +/- 2 pixels */
for(yy=-2;yy<2;yy++)
for(xx=-2;xx<2;xx++)
{
MB_avg_offset=MB_ref_offset+(xx+vx)+((yy+vy)*denoiser.frame.w);
SAD = calc_SAD ( denoiser.frame.ref[0]+MB_ref_offset,
denoiser.frame.avg[0]+MB_avg_offset );
if(SAD<best_SAD)
{
best_SAD = SAD;
vector.SAD = SAD;
vector.x = xx+vx;
vector.y = yy+vy;
}
}
/* finally do a zero check against the found vector */
SAD = calc_SAD ( denoiser.frame.ref[0]+MB_ref_offset,
denoiser.frame.avg[0]+MB_ref_offset );
if(SAD<=best_SAD)
{
vector.x = 0;
vector.y = 0;
vector.SAD = SAD;
}
}
/*********************************************************************
* *
* Estimate Motion Vectors in not subsampled frames *
* *
*********************************************************************/
uint32_t
mb_search_00 (uint16_t x, uint16_t y)
{
uint32_t best_SAD = 0x00ffffff;
uint32_t SAD;
int32_t MB_ref_offset = denoiser.frame.w * (y) + (x);
int32_t MB_avg_offset1;
int32_t MB_avg_offset2;
int16_t xx;
int16_t yy;
int16_t vx=vector.x;
int16_t vy=vector.y;
MB_avg_offset1=MB_ref_offset+(vx)+((vy)*denoiser.frame.w);
for(yy=-1;yy<1;yy++)
for(xx=-1;xx<1;xx++)
{
MB_avg_offset2=MB_ref_offset+(vx+xx)+((vy+yy)*denoiser.frame.w);
SAD = calc_SAD_half (denoiser.frame.ref[0]+MB_ref_offset,
denoiser.frame.avg[0]+MB_avg_offset1,
denoiser.frame.avg[0]+MB_avg_offset2);
if(SAD<best_SAD)
{
best_SAD = SAD;
vector.x = xx+vx*2;
vector.y = yy+vy*2;
}
}
return best_SAD;
}
|