[FFmpeg-devel] [PATCH 2/3] libavcodec/mips: Fix build errors reported by clang

yinshiyou-hf at loongson.cn yinshiyou-hf at loongson.cn
Fri May 28 13:19:04 EEST 2021




> -----原始邮件-----
> 发件人: "Jin Bo" <jinbo at loongson.cn>
> 发送时间: 2021-05-28 10:04:40 (星期五)
> 收件人: ffmpeg-devel at ffmpeg.org
> 抄送: "Jin Bo" <jinbo at loongson.cn>
> 主题: [FFmpeg-devel] [PATCH 2/3] libavcodec/mips: Fix build errors reported by clang
> 
> Clang is more strict on the type of asm operands, float or double
> type variable should use constraint 'f', integer variable should
> use constraint 'r'.
> 
> Signed-off-by: Jin Bo <jinbo at loongson.cn>
> ---
>  libavcodec/mips/constants.c      |  89 +++++++------
>  libavcodec/mips/constants.h      |  88 +++++++------
>  libavcodec/mips/h264chroma_mmi.c | 157 +++++++++++------------
>  libavcodec/mips/h264dsp_mmi.c    |  20 +--
>  libavcodec/mips/h264pred_mmi.c   |  23 ++--
>  libavcodec/mips/h264qpel_mmi.c   |  34 ++---
>  libavcodec/mips/hevcdsp_mmi.c    |  59 +++++----
>  libavcodec/mips/idctdsp_mmi.c    |   2 +-
>  libavcodec/mips/mpegvideo_mmi.c  |  20 +--
>  libavcodec/mips/vc1dsp_mmi.c     | 176 +++++++++++++-------------
>  libavcodec/mips/vp8dsp_mmi.c     | 263 +++++++++++++++++++++++++++++----------
>  libavutil/mips/asmdefs.h         |   8 ++
>  12 files changed, 536 insertions(+), 403 deletions(-)
> 
> diff --git a/libavcodec/mips/constants.c b/libavcodec/mips/constants.c
> index 8c990b6..6a8f1a5 100644
> --- a/libavcodec/mips/constants.c
> +++ b/libavcodec/mips/constants.c
> @@ -19,50 +19,49 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
> -#include "config.h"
> -#include "libavutil/mem_internal.h"
> +#include "libavutil/intfloat.h"
>  #include "constants.h"
>  
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_1) =       {0x0001000100010001ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_2) =       {0x0002000200020002ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_3) =       {0x0003000300030003ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_4) =       {0x0004000400040004ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_5) =       {0x0005000500050005ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_6) =       {0x0006000600060006ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_8) =       {0x0008000800080008ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_9) =       {0x0009000900090009ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_10) =      {0x000A000A000A000AULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_12) =      {0x000C000C000C000CULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) =      {0x000F000F000F000FULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_16) =      {0x0010001000100010ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_17) =      {0x0011001100110011ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_18) =      {0x0012001200120012ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_20) =      {0x0014001400140014ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_22) =      {0x0016001600160016ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_28) =      {0x001C001C001C001CULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_32) =      {0x0020002000200020ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_53) =      {0x0035003500350035ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_64) =      {0x0040004000400040ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) =     {0x0080008000800080ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_512) =     {0x0200020002000200ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_m8tom5) =  {0xFFFBFFFAFFF9FFF8ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_m4tom1) =  {0xFFFFFFFEFFFDFFFCULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_1to4) =    {0x0004000300020001ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_5to8) =    {0x0008000700060005ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_0to3) =    {0x0003000200010000ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_4to7) =    {0x0007000600050004ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_8tob) =    {0x000b000a00090008ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pw_ctof) =    {0x000f000e000d000cULL};
> -
> -DECLARE_ALIGNED(8, const uint64_t, ff_pb_1) =       {0x0101010101010101ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pb_3) =       {0x0303030303030303ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pb_80) =      {0x8080808080808080ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pb_A1) =      {0xA1A1A1A1A1A1A1A1ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_pb_FE) =      {0xFEFEFEFEFEFEFEFEULL};
> -
> -DECLARE_ALIGNED(8, const uint64_t, ff_rnd) =        {0x0004000400040004ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_rnd2) =       {0x0040004000400040ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_rnd3) =       {0x0020002000200020ULL};
> -
> -DECLARE_ALIGNED(8, const uint64_t, ff_wm1010) =     {0xFFFF0000FFFF0000ULL};
> -DECLARE_ALIGNED(8, const uint64_t, ff_d40000) =     {0x0000000000040000ULL};
> +union av_intfloat64 ff_pw_1 =      {0x0001000100010001ULL};
> +union av_intfloat64 ff_pw_2 =      {0x0002000200020002ULL};
> +union av_intfloat64 ff_pw_3 =      {0x0003000300030003ULL};
> +union av_intfloat64 ff_pw_4 =      {0x0004000400040004ULL};
> +union av_intfloat64 ff_pw_5 =      {0x0005000500050005ULL};
> +union av_intfloat64 ff_pw_6 =      {0x0006000600060006ULL};
> +union av_intfloat64 ff_pw_8 =      {0x0008000800080008ULL};
> +union av_intfloat64 ff_pw_9 =      {0x0009000900090009ULL};
> +union av_intfloat64 ff_pw_10 =     {0x000A000A000A000AULL};
> +union av_intfloat64 ff_pw_12 =     {0x000C000C000C000CULL};
> +union av_intfloat64 ff_pw_15 =     {0x000F000F000F000FULL};
> +union av_intfloat64 ff_pw_16 =     {0x0010001000100010ULL};
> +union av_intfloat64 ff_pw_17 =     {0x0011001100110011ULL};
> +union av_intfloat64 ff_pw_18 =     {0x0012001200120012ULL};
> +union av_intfloat64 ff_pw_20 =     {0x0014001400140014ULL};
> +union av_intfloat64 ff_pw_22 =     {0x0016001600160016ULL};
> +union av_intfloat64 ff_pw_28 =     {0x001C001C001C001CULL};
> +union av_intfloat64 ff_pw_32 =     {0x0020002000200020ULL};
> +union av_intfloat64 ff_pw_53 =     {0x0035003500350035ULL};
> +union av_intfloat64 ff_pw_64 =     {0x0040004000400040ULL};
> +union av_intfloat64 ff_pw_128 =    {0x0080008000800080ULL};
> +union av_intfloat64 ff_pw_512 =    {0x0200020002000200ULL};
> +union av_intfloat64 ff_pw_m8tom5 = {0xFFFBFFFAFFF9FFF8ULL};
> +union av_intfloat64 ff_pw_m4tom1 = {0xFFFFFFFEFFFDFFFCULL};
> +union av_intfloat64 ff_pw_1to4 =   {0x0004000300020001ULL};
> +union av_intfloat64 ff_pw_5to8 =   {0x0008000700060005ULL};
> +union av_intfloat64 ff_pw_0to3 =   {0x0003000200010000ULL};
> +union av_intfloat64 ff_pw_4to7 =   {0x0007000600050004ULL};
> +union av_intfloat64 ff_pw_8tob =   {0x000b000a00090008ULL};
> +union av_intfloat64 ff_pw_ctof =   {0x000f000e000d000cULL};
> +union av_intfloat64 ff_pw_32_1 =   {0x0000000100000001ULL};
> +union av_intfloat64 ff_pw_32_4 =   {0x0000000400000004ULL};
> +union av_intfloat64 ff_pw_32_64 =  {0x0000004000000040ULL};
> +union av_intfloat64 ff_pb_1 =      {0x0101010101010101ULL};
> +union av_intfloat64 ff_pb_3 =      {0x0303030303030303ULL};
> +union av_intfloat64 ff_pb_80 =     {0x8080808080808080ULL};
> +union av_intfloat64 ff_pb_A1 =     {0xA1A1A1A1A1A1A1A1ULL};
> +union av_intfloat64 ff_pb_FE =     {0xFEFEFEFEFEFEFEFEULL};
> +union av_intfloat64 ff_rnd =       {0x0004000400040004ULL};
> +union av_intfloat64 ff_rnd2 =      {0x0040004000400040ULL};
> +union av_intfloat64 ff_rnd3 =      {0x0020002000200020ULL};
> +union av_intfloat64 ff_ff_wm1010 = {0xFFFF0000FFFF0000ULL};
> +union av_intfloat64 ff_d40000 =    {0x0000000000040000ULL};
> diff --git a/libavcodec/mips/constants.h b/libavcodec/mips/constants.h
> index 2604559..bd86cd1 100644
> --- a/libavcodec/mips/constants.h
> +++ b/libavcodec/mips/constants.h
> @@ -22,50 +22,48 @@
>  #ifndef AVCODEC_MIPS_CONSTANTS_H
>  #define AVCODEC_MIPS_CONSTANTS_H
>  
> -#include <stdint.h>
> -
> -extern const uint64_t ff_pw_1;
> -extern const uint64_t ff_pw_2;
> -extern const uint64_t ff_pw_3;
> -extern const uint64_t ff_pw_4;
> -extern const uint64_t ff_pw_5;
> -extern const uint64_t ff_pw_6;
> -extern const uint64_t ff_pw_8;
> -extern const uint64_t ff_pw_9;
> -extern const uint64_t ff_pw_10;
> -extern const uint64_t ff_pw_12;
> -extern const uint64_t ff_pw_15;
> -extern const uint64_t ff_pw_16;
> -extern const uint64_t ff_pw_17;
> -extern const uint64_t ff_pw_18;
> -extern const uint64_t ff_pw_20;
> -extern const uint64_t ff_pw_22;
> -extern const uint64_t ff_pw_28;
> -extern const uint64_t ff_pw_32;
> -extern const uint64_t ff_pw_53;
> -extern const uint64_t ff_pw_64;
> -extern const uint64_t ff_pw_128;
> -extern const uint64_t ff_pw_512;
> -extern const uint64_t ff_pw_m8tom5;
> -extern const uint64_t ff_pw_m4tom1;
> -extern const uint64_t ff_pw_1to4;
> -extern const uint64_t ff_pw_5to8;
> -extern const uint64_t ff_pw_0to3;
> -extern const uint64_t ff_pw_4to7;
> -extern const uint64_t ff_pw_8tob;
> -extern const uint64_t ff_pw_ctof;
> -
> -extern const uint64_t ff_pb_1;
> -extern const uint64_t ff_pb_3;
> -extern const uint64_t ff_pb_80;
> -extern const uint64_t ff_pb_A1;
> -extern const uint64_t ff_pb_FE;
> -
> -extern const uint64_t ff_rnd;
> -extern const uint64_t ff_rnd2;
> -extern const uint64_t ff_rnd3;
> -
> -extern const uint64_t ff_wm1010;
> -extern const uint64_t ff_d40000;
> +extern union av_intfloat64 ff_pw_1;
> +extern union av_intfloat64 ff_pw_2;
> +extern union av_intfloat64 ff_pw_3;
> +extern union av_intfloat64 ff_pw_4;
> +extern union av_intfloat64 ff_pw_5;
> +extern union av_intfloat64 ff_pw_6;
> +extern union av_intfloat64 ff_pw_8;
> +extern union av_intfloat64 ff_pw_9;
> +extern union av_intfloat64 ff_pw_10;
> +extern union av_intfloat64 ff_pw_12;
> +extern union av_intfloat64 ff_pw_15;
> +extern union av_intfloat64 ff_pw_16;
> +extern union av_intfloat64 ff_pw_17;
> +extern union av_intfloat64 ff_pw_18;
> +extern union av_intfloat64 ff_pw_20;
> +extern union av_intfloat64 ff_pw_22;
> +extern union av_intfloat64 ff_pw_28;
> +extern union av_intfloat64 ff_pw_32;
> +extern union av_intfloat64 ff_pw_53;
> +extern union av_intfloat64 ff_pw_64;
> +extern union av_intfloat64 ff_pw_128;
> +extern union av_intfloat64 ff_pw_512;
> +extern union av_intfloat64 ff_pw_m8tom5;
> +extern union av_intfloat64 ff_pw_m4tom1;
> +extern union av_intfloat64 ff_pw_1to4;
> +extern union av_intfloat64 ff_pw_5to8;
> +extern union av_intfloat64 ff_pw_0to3;
> +extern union av_intfloat64 ff_pw_4to7;
> +extern union av_intfloat64 ff_pw_8tob;
> +extern union av_intfloat64 ff_pw_ctof;
> +extern union av_intfloat64 ff_pw_32_1;
> +extern union av_intfloat64 ff_pw_32_4;
> +extern union av_intfloat64 ff_pw_32_64;
> +extern union av_intfloat64 ff_pb_1;
> +extern union av_intfloat64 ff_pb_3;
> +extern union av_intfloat64 ff_pb_80;
> +extern union av_intfloat64 ff_pb_A1;
> +extern union av_intfloat64 ff_pb_FE;
> +extern union av_intfloat64 ff_rnd;
> +extern union av_intfloat64 ff_rnd2;
> +extern union av_intfloat64 ff_rnd3;
> +extern union av_intfloat64 ff_wm1010;
> +extern union av_intfloat64 ff_d40000;
>  
>  #endif /* AVCODEC_MIPS_CONSTANTS_H */
……

keep these variables as const will be better. </stdint.h></jinbo at loongson.cn></jinbo at loongson.cn></jinbo at loongson.cn>


More information about the ffmpeg-devel mailing list