什么品种的鸡肉最好吃| 阴历六月十五是什么日子| 颈动脉彩超能查出什么| 人为什么会晕车| 区长是什么级别的干部| wilson是什么意思| 戒断反应是什么| 羊水指数是什么意思| 柝什么意思| 胸膜炎吃什么药| 为什么蚊子咬了会起包| 禁忌什么意思| 什么是普世价值| 买什么化妆品好| 微波炉不热是什么原因| 舌苔发白厚吃什么药| 吃什么东西| 火牙是什么原因引起的| c罗全名叫什么| 生姜放肚脐眼有什么功效| 阿玛尼手表属于什么档次| 6月8日什么星座| 空腹是什么意思| 圆房要做什么| 宫腔内高回声是什么意思| 今年七夕节是什么时候| 尿路感染喝什么药| 夏天脸上皮肤痒是什么原因| 为什么狱警离婚率高| 中水是什么意思| 胸痛是什么情况| 腊月初八是什么日子| 无赖不还钱最怕什么| 脂肪瘤吃什么药可以消除| 淋巴挂什么科| 退位让贤是什么意思| 蟑螂喜欢什么样的环境| 入伏吃羊肉有什么好处| uv是什么意思| 涉水是什么意思| 回声结节什么意思| 白头发吃什么变黑| 蕞是什么意思| 重色轻友是什么意思| 雍正为什么只在位13年| 女人吃桃子有什么好处| 普通健康证都检查什么| 云南小黄姜和普通姜有什么区别| 榴莲补什么| 蝉蜕有什么功效| 智商什么意思| 胆固醇高对身体有什么危害| 鸡胗是什么| 水痘什么样| 属狗的守护神是什么菩萨| 打仗是什么意思| 专科警校出来干什么| sars是什么病毒| 指征是什么意思| 心情烦躁吃什么药| 智齿什么时候长| 黄体可能是什么意思啊| 手机为什么会发热| superstar什么意思| 脑梗都有什么症状| 50岁掉牙齿是什么原因| 十二月是什么星座| 腹泻可以吃什么水果| 一九八六年属什么生肖| 指标什么意思| 饱和脂肪是什么意思| ep病毒是什么| 复杂性囊肿是什么意思| 奔跑的马是什么牌子的车| 眼屎多用什么眼药水好| 什么手机像素好| 空调吹感冒吃什么药| 心不在焉是什么意思| 间接喉镜检查能检查出什么| 来月经同房有什么影响| 刚怀孕需要注意什么| 武夷山在什么地方| 曹操叫什么| 怀孕能吃什么水果| 手脚冰凉吃什么药| 龙骨是什么骨头| 为什么眼睛老是痒| 痛经喝什么药| mers是什么病毒| 乙肝什么症状| 梦到钓鱼是什么意思| 什么是天眼| davena手表什么牌子| 肌肉萎缩看什么科| 男人屁股翘代表什么| 帝加口念什么| 1953年是什么年| 复方乙酰水杨酸片是什么药| 吃无花果有什么好处| 口腔白斑是什么病| 体毛多是什么原因| 偷梁换柱是什么意思| 个体户是什么职业| 长痘不能吃什么| 拉肚子吃点什么食物好| 火车为什么会晚点| 睡觉时胳膊和手发麻是什么原因| image什么意思| 胸变大是什么原因| 宰相相当于现在什么官| 2月2日是什么星座| 相安无事什么意思| 腿软无力是什么原因| 亚硝酸盐阴性是什么意思| 头昏是什么原因引起的| 输卵管发炎有什么症状表现| 宫腔粘连有什么危害| 白居易被称为什么| 夜宵是什么意思| 金牛女喜欢什么样的男生| 肝功能挂什么科| 白带是什么样的| 开颌是什么意思| 镜花水月是什么意思| 针眼长什么样子图片| 藿香正气水什么味道| 黄龙玉产地在什么地方| 夏天容易出汗是什么原因| 吃什么减肥瘦肚子| 项链突然断了预示什么| 棒槌是什么意思| 眼睛浮肿是什么原因引起的| 身体游走性疼痛什么病| 2月份是什么星座| 舌头不舒服挂什么科| 大圣是什么生肖| 肌红蛋白高是什么意思| 孝顺的真正含义是什么| 低密度脂蛋白胆固醇偏低是什么意思| 牙齿什么时候换完| 猴魁属于什么茶| 霏字五行属什么| 巨石强森是什么人种| 白术适合什么地方种植| 生性凉薄什么意思| 玫瑰茄是什么| 吉祥动物是什么生肖| 重阳节是什么意思| 绿卡需要什么条件| 土豆有什么营养| 吃什么水果能长高| 假小子是什么意思| 什么条件| 公开遴选公务员是什么意思| 经期适合吃什么食物| 辅酶q10什么时候吃最好| 眼压高滴什么眼药水| 紫米和黑米有什么区别| 吃什么对前列腺有好处| 为什么尿会很黄| 脸上长斑是因为什么原因引起的| 花哨是什么意思| 哈士蟆是什么东西| 什么是音调| puma是什么品牌| 想长胖喝什么奶粉好| 包饺子用什么肉| 舌苔厚白吃什么药最好| 半身不遂是什么意思| d是什么元素| 变异性哮喘什么症状| 老是打喷嚏是什么原因| 嗓子疼咳嗽是什么原因| 卵巢囊肿是什么| 什么门永远关不上| 补体c1q偏高说明什么| 脚心热什么原因| 吴亦凡演过什么电影| 胃动力不足吃什么药| 莲雾吃了有什么好处| 塑料属于什么垃圾| 吃什么去火| 穿刺活检能查出肿瘤是什么性质吗| 脸上为什么会长斑| 肛肠科属于什么科| 丹凤眼是什么样的| 兵工厂属于什么单位| 受精卵着床有什么反应| 小暑吃什么| 子时是什么时候| 同房什么意思| 子宫内膜2mm说明什么| 为什么星星会眨眼| cps是什么单位| 蓝色妖姬适合送什么人| 腿麻是什么病的前兆吗| 喝红茶有什么好处和坏处| 电话停机是什么意思| 不爱说话的人是什么性格| tm是什么意思| 附骨疽是什么病| 尿道口长肉芽是什么| 百香果和什么不能一起吃| 杵状指见于什么病| 手起皮是什么原因| 态度是什么| 露从今夜白下一句是什么| 白色配什么颜色好看| 心脏房颤吃什么药好| 经常头昏是什么原因| 喝白醋有什么好处| 肾功能不好吃什么药调理| 什么蛇没有毒| 盆底脱垂有什么症状| 做什么能快速赚钱| 金光是什么生肖| 氢化聚异丁烯是什么| 钙片是什么意思| 0z是什么单位| 原发性是什么意思| 洗衣机单漂洗是什么意思| 胃不好适合吃什么食物| 吃羊肉不能和什么一起吃| 高密度脂蛋白偏高是什么原因| 免疫力下降吃什么好| 巴厘岛机场叫什么| 空调室内机漏水是什么原因| 什么花净化空气| 闲情雅致是什么意思| 失重感是什么感觉| 什么是隐匿性包茎| 什么兔子最好养| 什么叫靶向治疗| 什么是反流性咽喉炎| 脚心烧是什么原因| lsp是什么| 生姜水泡脚有什么好处| 十九畏是什么意思| 黄盖代表什么生肖| 乳头痛是什么原因| 主管是什么级别| 查高血压挂什么科| 干巴得是什么意思| 32岁属什么| 骨头受伤了吃什么恢复的快| 奶粉中的opo是什么| 人乳头瘤病毒是什么病| 心脏供血不足吃什么药好| female什么意思| 鼻甲肥大吃什么药最好| 为什么牙齿会发黑| 伊始什么意思| 种牙和假牙有什么区别| 医院信息科是做什么| 十月份生日是什么星座| 新生儿呛奶是什么原因引起的| 耳膜破了有什么症状| co2cp在医学上是什么| 痰多咳嗽是什么原因| 舌头长泡吃什么药| 方便是什么意思| 最好的减肥方法是什么| 带状疱疹挂什么科室| 梦到钓鱼是什么征兆| 百度


