media/libvpx/vp8/common/x86/idct_blk_mmx.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp8/common/x86/idct_blk_mmx.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +#include "vpx_config.h"
    1.15 +#include "vp8_rtcd.h"
    1.16 +#include "vp8/common/blockd.h"
    1.17 +#include "vpx_mem/vpx_mem.h"
    1.18 +
    1.19 +extern void vp8_dequantize_b_impl_mmx(short *sq, short *dq, short *q);
    1.20 +
    1.21 +void vp8_dequantize_b_mmx(BLOCKD *d, short *DQC)
    1.22 +{
    1.23 +    short *sq = (short *) d->qcoeff;
    1.24 +    short *dq = (short *) d->dqcoeff;
    1.25 +
    1.26 +    vp8_dequantize_b_impl_mmx(sq, dq, DQC);
    1.27 +}
    1.28 +
    1.29 +void vp8_dequant_idct_add_y_block_mmx
    1.30 +            (short *q, short *dq,
    1.31 +             unsigned char *dst, int stride, char *eobs)
    1.32 +{
    1.33 +    int i;
    1.34 +
    1.35 +    for (i = 0; i < 4; i++)
    1.36 +    {
    1.37 +        if (eobs[0] > 1)
    1.38 +            vp8_dequant_idct_add_mmx (q, dq, dst, stride);
    1.39 +        else if (eobs[0] == 1)
    1.40 +        {
    1.41 +            vp8_dc_only_idct_add_mmx (q[0]*dq[0], dst, stride, dst, stride);
    1.42 +            vpx_memset(q, 0, 2 * sizeof(q[0]));
    1.43 +        }
    1.44 +
    1.45 +        if (eobs[1] > 1)
    1.46 +            vp8_dequant_idct_add_mmx (q+16, dq, dst+4, stride);
    1.47 +        else if (eobs[1] == 1)
    1.48 +        {
    1.49 +            vp8_dc_only_idct_add_mmx (q[16]*dq[0], dst+4, stride,
    1.50 +                                      dst+4, stride);
    1.51 +            vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
    1.52 +        }
    1.53 +
    1.54 +        if (eobs[2] > 1)
    1.55 +            vp8_dequant_idct_add_mmx (q+32, dq, dst+8, stride);
    1.56 +        else if (eobs[2] == 1)
    1.57 +        {
    1.58 +            vp8_dc_only_idct_add_mmx (q[32]*dq[0], dst+8, stride,
    1.59 +                                      dst+8, stride);
    1.60 +            vpx_memset(q + 32, 0, 2 * sizeof(q[0]));
    1.61 +        }
    1.62 +
    1.63 +        if (eobs[3] > 1)
    1.64 +            vp8_dequant_idct_add_mmx (q+48, dq, dst+12, stride);
    1.65 +        else if (eobs[3] == 1)
    1.66 +        {
    1.67 +            vp8_dc_only_idct_add_mmx (q[48]*dq[0], dst+12, stride,
    1.68 +                                      dst+12, stride);
    1.69 +            vpx_memset(q + 48, 0, 2 * sizeof(q[0]));
    1.70 +        }
    1.71 +
    1.72 +        q    += 64;
    1.73 +        dst  += 4*stride;
    1.74 +        eobs += 4;
    1.75 +    }
    1.76 +}
    1.77 +
    1.78 +void vp8_dequant_idct_add_uv_block_mmx
    1.79 +            (short *q, short *dq,
    1.80 +             unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
    1.81 +{
    1.82 +    int i;
    1.83 +
    1.84 +    for (i = 0; i < 2; i++)
    1.85 +    {
    1.86 +        if (eobs[0] > 1)
    1.87 +            vp8_dequant_idct_add_mmx (q, dq, dstu, stride);
    1.88 +        else if (eobs[0] == 1)
    1.89 +        {
    1.90 +            vp8_dc_only_idct_add_mmx (q[0]*dq[0], dstu, stride, dstu, stride);
    1.91 +            vpx_memset(q, 0, 2 * sizeof(q[0]));
    1.92 +        }
    1.93 +
    1.94 +        if (eobs[1] > 1)
    1.95 +            vp8_dequant_idct_add_mmx (q+16, dq, dstu+4, stride);
    1.96 +        else if (eobs[1] == 1)
    1.97 +        {
    1.98 +            vp8_dc_only_idct_add_mmx (q[16]*dq[0], dstu+4, stride,
    1.99 +                                      dstu+4, stride);
   1.100 +            vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
   1.101 +        }
   1.102 +
   1.103 +        q    += 32;
   1.104 +        dstu += 4*stride;
   1.105 +        eobs += 2;
   1.106 +    }
   1.107 +
   1.108 +    for (i = 0; i < 2; i++)
   1.109 +    {
   1.110 +        if (eobs[0] > 1)
   1.111 +            vp8_dequant_idct_add_mmx (q, dq, dstv, stride);
   1.112 +        else if (eobs[0] == 1)
   1.113 +        {
   1.114 +            vp8_dc_only_idct_add_mmx (q[0]*dq[0], dstv, stride, dstv, stride);
   1.115 +            vpx_memset(q, 0, 2 * sizeof(q[0]));
   1.116 +        }
   1.117 +
   1.118 +        if (eobs[1] > 1)
   1.119 +            vp8_dequant_idct_add_mmx (q+16, dq, dstv+4, stride);
   1.120 +        else if (eobs[1] == 1)
   1.121 +        {
   1.122 +            vp8_dc_only_idct_add_mmx (q[16]*dq[0], dstv+4, stride,
   1.123 +                                      dstv+4, stride);
   1.124 +            vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
   1.125 +        }
   1.126 +
   1.127 +        q    += 32;
   1.128 +        dstv += 4*stride;
   1.129 +        eobs += 2;
   1.130 +    }
   1.131 +}

mercurial