Home | History | Annotate | Download | only in common
      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_config.h"
     12 #include "vp8_rtcd.h"
     13 #include "vpx_mem/vpx_mem.h"
     14 
     15 void vp8_dequant_idct_add_c(short *input, short *dq,
     16                             unsigned char *dest, int stride);
     17 void vp8_dc_only_idct_add_c(short input_dc, unsigned char * pred,
     18                             int pred_stride, unsigned char *dst_ptr,
     19                             int dst_stride);
     20 
     21 void vp8_dequant_idct_add_y_block_c
     22             (short *q, short *dq,
     23              unsigned char *dst, int stride, char *eobs)
     24 {
     25     int i, j;
     26 
     27     for (i = 0; i < 4; i++)
     28     {
     29         for (j = 0; j < 4; j++)
     30         {
     31             if (*eobs++ > 1)
     32                 vp8_dequant_idct_add_c (q, dq, dst, stride);
     33             else
     34             {
     35                 vp8_dc_only_idct_add_c (q[0]*dq[0], dst, stride, dst, stride);
     36                 vpx_memset(q, 0, 2 * sizeof(q[0]));
     37             }
     38 
     39             q   += 16;
     40             dst += 4;
     41         }
     42 
     43         dst += 4*stride - 16;
     44     }
     45 }
     46 
     47 void vp8_dequant_idct_add_uv_block_c
     48             (short *q, short *dq,
     49              unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
     50 {
     51     int i, j;
     52 
     53     for (i = 0; i < 2; i++)
     54     {
     55         for (j = 0; j < 2; j++)
     56         {
     57             if (*eobs++ > 1)
     58                 vp8_dequant_idct_add_c (q, dq, dstu, stride);
     59             else
     60             {
     61                 vp8_dc_only_idct_add_c (q[0]*dq[0], dstu, stride, dstu, stride);
     62                 vpx_memset(q, 0, 2 * sizeof(q[0]));
     63             }
     64 
     65             q    += 16;
     66             dstu += 4;
     67         }
     68 
     69         dstu += 4*stride - 8;
     70     }
     71 
     72     for (i = 0; i < 2; i++)
     73     {
     74         for (j = 0; j < 2; j++)
     75         {
     76             if (*eobs++ > 1)
     77                 vp8_dequant_idct_add_c (q, dq, dstv, stride);
     78             else
     79             {
     80                 vp8_dc_only_idct_add_c (q[0]*dq[0], dstv, stride, dstv, stride);
     81                 vpx_memset(q, 0, 2 * sizeof(q[0]));
     82             }
     83 
     84             q    += 16;
     85             dstv += 4;
     86         }
     87 
     88         dstv += 4*stride - 8;
     89     }
     90 }
     91