| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
| 11 #include <assert.h> | 11 #include <assert.h> |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 | 13 |
| 14 #include "./vpx_dsp_rtcd.h" | 14 #include "./vpx_dsp_rtcd.h" |
| 15 #include "vpx_dsp/mips/vpx_common_dspr2.h" | 15 #include "vpx_dsp/mips/convolve_common_dspr2.h" |
| 16 #include "vpx_dsp/vpx_convolve.h" | 16 #include "vpx_dsp/vpx_convolve.h" |
| 17 #include "vpx_dsp/vpx_dsp_common.h" | 17 #include "vpx_dsp/vpx_dsp_common.h" |
| 18 #include "vpx_ports/mem.h" | 18 #include "vpx_ports/mem.h" |
| 19 | 19 |
| 20 #if HAVE_DSPR2 | 20 #if HAVE_DSPR2 |
| 21 static void convolve_avg_vert_4_dspr2(const uint8_t *src, | 21 static void convolve_avg_vert_4_dspr2(const uint8_t *src, |
| 22 int32_t src_stride, | 22 int32_t src_stride, |
| 23 uint8_t *dst, | 23 uint8_t *dst, |
| 24 int32_t dst_stride, | 24 int32_t dst_stride, |
| 25 const int16_t *filter_y, | 25 const int16_t *filter_y, |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 src += src_stride; | 340 src += src_stride; |
| 341 dst += dst_stride; | 341 dst += dst_stride; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 void vpx_convolve8_avg_vert_dspr2(const uint8_t *src, ptrdiff_t src_stride, | 345 void vpx_convolve8_avg_vert_dspr2(const uint8_t *src, ptrdiff_t src_stride, |
| 346 uint8_t *dst, ptrdiff_t dst_stride, | 346 uint8_t *dst, ptrdiff_t dst_stride, |
| 347 const int16_t *filter_x, int x_step_q4, | 347 const int16_t *filter_x, int x_step_q4, |
| 348 const int16_t *filter_y, int y_step_q4, | 348 const int16_t *filter_y, int y_step_q4, |
| 349 int w, int h) { | 349 int w, int h) { |
| 350 if (((const int32_t *)filter_y)[1] == 0x800000) { | 350 assert(y_step_q4 == 16); |
| 351 vpx_convolve_avg(src, src_stride, | 351 assert(((const int32_t *)filter_y)[1] != 0x800000); |
| 352 dst, dst_stride, | 352 |
| 353 filter_x, x_step_q4, | 353 if (((const int32_t *)filter_y)[0] == 0) { |
| 354 filter_y, y_step_q4, | |
| 355 w, h); | |
| 356 } else if (((const int32_t *)filter_y)[0] == 0) { | |
| 357 vpx_convolve2_avg_vert_dspr2(src, src_stride, | 354 vpx_convolve2_avg_vert_dspr2(src, src_stride, |
| 358 dst, dst_stride, | 355 dst, dst_stride, |
| 359 filter_x, x_step_q4, | 356 filter_x, x_step_q4, |
| 360 filter_y, y_step_q4, | 357 filter_y, y_step_q4, |
| 361 w, h); | 358 w, h); |
| 362 } else { | 359 } else { |
| 363 if (16 == y_step_q4) { | 360 uint32_t pos = 38; |
| 364 uint32_t pos = 38; | |
| 365 | 361 |
| 366 /* bit positon for extract from acc */ | 362 /* bit positon for extract from acc */ |
| 367 __asm__ __volatile__ ( | 363 __asm__ __volatile__ ( |
| 368 "wrdsp %[pos], 1 \n\t" | 364 "wrdsp %[pos], 1 \n\t" |
| 369 : | 365 : |
| 370 : [pos] "r" (pos) | 366 : [pos] "r" (pos) |
| 371 ); | 367 ); |
| 372 | 368 |
| 373 prefetch_store(dst); | 369 prefetch_store(dst); |
| 374 | 370 |
| 375 switch (w) { | 371 switch (w) { |
| 376 case 4: | 372 case 4: |
| 377 case 8: | 373 case 8: |
| 378 case 16: | 374 case 16: |
| 379 case 32: | 375 case 32: |
| 380 convolve_avg_vert_4_dspr2(src, src_stride, | 376 convolve_avg_vert_4_dspr2(src, src_stride, |
| 381 dst, dst_stride, | 377 dst, dst_stride, |
| 382 filter_y, w, h); | 378 filter_y, w, h); |
| 383 break; | 379 break; |
| 384 case 64: | 380 case 64: |
| 385 prefetch_store(dst + 32); | 381 prefetch_store(dst + 32); |
| 386 convolve_avg_vert_64_dspr2(src, src_stride, | 382 convolve_avg_vert_64_dspr2(src, src_stride, |
| 387 dst, dst_stride, | |
| 388 filter_y, h); | |
| 389 break; | |
| 390 default: | |
| 391 vpx_convolve8_avg_vert_c(src, src_stride, | |
| 392 dst, dst_stride, | 383 dst, dst_stride, |
| 393 filter_x, x_step_q4, | 384 filter_y, h); |
| 394 filter_y, y_step_q4, | 385 break; |
| 395 w, h); | 386 default: |
| 396 break; | 387 vpx_convolve8_avg_vert_c(src, src_stride, |
| 397 } | 388 dst, dst_stride, |
| 398 } else { | 389 filter_x, x_step_q4, |
| 399 vpx_convolve8_avg_vert_c(src, src_stride, | 390 filter_y, y_step_q4, |
| 400 dst, dst_stride, | 391 w, h); |
| 401 filter_x, x_step_q4, | 392 break; |
| 402 filter_y, y_step_q4, | |
| 403 w, h); | |
| 404 } | 393 } |
| 405 } | 394 } |
| 406 } | 395 } |
| 407 | 396 |
| 408 void vpx_convolve8_avg_dspr2(const uint8_t *src, ptrdiff_t src_stride, | 397 void vpx_convolve8_avg_dspr2(const uint8_t *src, ptrdiff_t src_stride, |
| 409 uint8_t *dst, ptrdiff_t dst_stride, | 398 uint8_t *dst, ptrdiff_t dst_stride, |
| 410 const int16_t *filter_x, int x_step_q4, | 399 const int16_t *filter_x, int x_step_q4, |
| 411 const int16_t *filter_y, int y_step_q4, | 400 const int16_t *filter_y, int y_step_q4, |
| 412 int w, int h) { | 401 int w, int h) { |
| 413 /* Fixed size intermediate buffer places limits on parameters. */ | 402 /* Fixed size intermediate buffer places limits on parameters. */ |
| 414 DECLARE_ALIGNED(32, uint8_t, temp[64 * 135]); | 403 DECLARE_ALIGNED(32, uint8_t, temp[64 * 135]); |
| 415 int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7; | 404 int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7; |
| 416 | 405 |
| 417 assert(w <= 64); | 406 assert(w <= 64); |
| 418 assert(h <= 64); | 407 assert(h <= 64); |
| 408 assert(x_step_q4 == 16); |
| 409 assert(y_step_q4 == 16); |
| 419 | 410 |
| 420 if (intermediate_height < h) | 411 if (intermediate_height < h) |
| 421 intermediate_height = h; | 412 intermediate_height = h; |
| 422 | 413 |
| 423 if (x_step_q4 != 16 || y_step_q4 != 16) | |
| 424 return vpx_convolve8_avg_c(src, src_stride, | |
| 425 dst, dst_stride, | |
| 426 filter_x, x_step_q4, | |
| 427 filter_y, y_step_q4, | |
| 428 w, h); | |
| 429 | |
| 430 vpx_convolve8_horiz(src - (src_stride * 3), src_stride, | 414 vpx_convolve8_horiz(src - (src_stride * 3), src_stride, |
| 431 temp, 64, | 415 temp, 64, |
| 432 filter_x, x_step_q4, | 416 filter_x, x_step_q4, |
| 433 filter_y, y_step_q4, | 417 filter_y, y_step_q4, |
| 434 w, intermediate_height); | 418 w, intermediate_height); |
| 435 | 419 |
| 436 vpx_convolve8_avg_vert(temp + 64 * 3, 64, | 420 vpx_convolve8_avg_vert(temp + 64 * 3, 64, |
| 437 dst, dst_stride, | 421 dst, dst_stride, |
| 438 filter_x, x_step_q4, | 422 filter_x, x_step_q4, |
| 439 filter_y, y_step_q4, | 423 filter_y, y_step_q4, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 dst[x] = (dst[x] + src[x] + 1) >> 1; | 668 dst[x] = (dst[x] + src[x] + 1) >> 1; |
| 685 } | 669 } |
| 686 | 670 |
| 687 src += src_stride; | 671 src += src_stride; |
| 688 dst += dst_stride; | 672 dst += dst_stride; |
| 689 } | 673 } |
| 690 break; | 674 break; |
| 691 } | 675 } |
| 692 } | 676 } |
| 693 #endif | 677 #endif |
| OLD | NEW |