x86_csystemdependent.c 3.14 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5 6
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
John Koleszar's avatar
John Koleszar committed
9 10 11 12 13
 */


#include "vpx_ports/config.h"
#include "vpx_ports/x86.h"
14 15
#include "vp9/encoder/variance.h"
#include "vp9/encoder/onyx_int.h"
John Koleszar's avatar
John Koleszar committed
16 17 18


#if HAVE_MMX
19 20 21
void vp9_short_fdct8x4_mmx(short *input, short *output, int pitch) {
  vp9_short_fdct4x4_mmx(input,   output,    pitch);
  vp9_short_fdct4x4_mmx(input + 4, output + 16, pitch);
John Koleszar's avatar
John Koleszar committed
22 23
}

24 25
int vp9_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
int vp9_mbblock_error_mmx(MACROBLOCK *mb, int dc) {
John Koleszar's avatar
John Koleszar committed
26 27
  short *coeff_ptr =  mb->block[0].coeff;
  short *dcoef_ptr =  mb->e_mbd.block[0].dqcoeff;
28
  return vp9_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc);
John Koleszar's avatar
John Koleszar committed
29 30
}

31 32
int vp9_mbuverror_mmx_impl(short *s_ptr, short *d_ptr);
int vp9_mbuverror_mmx(MACROBLOCK *mb) {
John Koleszar's avatar
John Koleszar committed
33 34
  short *s_ptr = &mb->coeff[256];
  short *d_ptr = &mb->e_mbd.dqcoeff[256];
35
  return vp9_mbuverror_mmx_impl(s_ptr, d_ptr);
John Koleszar's avatar
John Koleszar committed
36 37
}

38
void vp9_subtract_b_mmx_impl(unsigned char *z,  int src_stride,
John Koleszar's avatar
John Koleszar committed
39 40
                             short *diff, unsigned char *predictor,
                             int pitch);
41
void vp9_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch) {
John Koleszar's avatar
John Koleszar committed
42 43 44 45
  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];
46
  vp9_subtract_b_mmx_impl(z, src_stride, diff, predictor, pitch);
John Koleszar's avatar
John Koleszar committed
47 48 49 50 51
}

#endif

#if HAVE_SSE2
52 53
int vp9_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
int vp9_mbblock_error_xmm(MACROBLOCK *mb, int dc) {
John Koleszar's avatar
John Koleszar committed
54 55
  short *coeff_ptr =  mb->block[0].coeff;
  short *dcoef_ptr =  mb->e_mbd.block[0].dqcoeff;
56
  return vp9_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr, dc);
John Koleszar's avatar
John Koleszar committed
57 58
}

59 60
int vp9_mbuverror_xmm_impl(short *s_ptr, short *d_ptr);
int vp9_mbuverror_xmm(MACROBLOCK *mb) {
John Koleszar's avatar
John Koleszar committed
61 62
  short *s_ptr = &mb->coeff[256];
  short *d_ptr = &mb->e_mbd.dqcoeff[256];
63
  return vp9_mbuverror_xmm_impl(s_ptr, d_ptr);
John Koleszar's avatar
John Koleszar committed
64 65
}

66
void vp9_subtract_b_sse2_impl(unsigned char *z,  int src_stride,
John Koleszar's avatar
John Koleszar committed
67 68
                              short *diff, unsigned char *predictor,
                              int pitch);
69
void vp9_subtract_b_sse2(BLOCK *be, BLOCKD *bd, int pitch) {
John Koleszar's avatar
John Koleszar committed
70 71 72 73
  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];
74
  vp9_subtract_b_sse2_impl(z, src_stride, diff, predictor, pitch);
Yunqing Wang's avatar
Yunqing Wang committed
75 76
}

John Koleszar's avatar
John Koleszar committed
77 78
#endif

79
void vp9_arch_x86_encoder_init(VP9_COMP *cpi) {
John Koleszar's avatar
John Koleszar committed
80
#if CONFIG_RUNTIME_CPU_DETECT
John Koleszar's avatar
John Koleszar committed
81
  int flags = x86_simd_caps();
John Koleszar's avatar
John Koleszar committed
82

John Koleszar's avatar
John Koleszar committed
83 84 85 86 87 88
  /* 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)
   */
John Koleszar's avatar
John Koleszar committed
89

John Koleszar's avatar
John Koleszar committed
90
  /* Override default functions with fastest ones for this CPU. */
91
#if HAVE_SSE2
John Koleszar's avatar
John Koleszar committed
92 93
  if (flags & HAS_SSE2) {
  }
John Koleszar's avatar
John Koleszar committed
94 95
#endif

96

John Koleszar's avatar
John Koleszar committed
97 98
#endif
}