Home | History | Annotate | Download | only in dspr2
      1 /*
      2  *  Copyright (c) 2013 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 #ifndef VP9_COMMON_VP9_COMMON_DSPR2_H_
     12 #define VP9_COMMON_VP9_COMMON_DSPR2_H_
     13 
     14 #include <assert.h>
     15 
     16 #include "./vpx_config.h"
     17 #include "vpx/vpx_integer.h"
     18 #include "vp9/common/vp9_common.h"
     19 
     20 #if HAVE_DSPR2
     21 #define CROP_WIDTH 512
     22 extern uint8_t *vp9_ff_cropTbl;
     23 
     24 #define DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input)                    ({   \
     25                                                                                \
     26   int32_t tmp, out;                                                            \
     27   int     dct_cost_rounding = DCT_CONST_ROUNDING;                              \
     28   int     in = input;                                                          \
     29                                                                                \
     30   __asm__ __volatile__ (                                                       \
     31       /* out = dct_const_round_shift(input_dc * cospi_16_64); */               \
     32       "mtlo     %[dct_cost_rounding],   $ac1                              \n\t"\
     33       "mthi     $zero,                  $ac1                              \n\t"\
     34       "madd     $ac1,                   %[in],            %[cospi_16_64]  \n\t"\
     35       "extp     %[tmp],                 $ac1,             31              \n\t"\
     36                                                                                \
     37       /* out = dct_const_round_shift(out * cospi_16_64); */                    \
     38       "mtlo     %[dct_cost_rounding],   $ac2                              \n\t"\
     39       "mthi     $zero,                  $ac2                              \n\t"\
     40       "madd     $ac2,                   %[tmp],           %[cospi_16_64]  \n\t"\
     41       "extp     %[out],                 $ac2,             31              \n\t"\
     42                                                                                \
     43       : [tmp] "=&r" (tmp), [out] "=r" (out)                                    \
     44       : [in] "r" (in),                                                         \
     45         [dct_cost_rounding] "r" (dct_cost_rounding),                           \
     46         [cospi_16_64] "r" (cospi_16_64)                                        \
     47    );                                                                          \
     48   out;                                                                    })
     49 
     50 static INLINE void vp9_prefetch_load(const unsigned char *src) {
     51   __asm__ __volatile__ (
     52       "pref   0,  0(%[src])   \n\t"
     53       :
     54       : [src] "r" (src)
     55   );
     56 }
     57 
     58 /* prefetch data for store */
     59 static INLINE void vp9_prefetch_store(unsigned char *dst) {
     60   __asm__ __volatile__ (
     61       "pref   1,  0(%[dst])   \n\t"
     62       :
     63       : [dst] "r" (dst)
     64   );
     65 }
     66 
     67 static INLINE void vp9_prefetch_load_streamed(const unsigned char *src) {
     68   __asm__ __volatile__ (
     69       "pref   4,  0(%[src])   \n\t"
     70       :
     71       : [src] "r" (src)
     72   );
     73 }
     74 
     75 /* prefetch data for store */
     76 static INLINE void vp9_prefetch_store_streamed(unsigned char *dst) {
     77   __asm__ __volatile__ (
     78       "pref   5,  0(%[dst])   \n\t"
     79       :
     80       : [dst] "r" (dst)
     81   );
     82 }
     83 
     84 void vp9_idct32_1d_cols_add_blk_dspr2(int16_t *input, uint8_t *dest,
     85                                       int dest_stride);
     86 
     87 void vp9_convolve2_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride,
     88                                uint8_t *dst, ptrdiff_t dst_stride,
     89                                const int16_t *filter_x, int x_step_q4,
     90                                const int16_t *filter_y, int y_step_q4,
     91                                int w, int h);
     92 
     93 void vp9_convolve2_avg_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride,
     94                                    uint8_t *dst, ptrdiff_t dst_stride,
     95                                    const int16_t *filter_x, int x_step_q4,
     96                                    const int16_t *filter_y, int y_step_q4,
     97                                    int w, int h);
     98 
     99 void vp9_convolve2_avg_vert_dspr2(const uint8_t *src, ptrdiff_t src_stride,
    100                                   uint8_t *dst, ptrdiff_t dst_stride,
    101                                   const int16_t *filter_x, int x_step_q4,
    102                                   const int16_t *filter_y, int y_step_q4,
    103                                   int w, int h);
    104 
    105 void vp9_convolve2_dspr2(const uint8_t *src, ptrdiff_t src_stride,
    106                          uint8_t *dst, ptrdiff_t dst_stride,
    107                          const int16_t *filter,
    108                          int w, int h);
    109 
    110 void vp9_convolve2_vert_dspr2(const uint8_t *src, ptrdiff_t src_stride,
    111                               uint8_t *dst, ptrdiff_t dst_stride,
    112                               const int16_t *filter_x, int x_step_q4,
    113                               const int16_t *filter_y, int y_step_q4,
    114                               int w, int h);
    115 
    116 #endif  // #if HAVE_DSPR2
    117 #endif  // VP9_COMMON_VP9_COMMON_DSPR2_H_
    118