2 * Copyright (c) 2015 Parag Salasakar (parag.salasakar@imgtec.com)
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "libavutil/mips/generic_macros_msa.h"
22 #include "blockdsp_mips.h"
24 static void copy_8bit_value_width8_msa(uint8_t *src, uint8_t val,
25 int32_t src_stride, int32_t height)
31 val0 = (v16u8) __msa_fill_b(val);
32 dst0 = __msa_copy_u_d((v2i64) val0, 0);
34 for (cnt = (height >> 2); cnt--;) {
35 SD4(dst0, dst0, dst0, dst0, src, src_stride);
36 src += (4 * src_stride);
40 static void copy_8bit_value_width16_msa(uint8_t *src, uint8_t val,
41 int32_t src_stride, int32_t height)
46 val0 = (v16u8) __msa_fill_b(val);
48 for (cnt = (height >> 3); cnt--;) {
49 ST_UB8(val0, val0, val0, val0, val0, val0, val0, val0, src, src_stride);
50 src += (8 * src_stride);
54 static void memset_zero_16width_msa(uint8_t *src, int32_t stride,
60 for (cnt = (height / 2); cnt--;) {
68 void ff_fill_block16_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height)
70 copy_8bit_value_width16_msa(src, val, stride, height);
73 void ff_fill_block8_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height)
75 copy_8bit_value_width8_msa(src, val, stride, height);
78 void ff_clear_block_msa(int16_t *block)
80 memset_zero_16width_msa((uint8_t *) block, 16, 8);
83 void ff_clear_blocks_msa(int16_t *block)
85 memset_zero_16width_msa((uint8_t *) block, 16, 8 * 6);