2010-05-18 11:58:33 -04:00
|
|
|
/*
|
2010-09-09 08:16:39 -04:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 11:58:33 -04:00
|
|
|
*
|
2010-06-18 12:39:21 -04:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 16:19:40 -04:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 12:39:21 -04:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 16:19:40 -04:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 11:58:33 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "vpx_ports/config.h"
|
|
|
|
#include "vpx_ports/x86.h"
|
2011-02-10 14:41:38 -05:00
|
|
|
#include "vp8/encoder/variance.h"
|
|
|
|
#include "vp8/encoder/onyx_int.h"
|
2010-05-18 11:58:33 -04:00
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_MMX
|
2012-07-13 15:21:29 -07:00
|
|
|
void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch) {
|
|
|
|
vp8_short_fdct4x4_mmx(input, output, pitch);
|
|
|
|
vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
|
2012-07-13 15:21:29 -07:00
|
|
|
int vp8_mbblock_error_mmx(MACROBLOCK *mb, int dc) {
|
|
|
|
short *coeff_ptr = mb->block[0].coeff;
|
|
|
|
short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
|
|
|
|
return vp8_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int vp8_mbuverror_mmx_impl(short *s_ptr, short *d_ptr);
|
2012-07-13 15:21:29 -07:00
|
|
|
int vp8_mbuverror_mmx(MACROBLOCK *mb) {
|
|
|
|
short *s_ptr = &mb->coeff[256];
|
|
|
|
short *d_ptr = &mb->e_mbd.dqcoeff[256];
|
|
|
|
return vp8_mbuverror_mmx_impl(s_ptr, d_ptr);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void vp8_subtract_b_mmx_impl(unsigned char *z, int src_stride,
|
|
|
|
short *diff, unsigned char *predictor,
|
|
|
|
int pitch);
|
2012-07-13 15:21:29 -07:00
|
|
|
void vp8_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch) {
|
|
|
|
unsigned char *z = *(be->base_src) + be->src;
|
|
|
|
unsigned int src_stride = be->src_stride;
|
|
|
|
short *diff = &be->src_diff[0];
|
|
|
|
unsigned char *predictor = &bd->predictor[0];
|
|
|
|
vp8_subtract_b_mmx_impl(z, src_stride, diff, predictor, pitch);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_SSE2
|
|
|
|
int vp8_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
|
2012-07-13 15:21:29 -07:00
|
|
|
int vp8_mbblock_error_xmm(MACROBLOCK *mb, int dc) {
|
|
|
|
short *coeff_ptr = mb->block[0].coeff;
|
|
|
|
short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
|
|
|
|
return vp8_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr, dc);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int vp8_mbuverror_xmm_impl(short *s_ptr, short *d_ptr);
|
2012-07-13 15:21:29 -07:00
|
|
|
int vp8_mbuverror_xmm(MACROBLOCK *mb) {
|
|
|
|
short *s_ptr = &mb->coeff[256];
|
|
|
|
short *d_ptr = &mb->e_mbd.dqcoeff[256];
|
|
|
|
return vp8_mbuverror_xmm_impl(s_ptr, d_ptr);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
2010-10-18 14:15:15 -04:00
|
|
|
void vp8_subtract_b_sse2_impl(unsigned char *z, int src_stride,
|
2012-07-13 15:21:29 -07:00
|
|
|
short *diff, unsigned char *predictor,
|
|
|
|
int pitch);
|
|
|
|
void vp8_subtract_b_sse2(BLOCK *be, BLOCKD *bd, int pitch) {
|
|
|
|
unsigned char *z = *(be->base_src) + be->src;
|
|
|
|
unsigned int src_stride = be->src_stride;
|
|
|
|
short *diff = &be->src_diff[0];
|
|
|
|
unsigned char *predictor = &bd->predictor[0];
|
|
|
|
vp8_subtract_b_sse2_impl(z, src_stride, diff, predictor, pitch);
|
2010-10-18 14:15:15 -04:00
|
|
|
}
|
|
|
|
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
void vp8_arch_x86_encoder_init(VP8_COMP *cpi) {
|
2010-05-18 11:58:33 -04:00
|
|
|
#if CONFIG_RUNTIME_CPU_DETECT
|
2012-07-13 15:21:29 -07:00
|
|
|
int flags = x86_simd_caps();
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
/* Note:
|
|
|
|
*
|
|
|
|
* This platform can be built without runtime CPU detection as well. If
|
|
|
|
* you modify any of the function mappings present in this file, be sure
|
|
|
|
* to also update them in static mapings (<arch>/filename_<arch>.h)
|
|
|
|
*/
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
/* Override default functions with fastest ones for this CPU. */
|
2010-05-18 11:58:33 -04:00
|
|
|
#if HAVE_MMX
|
2012-07-13 15:21:29 -07:00
|
|
|
if (flags & HAS_MMX) {
|
|
|
|
cpi->rtcd.encodemb.berr = vp8_block_error_mmx;
|
|
|
|
cpi->rtcd.encodemb.mberr = vp8_mbblock_error_mmx;
|
|
|
|
cpi->rtcd.encodemb.mbuverr = vp8_mbuverror_mmx;
|
|
|
|
cpi->rtcd.encodemb.subb = vp8_subtract_b_mmx;
|
|
|
|
cpi->rtcd.encodemb.submby = vp8_subtract_mby_mmx;
|
|
|
|
cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_mmx;
|
|
|
|
}
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
|
|
|
|
2010-10-27 08:45:24 -04:00
|
|
|
#if HAVE_SSE2
|
2012-07-13 15:21:29 -07:00
|
|
|
if (flags & HAS_SSE2) {
|
|
|
|
cpi->rtcd.encodemb.berr = vp8_block_error_xmm;
|
|
|
|
cpi->rtcd.encodemb.mberr = vp8_mbblock_error_xmm;
|
|
|
|
cpi->rtcd.encodemb.mbuverr = vp8_mbuverror_xmm;
|
|
|
|
cpi->rtcd.encodemb.subb = vp8_subtract_b_sse2;
|
|
|
|
cpi->rtcd.encodemb.submby = vp8_subtract_mby_sse2;
|
|
|
|
cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_sse2;
|
|
|
|
cpi->rtcd.temporal.apply = vp8_temporal_filter_apply_sse2;
|
2011-08-22 12:36:28 -07:00
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
}
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
|
|
|
|
2010-10-27 08:45:24 -04:00
|
|
|
#if HAVE_SSE3
|
2012-07-13 15:21:29 -07:00
|
|
|
if (flags & HAS_SSE3) {
|
|
|
|
cpi->rtcd.search.full_search = vp8_full_search_sadx3;
|
|
|
|
cpi->rtcd.search.diamond_search = vp8_diamond_search_sadx4;
|
|
|
|
cpi->rtcd.search.refining_search = vp8_refining_search_sadx4;
|
|
|
|
}
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
|
|
|
|
2011-03-08 09:05:18 -05:00
|
|
|
|
2010-10-27 08:45:24 -04:00
|
|
|
#if HAVE_SSE4_1
|
2012-07-13 15:21:29 -07:00
|
|
|
if (flags & HAS_SSE4_1) {
|
|
|
|
cpi->rtcd.search.full_search = vp8_full_search_sadx8;
|
|
|
|
}
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
2010-10-27 08:45:24 -04:00
|
|
|
|
2010-05-18 11:58:33 -04:00
|
|
|
#endif
|
|
|
|
}
|