Home | History | Annotate | Download | only in x86
      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_ports/config.h"
     13 #include "vpx_ports/x86.h"
     14 #include "vp8/decoder/onyxd_int.h"
     15 
     16 
     17 #if HAVE_MMX
     18 void vp8_dequantize_b_impl_mmx(short *sq, short *dq, short *q);
     19 
     20 static void dequantize_b_mmx(BLOCKD *d)
     21 {
     22     short *sq = (short *) d->qcoeff;
     23     short *dq = (short *) d->dqcoeff;
     24     short *q = (short *) d->dequant;
     25     vp8_dequantize_b_impl_mmx(sq, dq, q);
     26 }
     27 #endif
     28 
     29 void vp8_arch_x86_decode_init(VP8D_COMP *pbi)
     30 {
     31     int flags = x86_simd_caps();
     32 
     33     /* Note:
     34      *
     35      * This platform can be built without runtime CPU detection as well. If
     36      * you modify any of the function mappings present in this file, be sure
     37      * to also update them in static mapings (<arch>/filename_<arch>.h)
     38      */
     39 #if CONFIG_RUNTIME_CPU_DETECT
     40     /* Override default functions with fastest ones for this CPU. */
     41 #if HAVE_MMX
     42     if (flags & HAS_MMX)
     43     {
     44         pbi->dequant.block               = dequantize_b_mmx;
     45         pbi->dequant.idct_add            = vp8_dequant_idct_add_mmx;
     46         pbi->dequant.dc_idct_add         = vp8_dequant_dc_idct_add_mmx;
     47         pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_mmx;
     48         pbi->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_mmx;
     49         pbi->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_mmx;
     50     }
     51 #endif
     52 #if HAVE_SSE2
     53     if (flags & HAS_SSE2)
     54     {
     55         pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_sse2;
     56         pbi->dequant.idct_add_y_block    = vp8_dequant_idct_add_y_block_sse2;
     57         pbi->dequant.idct_add_uv_block   = vp8_dequant_idct_add_uv_block_sse2;
     58     }
     59 #endif
     60 
     61 #endif
     62 }
     63