Spaces:
Runtime error
Runtime error
/* | |
* MIPS SIMD optimized H.264 deblocking code | |
* | |
* Copyright (c) 2020 Loongson Technology Corporation Limited | |
* Gu Xiwei <[email protected]> | |
* | |
* This file is part of FFmpeg. | |
* | |
* FFmpeg is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public | |
* License as published by the Free Software Foundation; either | |
* version 2.1 of the License, or (at your option) any later version. | |
* | |
* FFmpeg is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
* Lesser General Public License for more details. | |
* | |
* You should have received a copy of the GNU Lesser General Public | |
* License along with FFmpeg; if not, write to the Free Software | |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
void ff_h264_loop_filter_strength_msa(int16_t bS[2][4][4], uint8_t nnz[40], | |
int8_t ref[2][40], int16_t mv[2][40][2], | |
int bidir, int edges, int step, | |
int mask_mv0, int mask_mv1, int field) | |
{ | |
v16i8 out; | |
v16i8 ref_0, ref_1, ref_2, ref_3; | |
v16i8 tmp_0, tmp_1; | |
v8i16 tmp_2, tmp_3, tmp_4, tmp_5, tmp_6; | |
v16i8 cnst_0, cnst_1, cnst_2; | |
v16i8 zero = { 0 }; | |
v16i8 one = __msa_fill_b(0xff); | |
if (field) { | |
cnst_0 = (v16i8)__msa_fill_h(0x206); | |
cnst_1 = (v16i8)__msa_fill_h(0x103); | |
cnst_2 = (v16i8)__msa_fill_h(0x101); | |
} else { | |
cnst_0 = __msa_fill_b(0x6); | |
cnst_1 = __msa_fill_b(0x3); | |
cnst_2 = __msa_fill_b(0x1); | |
} | |
step <<= 3; | |
edges <<= 3; | |
h264_loop_filter_strength_iteration_msa(edges, step, mask_mv1, 1, -8, zero); | |
h264_loop_filter_strength_iteration_msa(32, 8, mask_mv0, 0, -1, one); | |
LD_SB2((int8_t*)bS, 16, tmp_0, tmp_1); | |
tmp_2 = (v8i16)__msa_ilvl_d((v2i64)tmp_0, (v2i64)tmp_0); | |
tmp_3 = (v8i16)__msa_ilvl_d((v2i64)tmp_1, (v2i64)tmp_1); | |
TRANSPOSE4x4_SH_SH(tmp_0, tmp_2, tmp_1, tmp_3, tmp_2, tmp_3, tmp_4, tmp_5); | |
tmp_0 = (v16i8)__msa_ilvr_d((v2i64)tmp_3, (v2i64)tmp_2); | |
tmp_1 = (v16i8)__msa_ilvr_d((v2i64)tmp_5, (v2i64)tmp_4); | |
ST_SB2(tmp_0, tmp_1, (int8_t*)bS, 16); | |
} | |