你想什么| 梦见男人是什么意思| imp什么意思| 教导是什么意思| 颈肩综合症有什么症状| 气血不足吃什么中药| 海水是什么颜色的| 主动脉夹层a型是什么病| 嘴里发咸是什么原因| 总蛋白偏低是什么意思| 什么是虚无主义| 吃什么健脾胃| 眼睛有点模糊是什么原因| 送呈是什么意思| 闰六月是什么意思| 百米12秒什么水平| 武将是什么生肖| 9月17日是什么星座| 儒家思想的核心是什么| 顾字五行属什么| 风湿类风湿有什么症状表现| 7.12是什么星座| 肝经湿热吃什么中成药| butter是什么意思| 为什么肝区隐隐作痛| 桃子跟什么不能一起吃| 动车与高铁有什么区别| 哈工大全称是什么| ala是什么氨基酸| 杜蕾斯是什么| 祈祷是什么意思| 骑单车锻炼什么好处| 舌尖麻是什么原因| 膝盖内侧疼是什么原因| 淋巴炎吃什么药| 单纯疱疹病毒是什么病| 虞是什么意思| 脸上有癣用什么药膏好| 全麻对身体有什么危害| 为什么冬天容易长胖| 梦见自己请客吃饭是什么意思| 胰腺炎是什么症状| 日新月异什么意思| 什么东西越洗越脏答案| 脾虚吃什么食物补最快| 抗核抗体阳性是什么意思| 自行车什么牌子好| 拉黑色的屎是什么原因| 血氧低会有什么危害| 十二月二十三是什么星座| 骑驴找马什么意思| 反应蛋白高是什么原因| clara是什么意思| 什么锅好| 嗜酸性粒细胞偏高是什么原因| 北边是什么生肖| epc是什么意思| 感冒可以吃什么水果| 慢性胃炎伴胆汁反流是什么意思| 匪夷所思是什么意思| 分数值是什么意思| 正觉是什么意思| 北极熊的毛是什么颜色的| 985是什么学校| 强身之道的强是什么意思| 江湖是什么| 心率快吃什么药效果好| 勾心斗角是什么意思| 为什么空腹喝牛奶会拉肚子| 过年给老人买什么| 米线里的麻油是什么油| 输液葡萄糖有什么作用| 发烧拉肚子是什么原因| 老爷是什么意思| 肌肉僵硬是什么原因| 散光是什么原因造成的| 巴特尔是什么意思| 10岁属什么| 晚上睡觉磨牙是什么原因| 肺阳虚吃什么中成药| 五步蛇又叫什么蛇| 芭比q是什么意思| 茎是什么意思| 程咬金是什么意思| 面皮是什么做的| 日加军念什么| 三乙醇胺是什么东西| 喝藿香正气水不能吃什么| 寒号鸟是什么动物| 桃和什么不能一起吃| 染色体变异发生在什么时期| 第一次什么感觉| 嘴唇干燥是什么原因| 眼睛五行属什么| 验血能查出什么| 魏大勋和李沁什么关系| 中盐是什么盐| 喝什么解辣| 肝脏彩超能检查出什么| 喝温开水有什么好处| 兵役是什么意思| 晖字五行属什么| 三项规定内容是什么| 屁股后面骨头疼是什么原因| 儿童中暑吃什么药| 发改委是管什么的| 八月生日什么星座| 依字五行属什么| 吃辣流鼻涕是什么原因| 小五行属性是什么| 排骨炖什么好吃又有营养| 孕反一般什么时候开始| 什么是缓刑意思是什么| 游离三碘甲状腺原氨酸是什么意思| 梦见红色的蛇是什么意思| 右眼老跳是什么原因| 子宫占位是什么意思| kj什么意思| 老头晕是什么原因引起的| 男性婚检都检查什么项目| 盗汗是什么原因造成的| 平常吃什么补肾| 眼睛浮肿是什么原因| 大便绿色什么原因| 80年属猴的是什么命| 什么是闰年什么是平年| 忌行丧是什么意思| 逍遥丸适合什么人吃| 炸油条用什么油最好| 丝瓜络是什么东西| 痛经 吃什么| 阳刃是什么意思| 有什么故事| 7.11是什么日子| 胃疼吃点什么药| 胃炎吃什么药效果好| 三尖瓣关闭不全是什么意思| 拔火罐起水泡是什么原因| 10万个为什么| 头痛用什么药好| 子宫肌瘤吃什么食物好| 梦见自己给自己理发是什么意思| 肠系膜淋巴结炎吃什么药最有效| 一建什么时候报名| 为什么会长肥胖纹| 秋葵有什么功效| 大林木是什么数字| 标准的青色是什么颜色| 咽后壁淋巴滤泡增生吃什么药| 心律失常吃什么药| 女人腰酸背痛是什么病| 蟾酥是什么| 4月25日是什么星座| 风雨雷电代表什么生肖| 辽源有什么好玩的地方| 双鱼座的上升星座是什么| aape是什么牌子| 包袱是什么意思| 包皮嵌顿是什么| 乌托邦什么意思| 饱和脂肪酸是什么意思| 胳肢窝痒是什么原因| 小孩说话晚是什么原因| 1994年属狗是什么命| 面红耳赤是什么意思| 什么叫做亚健康| 老汉是什么意思| 慢性子宫颈炎是什么意思| 米氮平是什么药| 疔是什么意思| 卖萌什么意思| 右手大拇指发麻是什么原因| 脚底肿是什么原因引起的| 少了一个肾有什么影响| 什么生肖怕老婆| 容易流鼻血是什么原因| 梦到妈妈怀孕什么预兆| 潜能是什么意思| 小鱼的尾巴有什么作用| 肛门痒什么原因| 源源不断是什么意思| 渐行渐远是什么意思| 阴超是检查什么的| 木指什么生肖| 广东省省长什么级别| 梦见和老公吵架是什么意思| 胃胆汁反流是什么原因引起的| 属兔什么命| 乙肝表面抗体阳性什么意思| 什么的波涛| 男人睡觉流口水是什么原因| 过人之处是什么意思| 什么名字好听| 吃龟苓膏有什么好处| 为什么叫夺命大乌苏| 梦到被雷劈是什么意思| 护理是干什么的| 我会送你红色玫瑰是什么歌| 蘑菇和什么不能一起吃| 什么样的人不适合吃人参| 尿后余沥是什么意思| 粉盒和硒鼓有什么区别| 俊俏什么意思| 斑秃是什么原因造成的| 前列腺在什么位置| 喝咖啡胃疼是什么原因| 比宇宙还大的是什么| 肾阳虚有什么症状男性| 外周血是什么意思| 姨妈的老公叫什么| 吃什么有助于降血压| 酌情是什么意思| 嗓子干痒吃什么药| 总是嗳气是什么原因| 空腹血糖偏高是什么原因| 鸢是什么意思| 奇异果是什么水果| 朋友开业送什么礼物好| 吃什么不上火| 0.5是什么意思| 丨什么意思| 黄历破屋是什么意思| 口干舌燥口苦是什么原因引起的| 拔牙挂什么科| cdf1是什么意思| 心电监护pr是什么意思| abs是什么材质| 铊是什么东西| 双十一从什么时候开始| 一岁半宝宝反复发烧是什么原因| philips是什么牌子| 甘油三酯指什么| 单核细胞百分比偏高是什么意思| 酸是什么意思| 今天是什么日子| 5w是什么意思| 舌炎吃什么药好得快| 为什么叫中日友好医院| 什么是孝顺| 小肠镜什么情况下需要做| 激素六项挂什么科| 手指甲的月牙代表什么| 脸上不停的长痘痘是什么原因| 颈椎病最怕干什么活| 照顾是什么意思| 肚子胀气吃什么食物好| 喉咙有白点是什么原因| 军长是什么军衔| 每天吃松子有什么好处| 10月27是什么星座| cea升高是什么意思| 洽谈是什么意思| 男人吃香菜有什么好处| 学渣什么意思| 八个月宝宝可以吃什么水果| 吃什么有奶| 低密度脂蛋白胆固醇高吃什么药| 孩子走路晚是什么原因| 东吴在现在什么地方| 姜太公钓鱼愿者上钩是什么意思| 山楂什么季节成熟| 晚上七点到九点是什么时辰| 糖尿病人能喝什么饮料| 肝功能检查什么| 百度

