1 /* 2 * Copyright © 2018, VideoLAN and dav1d authors 3 * Copyright © 2018, Two Orioles, LLC 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef DAV1D_SRC_MC_H 29 #define DAV1D_SRC_MC_H 30 31 #include <stdint.h> 32 #include <stddef.h> 33 34 #include "common/bitdepth.h" 35 36 #include "src/levels.h" 37 38 #define decl_mc_fn(name) \ 39 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 40 const pixel *src, ptrdiff_t src_stride, \ 41 int w, int h, int mx, int my HIGHBD_DECL_SUFFIX) 42 typedef decl_mc_fn(*mc_fn); 43 44 #define decl_mc_scaled_fn(name) \ 45 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 46 const pixel *src, ptrdiff_t src_stride, \ 47 int w, int h, int mx, int my, int dx, int dy HIGHBD_DECL_SUFFIX) 48 typedef decl_mc_scaled_fn(*mc_scaled_fn); 49 50 #define decl_warp8x8_fn(name) \ 51 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 52 const pixel *src, ptrdiff_t src_stride, \ 53 const int16_t *abcd, int mx, int my HIGHBD_DECL_SUFFIX) 54 typedef decl_warp8x8_fn(*warp8x8_fn); 55 56 #define decl_mct_fn(name) \ 57 void (name)(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, \ 58 int w, int h, int mx, int my HIGHBD_DECL_SUFFIX) 59 typedef decl_mct_fn(*mct_fn); 60 61 #define decl_mct_scaled_fn(name) \ 62 void (name)(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, \ 63 int w, int h, int mx, int my, int dx, int dy HIGHBD_DECL_SUFFIX) 64 typedef decl_mct_scaled_fn(*mct_scaled_fn); 65 66 #define decl_warp8x8t_fn(name) \ 67 void (name)(int16_t *tmp, const ptrdiff_t tmp_stride, \ 68 const pixel *src, ptrdiff_t src_stride, \ 69 const int16_t *abcd, int mx, int my HIGHBD_DECL_SUFFIX) 70 typedef decl_warp8x8t_fn(*warp8x8t_fn); 71 72 #define decl_avg_fn(name) \ 73 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 74 const int16_t *tmp1, const int16_t *tmp2, int w, int h \ 75 HIGHBD_DECL_SUFFIX) 76 typedef decl_avg_fn(*avg_fn); 77 78 #define decl_w_avg_fn(name) \ 79 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 80 const int16_t *tmp1, const int16_t *tmp2, int w, int h, int weight \ 81 HIGHBD_DECL_SUFFIX) 82 typedef decl_w_avg_fn(*w_avg_fn); 83 84 #define decl_mask_fn(name) \ 85 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 86 const int16_t *tmp1, const int16_t *tmp2, int w, int h, \ 87 const uint8_t *mask HIGHBD_DECL_SUFFIX) 88 typedef decl_mask_fn(*mask_fn); 89 90 #define decl_w_mask_fn(name) \ 91 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 92 const int16_t *tmp1, const int16_t *tmp2, int w, int h, \ 93 uint8_t *mask, int sign HIGHBD_DECL_SUFFIX) 94 typedef decl_w_mask_fn(*w_mask_fn); 95 96 #define decl_blend_fn(name) \ 97 void (name)(pixel *dst, ptrdiff_t dst_stride, const pixel *tmp, \ 98 int w, int h, const uint8_t *mask) 99 typedef decl_blend_fn(*blend_fn); 100 101 #define decl_blend_dir_fn(name) \ 102 void (name)(pixel *dst, ptrdiff_t dst_stride, const pixel *tmp, int w, int h) 103 typedef decl_blend_dir_fn(*blend_dir_fn); 104 105 #define decl_emu_edge_fn(name) \ 106 void (name)(intptr_t bw, intptr_t bh, intptr_t iw, intptr_t ih, intptr_t x, intptr_t y, \ 107 pixel *dst, ptrdiff_t dst_stride, const pixel *src, ptrdiff_t src_stride) 108 typedef decl_emu_edge_fn(*emu_edge_fn); 109 110 #define decl_resize_fn(name) \ 111 void (name)(pixel *dst, ptrdiff_t dst_stride, \ 112 const pixel *src, ptrdiff_t src_stride, \ 113 int dst_w, int h, int src_w, int dx, int mx HIGHBD_DECL_SUFFIX) 114 typedef decl_resize_fn(*resize_fn); 115 116 typedef struct Dav1dMCDSPContext { 117 mc_fn mc[N_2D_FILTERS]; 118 mc_scaled_fn mc_scaled[N_2D_FILTERS]; 119 mct_fn mct[N_2D_FILTERS]; 120 mct_scaled_fn mct_scaled[N_2D_FILTERS]; 121 avg_fn avg; 122 w_avg_fn w_avg; 123 mask_fn mask; 124 w_mask_fn w_mask[3 /* 444, 422, 420 */]; 125 blend_fn blend; 126 blend_dir_fn blend_v; 127 blend_dir_fn blend_h; 128 warp8x8_fn warp8x8; 129 warp8x8t_fn warp8x8t; 130 emu_edge_fn emu_edge; 131 resize_fn resize; 132 } Dav1dMCDSPContext; 133 134 bitfn_decls(void dav1d_mc_dsp_init, Dav1dMCDSPContext *c); 135 136 #endif /* DAV1D_SRC_MC_H */ 137