咽喉炎吃什么药好得快| 项羽为什么叫西楚霸王| 辛弃疾字什么| 十二年义务教育什么时候开始| 长黑斑是什么原因引起的| 蚧壳虫用什么药| 硬核是什么意思| 乙肝e抗体阳性什么意思| 火车动车高铁有什么区别| 扁桃体发炎吃什么食物好| 皮肤起水泡发痒是什么病| 糖尿病能吃什么零食| 尿道发炎吃什么药| 大腿肌肉跳动是什么原因| 美国白宫是干什么的| 颈椎应该挂什么科| 什么童话| 梦见两个小男孩是什么意思| 你从什么时候不再爱我| 脾切除后有什么影响| 上半身皮肤痒什么原因| 443是什么意思| 626是什么日子| 大姨妈不来是什么原因造成的| 树挪死人挪活是什么意思| 全身检查挂什么科| 农历九月是什么月| 嘴巴苦是什么原因引起的| 一吃东西就牙疼是什么原因引起的| 外交部部长是什么级别| 梦见订婚是什么意思| 乌鸦飞进家里什么征兆| 阴道出血是什么原因| 进仓是什么意思| 什么的李逵| kappa是什么牌子| 嘴硬是什么意思| 葛根粉有什么功效和作用| 爸爸的爸爸叫什么| 帕金森病是什么症状| 省委组织部长是什么级别| 维生素h是什么| 白细胞3个加号是什么意思| 肚子胀气吃什么药好得快| 海螺不能和什么一起吃| 占有欲强什么意思| 猫起什么名字好| 什么是态度| 1921年属什么生肖| 肠胃不好经常拉肚子吃什么药| 昵称什么意思| 呼吸机vt代表什么| 高血压什么症状| 撸管是什么| 治鸡眼用什么药最好| 吃得苦中苦方为人上人是什么意思| 睾丸变小了是什么原因| 脊髓炎吃什么药| 国防部长什么级别| 辣椒红是什么| 欣赏是什么意思| 接下来有什么节日| 肉桂和桂皮有什么区别| 艺体生是什么意思| 身份证复印件是什么| 胆囊息肉是什么原因造成的| 氧分压低是什么原因| 右佐匹克隆是什么药| pda是什么意思| 什么泉水| 脸红是什么大病的前兆| 怀挺是什么意思| 斋醮是什么意思| 什么是鬼压床| 连奕名为什么娶杨若兮| 985和211是什么意思| 6月12号是什么星座| 普罗帕酮又叫什么| 颈椎病引起的头晕吃什么药| 只欠东风的上一句是什么| 怀孕从什么时候开始算起| 强直是什么意思| 咖喱是什么材料做的| 拔鼻毛有什么危害| 坚韧不拔是什么生肖| 不显山不露水是什么意思| 应无所住而生其心是什么意思| 拉姆是什么意思| 51岁属什么| 甲烷是什么| 总胆固醇高是什么原因| 脖子上有结节挂什么科| 氟斑牙是什么原因造成的| 蚯蚓吃什么食物| 7月24号是什么星座| 暖对什么| 理疗是什么| 梦到女朋友出轨是什么意思| 经常肚子疼是什么原因| zzegna是什么牌子价格| 青光眼是什么原因引起的| 屁很多是什么原因造成的| 为什么洗头发时会掉很多头发| 铺天盖地的意思是什么| 判缓刑是什么意思| 仪仗队是什么意思| 白猫进家有什么预兆| 鲁迅原名什么| 脏器灰阶立体成像是检查什么的| 爱马仕为什么要配货| cin是什么意思| 蛇缠腰是什么病| 孕妇多吃什么食物好| 皇帝菜是什么菜| 霉菌是什么| 1991年五行属什么| 吃什么水果对肾有好处| 间接胆红素偏高吃什么药| 康庄大道是什么意思| chocker是什么意思| 段泥紫砂壶适合泡什么茶| 心肌缺血吃什么药管用| 手腕关节疼痛什么原因引起的| 赵匡胤为什么不传位给儿子| 渐入佳境是什么意思| 妈妈是什么| 白头发吃什么维生素| 12月13号什么星座| 血压压差小是什么原因| 支原体培养及药敏是检查什么| 办理港澳通行证需要带什么证件| 肠癌便血和痔疮便血有什么区别| 药物流产最佳时间什么时候| 扁平疣是什么引起的| 漏蛋白是什么原因造成的| 孕期什么时候补钙| 脱式计算是什么意思| 隐疾是什么意思| 宫颈ecc是什么意思| 二次元文化是什么意思| 冬阴功汤都放什么食材| 什么水果能马上通便| 马陆吃什么| 贤上腺瘤是什么意思| 碱水是什么| 耳垂长痘痘是什么原因| 金牛后面是什么星座| 火鸡面是什么| 风土人情是什么意思| 合肥什么时候出梅| 胸腔积液是什么意思| sub是什么意思| 血红蛋白偏低的原因和危害是什么| 剑突下是什么位置| 伏天是什么时候| 聚酯纤维是什么面料优缺点| 景气是什么意思| 眼压低是什么原因| 蝙蝠是什么类| 什么行业最赚钱| 高凝状态是什么意思| 抖s什么意思| 眼睛流水是什么原因| 波澜壮阔是什么意思| 牙龈上火是什么原因引起的| 手背发黄是什么原因| 大便秘结是什么原因| 胃病吃什么食物养胃| 为什么屎是黑色的| 头发干枯毛躁用什么洗发水| 病假需要什么医院证明| 副主任医师什么级别| 一什么水井| 早上起来口干口苦是什么原因| 钮祜禄氏是什么旗| 风湿和类风湿有什么区别| 扁桃体为什么会发炎| 什么的脸| 胎儿没有胎心是什么原因| 免签是什么意思| 胸闷吃什么药| 爱居兔女装是什么档次| 闫学晶是什么军衔| 额头上长痘是什么原因| 结婚年数代表什么婚| 6月28日是什么日子| 黄酒有什么功效与作用| attach什么意思| 咽喉老有痰是什么原因| 性格内敛是什么意思| 空你几哇什么意思| 奇异果是什么| 畏寒是什么意思| 焦虑抑郁症吃什么药| 蟒袍是什么人穿的| 半什么半什么的成语| 氨咖黄敏胶囊主治什么| 肝五行属什么| 切除子宫有什么影响| 十三点是什么意思| 铝中毒有什么症状| 为什么会得脑血栓| 吃什么补血贫血| 什么牌子的风扇好| 豺是什么动物| 减肥适合吃什么水果| camel是什么颜色| 宫寒吃什么药调理最好| 主见是什么意思| 东盟是什么意思| 儿童拉稀吃什么药| 为什么喝酒后会头疼| 什么时候有流星| 查心脏挂什么科| 梦见塌方是什么预兆| 左腿酸痛是什么原因| 晚上睡觉老做梦是什么原因| 2017年是属什么年| 白天不咳嗽晚上咳嗽是什么原因| 鬼市是什么意思| 崇洋媚外是什么意思| 夏天什么面料最凉快| 斯德哥尔摩综合征是什么| 腿部肿胀是什么原因引起的| 狐狸是什么动物| 胆摘除对身体有什么影响| 相顾无言是什么意思| 桑螵蛸是什么| 预约转账什么时候到账| 药物流产后吃什么好| 癞蛤蟆吃什么| 三庚是什么意思| 四月天是什么意思| 上海有什么特产| 申遗是什么意思| 拉肚子拉稀水吃什么药管用| 二月二十二日是什么星座| 爱思是什么| 蒙脱石散适合什么腹泻| 孤是什么意思| 鸡的五行属什么| 重楼别名叫什么| 干咳嗽喉咙痒是什么原因| 孕妇做春梦是什么意思| verde是什么颜色| 以什么当什么| 成什么结什么| kub是什么检查| 房颤是什么| 盐酸左氧氟沙星片治什么病| 小孩经常吐是什么原因| 血虚吃什么中成药最好| 1600年是什么朝代| 心脏房颤吃什么药好| 纯是什么意思| 血糖吃什么水果| 3月5日是什么星座的| 天龙八部是什么朝代| 梦见好多西瓜是什么意思| 什么的毛主席| 63年属什么生肖| 灵芝适合什么样的人吃| 鹌鹑吃什么| 糖尿病人适合喝什么茶| 百度