Directory: ../../../ffmpeg/
File: src/libavfilter/vf_untile.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 67 77 87.0%
Functions: 5 5 100.0%
Branches: 25 36 69.4%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2020 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
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 #include "libavutil/imgutils.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/pixdesc.h"
24 #include "avfilter.h"
25 #include "formats.h"
26 #include "filters.h"
27 #include "video.h"
28
29 typedef struct UntileContext {
30 const AVClass *class;
31 unsigned w, h;
32 unsigned current;
33 unsigned nb_frames;
34 AVFrame *frame;
35 const AVPixFmtDescriptor *desc;
36 int64_t dpts, pts;
37 int max_step[4];
38 } UntileContext;
39
40 #define OFFSET(x) offsetof(UntileContext, x)
41 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
42
43 static const AVOption untile_options[] = {
44 { "layout", "set grid size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE,
45 {.str = "6x5"}, 0, 0, FLAGS },
46 { NULL }
47 };
48
49 AVFILTER_DEFINE_CLASS(untile);
50
51 4 static av_cold int init(AVFilterContext *ctx)
52 {
53 4 UntileContext *s = ctx->priv;
54
55
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (s->w > UINT_MAX / s->h) {
56 av_log(ctx, AV_LOG_ERROR, "Tile size %ux%u is insane.\n",
57 s->w, s->h);
58 return AVERROR(EINVAL);
59 }
60 4 s->nb_frames = s->w * s->h;
61 4 return 0;
62 }
63
64 2 static int query_formats(const AVFilterContext *ctx,
65 AVFilterFormatsConfig **cfg_in,
66 AVFilterFormatsConfig **cfg_out)
67 {
68 2 int reject_flags = AV_PIX_FMT_FLAG_HWACCEL |
69 AV_PIX_FMT_FLAG_BITSTREAM |
70 FF_PIX_FMT_FLAG_SW_FLAT_SUB;
71
72 2 return ff_set_common_formats2(ctx, cfg_in, cfg_out,
73 ff_formats_pixdesc_filter(0, reject_flags));
74 }
75
76 2 static int config_output(AVFilterLink *outlink)
77 {
78 2 AVFilterContext *ctx = outlink->src;
79 2 UntileContext *s = ctx->priv;
80 2 AVFilterLink *inlink = ctx->inputs[0];
81 2 FilterLink *il = ff_filter_link(inlink);
82 2 FilterLink *ol = ff_filter_link(outlink);
83 AVRational dt;
84
85 2 s->desc = av_pix_fmt_desc_get(outlink->format);
86
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (inlink->w % (s->w << s->desc->log2_chroma_w) ||
87
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 inlink->h % (s->h << s->desc->log2_chroma_h)) {
88 av_log(ctx, AV_LOG_ERROR,
89 "Input resolution %ux%u not multiple of layout %ux%u.\n",
90 inlink->w, inlink->h, s->w, s->h);
91 return AVERROR(EINVAL);
92 }
93 2 outlink->w = inlink->w / s->w;
94 2 outlink->h = inlink->h / s->h;
95 2 outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
96 2 ol->frame_rate = av_mul_q(il->frame_rate, av_make_q(s->nb_frames, 1));
97
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (ol->frame_rate.num)
98 2 dt = av_inv_q(ol->frame_rate);
99 else
100 dt = av_mul_q(inlink->time_base, av_make_q(1, s->nb_frames));
101 2 outlink->time_base = av_gcd_q(inlink->time_base, dt, AV_TIME_BASE / 2, AV_TIME_BASE_Q);
102 2 s->dpts = av_rescale_q(1, dt, outlink->time_base);
103 2 av_log(ctx, AV_LOG_VERBOSE, "frame interval: %"PRId64"*%d/%d\n",
104 s->dpts, dt.num, dt.den);
105 2 av_image_fill_max_pixsteps(s->max_step, NULL, s->desc);
106 2 return 0;
107 }
108
109 24 static int activate(AVFilterContext *ctx)
110 {
111 24 UntileContext *s = ctx->priv;
112 24 AVFilterLink *inlink = ctx->inputs[0];
113 24 AVFilterLink *outlink = ctx->outputs[0];
114 AVFrame *out;
115 int i, x, y, ret;
116
117
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
24 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
118
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
24 if (!s->frame) {
119 12 ret = ff_inlink_consume_frame(inlink, &s->frame);
120
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if (ret < 0)
121 return ret;
122
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 8 times.
12 if (ret)
123 4 s->pts = av_rescale_q(s->frame->pts, inlink->time_base, outlink->time_base);
124 }
125
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
24 if (s->frame) {
126
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 12 times.
16 if (s->current == s->nb_frames - 1) {
127 4 out = s->frame;
128 4 s->frame = NULL;
129 } else {
130 12 out = av_frame_clone(s->frame);
131
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if (!out)
132 return AVERROR(ENOMEM);
133 }
134 16 x = outlink->w * (s->current % s->w);
135 16 y = outlink->h * (s->current / s->w);
136 16 out->width = outlink->w;
137 16 out->height = outlink->h;
138 16 out->data[0] += y * out->linesize[0];
139 16 out->data[0] += x * s->max_step[0];
140
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL)) {
141
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
48 for (i = 1; i < 3; i ++) {
142
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 if (out->data[i]) {
143 32 out->data[i] += (y >> s->desc->log2_chroma_h) * out->linesize[i];
144 32 out->data[i] += (x >> s->desc->log2_chroma_w) * s->max_step[i];
145 }
146 }
147 }
148
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (out->data[3]) {
149 out->data[3] += y * out->linesize[3];
150 out->data[3] += x * s->max_step[3];
151 }
152 16 out->pts = s->pts;
153 16 s->pts += s->dpts;
154
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 12 times.
16 if (++s->current == s->nb_frames)
155 4 s->current = 0;
156 16 return ff_filter_frame(outlink, out);
157 }
158
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 6 times.
8 FF_FILTER_FORWARD_STATUS(inlink, outlink);
159
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 FF_FILTER_FORWARD_WANTED(outlink, inlink);
160 return FFERROR_NOT_READY;
161
162 }
163
164 4 static av_cold void uninit(AVFilterContext *ctx)
165 {
166 4 UntileContext *s = ctx->priv;
167
168 4 av_frame_free(&s->frame);
169 4 }
170
171 static const AVFilterPad untile_outputs[] = {
172 {
173 .name = "default",
174 .type = AVMEDIA_TYPE_VIDEO,
175 .config_props = config_output,
176 },
177 };
178
179 const FFFilter ff_vf_untile = {
180 .p.name = "untile",
181 .p.description = NULL_IF_CONFIG_SMALL("Untile a frame into a sequence of frames."),
182 .p.priv_class = &untile_class,
183 .init = init,
184 .uninit = uninit,
185 .activate = activate,
186 .priv_size = sizeof(UntileContext),
187 FILTER_INPUTS(ff_video_default_filterpad),
188 FILTER_OUTPUTS(untile_outputs),
189 FILTER_QUERY_FUNC2(query_formats),
190 };
191