唐僧、悟空、八戒、沙僧,原来是中国人的4种品质


Directory: ../../../ffmpeg/
File: src/libavcodec/pthread.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 45 46 97.8%
Functions: 5 5 100.0%
Branches: 35 42 83.3%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2004 Roman Shaposhnik
3 * Copyright (c) 2008 Alexander Strange (astrange@ithinksw.com)
4 *
5 * Many thanks to Steven M. Schultz for providing clever ideas and
6 * to Michael Niedermayer <michaelni@gmx.at> for writing initial
7 * implementation.
8 *
9 * This file is part of FFmpeg.
10 *
11 * FFmpeg is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * FFmpeg is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with FFmpeg; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 /**
27 * @file
28 * Multithreading support functions
29 * @see doc/multithreading.txt
30 */
31
32 #include "libavutil/attributes.h"
33 #include "libavutil/thread.h"
34
35 #include "avcodec.h"
36 #include "avcodec_internal.h"
37 #include "codec_internal.h"
38 #include "pthread_internal.h"
39
40 /**
41 * Set the threading algorithms used.
42 *
43 * Threading requires more than one thread.
44 * Frame threading requires entire frames to be passed to the codec,
45 * and introduces extra decoding delay, so is incompatible with low_delay.
46 *
47 * @param avctx The context.
48 */
49 35399 static av_cold void validate_thread_parameters(AVCodecContext *avctx)
50 {
51 70798 int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
52
1/2
✓ Branch 0 taken 21249 times.
✗ Branch 1 not taken.
21249 && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
53
4/4
✓ Branch 0 taken 21249 times.
✓ Branch 1 taken 14150 times.
✓ Branch 2 taken 21248 times.
✓ Branch 3 taken 1 times.
56648 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
54
2/2
✓ Branch 0 taken 34178 times.
✓ Branch 1 taken 1221 times.
35399 if (avctx->thread_count == 1) {
55 34178 avctx->active_thread_type = 0;
56
4/4
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1205 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 6 times.
1221 } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
57 10 avctx->active_thread_type = FF_THREAD_FRAME;
58
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 1183 times.
1211 } else if (avctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS &&
59
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 avctx->thread_type & FF_THREAD_SLICE) {
60 28 avctx->active_thread_type = FF_THREAD_SLICE;
61
1/2
✓ Branch 1 taken 1183 times.
✗ Branch 2 not taken.
1183 } else if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_AUTO_THREADS)) {
62 1183 avctx->thread_count = 1;
63 1183 avctx->active_thread_type = 0;
64 }
65
66
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35399 times.
35399 if (avctx->thread_count > MAX_AUTO_THREADS)
67 av_log(avctx, AV_LOG_WARNING,
68 "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n",
69 avctx->thread_count, MAX_AUTO_THREADS);
70 35399 }
71
72 35399 av_cold int ff_thread_init(AVCodecContext *avctx)
73 {
74 35399 validate_thread_parameters(avctx);
75
76
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 35371 times.
35399 if (avctx->active_thread_type&FF_THREAD_SLICE)
77 28 return ff_slice_thread_init(avctx);
78
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 35361 times.
35371 else if (avctx->active_thread_type&FF_THREAD_FRAME)
79 10 return ff_frame_thread_init(avctx);
80
81 35361 return 0;
82 }
83
84 35 av_cold void ff_thread_free(AVCodecContext *avctx)
85 {
86
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 25 times.
35 if (avctx->active_thread_type&FF_THREAD_FRAME)
87 10 ff_frame_thread_free(avctx, avctx->thread_count);
88 else
89 25 ff_slice_thread_free(avctx);
90 35 }
91
92 6158 av_cold void ff_pthread_free(void *obj, const unsigned offsets[])
93 {
94 6158 unsigned cnt = *(unsigned*)((char*)obj + offsets[0]);
95 6158 const unsigned *cur_offset = offsets;
96
97 6158 *(unsigned*)((char*)obj + offsets[0]) = 0;
98
99
4/4
✓ Branch 0 taken 7902 times.
✓ Branch 1 taken 1758 times.
✓ Branch 2 taken 3502 times.
✓ Branch 3 taken 4400 times.
9660 for (; *(++cur_offset) != THREAD_SENTINEL && cnt; cnt--)
100 3502 pthread_mutex_destroy((pthread_mutex_t*)((char*)obj + *cur_offset));
101
3/4
✓ Branch 0 taken 3558 times.
✓ Branch 1 taken 6158 times.
✓ Branch 2 taken 3558 times.
✗ Branch 3 not taken.
9716 for (; *(++cur_offset) != THREAD_SENTINEL && cnt; cnt--)
102 3558 pthread_cond_destroy ((pthread_cond_t *)((char*)obj + *cur_offset));
103 6158 }
104
105 1758 av_cold int ff_pthread_init(void *obj, const unsigned offsets[])
106 {
107 1758 const unsigned *cur_offset = offsets;
108 1758 unsigned cnt = 0;
109 int err;
110
111 #define PTHREAD_INIT_LOOP(type) \
112 for (; *(++cur_offset) != THREAD_SENTINEL; cnt++) { \
113 pthread_ ## type ## _t *dst = (void*)((char*)obj + *cur_offset); \
114 err = pthread_ ## type ## _init(dst, NULL); \
115 if (err) { \
116 err = AVERROR(err); \
117 goto fail; \
118 } \
119 }
120
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 3502 times.
✓ Branch 3 taken 3502 times.
✓ Branch 4 taken 1758 times.
5260 PTHREAD_INIT_LOOP(mutex)
121
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 3558 times.
✓ Branch 3 taken 3558 times.
✓ Branch 4 taken 1758 times.
5316 PTHREAD_INIT_LOOP(cond)
122
123 1758 fail:
124 1758 *(unsigned*)((char*)obj + offsets[0]) = cnt;
125 1758 return err;
126 }
127

