FFmpeg  4.3
intmath.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef AVUTIL_ARM_INTMATH_H
22 #define AVUTIL_ARM_INTMATH_H
23 
24 #include <stdint.h>
25 
26 #include "config.h"
27 #include "libavutil/attributes.h"
28 
29 #if HAVE_INLINE_ASM
30 
31 #if HAVE_ARMV6_INLINE
32 
33 #define av_clip_uint8 av_clip_uint8_arm
34 static av_always_inline av_const int av_clip_uint8_arm(int a)
35 {
36  int x;
37  __asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a));
38  return x;
39 }
40 
41 #define av_clip_int8 av_clip_int8_arm
42 static av_always_inline av_const int av_clip_int8_arm(int a)
43 {
44  int x;
45  __asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a));
46  return x;
47 }
48 
49 #define av_clip_uint16 av_clip_uint16_arm
50 static av_always_inline av_const int av_clip_uint16_arm(int a)
51 {
52  int x;
53  __asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a));
54  return x;
55 }
56 
57 #define av_clip_int16 av_clip_int16_arm
58 static av_always_inline av_const int av_clip_int16_arm(int a)
59 {
60  int x;
61  __asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
62  return x;
63 }
64 
65 #define av_clip_intp2 av_clip_intp2_arm
66 static av_always_inline av_const int av_clip_intp2_arm(int a, int p)
67 {
68  unsigned x;
69  __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1));
70  return x;
71 }
72 
73 #define av_clip_uintp2 av_clip_uintp2_arm
74 static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p)
75 {
76  unsigned x;
77  __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
78  return x;
79 }
80 
81 #define av_sat_add32 av_sat_add32_arm
82 static av_always_inline int av_sat_add32_arm(int a, int b)
83 {
84  int r;
85  __asm__ ("qadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
86  return r;
87 }
88 
89 #define av_sat_dadd32 av_sat_dadd32_arm
90 static av_always_inline int av_sat_dadd32_arm(int a, int b)
91 {
92  int r;
93  __asm__ ("qdadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
94  return r;
95 }
96 
97 #define av_sat_sub32 av_sat_sub32_arm
98 static av_always_inline int av_sat_sub32_arm(int a, int b)
99 {
100  int r;
101  __asm__ ("qsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
102  return r;
103 }
104 
105 #define av_sat_dsub32 av_sat_dsub32_arm
106 static av_always_inline int av_sat_dsub32_arm(int a, int b)
107 {
108  int r;
109  __asm__ ("qdsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
110  return r;
111 }
112 
113 #endif /* HAVE_ARMV6_INLINE */
114 
115 #if HAVE_ASM_MOD_Q
116 
117 #define av_clipl_int32 av_clipl_int32_arm
118 static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
119 {
120  int x, y;
121  __asm__ ("adds %1, %R2, %Q2, lsr #31 \n\t"
122  "itet ne \n\t"
123  "mvnne %1, #1<<31 \n\t"
124  "moveq %0, %Q2 \n\t"
125  "eorne %0, %1, %R2, asr #31 \n\t"
126  : "=r"(x), "=&r"(y) : "r"(a) : "cc");
127  return x;
128 }
129 
130 #endif /* HAVE_ASM_MOD_Q */
131 
132 #endif /* HAVE_INLINE_ASM */
133 
134 #endif /* AVUTIL_ARM_INTMATH_H */
av_const
#define av_const
Definition: attributes.h:84
b
#define b
Definition: input.c:41
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
int32_t
int32_t
Definition: audio_convert.c:194
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
attributes.h
r
#define r
Definition: input.c:40
av_always_inline
#define av_always_inline
Definition: attributes.h:49
config.h