ffmpeg | branch: master | Clément Bœsch <u...@pkh.me> | Tue Mar 21 15:19:17 2017 +0100| [6d11b2f6567619cfa40b7e3809572818c7fc41b9] | committer: Clément Bœsch
Merge commit 'b2939a75270bc7e971462648168aa3a2a48c1c8c' * commit 'b2939a75270bc7e971462648168aa3a2a48c1c8c': blockdsp: Change type of array stride parameters to ptrdiff_t Merged-by: Clément Bœsch <u...@pkh.me> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d11b2f6567619cfa40b7e3809572818c7fc41b9 --- libavcodec/blockdsp.c | 6 ++++-- libavcodec/blockdsp.h | 3 ++- libavcodec/mips/blockdsp_mips.h | 8 ++++---- libavcodec/mips/blockdsp_mmi.c | 4 ++-- libavcodec/mips/blockdsp_msa.c | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c index a5c527a..c7efe7e 100644 --- a/libavcodec/blockdsp.c +++ b/libavcodec/blockdsp.c @@ -35,7 +35,8 @@ static void clear_blocks_c(int16_t *blocks) memset(blocks, 0, sizeof(int16_t) * 6 * 64); } -static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h) +static void fill_block16_c(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h) { int i; @@ -45,7 +46,8 @@ static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h) } } -static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h) +static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h) { int i; diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h index 95e1d0f..6e27a02 100644 --- a/libavcodec/blockdsp.h +++ b/libavcodec/blockdsp.h @@ -19,6 +19,7 @@ #ifndef AVCODEC_BLOCKDSP_H #define AVCODEC_BLOCKDSP_H +#include <stddef.h> #include <stdint.h> #include "avcodec.h" @@ -29,7 +30,7 @@ * h for op_pixels_func is limited to { width / 2, width }, * but never larger than 16 and never smaller than 4. */ typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, - uint8_t value, int line_size, int h); + uint8_t value, ptrdiff_t line_size, int h); typedef struct BlockDSPContext { void (*clear_block)(int16_t *block /* align 16 */); diff --git a/libavcodec/mips/blockdsp_mips.h b/libavcodec/mips/blockdsp_mips.h index 9559d40..1742b12 100644 --- a/libavcodec/mips/blockdsp_mips.h +++ b/libavcodec/mips/blockdsp_mips.h @@ -24,13 +24,13 @@ #include "../mpegvideo.h" -void ff_fill_block16_msa(uint8_t *src, uint8_t val, int stride, int height); -void ff_fill_block8_msa(uint8_t *src, uint8_t val, int stride, int height); +void ff_fill_block16_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height); +void ff_fill_block8_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height); void ff_clear_block_msa(int16_t *block); void ff_clear_blocks_msa(int16_t *block); -void ff_fill_block16_mmi(uint8_t *block, uint8_t value, int line_size, int h); -void ff_fill_block8_mmi(uint8_t *block, uint8_t value, int line_size, int h); +void ff_fill_block16_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h); +void ff_fill_block8_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h); void ff_clear_block_mmi(int16_t *block); void ff_clear_blocks_mmi(int16_t *block); diff --git a/libavcodec/mips/blockdsp_mmi.c b/libavcodec/mips/blockdsp_mmi.c index 1035dbb..68641e2 100644 --- a/libavcodec/mips/blockdsp_mmi.c +++ b/libavcodec/mips/blockdsp_mmi.c @@ -24,7 +24,7 @@ #include "blockdsp_mips.h" #include "libavutil/mips/mmiutils.h" -void ff_fill_block16_mmi(uint8_t *block, uint8_t value, int line_size, int h) +void ff_fill_block16_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h) { double ftmp[1]; DECLARE_VAR_ALL64; @@ -48,7 +48,7 @@ void ff_fill_block16_mmi(uint8_t *block, uint8_t value, int line_size, int h) ); } -void ff_fill_block8_mmi(uint8_t *block, uint8_t value, int line_size, int h) +void ff_fill_block8_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h) { double ftmp0; DECLARE_VAR_ALL64; diff --git a/libavcodec/mips/blockdsp_msa.c b/libavcodec/mips/blockdsp_msa.c index 32ac858..2b78c28 100644 --- a/libavcodec/mips/blockdsp_msa.c +++ b/libavcodec/mips/blockdsp_msa.c @@ -65,12 +65,12 @@ static void memset_zero_16width_msa(uint8_t *src, int32_t stride, } } -void ff_fill_block16_msa(uint8_t *src, uint8_t val, int stride, int height) +void ff_fill_block16_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height) { copy_8bit_value_width16_msa(src, val, stride, height); } -void ff_fill_block8_msa(uint8_t *src, uint8_t val, int stride, int height) +void ff_fill_block8_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height) { copy_8bit_value_width8_msa(src, val, stride, height); } ====================================================================== diff --cc libavcodec/mips/blockdsp_mips.h index 9559d40,0000000..1742b12 mode 100644,000000..100644 --- a/libavcodec/mips/blockdsp_mips.h +++ b/libavcodec/mips/blockdsp_mips.h @@@ -1,37 -1,0 +1,37 @@@ +/* + * Copyright (c) 2015 Parag Salasakar (parag.salasa...@imgtec.com) + * Zhou Xiaoyong <zhouxiaoy...@loongson.cn> + * + * 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 + */ + +#ifndef AVCODEC_MIPS_BLOCKDSP_MIPS_H +#define AVCODEC_MIPS_BLOCKDSP_MIPS_H + +#include "../mpegvideo.h" + - void ff_fill_block16_msa(uint8_t *src, uint8_t val, int stride, int height); - void ff_fill_block8_msa(uint8_t *src, uint8_t val, int stride, int height); ++void ff_fill_block16_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height); ++void ff_fill_block8_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height); +void ff_clear_block_msa(int16_t *block); +void ff_clear_blocks_msa(int16_t *block); + - void ff_fill_block16_mmi(uint8_t *block, uint8_t value, int line_size, int h); - void ff_fill_block8_mmi(uint8_t *block, uint8_t value, int line_size, int h); ++void ff_fill_block16_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h); ++void ff_fill_block8_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h); +void ff_clear_block_mmi(int16_t *block); +void ff_clear_blocks_mmi(int16_t *block); + +#endif // #ifndef AVCODEC_MIPS_BLOCKDSP_MIPS_H diff --cc libavcodec/mips/blockdsp_mmi.c index 1035dbb,0000000..68641e2 mode 100644,000000..100644 --- a/libavcodec/mips/blockdsp_mmi.c +++ b/libavcodec/mips/blockdsp_mmi.c @@@ -1,159 -1,0 +1,159 @@@ +/* + * Loongson SIMD optimized blockdsp + * + * Copyright (c) 2015 Loongson Technology Corporation Limited + * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoy...@loongson.cn> + * + * 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 + */ + +#include "blockdsp_mips.h" +#include "libavutil/mips/mmiutils.h" + - void ff_fill_block16_mmi(uint8_t *block, uint8_t value, int line_size, int h) ++void ff_fill_block16_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h) +{ + double ftmp[1]; + DECLARE_VAR_ALL64; + + __asm__ volatile ( + "mtc1 %[value], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "1: \n\t" + MMI_SDC1(%[ftmp0], %[block], 0x00) + PTR_ADDI "%[h], %[h], -0x01 \n\t" + MMI_SDC1(%[ftmp0], %[block], 0x08) + PTR_ADDU "%[block], %[block], %[line_size] \n\t" + "bnez %[h], 1b \n\t" + : [ftmp0]"=&f"(ftmp[0]), + RESTRICT_ASM_ALL64 + [block]"+&r"(block), [h]"+&r"(h) + : [value]"r"(value), [line_size]"r"((mips_reg)line_size) + : "memory" + ); +} + - void ff_fill_block8_mmi(uint8_t *block, uint8_t value, int line_size, int h) ++void ff_fill_block8_mmi(uint8_t *block, uint8_t value, ptrdiff_t line_size, int h) +{ + double ftmp0; + DECLARE_VAR_ALL64; + + __asm__ volatile ( + "mtc1 %[value], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "punpcklbh %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "1: \n\t" + MMI_SDC1(%[ftmp0], %[block], 0x00) + PTR_ADDI "%[h], %[h], -0x01 \n\t" + PTR_ADDU "%[block], %[block], %[line_size] \n\t" + "bnez %[h], 1b \n\t" + : [ftmp0]"=&f"(ftmp0), + RESTRICT_ASM_ALL64 + [block]"+&r"(block), [h]"+&r"(h) + : [value]"r"(value), [line_size]"r"((mips_reg)line_size) + : "memory" + ); +} + +void ff_clear_block_mmi(int16_t *block) +{ + double ftmp[2]; + + __asm__ volatile ( + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "xor %[ftmp1], %[ftmp1], %[ftmp1] \n\t" + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x00) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x10) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x20) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x30) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x40) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x50) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x60) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x70) + : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]) + : [block]"r"(block) + : "memory" + ); +} + +void ff_clear_blocks_mmi(int16_t *block) +{ + double ftmp[2]; + + __asm__ volatile ( + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "xor %[ftmp1], %[ftmp1], %[ftmp1] \n\t" + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x00) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x10) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x20) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x30) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x40) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x50) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x60) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x70) + + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x80) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x90) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xa0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xb0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xc0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xd0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xe0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0xf0) + + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x100) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x110) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x120) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x130) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x140) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x150) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x160) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x170) + + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x180) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x190) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1a0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1b0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1c0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1d0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1e0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x1f0) + + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x200) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x210) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x220) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x230) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x240) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x250) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x260) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x270) + + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x280) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x290) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2a0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2b0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2c0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2d0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2e0) + MMI_SQC1(%[ftmp0], %[ftmp1], %[block], 0x2f0) + : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]) + : [block]"r"((uint64_t *)block) + : "memory" + ); +} diff --cc libavcodec/mips/blockdsp_msa.c index 32ac858,0000000..2b78c28 mode 100644,000000..100644 --- a/libavcodec/mips/blockdsp_msa.c +++ b/libavcodec/mips/blockdsp_msa.c @@@ -1,86 -1,0 +1,86 @@@ +/* + * Copyright (c) 2015 Parag Salasakar (parag.salasa...@imgtec.com) + * + * 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 + */ + +#include "libavutil/mips/generic_macros_msa.h" +#include "blockdsp_mips.h" + +static void copy_8bit_value_width8_msa(uint8_t *src, uint8_t val, + int32_t src_stride, int32_t height) +{ + int32_t cnt; + uint64_t dst0; + v16u8 val0; + + val0 = (v16u8) __msa_fill_b(val); + dst0 = __msa_copy_u_d((v2i64) val0, 0); + + for (cnt = (height >> 2); cnt--;) { + SD4(dst0, dst0, dst0, dst0, src, src_stride); + src += (4 * src_stride); + } +} + +static void copy_8bit_value_width16_msa(uint8_t *src, uint8_t val, + int32_t src_stride, int32_t height) +{ + int32_t cnt; + v16u8 val0; + + val0 = (v16u8) __msa_fill_b(val); + + for (cnt = (height >> 3); cnt--;) { + ST_UB8(val0, val0, val0, val0, val0, val0, val0, val0, src, src_stride); + src += (8 * src_stride); + } +} + +static void memset_zero_16width_msa(uint8_t *src, int32_t stride, + int32_t height) +{ + int8_t cnt; + v16u8 zero = { 0 }; + + for (cnt = (height / 2); cnt--;) { + ST_UB(zero, src); + src += stride; + ST_UB(zero, src); + src += stride; + } +} + - void ff_fill_block16_msa(uint8_t *src, uint8_t val, int stride, int height) ++void ff_fill_block16_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height) +{ + copy_8bit_value_width16_msa(src, val, stride, height); +} + - void ff_fill_block8_msa(uint8_t *src, uint8_t val, int stride, int height) ++void ff_fill_block8_msa(uint8_t *src, uint8_t val, ptrdiff_t stride, int height) +{ + copy_8bit_value_width8_msa(src, val, stride, height); +} + +void ff_clear_block_msa(int16_t *block) +{ + memset_zero_16width_msa((uint8_t *) block, 16, 8); +} + +void ff_clear_blocks_msa(int16_t *block) +{ + memset_zero_16width_msa((uint8_t *) block, 16, 8 * 6); +} _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog