vp9_x86_csystemdependent.c 2.84 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/vp9_variance.h"
#include "vp9/encoder/vp9_onyx_int.h"
Jim Bankoski's avatar
Jim Bankoski committed
16
#include "vp9/encoder/x86/vp9_dct_mmx.h"
John Koleszar's avatar
John Koleszar committed
17

18
19
// TODO(jimbankoski) Consider rewriting the c to take the same values rather
// than going through these pointer conversions
John Koleszar's avatar
John Koleszar committed
20
#if HAVE_MMX
21
22
23
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
24
25
}

26
27
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
28
29
  short *coeff_ptr =  mb->block[0].coeff;
  short *dcoef_ptr =  mb->e_mbd.block[0].dqcoeff;
30
  return vp9_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc);
John Koleszar's avatar
John Koleszar committed
31
32
}

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

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

#endif

#if HAVE_SSE2
54
55
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
56
57
  short *coeff_ptr =  mb->block[0].coeff;
  short *dcoef_ptr =  mb->e_mbd.block[0].dqcoeff;
58
  return vp9_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr, dc);
John Koleszar's avatar
John Koleszar committed
59
60
}

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

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

John Koleszar's avatar
John Koleszar committed
79
#endif