michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: michael@0: #include "vpx_config.h" michael@0: #include "vp8_rtcd.h" michael@0: #include "vpx_ports/x86.h" michael@0: #include "vp8/encoder/block.h" michael@0: michael@0: void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch); michael@0: void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch) michael@0: { michael@0: vp8_short_fdct4x4_mmx(input, output, pitch); michael@0: vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch); michael@0: } michael@0: michael@0: int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr, michael@0: short *qcoeff_ptr, short *dequant_ptr, michael@0: const short *scan_mask, short *round_ptr, michael@0: short *quant_ptr, short *dqcoeff_ptr); michael@0: void vp8_fast_quantize_b_mmx(BLOCK *b, BLOCKD *d) michael@0: { michael@0: const short *scan_mask = vp8_default_zig_zag_mask; michael@0: short *coeff_ptr = b->coeff; michael@0: short *zbin_ptr = b->zbin; michael@0: short *round_ptr = b->round; michael@0: short *quant_ptr = b->quant_fast; michael@0: short *qcoeff_ptr = d->qcoeff; michael@0: short *dqcoeff_ptr = d->dqcoeff; michael@0: short *dequant_ptr = d->dequant; michael@0: michael@0: *d->eob = (char)vp8_fast_quantize_b_impl_mmx( michael@0: coeff_ptr, michael@0: zbin_ptr, michael@0: qcoeff_ptr, michael@0: dequant_ptr, michael@0: scan_mask, michael@0: michael@0: round_ptr, michael@0: quant_ptr, michael@0: dqcoeff_ptr michael@0: ); michael@0: } michael@0: michael@0: int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc); michael@0: int vp8_mbblock_error_mmx(MACROBLOCK *mb, int dc) michael@0: { michael@0: short *coeff_ptr = mb->block[0].coeff; michael@0: short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff; michael@0: return vp8_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc); michael@0: } michael@0: michael@0: int vp8_mbuverror_mmx_impl(short *s_ptr, short *d_ptr); michael@0: int vp8_mbuverror_mmx(MACROBLOCK *mb) michael@0: { michael@0: short *s_ptr = &mb->coeff[256]; michael@0: short *d_ptr = &mb->e_mbd.dqcoeff[256]; michael@0: return vp8_mbuverror_mmx_impl(s_ptr, d_ptr); michael@0: } michael@0: michael@0: void vp8_subtract_b_mmx_impl(unsigned char *z, int src_stride, michael@0: short *diff, unsigned char *predictor, michael@0: int pitch); michael@0: void vp8_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch) michael@0: { michael@0: unsigned char *z = *(be->base_src) + be->src; michael@0: unsigned int src_stride = be->src_stride; michael@0: short *diff = &be->src_diff[0]; michael@0: unsigned char *predictor = &bd->predictor[0]; michael@0: vp8_subtract_b_mmx_impl(z, src_stride, diff, predictor, pitch); michael@0: }