Home | History | Annotate | Download | only in common
      1 /*
      2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
      3  *
      4  * This source code is subject to the terms of the BSD 2 Clause License and
      5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
      6  * was not distributed with this source code in the LICENSE file, you can
      7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
      8  * Media Patent License 1.0 was not distributed with this source code in the
      9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
     10  */
     11 
     12 #ifndef AOM_AV1_COMMON_CDEF_BLOCK_H_
     13 #define AOM_AV1_COMMON_CDEF_BLOCK_H_
     14 
     15 #include "av1/common/odintrin.h"
     16 
     17 #define CDEF_BLOCKSIZE 64
     18 #define CDEF_BLOCKSIZE_LOG2 6
     19 #define CDEF_NBLOCKS ((1 << MAX_SB_SIZE_LOG2) / 8)
     20 #define CDEF_SB_SHIFT (MAX_SB_SIZE_LOG2 - CDEF_BLOCKSIZE_LOG2)
     21 
     22 /* We need to buffer three vertical lines. */
     23 #define CDEF_VBORDER (3)
     24 /* We only need to buffer three horizontal pixels too, but let's align to
     25    16 bytes (8 x 16 bits) to make vectorization easier. */
     26 #define CDEF_HBORDER (8)
     27 #define CDEF_BSTRIDE \
     28   ALIGN_POWER_OF_TWO((1 << MAX_SB_SIZE_LOG2) + 2 * CDEF_HBORDER, 3)
     29 
     30 #define CDEF_VERY_LARGE (30000)
     31 #define CDEF_INBUF_SIZE \
     32   (CDEF_BSTRIDE * ((1 << MAX_SB_SIZE_LOG2) + 2 * CDEF_VBORDER))
     33 
     34 extern const int cdef_pri_taps[2][2];
     35 extern const int cdef_sec_taps[2][2];
     36 DECLARE_ALIGNED(16, extern const int, cdef_directions[8][2]);
     37 
     38 typedef struct {
     39   uint8_t by;
     40   uint8_t bx;
     41 } cdef_list;
     42 
     43 typedef void (*cdef_filter_block_func)(uint8_t *dst8, uint16_t *dst16,
     44                                        int dstride, const uint16_t *in,
     45                                        int pri_strength, int sec_strength,
     46                                        int dir, int pri_damping,
     47                                        int sec_damping, int bsize,
     48                                        int coeff_shift);
     49 void copy_cdef_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
     50                               cdef_list *dlist, int cdef_count, int bsize);
     51 
     52 void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
     53                     int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS],
     54                     int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
     55                     cdef_list *dlist, int cdef_count, int level,
     56                     int sec_strength, int pri_damping, int sec_damping,
     57                     int coeff_shift);
     58 #endif  // AOM_AV1_COMMON_CDEF_BLOCK_H_
     59