魔兽世界8.0将加入新种族 魅惑成种族天赋


Directory: ../../../ffmpeg/
File: src/libavfilter/af_volumedetect.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 0 51 0.0%
Functions: 0 4 0.0%
Branches: 0 34 0.0%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2012 Nicolas George
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 License
8 * 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
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "libavutil/channel_layout.h"
22 #include "libavutil/avassert.h"
23 #include "audio.h"
24 #include "avfilter.h"
25 #include "filters.h"
26
27 typedef struct VolDetectContext {
28 /**
29 * Number of samples at each PCM value.
30 * histogram[0x8000 + i] is the number of samples at value i.
31 * The extra element is there for symmetry.
32 */
33 uint64_t histogram[0x10001];
34 } VolDetectContext;
35
36 static int filter_frame(AVFilterLink *inlink, AVFrame *samples)
37 {
38 AVFilterContext *ctx = inlink->dst;
39 VolDetectContext *vd = ctx->priv;
40 int nb_samples = samples->nb_samples;
41 int nb_channels = samples->ch_layout.nb_channels;
42 int nb_planes = nb_channels;
43 int plane, i;
44 int16_t *pcm;
45
46 if (!av_sample_fmt_is_planar(samples->format)) {
47 nb_samples *= nb_channels;
48 nb_planes = 1;
49 }
50 for (plane = 0; plane < nb_planes; plane++) {
51 pcm = (int16_t *)samples->extended_data[plane];
52 for (i = 0; i < nb_samples; i++)
53 vd->histogram[pcm[i] + 0x8000]++;
54 }
55
56 return ff_filter_frame(inlink->dst->outputs[0], samples);
57 }
58
59 #define MAX_DB 91
60
61 static inline double logdb(uint64_t v)
62 {
63 double d = v / (double)(0x8000 * 0x8000);
64 if (!v)
65 return MAX_DB;
66 return -log10(d) * 10;
67 }
68
69 static void print_stats(AVFilterContext *ctx)
70 {
71 VolDetectContext *vd = ctx->priv;
72 int i, max_volume, shift;
73 uint64_t nb_samples = 0, power = 0, nb_samples_shift = 0, sum = 0;
74 uint64_t histdb[MAX_DB + 1] = { 0 };
75
76 for (i = 0; i < 0x10000; i++)
77 nb_samples += vd->histogram[i];
78 av_log(ctx, AV_LOG_INFO, "n_samples: %"PRId64"\n", nb_samples);
79 if (!nb_samples)
80 return;
81
82 /* If nb_samples > 1<<34, there is a risk of overflow in the
83 multiplication or the sum: shift all histogram values to avoid that.
84 The total number of samples must be recomputed to avoid rounding
85 errors. */
86 shift = av_log2(nb_samples >> 33);
87 for (i = 0; i < 0x10000; i++) {
88 nb_samples_shift += vd->histogram[i] >> shift;
89 power += (i - 0x8000) * (i - 0x8000) * (vd->histogram[i] >> shift);
90 }
91 if (!nb_samples_shift)
92 return;
93 power = (power + nb_samples_shift / 2) / nb_samples_shift;
94 av_assert0(power <= 0x8000 * 0x8000);
95 av_log(ctx, AV_LOG_INFO, "mean_volume: %.1f dB\n", -logdb(power));
96
97 max_volume = 0x8000;
98 while (max_volume > 0 && !vd->histogram[0x8000 + max_volume] &&
99 !vd->histogram[0x8000 - max_volume])
100 max_volume--;
101 av_log(ctx, AV_LOG_INFO, "max_volume: %.1f dB\n", -logdb(max_volume * max_volume));
102
103 for (i = 0; i < 0x10000; i++)
104 histdb[(int)logdb((i - 0x8000) * (i - 0x8000))] += vd->histogram[i];
105 for (i = 0; i <= MAX_DB && !histdb[i]; i++);
106 for (; i <= MAX_DB && sum < nb_samples / 1000; i++) {
107 av_log(ctx, AV_LOG_INFO, "histogram_%ddb: %"PRId64"\n", i, histdb[i]);
108 sum += histdb[i];
109 }
110 }
111
112 static av_cold void uninit(AVFilterContext *ctx)
113 {
114 print_stats(ctx);
115 }
116
117 static const AVFilterPad volumedetect_inputs[] = {
118 {
119 .name = "default",
120 .type = AVMEDIA_TYPE_AUDIO,
121 .filter_frame = filter_frame,
122 },
123 };
124
125 const FFFilter ff_af_volumedetect = {
126 .p.name = "volumedetect",
127 .p.description = NULL_IF_CONFIG_SMALL("Detect audio volume."),
128 .p.flags = AVFILTER_FLAG_METADATA_ONLY,
129 .priv_size = sizeof(VolDetectContext),
130 .uninit = uninit,
131 FILTER_INPUTS(volumedetect_inputs),
132 FILTER_OUTPUTS(ff_audio_default_filterpad),
133 FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P),
134 };
135

