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 #include "vpx_ports/config.h"
     12 #include "vp8/common/idct.h"
     13 #include "vp8/decoder/dequantize.h"
     14 
     15 void vp8_dequant_dc_idct_add_y_block_mmx
     16             (short *q, short *dq, unsigned char *pre,
     17              unsigned char *dst, int stride, char *eobs, short *dc)
     18 {
     19     int i;
     20 
     21     for (i = 0; i < 4; i++)
     22     {
     23         if (eobs[0] > 1)
     24             vp8_dequant_dc_idct_add_mmx (q, dq, pre, dst, 16, stride, dc[0]);
     25         else
     26             vp8_dc_only_idct_add_mmx (dc[0], pre, dst, 16, stride);
     27 
     28         if (eobs[1] > 1)
     29             vp8_dequant_dc_idct_add_mmx (q+16, dq, pre+4, dst+4, 16, stride, dc[1]);
     30         else
     31             vp8_dc_only_idct_add_mmx (dc[1], pre+4, dst+4, 16, stride);
     32 
     33         if (eobs[2] > 1)
     34             vp8_dequant_dc_idct_add_mmx (q+32, dq, pre+8, dst+8, 16, stride, dc[2]);
     35         else
     36             vp8_dc_only_idct_add_mmx (dc[2], pre+8, dst+8, 16, stride);
     37 
     38         if (eobs[3] > 1)
     39             vp8_dequant_dc_idct_add_mmx (q+48, dq, pre+12, dst+12, 16, stride, dc[3]);
     40         else
     41             vp8_dc_only_idct_add_mmx (dc[3], pre+12, dst+12, 16, stride);
     42 
     43         q    += 64;
     44         dc   += 4;
     45         pre  += 64;
     46         dst  += 4*stride;
     47         eobs += 4;
     48     }
     49 }
     50 
     51 void vp8_dequant_idct_add_y_block_mmx
     52             (short *q, short *dq, unsigned char *pre,
     53              unsigned char *dst, int stride, char *eobs)
     54 {
     55     int i;
     56 
     57     for (i = 0; i < 4; i++)
     58     {
     59         if (eobs[0] > 1)
     60             vp8_dequant_idct_add_mmx (q, dq, pre, dst, 16, stride);
     61         else
     62         {
     63             vp8_dc_only_idct_add_mmx (q[0]*dq[0], pre, dst, 16, stride);
     64             ((int *)q)[0] = 0;
     65         }
     66 
     67         if (eobs[1] > 1)
     68             vp8_dequant_idct_add_mmx (q+16, dq, pre+4, dst+4, 16, stride);
     69         else
     70         {
     71             vp8_dc_only_idct_add_mmx (q[16]*dq[0], pre+4, dst+4, 16, stride);
     72             ((int *)(q+16))[0] = 0;
     73         }
     74 
     75         if (eobs[2] > 1)
     76             vp8_dequant_idct_add_mmx (q+32, dq, pre+8, dst+8, 16, stride);
     77         else
     78         {
     79             vp8_dc_only_idct_add_mmx (q[32]*dq[0], pre+8, dst+8, 16, stride);
     80             ((int *)(q+32))[0] = 0;
     81         }
     82 
     83         if (eobs[3] > 1)
     84             vp8_dequant_idct_add_mmx (q+48, dq, pre+12, dst+12, 16, stride);
     85         else
     86         {
     87             vp8_dc_only_idct_add_mmx (q[48]*dq[0], pre+12, dst+12, 16, stride);
     88             ((int *)(q+48))[0] = 0;
     89         }
     90 
     91         q    += 64;
     92         pre  += 64;
     93         dst  += 4*stride;
     94         eobs += 4;
     95     }
     96 }
     97 
     98 void vp8_dequant_idct_add_uv_block_mmx
     99             (short *q, short *dq, unsigned char *pre,
    100              unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
    101 {
    102     int i;
    103 
    104     for (i = 0; i < 2; i++)
    105     {
    106         if (eobs[0] > 1)
    107             vp8_dequant_idct_add_mmx (q, dq, pre, dstu, 8, stride);
    108         else
    109         {
    110             vp8_dc_only_idct_add_mmx (q[0]*dq[0], pre, dstu, 8, stride);
    111             ((int *)q)[0] = 0;
    112         }
    113 
    114         if (eobs[1] > 1)
    115             vp8_dequant_idct_add_mmx (q+16, dq, pre+4, dstu+4, 8, stride);
    116         else
    117         {
    118             vp8_dc_only_idct_add_mmx (q[16]*dq[0], pre+4, dstu+4, 8, stride);
    119             ((int *)(q+16))[0] = 0;
    120         }
    121 
    122         q    += 32;
    123         pre  += 32;
    124         dstu += 4*stride;
    125         eobs += 2;
    126     }
    127 
    128     for (i = 0; i < 2; i++)
    129     {
    130         if (eobs[0] > 1)
    131             vp8_dequant_idct_add_mmx (q, dq, pre, dstv, 8, stride);
    132         else
    133         {
    134             vp8_dc_only_idct_add_mmx (q[0]*dq[0], pre, dstv, 8, stride);
    135             ((int *)q)[0] = 0;
    136         }
    137 
    138         if (eobs[1] > 1)
    139             vp8_dequant_idct_add_mmx (q+16, dq, pre+4, dstv+4, 8, stride);
    140         else
    141         {
    142             vp8_dc_only_idct_add_mmx (q[16]*dq[0], pre+4, dstv+4, 8, stride);
    143             ((int *)(q+16))[0] = 0;
    144         }
    145 
    146         q    += 32;
    147         pre  += 32;
    148         dstv += 4*stride;
    149         eobs += 2;
    150     }
    151 }
    152