甲减有什么症状表现 牛吃什么 什么什么分明的成语 冠状沟溃疡是什么病 白敬亭原名叫什么
五月十九日是什么星座 男人喜欢什么样的女人 才子是什么生肖 为什么没人穿卡帕 生化流产是什么原因造成的
为什么医生都穿洞洞鞋 八月三日是什么星座 孩子出汗多是什么原因 乳房胀痛是什么原因引起的 奇异果是什么水果
脾胃挂什么科 三陪是什么 女人小便带血是什么原因引起的 肝右叶钙化灶什么意思 人的血压一天中什么时候最高
有什么好吃的零食beikeqingting.com 卵巢过度刺激综合症是什么hcv9jop1ns9r.cn 粉底液和bb霜有什么区别hcv8jop1ns5r.cn 下身有异味用什么药hcv9jop5ns0r.cn 胃一阵一阵的疼吃什么药hcv9jop8ns0r.cn
梦到大牙掉了一颗是什么意思hcv8jop3ns0r.cn 同房后小腹疼痛是什么原因hcv9jop0ns3r.cn 胃下面是什么器官hcv8jop5ns5r.cn 炖肉什么时候放盐hcv8jop3ns5r.cn 为什么会晕3dhcv8jop4ns5r.cn
喝水不排尿是什么原因hcv8jop0ns8r.cn 心肌标志物是查什么的qingzhougame.com 弱水是什么意思hcv9jop6ns0r.cn 高中生物学什么hcv9jop2ns6r.cn 吃什么去湿气最好最快hcv9jop0ns8r.cn
低热是什么症状hcv8jop4ns9r.cn 绿茶有什么好处hcv9jop5ns3r.cn 经常腿麻是什么原因hcv8jop0ns6r.cn 甲状腺斑块是什么意思hcv9jop2ns2r.cn 夜尿频多吃什么药效果好hcv8jop1ns3r.cn
百度