1 /* 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * 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. 9 */ 10 11 12 #include "vpx_config.h" 13 #include "vp8_rtcd.h" 14 #include "vpx_ports/x86.h" 15 #include "vp8/encoder/block.h" 16 17 void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch); 18 void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch) 19 { 20 vp8_short_fdct4x4_mmx(input, output, pitch); 21 vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch); 22 } 23 24 int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr, 25 short *qcoeff_ptr, short *dequant_ptr, 26 const short *scan_mask, short *round_ptr, 27 short *quant_ptr, short *dqcoeff_ptr); 28 void vp8_fast_quantize_b_mmx(BLOCK *b, BLOCKD *d) 29 { 30 const short *scan_mask = vp8_default_zig_zag_mask; 31 short *coeff_ptr = b->coeff; 32 short *zbin_ptr = b->zbin; 33 short *round_ptr = b->round; 34 short *quant_ptr = b->quant_fast; 35 short *qcoeff_ptr = d->qcoeff; 36 short *dqcoeff_ptr = d->dqcoeff; 37 short *dequant_ptr = d->dequant; 38 39 *d->eob = (char)vp8_fast_quantize_b_impl_mmx( 40 coeff_ptr, 41 zbin_ptr, 42 qcoeff_ptr, 43 dequant_ptr, 44 scan_mask, 45 46 round_ptr, 47 quant_ptr, 48 dqcoeff_ptr 49 ); 50 } 51 52 int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc); 53 int vp8_mbblock_error_mmx(MACROBLOCK *mb, int dc) 54 { 55 short *coeff_ptr = mb->block[0].coeff; 56 short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff; 57 return vp8_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc); 58 } 59 60 int vp8_mbuverror_mmx_impl(short *s_ptr, short *d_ptr); 61 int vp8_mbuverror_mmx(MACROBLOCK *mb) 62 { 63 short *s_ptr = &mb->coeff[256]; 64 short *d_ptr = &mb->e_mbd.dqcoeff[256]; 65 return vp8_mbuverror_mmx_impl(s_ptr, d_ptr); 66 } 67 68 void vp8_subtract_b_mmx_impl(unsigned char *z, int src_stride, 69 short *diff, unsigned char *predictor, 70 int pitch); 71 void vp8_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch) 72 { 73 unsigned char *z = *(be->base_src) + be->src; 74 unsigned int src_stride = be->src_stride; 75 short *diff = &be->src_diff[0]; 76 unsigned char *predictor = &bd->predictor[0]; 77 vp8_subtract_b_mmx_impl(z, src_stride, diff, predictor, pitch); 78 } 79