An error occurred while loading the file. Please try again.
-
Dmitry Kovalev authored
Replacing vpx_codec_cx_pkt argument with two separate pts and frame_size. Change-Id: I7b37e379ee71342520cf08f03acfb4b499b2cbe4
373b0f9a
variance_c.c 15.54 KiB
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "variance.h"
#include "vp8/common/filter.h"
unsigned int vp8_get_mb_ss_c
(
const short *src_ptr
) {
unsigned int i = 0, sum = 0;
do {
sum += (src_ptr[i] * src_ptr[i]);
i++;
} while (i < 256);
return sum;
}
static void variance(
const unsigned char *src_ptr,
int source_stride,
const unsigned char *ref_ptr,
int recon_stride,
int w,
int h,
unsigned int *sse,
int *sum) {
int i, j;
int diff;
*sum = 0;
*sse = 0;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
diff = src_ptr[j] - ref_ptr[j];
*sum += diff;
*sse += diff * diff;
}
src_ptr += source_stride;
ref_ptr += recon_stride;
}
}
#if CONFIG_SUPERBLOCKS
unsigned int vp8_variance32x32_c(const unsigned char *src_ptr,
int source_stride,
const unsigned char *ref_ptr,
int recon_stride,
unsigned int *sse) {
unsigned int var;
int avg;
variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32, &var, &avg);
*sse = var;
return (var - ((avg * avg) >> 10));
}