纳甲是什么意思 火龙果不能和什么一起吃 擦什么能阻止毛发生长 rf是什么的缩写 什么什么言什么
众叛亲离是什么意思 肛门坠胀用什么药 什么叫感性的女人 脂肪肝挂什么科 羊毛疔是什么病
jbp什么意思 脚出汗是什么原因 骨折喝什么汤恢复得快 吃什么能补血 更年期出汗多是什么原因
感悟是什么意思 痔疮是什么原因引起的 发炎是什么意思 血压低吃什么好 上火流鼻血吃什么降火
宝刀未老的意思是什么hcv8jop5ns2r.cn 知柏地黄丸治疗什么病hcv7jop9ns9r.cn 鼻子长痘是什么原因hcv8jop9ns5r.cn 缺血吃什么补血最快hcv7jop5ns3r.cn lucas是什么意思hcv8jop2ns6r.cn
经常手麻是什么原因hcv8jop7ns4r.cn 尿酸高吃什么药hcv7jop5ns3r.cn 小孩不说话什么原因hcv9jop1ns1r.cn 云南白药气雾剂保险液有什么作用hcv9jop2ns9r.cn 苋菜什么人不能吃hcv8jop8ns1r.cn
自费是什么意思hcv9jop6ns7r.cn 沈阳有什么特产hcv8jop7ns0r.cn 口苦尿黄是什么原因hcv9jop5ns4r.cn 眼睑炎用什么药hcv8jop5ns8r.cn 内膜欠均匀是什么意思hanqikai.com
异国他乡的异是什么意思hcv8jop9ns9r.cn soho是什么意思0297y7.com 擦汗表情是什么意思clwhiglsz.com 七月十日是什么日子helloaicloud.com 身体痒是什么原因hcv8jop3ns5r.cn
百度