1 /* 2 * Copyright (c) 2021 Loongson Technology Corporation Limited 3 * Contributed by Hao Chen <chenhao@loongson.cn> 4 * 5 * This file is part of FFmpeg. 6 * 7 * FFmpeg is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * FFmpeg is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with FFmpeg; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H 23 #define AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H 24 25 #define VP9_8TAP_LOONGARCH_LSX_FUNC(SIZE, type, type_idx) \ 26 void ff_put_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \ 27 const uint8_t *src, \ 28 ptrdiff_t srcstride, \ 29 int h, int mx, int my); \ 30 \ 31 void ff_put_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \ 32 const uint8_t *src, \ 33 ptrdiff_t srcstride, \ 34 int h, int mx, int my); \ 35 \ 36 void ff_put_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \ 37 const uint8_t *src, \ 38 ptrdiff_t srcstride, \ 39 int h, int mx, int my); \ 40 \ 41 void ff_avg_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \ 42 const uint8_t *src, \ 43 ptrdiff_t srcstride, \ 44 int h, int mx, int my); \ 45 \ 46 void ff_avg_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \ 47 const uint8_t *src, \ 48 ptrdiff_t srcstride, \ 49 int h, int mx, int my); \ 50 \ 51 void ff_avg_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \ 52 const uint8_t *src, \ 53 ptrdiff_t srcstride, \ 54 int h, int mx, int my); 55 56 #define VP9_COPY_LOONGARCH_LSX_FUNC(SIZE) \ 57 void ff_copy##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \ 58 const uint8_t *src, ptrdiff_t srcstride, \ 59 int h, int mx, int my); \ 60 \ 61 void ff_avg##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \ 62 const uint8_t *src, ptrdiff_t srcstride, \ 63 int h, int mx, int my); 64 65 VP9_8TAP_LOONGARCH_LSX_FUNC(64, regular, FILTER_8TAP_REGULAR); 66 VP9_8TAP_LOONGARCH_LSX_FUNC(32, regular, FILTER_8TAP_REGULAR); 67 VP9_8TAP_LOONGARCH_LSX_FUNC(16, regular, FILTER_8TAP_REGULAR); 68 VP9_8TAP_LOONGARCH_LSX_FUNC(8, regular, FILTER_8TAP_REGULAR); 69 VP9_8TAP_LOONGARCH_LSX_FUNC(4, regular, FILTER_8TAP_REGULAR); 70 71 VP9_8TAP_LOONGARCH_LSX_FUNC(64, sharp, FILTER_8TAP_SHARP); 72 VP9_8TAP_LOONGARCH_LSX_FUNC(32, sharp, FILTER_8TAP_SHARP); 73 VP9_8TAP_LOONGARCH_LSX_FUNC(16, sharp, FILTER_8TAP_SHARP); 74 VP9_8TAP_LOONGARCH_LSX_FUNC(8, sharp, FILTER_8TAP_SHARP); 75 VP9_8TAP_LOONGARCH_LSX_FUNC(4, sharp, FILTER_8TAP_SHARP); 76 77 VP9_8TAP_LOONGARCH_LSX_FUNC(64, smooth, FILTER_8TAP_SMOOTH); 78 VP9_8TAP_LOONGARCH_LSX_FUNC(32, smooth, FILTER_8TAP_SMOOTH); 79 VP9_8TAP_LOONGARCH_LSX_FUNC(16, smooth, FILTER_8TAP_SMOOTH); 80 VP9_8TAP_LOONGARCH_LSX_FUNC(8, smooth, FILTER_8TAP_SMOOTH); 81 VP9_8TAP_LOONGARCH_LSX_FUNC(4, smooth, FILTER_8TAP_SMOOTH); 82 83 VP9_COPY_LOONGARCH_LSX_FUNC(64); 84 VP9_COPY_LOONGARCH_LSX_FUNC(32); 85 VP9_COPY_LOONGARCH_LSX_FUNC(16); 86 VP9_COPY_LOONGARCH_LSX_FUNC(8); 87 88 #undef VP9_8TAP_LOONGARCH_LSX_FUNC 89 #undef VP9_COPY_LOONGARCH_LSX_FUNC 90 91 void ff_vert_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 92 const uint8_t *top); 93 void ff_vert_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 94 const uint8_t *top); 95 void ff_hor_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 96 const uint8_t *top); 97 void ff_hor_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 98 const uint8_t *top); 99 void ff_dc_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 100 const uint8_t *top); 101 void ff_dc_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 102 const uint8_t *top); 103 void ff_dc_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 104 const uint8_t *top); 105 void ff_dc_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 106 const uint8_t *top); 107 void ff_dc_left_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 108 const uint8_t *top); 109 void ff_dc_left_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 110 const uint8_t *top); 111 void ff_dc_left_16x16_lsx(uint8_t *dst, ptrdiff_t stride, 112 const uint8_t *left, const uint8_t *top); 113 void ff_dc_left_32x32_lsx(uint8_t *dst, ptrdiff_t stride, 114 const uint8_t *left, const uint8_t *top); 115 void ff_dc_top_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 116 const uint8_t *top); 117 void ff_dc_top_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 118 const uint8_t *top); 119 void ff_dc_top_16x16_lsx(uint8_t *dst, ptrdiff_t stride, 120 const uint8_t *left, const uint8_t *top); 121 void ff_dc_top_32x32_lsx(uint8_t *dst, ptrdiff_t stride, 122 const uint8_t *left, const uint8_t *top); 123 void ff_dc_128_16x16_lsx(uint8_t *dst, ptrdiff_t stride, 124 const uint8_t *left, const uint8_t *top); 125 void ff_dc_128_32x32_lsx(uint8_t *dst, ptrdiff_t stride, 126 const uint8_t *left, const uint8_t *top); 127 void ff_dc_127_16x16_lsx(uint8_t *dst, ptrdiff_t stride, 128 const uint8_t *left, const uint8_t *top); 129 void ff_dc_127_32x32_lsx(uint8_t *dst, ptrdiff_t stride, 130 const uint8_t *left, const uint8_t *top); 131 void ff_dc_129_16x16_lsx(uint8_t *dst, ptrdiff_t stride, 132 const uint8_t *left, const uint8_t *top); 133 void ff_dc_129_32x32_lsx(uint8_t *dst, ptrdiff_t stride, 134 const uint8_t *left, const uint8_t *top); 135 void ff_tm_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 136 const uint8_t *top); 137 void ff_tm_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 138 const uint8_t *top); 139 void ff_tm_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 140 const uint8_t *top); 141 void ff_tm_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, 142 const uint8_t *top); 143 void ff_loop_filter_h_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 144 int32_t i, int32_t h); 145 void ff_loop_filter_v_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 146 int32_t i, int32_t h); 147 void ff_loop_filter_h_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 148 int32_t i, int32_t h); 149 void ff_loop_filter_v_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 150 int32_t i, int32_t h); 151 void ff_loop_filter_h_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 152 int32_t i, int32_t h); 153 void ff_loop_filter_v_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 154 int32_t i, int32_t h); 155 void ff_loop_filter_h_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 156 int32_t i, int32_t h); 157 void ff_loop_filter_v_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 158 int32_t i, int32_t h); 159 void ff_loop_filter_h_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 160 int32_t i, int32_t h); 161 void ff_loop_filter_v_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 162 int32_t i, int32_t h); 163 void ff_loop_filter_h_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 164 int32_t i, int32_t h); 165 void ff_loop_filter_v_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 166 int32_t i, int32_t h); 167 void ff_loop_filter_h_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 168 int32_t i, int32_t h); 169 void ff_loop_filter_v_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 170 int32_t i, int32_t h); 171 void ff_loop_filter_h_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 172 int32_t i, int32_t h); 173 void ff_loop_filter_v_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e, 174 int32_t i, int32_t h); 175 void ff_idct_idct_8x8_add_lsx(uint8_t *dst, ptrdiff_t stride, 176 int16_t *block, int eob); 177 void ff_idct_idct_16x16_add_lsx(uint8_t *dst, ptrdiff_t stride, 178 int16_t *block, int eob); 179 void ff_idct_idct_32x32_add_lsx(uint8_t *dst, ptrdiff_t stride, 180 int16_t *block, int eob); 181 182 #endif /* AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H */ 183