Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_variance.c

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const int tmp = pred[j] + ref[j]; 262 const int tmp = pred[j] + ref[j];
263 comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1); 263 comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
264 } 264 }
265 comp_pred += width; 265 comp_pred += width;
266 pred += width; 266 pred += width;
267 ref += ref_stride; 267 ref += ref_stride;
268 } 268 }
269 } 269 }
270 270
271 #if CONFIG_VP9_HIGHBITDEPTH 271 #if CONFIG_VP9_HIGHBITDEPTH
272 void high_variance64(const uint8_t *a8, int a_stride, 272 void highbd_variance64(const uint8_t *a8, int a_stride,
273 const uint8_t *b8, int b_stride, 273 const uint8_t *b8, int b_stride,
274 int w, int h, uint64_t *sse, 274 int w, int h, uint64_t *sse,
275 uint64_t *sum) { 275 uint64_t *sum) {
276 int i, j; 276 int i, j;
277 277
278 uint16_t *a = CONVERT_TO_SHORTPTR(a8); 278 uint16_t *a = CONVERT_TO_SHORTPTR(a8);
279 uint16_t *b = CONVERT_TO_SHORTPTR(b8); 279 uint16_t *b = CONVERT_TO_SHORTPTR(b8);
280 *sum = 0; 280 *sum = 0;
281 *sse = 0; 281 *sse = 0;
282 282
283 for (i = 0; i < h; i++) { 283 for (i = 0; i < h; i++) {
284 for (j = 0; j < w; j++) { 284 for (j = 0; j < w; j++) {
285 const int diff = a[j] - b[j]; 285 const int diff = a[j] - b[j];
286 *sum += diff; 286 *sum += diff;
287 *sse += diff * diff; 287 *sse += diff * diff;
288 } 288 }
289 a += a_stride; 289 a += a_stride;
290 b += b_stride; 290 b += b_stride;
291 } 291 }
292 } 292 }
293 293
294 void high_variance(const uint8_t *a8, int a_stride, 294 void highbd_variance(const uint8_t *a8, int a_stride,
295 const uint8_t *b8, int b_stride, 295 const uint8_t *b8, int b_stride,
296 int w, int h, unsigned int *sse, 296 int w, int h, unsigned int *sse,
297 int *sum) { 297 int *sum) {
298 uint64_t sse_long = 0; 298 uint64_t sse_long = 0;
299 uint64_t sum_long = 0; 299 uint64_t sum_long = 0;
300 high_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long); 300 highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
301 *sse = sse_long; 301 *sse = sse_long;
302 *sum = sum_long; 302 *sum = sum_long;
303 } 303 }
304 304
305 void high_10_variance(const uint8_t *a8, int a_stride, 305 void highbd_10_variance(const uint8_t *a8, int a_stride,
306 const uint8_t *b8, int b_stride, 306 const uint8_t *b8, int b_stride,
307 int w, int h, unsigned int *sse, 307 int w, int h, unsigned int *sse,
308 int *sum) { 308 int *sum) {
309 uint64_t sse_long = 0; 309 uint64_t sse_long = 0;
310 uint64_t sum_long = 0; 310 uint64_t sum_long = 0;
311 high_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long); 311 highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
312 *sum = ROUND_POWER_OF_TWO(sum_long, 2); 312 *sum = ROUND_POWER_OF_TWO(sum_long, 2);
313 *sse = ROUND_POWER_OF_TWO(sse_long, 4); 313 *sse = ROUND_POWER_OF_TWO(sse_long, 4);
314 } 314 }
315 315
316 void high_12_variance(const uint8_t *a8, int a_stride, 316 void highbd_12_variance(const uint8_t *a8, int a_stride,
317 const uint8_t *b8, int b_stride, 317 const uint8_t *b8, int b_stride,
318 int w, int h, unsigned int *sse, 318 int w, int h, unsigned int *sse,
319 int *sum) { 319 int *sum) {
320 uint64_t sse_long = 0; 320 uint64_t sse_long = 0;
321 uint64_t sum_long = 0; 321 uint64_t sum_long = 0;
322 high_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long); 322 highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
323 *sum = ROUND_POWER_OF_TWO(sum_long, 4); 323 *sum = ROUND_POWER_OF_TWO(sum_long, 4);
324 *sse = ROUND_POWER_OF_TWO(sse_long, 8); 324 *sse = ROUND_POWER_OF_TWO(sse_long, 8);
325 } 325 }
326 326
327 static void high_var_filter_block2d_bil_first_pass( 327 static void highbd_var_filter_block2d_bil_first_pass(
328 const uint8_t *src_ptr8, 328 const uint8_t *src_ptr8,
329 uint16_t *output_ptr, 329 uint16_t *output_ptr,
330 unsigned int src_pixels_per_line, 330 unsigned int src_pixels_per_line,
331 int pixel_step, 331 int pixel_step,
332 unsigned int output_height, 332 unsigned int output_height,
333 unsigned int output_width, 333 unsigned int output_width,
334 const int16_t *vp9_filter) { 334 const int16_t *vp9_filter) {
335 unsigned int i, j; 335 unsigned int i, j;
336 uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src_ptr8); 336 uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src_ptr8);
337 for (i = 0; i < output_height; i++) { 337 for (i = 0; i < output_height; i++) {
338 for (j = 0; j < output_width; j++) { 338 for (j = 0; j < output_width; j++) {
339 output_ptr[j] = 339 output_ptr[j] =
340 ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] + 340 ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
341 (int)src_ptr[pixel_step] * vp9_filter[1], 341 (int)src_ptr[pixel_step] * vp9_filter[1],
342 FILTER_BITS); 342 FILTER_BITS);
343 343
344 src_ptr++; 344 src_ptr++;
345 } 345 }
346 346
347 // Next row... 347 // Next row...
348 src_ptr += src_pixels_per_line - output_width; 348 src_ptr += src_pixels_per_line - output_width;
349 output_ptr += output_width; 349 output_ptr += output_width;
350 } 350 }
351 } 351 }
352 352
353 static void high_var_filter_block2d_bil_second_pass( 353 static void highbd_var_filter_block2d_bil_second_pass(
354 const uint16_t *src_ptr, 354 const uint16_t *src_ptr,
355 uint16_t *output_ptr, 355 uint16_t *output_ptr,
356 unsigned int src_pixels_per_line, 356 unsigned int src_pixels_per_line,
357 unsigned int pixel_step, 357 unsigned int pixel_step,
358 unsigned int output_height, 358 unsigned int output_height,
359 unsigned int output_width, 359 unsigned int output_width,
360 const int16_t *vp9_filter) { 360 const int16_t *vp9_filter) {
361 unsigned int i, j; 361 unsigned int i, j;
362 362
363 for (i = 0; i < output_height; i++) { 363 for (i = 0; i < output_height; i++) {
364 for (j = 0; j < output_width; j++) { 364 for (j = 0; j < output_width; j++) {
365 output_ptr[j] = 365 output_ptr[j] =
366 ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] + 366 ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
367 (int)src_ptr[pixel_step] * vp9_filter[1], 367 (int)src_ptr[pixel_step] * vp9_filter[1],
368 FILTER_BITS); 368 FILTER_BITS);
369 src_ptr++; 369 src_ptr++;
370 } 370 }
371 371
372 src_ptr += src_pixels_per_line - output_width; 372 src_ptr += src_pixels_per_line - output_width;
373 output_ptr += output_width; 373 output_ptr += output_width;
374 } 374 }
375 } 375 }
376 376
377 #define HIGH_VAR(W, H) \ 377 #define HIGHBD_VAR(W, H) \
378 unsigned int vp9_high_variance##W##x##H##_c(const uint8_t *a, int a_stride, \ 378 unsigned int vp9_highbd_variance##W##x##H##_c(const uint8_t *a, int a_stride, \
379 const uint8_t *b, int b_stride, \ 379 const uint8_t *b, int b_stride, \
380 unsigned int *sse) { \ 380 unsigned int *sse) { \
381 int sum; \ 381 int sum; \
382 high_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \ 382 highbd_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \
383 return *sse - (((int64_t)sum * sum) / (W * H)); \ 383 return *sse - (((int64_t)sum * sum) / (W * H)); \
384 } \ 384 } \
385 \ 385 \
386 unsigned int vp9_high_10_variance##W##x##H##_c(const uint8_t *a, int a_stride, \ 386 unsigned int vp9_highbd_10_variance##W##x##H##_c(const uint8_t *a, \
387 const uint8_t *b, int b_stride, \ 387 int a_stride, \
388 unsigned int *sse) { \ 388 const uint8_t *b, \
389 int b_stride, \
390 unsigned int *sse) { \
389 int sum; \ 391 int sum; \
390 high_10_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \ 392 highbd_10_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \
391 return *sse - (((int64_t)sum * sum) / (W * H)); \ 393 return *sse - (((int64_t)sum * sum) / (W * H)); \
392 } \ 394 } \
393 \ 395 \
394 unsigned int vp9_high_12_variance##W##x##H##_c(const uint8_t *a, int a_stride, \ 396 unsigned int vp9_highbd_12_variance##W##x##H##_c(const uint8_t *a, \
395 const uint8_t *b, int b_stride, \ 397 int a_stride, \
396 unsigned int *sse) { \ 398 const uint8_t *b, \
399 int b_stride, \
400 unsigned int *sse) { \
397 int sum; \ 401 int sum; \
398 high_12_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \ 402 highbd_12_variance(a, a_stride, b, b_stride, W, H, sse, &sum); \
399 return *sse - (((int64_t)sum * sum) / (W * H)); \ 403 return *sse - (((int64_t)sum * sum) / (W * H)); \
400 } 404 }
401 405
402 #define HIGH_SUBPIX_VAR(W, H) \ 406 #define HIGHBD_SUBPIX_VAR(W, H) \
403 unsigned int vp9_high_sub_pixel_variance##W##x##H##_c( \ 407 unsigned int vp9_highbd_sub_pixel_variance##W##x##H##_c( \
404 const uint8_t *src, int src_stride, \ 408 const uint8_t *src, int src_stride, \
405 int xoffset, int yoffset, \ 409 int xoffset, int yoffset, \
406 const uint8_t *dst, int dst_stride, \ 410 const uint8_t *dst, int dst_stride, \
407 unsigned int *sse) { \ 411 unsigned int *sse) { \
408 uint16_t fdata3[(H + 1) * W]; \ 412 uint16_t fdata3[(H + 1) * W]; \
409 uint16_t temp2[H * W]; \ 413 uint16_t temp2[H * W]; \
410 \ 414 \
411 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 415 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
412 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 416 W, BILINEAR_FILTERS_2TAP(xoffset)); \
413 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 417 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
414 BILINEAR_FILTERS_2TAP(yoffset)); \ 418 BILINEAR_FILTERS_2TAP(yoffset)); \
415 \ 419 \
416 return vp9_high_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, dst, \ 420 return vp9_highbd_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, dst, \
417 dst_stride, sse); \ 421 dst_stride, sse); \
418 } \ 422 } \
419 \ 423 \
420 unsigned int vp9_high_10_sub_pixel_variance##W##x##H##_c( \ 424 unsigned int vp9_highbd_10_sub_pixel_variance##W##x##H##_c( \
421 const uint8_t *src, int src_stride, \ 425 const uint8_t *src, int src_stride, \
422 int xoffset, int yoffset, \ 426 int xoffset, int yoffset, \
423 const uint8_t *dst, int dst_stride, \ 427 const uint8_t *dst, int dst_stride, \
424 unsigned int *sse) { \ 428 unsigned int *sse) { \
425 uint16_t fdata3[(H + 1) * W]; \ 429 uint16_t fdata3[(H + 1) * W]; \
426 uint16_t temp2[H * W]; \ 430 uint16_t temp2[H * W]; \
427 \ 431 \
428 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 432 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
429 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 433 W, BILINEAR_FILTERS_2TAP(xoffset)); \
430 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 434 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
431 BILINEAR_FILTERS_2TAP(yoffset)); \ 435 BILINEAR_FILTERS_2TAP(yoffset)); \
432 \ 436 \
433 return vp9_high_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, dst, \ 437 return vp9_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), \
434 dst_stride, sse); \ 438 W, dst, dst_stride, sse); \
435 } \ 439 } \
436 \ 440 \
437 unsigned int vp9_high_12_sub_pixel_variance##W##x##H##_c( \ 441 unsigned int vp9_highbd_12_sub_pixel_variance##W##x##H##_c( \
438 const uint8_t *src, int src_stride, \ 442 const uint8_t *src, int src_stride, \
439 int xoffset, int yoffset, \ 443 int xoffset, int yoffset, \
440 const uint8_t *dst, int dst_stride, \ 444 const uint8_t *dst, int dst_stride, \
441 unsigned int *sse) { \ 445 unsigned int *sse) { \
442 uint16_t fdata3[(H + 1) * W]; \ 446 uint16_t fdata3[(H + 1) * W]; \
443 uint16_t temp2[H * W]; \ 447 uint16_t temp2[H * W]; \
444 \ 448 \
445 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 449 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
446 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 450 W, BILINEAR_FILTERS_2TAP(xoffset)); \
447 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 451 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
448 BILINEAR_FILTERS_2TAP(yoffset)); \ 452 BILINEAR_FILTERS_2TAP(yoffset)); \
449 \ 453 \
450 return vp9_high_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, dst, \ 454 return vp9_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), \
451 dst_stride, sse); \ 455 W, dst, dst_stride, sse); \
452 } 456 }
453 457
454 #define HIGH_SUBPIX_AVG_VAR(W, H) \ 458 #define HIGHBD_SUBPIX_AVG_VAR(W, H) \
455 unsigned int vp9_high_sub_pixel_avg_variance##W##x##H##_c( \ 459 unsigned int vp9_highbd_sub_pixel_avg_variance##W##x##H##_c( \
456 const uint8_t *src, int src_stride, \ 460 const uint8_t *src, int src_stride, \
457 int xoffset, int yoffset, \ 461 int xoffset, int yoffset, \
458 const uint8_t *dst, int dst_stride, \ 462 const uint8_t *dst, int dst_stride, \
459 unsigned int *sse, \ 463 unsigned int *sse, \
460 const uint8_t *second_pred) { \ 464 const uint8_t *second_pred) { \
461 uint16_t fdata3[(H + 1) * W]; \ 465 uint16_t fdata3[(H + 1) * W]; \
462 uint16_t temp2[H * W]; \ 466 uint16_t temp2[H * W]; \
463 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \ 467 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \
464 \ 468 \
465 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 469 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
466 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 470 W, BILINEAR_FILTERS_2TAP(xoffset)); \
467 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 471 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
468 BILINEAR_FILTERS_2TAP(yoffset)); \ 472 BILINEAR_FILTERS_2TAP(yoffset)); \
469 \ 473 \
470 vp9_high_comp_avg_pred(temp3, second_pred, W, H, CONVERT_TO_BYTEPTR(temp2), \ 474 vp9_highbd_comp_avg_pred(temp3, second_pred, W, H, \
471 W); \ 475 CONVERT_TO_BYTEPTR(temp2), W); \
472 \ 476 \
473 return vp9_high_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, dst, \ 477 return vp9_highbd_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, dst, \
474 dst_stride, sse); \ 478 dst_stride, sse); \
475 } \ 479 } \
476 \ 480 \
477 unsigned int vp9_high_10_sub_pixel_avg_variance##W##x##H##_c( \ 481 unsigned int vp9_highbd_10_sub_pixel_avg_variance##W##x##H##_c( \
478 const uint8_t *src, int src_stride, \ 482 const uint8_t *src, int src_stride, \
479 int xoffset, int yoffset, \ 483 int xoffset, int yoffset, \
480 const uint8_t *dst, int dst_stride, \ 484 const uint8_t *dst, int dst_stride, \
481 unsigned int *sse, \ 485 unsigned int *sse, \
482 const uint8_t *second_pred) { \ 486 const uint8_t *second_pred) { \
483 uint16_t fdata3[(H + 1) * W]; \ 487 uint16_t fdata3[(H + 1) * W]; \
484 uint16_t temp2[H * W]; \ 488 uint16_t temp2[H * W]; \
485 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \ 489 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \
486 \ 490 \
487 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 491 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
488 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 492 W, BILINEAR_FILTERS_2TAP(xoffset)); \
489 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 493 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
490 BILINEAR_FILTERS_2TAP(yoffset)); \ 494 BILINEAR_FILTERS_2TAP(yoffset)); \
491 \ 495 \
492 vp9_high_comp_avg_pred(temp3, second_pred, W, H, CONVERT_TO_BYTEPTR(temp2), \ 496 vp9_highbd_comp_avg_pred(temp3, second_pred, W, H, \
493 W); \ 497 CONVERT_TO_BYTEPTR(temp2), W); \
494 \ 498 \
495 return vp9_high_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, dst, \ 499 return vp9_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), \
496 dst_stride, sse); \ 500 W, dst, dst_stride, sse); \
497 } \ 501 } \
498 \ 502 \
499 unsigned int vp9_high_12_sub_pixel_avg_variance##W##x##H##_c( \ 503 unsigned int vp9_highbd_12_sub_pixel_avg_variance##W##x##H##_c( \
500 const uint8_t *src, int src_stride, \ 504 const uint8_t *src, int src_stride, \
501 int xoffset, int yoffset, \ 505 int xoffset, int yoffset, \
502 const uint8_t *dst, int dst_stride, \ 506 const uint8_t *dst, int dst_stride, \
503 unsigned int *sse, \ 507 unsigned int *sse, \
504 const uint8_t *second_pred) { \ 508 const uint8_t *second_pred) { \
505 uint16_t fdata3[(H + 1) * W]; \ 509 uint16_t fdata3[(H + 1) * W]; \
506 uint16_t temp2[H * W]; \ 510 uint16_t temp2[H * W]; \
507 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \ 511 DECLARE_ALIGNED_ARRAY(16, uint16_t, temp3, H * W); \
508 \ 512 \
509 high_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \ 513 highbd_var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, \
510 W, BILINEAR_FILTERS_2TAP(xoffset)); \ 514 W, BILINEAR_FILTERS_2TAP(xoffset)); \
511 high_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \ 515 highbd_var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
512 BILINEAR_FILTERS_2TAP(yoffset)); \ 516 BILINEAR_FILTERS_2TAP(yoffset)); \
513 \ 517 \
514 vp9_high_comp_avg_pred(temp3, second_pred, W, H, CONVERT_TO_BYTEPTR(temp2), \ 518 vp9_highbd_comp_avg_pred(temp3, second_pred, W, H, \
515 W); \ 519 CONVERT_TO_BYTEPTR(temp2), W); \
516 \ 520 \
517 return vp9_high_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, dst, \ 521 return vp9_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), \
518 dst_stride, sse); \ 522 W, dst, dst_stride, sse); \
519 } 523 }
520 524
521 #define HIGH_GET_VAR(S) \ 525 #define HIGHBD_GET_VAR(S) \
522 void vp9_high_get##S##x##S##var_c(const uint8_t *src, int src_stride, \ 526 void vp9_highbd_get##S##x##S##var_c(const uint8_t *src, int src_stride, \
523 const uint8_t *ref, int ref_stride, \ 527 const uint8_t *ref, int ref_stride, \
524 unsigned int *sse, int *sum) { \ 528 unsigned int *sse, int *sum) { \
525 high_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \ 529 highbd_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \
526 } \ 530 } \
527 \ 531 \
528 void vp9_high_10_get##S##x##S##var_c(const uint8_t *src, int src_stride, \ 532 void vp9_highbd_10_get##S##x##S##var_c(const uint8_t *src, int src_stride, \
529 const uint8_t *ref, int ref_stride, \ 533 const uint8_t *ref, int ref_stride, \
530 unsigned int *sse, int *sum) { \ 534 unsigned int *sse, int *sum) { \
531 high_10_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \ 535 highbd_10_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \
532 } \ 536 } \
533 \ 537 \
534 void vp9_high_12_get##S##x##S##var_c(const uint8_t *src, int src_stride, \ 538 void vp9_highbd_12_get##S##x##S##var_c(const uint8_t *src, int src_stride, \
535 const uint8_t *ref, int ref_stride, \ 539 const uint8_t *ref, int ref_stride, \
536 unsigned int *sse, int *sum) { \ 540 unsigned int *sse, int *sum) { \
537 high_12_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \ 541 highbd_12_variance(src, src_stride, ref, ref_stride, S, S, sse, sum); \
538 } 542 }
539 543
540 #define HIGH_MSE(W, H) \ 544 #define HIGHBD_MSE(W, H) \
541 unsigned int vp9_high_mse##W##x##H##_c(const uint8_t *src, int src_stride, \ 545 unsigned int vp9_highbd_mse##W##x##H##_c(const uint8_t *src, \
542 const uint8_t *ref, int ref_stride, \ 546 int src_stride, \
543 unsigned int *sse) { \ 547 const uint8_t *ref, \
548 int ref_stride, \
549 unsigned int *sse) { \
544 int sum; \ 550 int sum; \
545 high_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \ 551 highbd_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \
546 return *sse; \ 552 return *sse; \
547 } \ 553 } \
548 \ 554 \
549 unsigned int vp9_high_10_mse##W##x##H##_c(const uint8_t *src, int src_stride, \ 555 unsigned int vp9_highbd_10_mse##W##x##H##_c(const uint8_t *src, \
550 const uint8_t *ref, int ref_stride, \ 556 int src_stride, \
551 unsigned int *sse) { \ 557 const uint8_t *ref, \
558 int ref_stride, \
559 unsigned int *sse) { \
552 int sum; \ 560 int sum; \
553 high_10_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \ 561 highbd_10_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \
554 return *sse; \ 562 return *sse; \
555 } \ 563 } \
556 \ 564 \
557 unsigned int vp9_high_12_mse##W##x##H##_c(const uint8_t *src, int src_stride, \ 565 unsigned int vp9_highbd_12_mse##W##x##H##_c(const uint8_t *src, \
558 const uint8_t *ref, int ref_stride, \ 566 int src_stride, \
559 unsigned int *sse) { \ 567 const uint8_t *ref, \
568 int ref_stride, \
569 unsigned int *sse) { \
560 int sum; \ 570 int sum; \
561 high_12_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \ 571 highbd_12_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum); \
562 return *sse; \ 572 return *sse; \
563 } 573 }
564 574
565 HIGH_GET_VAR(8) 575 HIGHBD_GET_VAR(8)
566 HIGH_GET_VAR(16) 576 HIGHBD_GET_VAR(16)
567 577
568 HIGH_MSE(16, 16) 578 HIGHBD_MSE(16, 16)
569 HIGH_MSE(16, 8) 579 HIGHBD_MSE(16, 8)
570 HIGH_MSE(8, 16) 580 HIGHBD_MSE(8, 16)
571 HIGH_MSE(8, 8) 581 HIGHBD_MSE(8, 8)
572 582
573 HIGH_VAR(4, 4) 583 HIGHBD_VAR(4, 4)
574 HIGH_SUBPIX_VAR(4, 4) 584 HIGHBD_SUBPIX_VAR(4, 4)
575 HIGH_SUBPIX_AVG_VAR(4, 4) 585 HIGHBD_SUBPIX_AVG_VAR(4, 4)
576 586
577 HIGH_VAR(4, 8) 587 HIGHBD_VAR(4, 8)
578 HIGH_SUBPIX_VAR(4, 8) 588 HIGHBD_SUBPIX_VAR(4, 8)
579 HIGH_SUBPIX_AVG_VAR(4, 8) 589 HIGHBD_SUBPIX_AVG_VAR(4, 8)
580 590
581 HIGH_VAR(8, 4) 591 HIGHBD_VAR(8, 4)
582 HIGH_SUBPIX_VAR(8, 4) 592 HIGHBD_SUBPIX_VAR(8, 4)
583 HIGH_SUBPIX_AVG_VAR(8, 4) 593 HIGHBD_SUBPIX_AVG_VAR(8, 4)
584 594
585 HIGH_VAR(8, 8) 595 HIGHBD_VAR(8, 8)
586 HIGH_SUBPIX_VAR(8, 8) 596 HIGHBD_SUBPIX_VAR(8, 8)
587 HIGH_SUBPIX_AVG_VAR(8, 8) 597 HIGHBD_SUBPIX_AVG_VAR(8, 8)
588 598
589 HIGH_VAR(8, 16) 599 HIGHBD_VAR(8, 16)
590 HIGH_SUBPIX_VAR(8, 16) 600 HIGHBD_SUBPIX_VAR(8, 16)
591 HIGH_SUBPIX_AVG_VAR(8, 16) 601 HIGHBD_SUBPIX_AVG_VAR(8, 16)
592 602
593 HIGH_VAR(16, 8) 603 HIGHBD_VAR(16, 8)
594 HIGH_SUBPIX_VAR(16, 8) 604 HIGHBD_SUBPIX_VAR(16, 8)
595 HIGH_SUBPIX_AVG_VAR(16, 8) 605 HIGHBD_SUBPIX_AVG_VAR(16, 8)
596 606
597 HIGH_VAR(16, 16) 607 HIGHBD_VAR(16, 16)
598 HIGH_SUBPIX_VAR(16, 16) 608 HIGHBD_SUBPIX_VAR(16, 16)
599 HIGH_SUBPIX_AVG_VAR(16, 16) 609 HIGHBD_SUBPIX_AVG_VAR(16, 16)
600 610
601 HIGH_VAR(16, 32) 611 HIGHBD_VAR(16, 32)
602 HIGH_SUBPIX_VAR(16, 32) 612 HIGHBD_SUBPIX_VAR(16, 32)
603 HIGH_SUBPIX_AVG_VAR(16, 32) 613 HIGHBD_SUBPIX_AVG_VAR(16, 32)
604 614
605 HIGH_VAR(32, 16) 615 HIGHBD_VAR(32, 16)
606 HIGH_SUBPIX_VAR(32, 16) 616 HIGHBD_SUBPIX_VAR(32, 16)
607 HIGH_SUBPIX_AVG_VAR(32, 16) 617 HIGHBD_SUBPIX_AVG_VAR(32, 16)
608 618
609 HIGH_VAR(32, 32) 619 HIGHBD_VAR(32, 32)
610 HIGH_SUBPIX_VAR(32, 32) 620 HIGHBD_SUBPIX_VAR(32, 32)
611 HIGH_SUBPIX_AVG_VAR(32, 32) 621 HIGHBD_SUBPIX_AVG_VAR(32, 32)
612 622
613 HIGH_VAR(32, 64) 623 HIGHBD_VAR(32, 64)
614 HIGH_SUBPIX_VAR(32, 64) 624 HIGHBD_SUBPIX_VAR(32, 64)
615 HIGH_SUBPIX_AVG_VAR(32, 64) 625 HIGHBD_SUBPIX_AVG_VAR(32, 64)
616 626
617 HIGH_VAR(64, 32) 627 HIGHBD_VAR(64, 32)
618 HIGH_SUBPIX_VAR(64, 32) 628 HIGHBD_SUBPIX_VAR(64, 32)
619 HIGH_SUBPIX_AVG_VAR(64, 32) 629 HIGHBD_SUBPIX_AVG_VAR(64, 32)
620 630
621 HIGH_VAR(64, 64) 631 HIGHBD_VAR(64, 64)
622 HIGH_SUBPIX_VAR(64, 64) 632 HIGHBD_SUBPIX_VAR(64, 64)
623 HIGH_SUBPIX_AVG_VAR(64, 64) 633 HIGHBD_SUBPIX_AVG_VAR(64, 64)
624 634
625 void vp9_high_comp_avg_pred(uint16_t *comp_pred, const uint8_t *pred8, 635 void vp9_highbd_comp_avg_pred(uint16_t *comp_pred, const uint8_t *pred8,
626 int width, int height, const uint8_t *ref8, 636 int width, int height, const uint8_t *ref8,
627 int ref_stride) { 637 int ref_stride) {
628 int i, j; 638 int i, j;
629 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8); 639 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
630 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); 640 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
631 for (i = 0; i < height; i++) { 641 for (i = 0; i < height; i++) {
632 for (j = 0; j < width; j++) { 642 for (j = 0; j < width; j++) {
633 const int tmp = pred[j] + ref[j]; 643 const int tmp = pred[j] + ref[j];
634 comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1); 644 comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
635 } 645 }
636 comp_pred += width; 646 comp_pred += width;
637 pred += width; 647 pred += width;
638 ref += ref_stride; 648 ref += ref_stride;
639 } 649 }
640 } 650 }
641 #endif // CONFIG_VP9_HIGHBITDEPTH 651 #endif // CONFIG_VP9_HIGHBITDEPTH
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_variance.h ('k') | source/libvpx/vp9/encoder/x86/vp9_avg_intrin_sse2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698