cdef_block.h (2527B)
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 "aom_dsp/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 two vertical lines. */ 23 #define CDEF_VBORDER (2) 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 (0x4000) 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]; 36 extern const int (*const cdef_directions)[2]; 37 38 typedef struct { 39 uint8_t by; 40 uint8_t bx; 41 } cdef_list; 42 43 typedef void (*cdef_filter_block_func)(void *dest, int dstride, 44 const uint16_t *in, int pri_strength, 45 int sec_strength, int dir, 46 int pri_damping, int sec_damping, 47 int coeff_shift, int block_width, 48 int block_height); 49 50 void av1_cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, 51 const uint16_t *in, int xdec, int ydec, 52 int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], int *dirinit, 53 int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli, 54 cdef_list *dlist, int cdef_count, int level, 55 int sec_strength, int damping, int coeff_shift); 56 57 static inline void fill_rect(uint16_t *dst, int dstride, int v, int h, 58 uint16_t x) { 59 for (int i = 0; i < v; i++) { 60 for (int j = 0; j < h; j++) { 61 dst[i * dstride + j] = x; 62 } 63 } 64 } 65 #endif // AOM_AV1_COMMON_CDEF_BLOCK_H_