2015-06-05 19:54:19 +03:00
|
|
|
/*
|
2016-03-24 21:38:32 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2015-06-05 19:54:19 +03:00
|
|
|
*
|
2016-03-24 21:38:32 +03:00
|
|
|
* This source code is subject to the terms of the BSD 2 Clause License and
|
|
|
|
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
|
|
|
* was not distributed with this source code in the LICENSE file, you can
|
|
|
|
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
|
|
|
* Media Patent License 1.0 was not distributed with this source code in the
|
|
|
|
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
2015-06-05 19:54:19 +03:00
|
|
|
*/
|
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
#include "./aom_config.h"
|
|
|
|
#include "./aom_dsp_rtcd.h"
|
|
|
|
#include "aom/aom_integer.h"
|
2016-03-22 01:15:19 +03:00
|
|
|
#include "aom_ports/mem.h"
|
2015-06-05 19:54:19 +03:00
|
|
|
|
|
|
|
#if HAVE_MEDIA
|
2016-01-27 23:42:45 +03:00
|
|
|
static const int16_t bilinear_filters_media[8][2] = { { 128, 0 }, { 112, 16 },
|
|
|
|
{ 96, 32 }, { 80, 48 },
|
|
|
|
{ 64, 64 }, { 48, 80 },
|
|
|
|
{ 32, 96 }, { 16, 112 } };
|
2015-06-05 19:54:19 +03:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
extern void aom_filter_block2d_bil_first_pass_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
const uint8_t *src_ptr, uint16_t *dst_ptr, uint32_t src_pitch,
|
|
|
|
uint32_t height, uint32_t width, const int16_t *filter);
|
2015-06-05 19:54:19 +03:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
extern void aom_filter_block2d_bil_second_pass_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
const uint16_t *src_ptr, uint8_t *dst_ptr, int32_t src_pitch,
|
|
|
|
uint32_t height, uint32_t width, const int16_t *filter);
|
2015-06-05 19:54:19 +03:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
unsigned int aom_sub_pixel_variance8x8_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
|
|
|
|
const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
|
|
|
|
uint16_t first_pass[10 * 8];
|
|
|
|
uint8_t second_pass[8 * 8];
|
2015-06-05 19:54:19 +03:00
|
|
|
const int16_t *HFilter, *VFilter;
|
|
|
|
|
|
|
|
HFilter = bilinear_filters_media[xoffset];
|
|
|
|
VFilter = bilinear_filters_media[yoffset];
|
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
aom_filter_block2d_bil_first_pass_media(src_ptr, first_pass,
|
2016-01-27 23:42:45 +03:00
|
|
|
src_pixels_per_line, 9, 8, HFilter);
|
2016-03-25 22:11:05 +03:00
|
|
|
aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 8, 8, 8,
|
2016-01-27 23:42:45 +03:00
|
|
|
VFilter);
|
2015-06-05 19:54:19 +03:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
return aom_variance8x8_media(second_pass, 8, dst_ptr, dst_pixels_per_line,
|
2016-01-27 23:42:45 +03:00
|
|
|
sse);
|
2015-06-05 19:54:19 +03:00
|
|
|
}
|
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
unsigned int aom_sub_pixel_variance16x16_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
|
|
|
|
const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
|
|
|
|
uint16_t first_pass[36 * 16];
|
|
|
|
uint8_t second_pass[20 * 16];
|
2015-06-05 19:54:19 +03:00
|
|
|
const int16_t *HFilter, *VFilter;
|
|
|
|
unsigned int var;
|
|
|
|
|
|
|
|
if (xoffset == 4 && yoffset == 0) {
|
2016-03-25 22:11:05 +03:00
|
|
|
var = aom_variance_halfpixvar16x16_h_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
|
2015-06-05 19:54:19 +03:00
|
|
|
} else if (xoffset == 0 && yoffset == 4) {
|
2016-03-25 22:11:05 +03:00
|
|
|
var = aom_variance_halfpixvar16x16_v_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
|
2015-06-05 19:54:19 +03:00
|
|
|
} else if (xoffset == 4 && yoffset == 4) {
|
2016-03-25 22:11:05 +03:00
|
|
|
var = aom_variance_halfpixvar16x16_hv_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
|
2015-06-05 19:54:19 +03:00
|
|
|
} else {
|
|
|
|
HFilter = bilinear_filters_media[xoffset];
|
|
|
|
VFilter = bilinear_filters_media[yoffset];
|
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
aom_filter_block2d_bil_first_pass_media(
|
2016-01-27 23:42:45 +03:00
|
|
|
src_ptr, first_pass, src_pixels_per_line, 17, 16, HFilter);
|
2016-03-25 22:11:05 +03:00
|
|
|
aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 16, 16,
|
2016-01-27 23:42:45 +03:00
|
|
|
16, VFilter);
|
2015-06-05 19:54:19 +03:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
var = aom_variance16x16_media(second_pass, 16, dst_ptr, dst_pixels_per_line,
|
2016-01-27 23:42:45 +03:00
|
|
|
sse);
|
2015-06-05 19:54:19 +03:00
|
|
|
}
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
#endif // HAVE_MEDIA
|