氮肥是什么肥 撸是什么意思 老人嗜睡是什么原因 人绒毛膜促性腺激素是查什么的 吃什么补羊水最快
恻隐之心什么意思 补铁有什么好处 gc是什么 科举制什么时候废除 胸闷气短呼吸困难心慌是什么原因
紫苏是什么植物 不可理喻什么意思 野蒜有什么功效和作用 老舍被誉为什么 盛世的意思是什么
膀胱炎尿道炎吃什么药 眩晕是怎么回事是什么原因引起 cpf是什么意思 翳是什么意思 酒店尾房是什么意思
lfc是什么意思hcv8jop4ns8r.cn 周杰伦为什么叫jayhcv8jop7ns6r.cn 肝硬化是什么原因引起的hcv9jop3ns1r.cn 圆脸女生适合什么发型hcv8jop5ns5r.cn 腺肌症不治疗会导致什么结果hcv7jop9ns5r.cn
为什么夏天hcv8jop7ns6r.cn 狐臭是什么原因引起的hcv8jop1ns9r.cn 人尽可夫什么意思hcv9jop4ns1r.cn 尿蛋白高吃什么药hcv7jop4ns8r.cn nars属于什么档次hcv9jop1ns5r.cn
百香果有什么功效与作用hcv9jop7ns3r.cn 梦见亲人死了是什么意思hcv8jop5ns2r.cn 夏天为什么这么热cj623037.com 纯化水是什么水helloaicloud.com 石青色是什么颜色hcv9jop0ns4r.cn
二胎什么时候放开的bjcbxg.com 精气神是什么意思520myf.com 90年属什么hcv8jop7ns1r.cn 闭口粉刺是什么原因引起的hcv8jop5ns3r.cn 贵人是什么意思hcv8jop1ns0r.cn
百度