zoukankan      html  css  js  c++  java
  • ffmpeg-utils

    1. 说明
    2. Syntax 语法
    2.1 Quoting and escaping 引用和转义
    2.2 Date 日期
    2.3 Time duration 持续时间
    2.4 Video size 视频大小
    2.5 Video rate 视频速率
    2.6 Ratio 比率
    2.7 Color 颜色
    2.8 Channel Layout 通道布局
    2.8.1 各个频道由 id 标识,如下表所示:
    2.8.2 可以使用以下标识符指定标准通道布局组合:
    2.8.3 各频道id空间图示: 
    2.8.4 自定义通道布局
    3 Expression Evaluation 表达式评估
    3.1 functions
    3.2 constants 常数
    3.3. International System prefixes 国际系统前缀
     
    下文是ffmpeg官方页面(2021-06-17)的google自动翻译, 请参阅如下原文。

    1. 说明

    本文档描述了 libavutil 库提供的一些通用功能和实用程序。

    2. Syntax 语法

    本节记录了 FFmpeg 库和工具使用的语法和格式。

    2.1 Quoting and escaping 引用和转义

    除非明确指定,FFmpeg 采用以下引用和转义机制。应用以下规则:
    • ‘'’ and ‘’ 是特殊字符(分别用于引用和转义)。除了它们之外,根据使用转义和引用的特定语法,可能还有其他特殊字符。
    • 特殊字符通过在它前面加上 ‘’ 进行转义。
    • 包含在 ‘''’  之间的所有字符 字面上包含在解析的字符串中。引号字符 ''' 本身不能被引用,因此您可能需要关闭引用并转义它。
    • 除非转义或引用,否则将从解析的字符串中删除前导和尾随空格。
    请注意,在使用命令行或脚本时,您可能需要添加第二级转义,这取决于所采用的 shell 语言的语法。
    在av_get_token定义 的函数libavutil / avstring.h 可用于根据上面定义的规则解析引用或转义的标记。
    工具 tools/ffescape 在FFmpeg 源代码树中的 可用于自动引用或转义脚本中的字符串。

    2.2 Date 日期

    接受的语法是:
    [(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]
    now
    如果值为“now”,则表示当前时间。
    时间是本地时间,除非附加了 Z,在这种情况下,它被解释为 UTC。如果未指定年月日部分,则采用当前年月日。

    2.3 Time duration 持续时间

    有两种可接受的语法来表示持续时间。
    [-][HH:]MM:SS[.m...]
    HH表示小时数,MM表示分钟数,最多 2 位,SS表示秒数,最多 2 位。末尾的m表示SS 的十进制值 。
    或者
    [-]S+[.m...][s|ms|us]
    S表示秒数,带有可选的小数部分 m。可选的文字后缀 's', 'ms', 'us' 表示将值分别解释为秒、毫秒或微秒。
    在这两个表达式中,可选的 '-' 表示负持续时间。
     
    Examples
    The following examples are all valid time duration:
    ‘55’55 seconds
    ‘0.2’0.2 seconds
    ‘200ms’200 milliseconds, that’s 0.2s
    ‘200000us’200000 microseconds, that’s 0.2s
    ‘12:03:45’12 hours, 03 minutes and 45 seconds
    ‘23.189’23.189 seconds

    2.4 Video size 视频大小

    指定源视频的尺寸, 它可以是宽度x高度形式的字符串, 或者是尺寸缩写的名称。以下缩写被认可:
    name size X*Y ↓ y/(x/16);16:?
    sqcif 128x96 12288 12
    qqvga 160x120 19200 12
    qcif 176x144 25344 13.0909
    hqvga 240x160 38400 10.6667
    cga 320x200 64000 10
    qvga 320x240 76800 12
    qntsc 352x240 84480 10.9091
    film 352x240 84480 10.9091
    ntsc-film 352x240 84480 10.9091
    wqvga 400x240 96000 9.6
    qpal 352x288 101376 13.0909
    cif 352x288 101376 13.0909
    fwqvga 432x240 103680 8.8889
    hvga 480x320 153600 10.6667
    ega 640x350 224000 8.75
    nhd 640x360 230400 9
    sntsc 640x480 307200 12
    vga 640x480 307200 12
    ntsc 720x480 345600 10.6667
    4cif 704x576 405504 13.0909
    wvga 852x480 408960 9.0141
    hd480 852x480 408960 9.0141
    pal 720x576 414720 12.8
    spal 768x576 442368 12
    svga 800x600 480000 12
    qhd 960x540 518400 9
    xga 1024x768 786432 12
    hd720 1280x720 921600 9
    wxga 1366x768 1049088 8.9956
    sxga 1280x1024 1310720 12.8
    16cif 1408x1152 1622016 13.0909
    wsxga 1600x1024 1638400 10.24
    2kscope 2048x858 1757184 6.703
    uxga 1600x1200 1920000 12
    hd1080 1920x1080 2073600 9
    2kflat 1998x1080 2157840 8.6486
    2k 2048x1080 2211840 8.438
    2kdci 2048x1080 2211840 8.438
    wuxga 1920x1200 2304000 10
    qxga 2048x1536 3145728 12
    woxga 2560x1600 4096000 10
    qsxga 2560x2048 5242880 12.8
    wqsxga 3200x2048 6553600 10.24
    4kscope 4096x1716 7028736 6.703
    uhd2160 3840x2160 8294400 9
    4kflat 3996x2160 8631360 8.6486
    4k 4096x2160 8847360 8.438
    4kdci 4096x2160 8847360 8.438
    wquxga 3840x2400 9216000 10
    hsxga 5120x4096 20971520 12.8
    whsxga 6400x4096 26214400 10.24
    uhd4320 7680x4320 33177600 9
    whuxga 7680x4800 36864000 10

    2.5 Video rate 视频速率

    指定视频的帧速率,表示为每秒生成的帧数。它必须是格式为frame_rate_num / frame_rate_den的字符串 、整数、浮点数或有效的视频帧速率缩写。
    以下缩写被认可:
    ‘ntsc’30000/1001
    ‘pal’25/1
    ‘qntsc’30000/1001
    ‘qpal’25/1
    ‘sntsc’30000/1001
    ‘spal’25/1
    ‘film’24/1
    ‘ntsc-film’24000/1001

    2.6 Ratio 比率

    比率可以表示为表达式,或以分子:分母的形式表示 。
    请注意,无限 (1/0) 或负值的比率被认为是有效的,因此如果要排除这些值,则应检查返回值。
    未定义的值可以使用“0:0”字符串表示。

    2.7 Color 颜色

    它可以是如下定义的颜色名称(不区分大小写匹配)或 [0x|#]RRGGBB[AA]序列,可能后跟 @ 和表示 alpha 分量的字符串。
    alpha分量可以是由“0x”后跟一个十六进制数或0.0到1.0之间的十进制数组成的字符串,表示不透明度值('0x00' 或者 '0.0' 表示完全透明,'0xff' 或者 '1.0' 完全不透明)。如果未指定 alpha 分量,则 '0xff' 假设。
    字符串 'random' 将产生随机颜色。
    识别以下颜色名称:
    $ ffmpeg -colors color cn #RRGGBB
    AliceBlue #f0f8ff 爱丽丝蓝 #f0f8ff
    AntiqueWhite #faebd7 古董白 #faebd7
    Aqua #00ffff 水族 #00ffff
    Aquamarine #7fffd4 蓝晶 #7fffd4
    Azure #f0ffff 天蓝色 #f0ffff
    Beige #f5f5dc 浅褐色的 #f5f5dc
    Bisque #ffe4c4 浓汤 #ffe4c4
    Black #000000 黑色的 #000000
    BlanchedAlmond #ffebcd 杏仁白 #ffebcd
    Blue #0000ff 蓝色的 #0000ff
    BlueViolet #8a2be2 紫罗兰色 #8a2be2
    Brown #a52a2a 棕色的 #a52a2a
    BurlyWood #deb887 原木色 #deb887
    CadetBlue #5f9ea0 藏青 #5f9ea0
    Chartreuse #7fff00 黄绿色 #7fff00
    Chocolate #d2691e 巧克力 #d2691e
    Coral #ff7f50 珊瑚 #ff7f50
    CornflowerBlue #6495ed 矢车菊蓝 #6495ed
    Cornsilk #fff8dc 玉米穗黄 #fff8dc
    Crimson #dc143c 深红色 #dc143c
    Cyan #00ffff 青色 #00ffff
    DarkBlue #00008b 深蓝 #00008b
    DarkCyan #008b8b 深青色 #008b8b
    DarkGoldenRod #b8860b 深金黄 #b8860b
    DarkGray #a9a9a9 深灰色 #a9a9a9
    DarkGreen #006400 深绿色 #006400
    DarkKhaki #bdb76b 深卡其色 #bdb76b
    DarkMagenta #8b008b 深洋红色 #8b008b
    DarkOliveGreen #556b2f 深橄榄绿 #556b2f
    Darkorange #ff8c00 深橙色 #ff8c00
    DarkOrchid #9932cc 深兰花紫 #9932cc
    DarkRed #8b0000 深红 #8b0000
    DarkSalmon #e9967a 深橙红 #e9967a
    DarkSeaGreen #8fbc8f 海藻绿 #8fbc8f
    DarkSlateBlue #483d8b 深青蓝 #483d8b
    DarkSlateGray #2f4f4f 深青灰 #2f4f4f
    DarkTurquoise #00ced1 深粉蓝 #00ced1
    DarkViolet #9400d3 暗紫 #9400d3
    DeepPink #ff1493 深粉红 #ff1493
    DeepSkyBlue #00bfff 深蓝 #00bfff
    DimGray #696969 暗灰色 #696969
    DodgerBlue #1e90ff 道奇蓝 #1e90ff
    FireBrick #b22222 耐火砖 #b22222
    FloralWhite #fffaf0 花白 #fffaf0
    ForestGreen #228b22 森林绿 #228b22
    Fuchsia #ff00ff 紫红色 #ff00ff
    Gainsboro #dcdcdc 亮灰 #dcdcdc
    GhostWhite #f8f8ff 鬼白 #f8f8ff
    Gold #ffd700 金色的 #ffd700
    GoldenRod #daa520 金棒 #daa520
    Gray #808080 灰色的 #808080
    Green #008000 绿色的 #008000
    GreenYellow #adff2f 黄绿色 #adff2f
    HoneyDew #f0fff0 甘露 #f0fff0
    HotPink #ff69b4 亮粉色 #ff69b4
    IndianRed #cd5c5c 印度红 #cd5c5c
    Indigo #4b0082 靛青 #4b0082
    Ivory #fffff0 象牙 #fffff0
    Khaki #f0e68c 卡其色 #f0e68c
    Lavender #e6e6fa 薰衣草 #e6e6fa
    LavenderBlush #fff0f5 淡紫 #fff0f5
    LawnGreen #7cfc00 草坪绿 #7cfc00
    LemonChiffon #fffacd 粉黄 #fffacd
    LightBlue #add8e6 浅蓝 #add8e6
    LightCoral #f08080 珊瑚色 #f08080
    LightCyan #e0ffff 淡青色 #e0ffff
    LightGoldenRodYellow #fafad2 浅金黄色 #fafad2
    LightGreen #90ee90 浅绿色 #90ee90
    LightGrey #d3d3d3 浅灰色 #d3d3d3
    LightPink #ffb6c1 淡粉色 #ffb6c1
    LightSalmon #ffa07a 橙红 #ffa07a
    LightSeaGreen #20b2aa 光海绿 #20b2aa
    LightSkyBlue #87cefa 淡天蓝 #87cefa
    LightSlateGray #778899 浅灰色 #778899
    LightSteelBlue #b0c4de 轻钢蓝 #b0c4de
    LightYellow #ffffe0 淡黄色 #ffffe0
    Lime #00ff00 酸橙 #00ff00
    LimeGreen #32cd32 青柠 #32cd32
    Linen #faf0e6 亚麻布 #faf0e6
    Magenta #ff00ff 品红 #ff00ff
    Maroon #800000 栗色 #800000
    MediumAquaMarine #66cdaa 草绿 #66cdaa
    MediumBlue #0000cd 暗蓝 #0000cd
    MediumOrchid #ba55d3 暗兰花 #ba55d3
    MediumPurple #9370d8 暗紫 #9370d8
    MediumSeaGreen #3cb371 暗海藻 #3cb371
    MediumSlateBlue #7b68ee 青蓝 #7b68ee
    MediumSpringGreen #00fa9a 嫩绿 #00fa9a
    MediumTurquoise #48d1cc 粉蓝 #48d1cc
    MediumVioletRed #c71585 暗紫 #c71585
    MidnightBlue #191970 黑蓝 #191970
    MintCream #f5fffa 薄荷乳白 #f5fffa
    MistyRose #ffe4e1 粉玫瑰红 #ffe4e1
    Moccasin #ffe4b5 莫卡辛 #ffe4b5
    NavajoWhite #ffdead 纳瓦霍白 #ffdead
    Navy #000080 海军 #000080
    OldLace #fdf5e6 旧布黄 #fdf5e6
    Olive #808000 橄榄 #808000
    OliveDrab #6b8e23 淡绿褐 #6b8e23
    Orange #ffa500 橙色 #ffa500
    OrangeRed #ff4500 橙红色 #ff4500
    Orchid #da70d6 兰花 #da70d6
    PaleGoldenRod #eee8aa 淡金黄 #eee8aa
    PaleGreen #98fb98 浅绿色 #98fb98
    PaleTurquoise #afeeee 淡蓝绿 #afeeee
    PaleVioletRed #d87093 淡紫红色 #d87093
    PapayaWhip #ffefd5 粉木瓜橙 #ffefd5
    PeachPuff #ffdab9 粉桃红 #ffdab9
    Peru #cd853f 秘鲁 #cd853f
    Pink #ffc0cb 粉色的 #ffc0cb
    Plum #dda0dd 李子 #dda0dd
    PowderBlue #b0e0e6 粉蓝色 #b0e0e6
    Purple #800080 紫色的 #800080
    Red #ff0000 红色的 #ff0000
    RosyBrown #bc8f8f 玫瑰褐 #bc8f8f
    RoyalBlue #4169e1 宝蓝色 #4169e1
    SaddleBrown #8b4513 马鞍棕 #8b4513
    Salmon #fa8072 三文鱼 #fa8072
    SandyBrown #f4a460 桑迪布朗 #f4a460
    SeaGreen #2e8b57 海绿色 #2e8b57
    SeaShell #fff5ee 贝壳 #fff5ee
    Sienna #a0522d 赭色 #a0522d
    Silver #c0c0c0 银色的 #c0c0c0
    SkyBlue #87ceeb 天蓝色 #87ceeb
    SlateBlue #6a5acd 青蓝 #6a5acd
    SlateGray #708090 青灰 #708090
    Snow #fffafa #fffafa
    SpringGreen #00ff7f 嫩绿 #00ff7f
    SteelBlue #4682b4 钢蓝 #4682b4
    Tan #d2b48c 黄褐色 #d2b48c
    Teal #008080 青色 #008080
    Thistle #d8bfd8 #d8bfd8
    Tomato #ff6347 番茄 #ff6347
    Turquoise #40e0d0 绿松石 #40e0d0
    Violet #ee82ee 紫罗兰 #ee82ee
    Wheat #f5deb3 小麦 #f5deb3
    White #ffffff 白色的 #ffffff
    WhiteSmoke #f5f5f5 白色的烟 #f5f5f5
    Yellow #ffff00 黄色的 #ffff00
    YellowGreen #9acd32 黄绿色 #9acd32

    2.8 Channel Layout 通道布局

    通道布局指定多通道音频流中通道的空间布置。为了指定通道布局,FFmpeg 使用了一种特殊的语法。

    2.8.1 各个频道由 id 标识,如下表所示:

    NAME DESCRIPTION cn use
    FL front left 左前 27
    FR front right 右前 27
    FC front center 前中 21
    LFE low frequency 低频 12
    BL back left 左后 11
    BR back right 右后 11
    FLC front left-of-center 前中左 6
    FRC front right-of-center 前中右 6
    BC back center 后中 10
    SL side left 左侧 14
    SR side right 右侧 14
    TC top center 顶中心 1
    TFL top front left 顶左前 2
    TFC top front center 顶前中 2
    TFR top front right 顶右前 2
    TBL top back left 顶左后 2
    TBC top back center 顶后中 2
    TBR top back right 顶右后 2
    TSL top side left 顶左侧 1
    TSR top side right 顶右侧 1
    DL downmix left 左缩混 1
    DR downmix right 右缩混 1
    WL wide left 宽左 1
    WR wide right 宽右 1
    SDL surround direct left 环绕左 0
    SDR surround direct right 环绕右 0
    LFE2 low frequency 2 低频2 1
    BFC bottom front center 底前中 1
    BFL bottom front left 底左前 1
    BFR bottom front right 底右前 1

    2.8.2 可以使用以下标识符指定标准通道布局组合:

    NAME DECOMPOSITION channel FL FR FC LFE BL BR FLC FRC BC SL SR other Top/Bottom …
    mono FC 1     FC                    
    stereo FL+FR 2 FL FR                      
    2.1 FL+FR+LFE 3 FL FR   LFE                  
    3 FL+FR+FC 3 FL FR FC                    
    3.0(back) FL+FR+BC 3 FL FR             BC        
    3.1 FL+FR+FC+LFE 4 FL FR FC LFE                  
    4 FL+FR+FC+BC 4 FL FR FC           BC        
    quad FL+FR+BL+BR 4 FL FR     BL BR              
    quad(side) FL+FR+SL+SR 4 FL FR               SL SR    
    4.1 FL+FR+FC+LFE+BC 5 FL FR FC LFE         BC        
    5 FL+FR+FC+BL+BR 5 FL FR FC   BL BR              
    5.0(side) FL+FR+FC+SL+SR 5 FL FR FC             SL SR    
    5.1 FL+FR+FC+LFE+BL+BR 6 FL FR FC LFE BL BR              
    5.1(side) FL+FR+FC+LFE+SL+SR 6 FL FR FC LFE           SL SR    
    6 FL+FR+FC+BC+SL+SR 6 FL FR FC           BC SL SR    
    6.0(front) FL+FR+FLC+FRC+SL+SR 6 FL FR         FLC FRC   SL SR    
    hexagonal FL+FR+FC+BL+BR+BC 6 FL FR FC   BL BR     BC        
    6.1 FL+FR+FC+LFE+BC+SL+SR 7 FL FR FC LFE         BC SL SR    
    6.1(back) FL+FR+FC+LFE+BL+BR+BC 7 FL FR FC LFE BL BR     BC        
    6.1(front) FL+FR+LFE+FLC+FRC+SL+SR 7 FL FR   LFE     FLC FRC   SL SR    
    7 FL+FR+FC+BL+BR+SL+SR 7 FL FR FC   BL BR       SL SR    
    7.0(front) FL+FR+FC+FLC+FRC+SL+SR 7 FL FR FC       FLC FRC   SL SR    
    7.1 FL+FR+FC+LFE+BL+BR+SL+SR 8 FL FR FC LFE BL BR       SL SR    
    7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC 8 FL FR FC LFE BL BR FLC FRC          
    7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR 8 FL FR FC LFE     FLC FRC   SL SR    
    octagonal FL+FR+FC+BL+BR+BC+SL+SR 8 FL FR FC   BL BR     BC SL SR    
    hexadecagonal FL+FR+FC+BL+BR+BC+SL+SR+
    TFL+TFC+TFR+TBL+TBC+TBR+WL+WR
    16 FL FR FC   BL BR     BC SL SR WL;WR TFL;TFC;TFR;
    TBL;TBC;TBR
    downmix DL+DR 2                       DL;DR  
    22.2 FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+
    TC+TFL+TFC+TFR+TBL+TBC+TBR+TSL+TSR+
    LFE2+BFC+BFL+BFR
    24 FL FR FC LFE BL BR FLC FRC BC SL SR LFE2 TC;TFL;TFC;TFR;TBL;
    TBC;TBR;TSL;TSR
    BFC;BFL;BFR

    2.8.3 各频道id空间图示:

      TFL       TFC       TFR  
      T
    S
    L
                  T
    S
    R
     
            TC        
                     
      TBL       TBC       TBR  
                         
    S
    D
    L
    FL W
    L
    FLC   FC   FRC W
    R
    FR S
    D
    R
    S
    L
              S
    R
             
             
    BL     BC     BR
                         
      BFL       BFC       BFR  
                         
      DL               DR  
                         
                         

    2.8.4 自定义通道布局

    自定义通道布局可以指定为一系列术语,以“+”或“|”分隔。每个术语可以是:
    • 标准通道布局的名称(e.g. ‘mono’, ‘stereo’, ‘4.0’, ‘quad’, ‘5.0’, etc.)
    • 单个频道的名称(e.g. ‘FL’, ‘FR’, ‘FC’, ‘LFE’, etc.)
    • 十进制数的通道数,后跟“c”,产生该通道数的默认通道布局(请参阅函数 av_get_default_channel_layout)。请注意,并非所有通道计数都有默认布局。
    • 十进制数的通道数,后跟“C”,产生具有指定通道数的未知通道布局。请注意,并非所有通道布局规范字符串都支持未知的通道布局。
    • 一个信道布局掩模mask,以十六进制开始以“0x”(见 AV_CH_*宏在libavutil/channel_layout.h.
    在 libavutil 版本 53 之前,指定通道数的尾随字符“c”是可选的,但现在是必需的,而通道布局掩码也可以指定为十进制数(当且仅当后面没有“c”或“C”)。
    另请参阅中av_get_channel_layout定义 的函数libavutil/channel_layout.h.

    3. Expression Evaluation 表达式评估

    在计算算术表达式时,FFmpeg 使用内部公式计算器,通过 libavutil/eval.h 界面。
    表达式可能包含一元、二元运算符、常量和函数。
    两个表达式expr1和expr2可以组合形成另一个表达式“ expr1 ; expr2 ”。 expr1和expr2依次求值,新表达式求值为expr2的值。
    可以使用以下二元运算符:+, -, *, /, ^。
    可以使用以下一元运算符:+, -.

    3.1 functions

    可以使用以下功能:
    abs(x)Compute absolute value of x. 计算x 的绝对值。
    acos(x)Compute arccosine of x. 计算x 的反余弦值。
    sin(x)Compute arcsine of x. 计算x 的反正弦。
    atan(x)Compute arctangent of x. 计算x 的反正切。
    atan2(x, y)Compute principal value of the arc tangent of y/x. 计算y / x 的反正切的主值。
    between(x, min, max)Return 1 if x is greater than or equal to min and lesser than or equal to max, 0 otherwise. 如果x大于或等于min且小于或等于max,则返回 1,否则返回0。
    bitand(x, y)bitor(x, y)Compute bitwise and/or operation on x and y. 在x和y上计算按位和/或运算。
      x和y的计算结果在执行按位运算之前转换为整数。
      请注意,转换为整数和转换回浮点数都会失去精度。当心大数(通常为 2^53 及更大)的意外结果。
    ceil(expr)Round the value of expression expr upwards to the nearest integer. For example, "ceil(1.5)" is "2.0". 将表达式expr的值向上舍入到最接近的整数。例如,“ceil(1.5)”是“2.0”。
    clip(x, min, max)Return the value of x clipped between min and max. 返回裁剪在min和max之间的x值。
    cos(x)Compute cosine of x. 计算x 的余弦。
    cosh(x)Compute hyperbolic cosine of x. 计算x 的双曲余弦值。
    eq(x, y)Return 1 if x and y are equivalent, 0 otherwise. 如果x和y相等,则返回 1 ,否则返回0。
    exp(x)Compute exponential of x (with base e, the Euler’s number). 计算x 的指数(基数e为欧拉数)
    floor(expr)Round the value of expression expr downwards to the nearest integer. For example, "floor(-1.5)" is "-2.0". 将表达式expr的值向下舍入到最接近的整数。例如,“地板(-1.5)”是“-2.0”。
    gauss(x)Compute Gauss function of x, corresponding to exp(-x*x/2) / sqrt(2*PI). 计算x 的高斯函数,对应于 exp(-x*x/2) / sqrt(2*PI)。
    gcd(x, y)Return the greatest common divisor of x and y. If both x and y are 0 or either or both are less than zero then behavior is undefined. 返回x和y 的最大公约数。如果x和 y均为 0 或其中一个或两者都小于零,则行为未定义。
    gt(x, y)Return 1 if x is greater than y, 0 otherwise. 如果x大于y则返回 1 ,否则返回0。
    gte(x, y)Return 1 if x is greater than or equal to y, 0 otherwise. 如果x大于或等于y则返回 1 ,否则返回0。
    hypot(x, y)This function is similar to the C function with the same name; it returns "sqrt(x*x + y*y)", the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. 这个函数类似于同名的C函数;它返回“sqrt( x * x + y * y )”,即边长为x和y的直角三角形斜边的长度,或点 ( x , y ) 与原点的距离。
    if(x, y)Evaluate x, and if the result is non-zero return the result of the evaluation of y, return 0 otherwise. 计算x,如果结果非零,则返回y的计算结果,否则返回 0。
    if(x, y, z)Evaluate x, and if the result is non-zero return the evaluation result of y, otherwise the evaluation result of z. 计算x,如果结果非零返回y 的计算结果,否则返回z 的计算结果。
    ifnot(x, y)Evaluate x, and if the result is zero return the result of the evaluation of y, return 0 otherwise. 计算x,如果结果为零,则返回y的计算结果,否则返回 0。
    ifnot(x, y, z)Evaluate x, and if the result is zero return the evaluation result of y, otherwise the evaluation result of z. 计算x,如果结果为零则返回y 的计算结果,否则返回z 的计算结果。
    isinf(x)Return 1.0 if x is +/-INFINITY, 0.0 otherwise. 如果x是 +/-INFINITY,则返回 1.0 ,否则返回0.0。
    isnan(x)Return 1.0 if x is NAN, 0.0 otherwise. 如果x是 NAN,则返回 1.0 ,否则返回0.0。
    ld(var)Load the value of the internal variable with number var, which was previously stored with st(var, expr). The function returns the loaded value. 加载编号为var的内部变量的值,该值 之前是用 st( var , expr )存储的。该函数返回加载的值。
    lerp(x, y, z)Return linear interpolation between x and y by amount of z. 按z的量返回x和y之间的线性插值。
    log(x)Compute natural logarithm of x. 计算x 的自然对数。
    lt(x, y)Return 1 if x is lesser than y, 0 otherwise. 如果x小于y则返回 1 ,否则返回0。
    lte(x, y)Return 1 if x is lesser than or equal to y, 0 otherwise. 如果x小于或等于y,则返回 1 ,否则返回0。
    max(x, y)Return the maximum between x and y. 返回x和y之间的最大值。
    min(x, y)Return the minimum between x and y. 返回x和y之间的最小值。
    mod(x, y)Compute the remainder of division of x by y. 计算x除以y的余数。
    not(expr)Return 1.0 if expr is zero, 0.0 otherwise. 如果expr为零,则返回 1.0 ,否则返回0.0。
    pow(x, y)Compute the power of x elevated y, it is equivalent to "(x)^(y)". 计算x提升y的幂,它等价于“( x )^( y )”。
    print(t)print(t, l)Print the value of expression t with loglevel l. If l is not specified then a default log level is used. Returns the value of the expression printed. 使用日志级别l打印表达式t的值。如果 未指定l则使用默认日志级别。返回打印的表达式的值。Prints t with loglevel l
    random(x)Return a pseudo random value between 0.0 and 1.0. x is the index of the internal variable which will be used to save the seed/state. 返回一个介于 0.0 和 1.0 之间的伪随机值。x是用于保存种子/状态的内部变量的索引。
    root(expr, max)Find an input value for which the function represented by expr with argument ld(0) is 0 in the interval 0..max. 
      在区间 0.. max 中查找由expr表示的函数 和参数ld(0)为 0的输入值。
      expr中的表达式必须表示连续函数,否则结果未定义。
      ld(0)用于表示函数输入值,这意味着给定的表达式将使用表达式可以访问的各种输入值进行多次计算 ld(0)。当表达式的计算结果为 0 时,将返回相应的输入值。
    round(expr)Round the value of expression expr to the nearest integer. For example, "round(1.5)" is "2.0". 将表达式expr的值四舍五入到最接近的整数。例如,“round(1.5)”是“2.0”。
    sgn(x)Compute sign of x. 计算x 的符号。
    sin(x)Compute sine of x. 计算x 的正弦值。
    sinh(x)Compute hyperbolic sine of x. 计算x 的双曲正弦值。
    sqrt(expr)Compute the square root of expr. This is equivalent to "(expr)^.5". 计算expr 的平方根。这相当于“( expr )^.5”。
    squish(x)Compute expression 1/(1 + exp(4*x)). 计算表达式1/(1 + exp(4*x))。
    st(var, expr)Store the value of the expression expr in an internal variable. var specifies the number of the variable where to store the value, and it is a value ranging from 0 to 9. The function returns the value stored in the internal variable. Note, Variables are currently not shared between expressions. 将表达式expr的值存储在内部变量中。var指定存储值的变量的编号,它是一个范围从 0 到 9 的值。该函数返回存储在内部变量中的值。请注意,变量当前不在表达式之间共享。
    tan(x)Compute tangent of x. 计算x 的切线。
    tanh(x)Compute hyperbolic tangent of x. 计算x 的双曲正切值。
    taylor(expr, x)taylor(expr, x, id)Evaluate a Taylor series at x, given an expression representing the ld(id)-th derivative of a function at 0.
      计算x处的泰勒级数,给定一个表达式,表示ld(id)函数在 0 处的-th 导数。
      当级数不收敛时,结果是不确定的。
      ld(id)用于表示expr 中的导数顺序,这意味着给定的表达式将使用表达式可以访问的各种输入值进行多次计算 ld(id)。如果未指定id,则假定为 0。
      请注意,当您在 y 而不是 0 处有导数时, taylor(expr, x-y)可以使用。
    time(0)Return the current (wallclock) time in seconds. 以秒为单位返回当前(挂钟)时间。
    trunc(expr)Round the value of expression expr towards zero to the nearest integer. For example, "trunc(-1.5)" is "-1.0". 将表达式expr的值向零舍入到最接近的整数。例如,“trunc(-1​​.5)”是“-1.0”。
    while(cond, expr)Evaluate expression expr while the expression cond is non-zero, and returns the value of the last expr evaluation, or NAN if cond was always false. 当表达式cond非零时计算表达式expr,并返回最后一次expr评估的值,如果cond始终为假,则返回NAN 。

    3.2 constants 常数

    The following constants are available: 以下常量可用:
    PIarea of the unit disc, approximately 3.14 圆周率
    Eexp(1) (Euler’s number), approximately 2.718 自然常数 欧拉数
    PHIgolden ratio (1+sqrt(5))/2, approximately 1.618 黄金比例
    假设如果表达式具有非零值,则该表达式被视为“真”,请注意:
    * 像 AND 一样工作
    + 像 OR 一样工作
    例如构造: if (A AND B) then C  相当于: if(A*B, C)
    在您的 C 代码中,您可以扩展一元和二元函数的列表,并定义可识别的常量,以便它们可用于您的表达式。
    评估器还识别国际系统单位前缀。如果在前缀后附加“i”,则使用二进制前缀,其基于 1024 的幂而不是 1000 的幂。“B”后缀将值乘以 8,并且可以附加在单位前缀之后或单独使用. 这允许使用例如“KB”、“MiB”、“G”和“B”作为数字后缀。

    3.3 International System prefixes 国际系统前缀

    可用的国际系统前缀列表如下,并指示了 10 和 2 的相应幂。
    y10^-24 / 2^-80
    z10^-21 / 2^-70
    a10^-18 / 2^-60
    f10^-15 / 2^-50
    p10^-12 / 2^-40
    n10^-9 / 2^-30
    u10^-6 / 2^-20
    m10^-3 / 2^-10
    c10^-2
    d10^-1
    h10^2
    k10^3 / 2^10
    K10^3 / 2^10
    M10^6 / 2^20
    G10^9 / 2^30
    T10^12 / 2^40
    P10^15 / 2^40
    E10^18 / 2^50
    Z10^21 / 2^60
    Y10^24 / 2^70
     
    sztom osoft@qq.com CC-BY-NC-SA
  • 相关阅读:
    shell脚本查找tcp过多ip地址封掉
    tomcat日志传参乱码问题
    nginx部署vue跨域proxy方式
    nginx部署VUE跨域访问api
    springboot2.1.3 + redisTemplate + Lock 操作 redis 3.0.5
    java8 lamb表达式对List排序
    Mysql5.7降级到5.6遇到的坑
    mac中git使用
    mac中git flow使用
    mac安装openjdk8-maven-mysql-git-docker
  • 原文地址:https://www.cnblogs.com/sztom/p/14918694.html
Copyright © 2011-2022 走看看