Add highbitdepth function for vp9_avg_8x8

Cherry-picked from https://gerrit.chromium.org/gerrit/#/c/71914/
(a92f987a6b) on highbitdepth branch.

Change-Id: I6903e4e4cb57d90590725c8a1c64c23da7ae65e8
This commit is contained in:
Peter de Rivaz 2014-10-16 14:36:07 +01:00 committed by Deb Mukherjee
parent 8101e82a1b
commit 73ae6e495c
3 changed files with 32 additions and 2 deletions

View File

@ -1114,6 +1114,11 @@ specialize qw/vp9_get_mb_ss/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_avg_8x8/, "const uint8_t *, int p";
specialize qw/vp9_avg_8x8 sse2/;
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/unsigned int vp9_highbd_avg_8x8/, "const uint8_t *, int p";
specialize qw/vp9_highbd_avg_8x8/;
}
# ENCODEMB INVOKE
add_proto qw/void vp9_subtract_block/, "int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride";

View File

@ -7,6 +7,7 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp9/common/vp9_common.h"
#include "vpx_ports/mem.h"
unsigned int vp9_avg_8x8_c(const uint8_t *s, int p) {
@ -17,3 +18,16 @@ unsigned int vp9_avg_8x8_c(const uint8_t *s, int p) {
return (sum + 32) >> 6;
}
#if CONFIG_VP9_HIGHBITDEPTH
unsigned int vp9_highbd_avg_8x8_c(const uint8_t *s8, int p) {
int i, j;
int sum = 0;
const uint16_t* s = CONVERT_TO_SHORTPTR(s8);
for (i = 0; i < 8; ++i, s+=p)
for (j = 0; j < 8; sum += s[j], ++j) {}
return (sum + 32) >> 6;
}
#endif // CONFIG_VP9_HIGHBITDEPTH

View File

@ -533,8 +533,19 @@ static void choose_partitioning(VP9_COMP *cpi,
int sum = 0;
if (x_idx < pixels_wide && y_idx < pixels_high) {
int s_avg = vp9_avg_8x8(s + y_idx * sp + x_idx, sp);
int d_avg = vp9_avg_8x8(d + y_idx * dp + x_idx, dp);
int s_avg, d_avg;
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
s_avg = vp9_highbd_avg_8x8(s + y_idx * sp + x_idx, sp);
d_avg = vp9_highbd_avg_8x8(d + y_idx * dp + x_idx, dp);
} else {
s_avg = vp9_avg_8x8(s + y_idx * sp + x_idx, sp);
d_avg = vp9_avg_8x8(d + y_idx * dp + x_idx, dp);
}
#else
s_avg = vp9_avg_8x8(s + y_idx * sp + x_idx, sp);
d_avg = vp9_avg_8x8(d + y_idx * dp + x_idx, dp);
#endif
sum = s_avg - d_avg;
sse = sum * sum;
}