什么是催眠| 中焦不通吃什么药| 喉部有异物感是什么病| 头发少剪什么发型好看| timing是什么意思| 什么闻什么睹| 宫颈多发纳囊是什么病| 什么是理数| 恶心想吐胃不舒服是什么原因| 香港特首是什么级别| 北京市长是什么级别| 春运是什么意思| 1988年属什么| 拔罐紫色说明什么| gm是什么| 青霉素过敏不能吃什么药| 辛苦是什么意思| 心电图窦性心律不齐是什么意思| 切莫是什么意思| 什么食物吃了会胀气| 窜稀是什么意思| 喝酒上脸是什么原因| 睡觉咬牙齿是什么原因引起的| 丑指什么生肖| 水准仪是测量什么的| s和m什么意思| 邪魅是什么意思| 情人的定义是什么| 什么牌子的辅酶q10好| 梦见大便是什么预兆| 出征是什么意思| 眼睛发粘是什么原因| 六子是什么意思| 虚伪是什么意思| 前囟门什么时候闭合| 升血小板吃什么药| 同位分是什么意思| 把头是什么意思| 偶像是什么意思| 冬是什么结构| 电轴不偏是什么意思| 11.11什么星座| otc代表什么| 临床路径是什么意思| 白带发黄是什么原因引起的| hpf是什么意思| 挚友是什么意思| 什么叫阳性| 傻狍子为什么叫傻狍子| 917是什么星座| 尿突然是红褐色的是什么问题| 吃甲钴胺有什么副作用| 地球代表什么生肖| 怀孕什么时候吃鹅蛋最好| 颈椎反弓有什么症状| 上头是什么意思| 什么洗面奶最好用排行第一| lesportsac什么牌子| 细胞学检查是什么| 扶她是什么意思| 十玉九裂是什么意思| 肚子冰凉是什么原因| 八月初十是什么星座| 炒菜什么时候放盐最合适| 列席是什么意思| 广东话扑街是什么意思| 过敏性紫癜看什么科| 大腿内侧痒是什么原因| bpo是什么意思| 红色和什么颜色搭配好看| 看空是什么意思| 3岁宝宝流鼻血是什么原因| 右肺中叶小结节是什么意思严重吗| 植物奶油是什么做的| 肠系膜淋巴结炎吃什么药| 看病人买什么花合适| 喉咙发炎吃什么水果好| 傻白甜是什么意思| 血小板太高会导致什么| 精神什么满| 河虾最爱吃什么食物| 紧张吃什么药| 尿蛋白质阳性是什么意思| 舌根起泡是什么原因| 什么的尾巴有什么作用| 圣经是什么时候写的| 得意忘形是什么意思| 三代试管是什么意思| er什么意思| 女人吃洋葱有什么好处| 叶酸偏高有什么影响| venes保温杯是什么品牌| 新斯的明是什么药| 清福是什么意思| 事业编有什么好处| 结肠炎吃什么药| 高密度脂蛋白胆固醇偏高是什么意思| 安门是什么意思| 西米露是什么做的| paba是什么药| 佰草集适合什么年龄| 什么应什么合| mickey是什么牌子| 八月13号是什么星座| 丰胸吃什么| 偏安一隅是什么意思| 一什么阳光| 避孕套什么牌子的好| 戊午五行属什么| 8023什么意思| 什么可以减肥| 痔疮是什么原因引起的| 幼儿睡觉出汗多是什么原因| 梅毒有什么症状| 肤专家软膏主要治什么| 不负卿是什么意思| 孩子皮肤黑是什么原因| 小肚子胀是什么原因女性| 曲酒是什么酒| 土是什么颜色| 吃什么清理血管| 血糖高的人吃什么| 山竹树长什么样| 静养是什么意思| 氯偏低是什么原因| 水猴子长什么样| 氯化钠是什么| 什么的石桥| 鸽子单眼伤风用什么药| 怀孕有积液是什么原因| 人流后吃什么水果好| b3维生素又叫什么| 生鱼又叫什么鱼| 广州的市花是什么| 牙疼吃什么药效果最好| 胃出血挂什么科室| cps是什么意思| 须菩提是什么意思| 梦见下暴雨是什么意思| 草莓什么时候种| 数不胜数是什么意思| 值太岁是什么意思| 总做噩梦是什么原因| 宝宝低烧是什么原因引起的| 什么是气血不足| 蚊子不喜欢什么味道| 什么是断掌| 缄默症是什么病| 劲酒加红牛有什么功能| 甜虾是什么虾| 做完手术吃什么水果好| yj是什么意思| 2013属什么生肖| 吊销驾驶证是什么意思| 马齿苋吃了有什么好处| 做梦捡钱是什么预兆| 什么动物没有方向感| mi是什么单位| 蒙羞是什么意思| 头部神经痛吃什么药好| 戴尾戒是什么意思| 权衡利弊是什么意思| generic是什么意思| 厘清和理清的区别是什么| 书店买不到的书是什么书| 胎儿fl是什么意思| a股是什么意思| 腻歪是什么意思| 口干口苦挂什么科| 芒果和什么相克| 为什么要努力读书| 什么是肝炎| 247什么意思| 梦见数字是什么意思| 梦见放生鱼是什么意思| 灸石门为什么会不孕| doms是什么意思| 阴瑜伽是什么意思| 3月6号是什么星座| cm是什么| gbs检查是什么| 60年属鼠是什么命| 割包皮是什么| 人体最大的消化腺是什么| 蜈蚣代表什么生肖| 晕车药什么时候吃最好| 腮腺炎吃什么食物| 什么路不能走| 仄怎么读什么意思| 雅痞是什么意思| 喝柠檬水有什么作用与功效| 多春鱼为什么全是籽| 汗疱疹是什么| 痛经吃什么水果| 痞满是什么意思| 美尼尔综合症吃什么药| 氮肥是什么肥| 海黄瓜是什么| td什么意思| 做nt需要准备什么| 明胶是什么做的| 什么成什么就| 急性乳腺炎是什么原因引起的| 老专家药膏有什么功效| 李开复是什么人| 上海古代叫什么| 怀孕第一个月有什么特征| 钟点房是什么意思| 国资委主任是什么级别| ems是什么| 抠鼻表情是什么意思| 喝陈皮水有什么好处| 纺织厂是做什么的| 37属什么| 学护理需要什么条件| 紧张的反义词是什么| 鸡五行属什么| 早筛是检查什么项目| 狗喜欢吃什么食物| 男士皮带什么品牌好| 神经衰弱吃什么药| 淀粉酶高是什么原因| 梦见自己搬家是什么意思| 拔了尿管尿不出来有什么好办法| 嗓子痒痒老想咳嗽是什么原因| 防血栓是什么意思| 胆红素偏高是什么原因| 甲状腺分泌什么激素| 凉面用的是什么面条| 眼睛红是什么病| 豆工念什么| 甲醛什么气味| 伏吟是什么意思| 参透是什么意思| cn是什么单位| 3月22日什么星座| 气场强大是什么意思| 眼皮老跳是什么原因| 头晕出虚汗是什么原因引起的| 凯撒是什么意思| 输卵管为什么会堵塞原因是什么| 脾是起什么作用的| 老年人腿脚无力是什么原因| 肠易激综合症用什么药能治好| 是什么词性| 为什么会突然得荨麻疹| 为什么早上起来血压高| 兰花象征着什么| 冰雪什么| 燕子进屋来有什么兆头| 青盐是什么盐| 血管堵塞吃什么好| 气短咳嗽是什么原因引起的| 怀孕初期能吃什么不能吃什么| 菡什么意思| lady是什么意思啊| 右肩膀疼是什么原因| 容易被吓到是什么原因| 回是什么生肖| 肺积水有什么症状| 什么是健康管理| 重本是什么意思| 尿蛋白高吃什么药| 什么时候喝蜂蜜水最好| 百度

甘肃地区联合辟谣平台上线


Directory: ../../../ffmpeg/
File: src/libavcodec/dfa.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 132 255 51.8%
Functions: 6 11 54.5%
Branches: 70 160 43.8%

Line Branch Exec Source
1 /*
2 * Chronomaster DFA Video Decoder
3 * Copyright (c) 2011 Konstantin Shishkov
4 * based on work by Vladimir "VAG" Gneushev
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include <inttypes.h>
24
25 #include "avcodec.h"
26 #include "bytestream.h"
27 #include "codec_internal.h"
28 #include "decode.h"
29
30 #include "libavutil/avassert.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/mem.h"
33
34 typedef struct DfaContext {
35 uint32_t pal[256];
36 uint8_t *frame_buf;
37 } DfaContext;
38
39 22 static av_cold int dfa_decode_init(AVCodecContext *avctx)
40 {
41 22 DfaContext *s = avctx->priv_data;
42
43 22 avctx->pix_fmt = AV_PIX_FMT_PAL8;
44
45
3/6
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 22 times.
22 if (!avctx->width || !avctx->height || FFMAX(avctx->width, avctx->height) >= (1<<16))
46 return AVERROR_INVALIDDATA;
47
48
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
22 av_assert0(av_image_check_size(avctx->width, avctx->height, 0, avctx) >= 0);
49
50 22 s->frame_buf = av_mallocz(avctx->width * avctx->height);
51
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
22 if (!s->frame_buf)
52 return AVERROR(ENOMEM);
53
54 22 return 0;
55 }
56
57 static int decode_copy(GetByteContext *gb, uint8_t *frame, int width, int height)
58 {
59 const int size = width * height;
60
61 if (bytestream2_get_buffer(gb, frame, size) != size)
62 return AVERROR_INVALIDDATA;
63 return 0;
64 }
65
66 35 static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
67 {
68 35 const uint8_t *frame_start = frame;
69 35 const uint8_t *frame_end = frame + width * height;
70 35 int mask = 0x10000, bitbuf = 0;
71 int v, count;
72 unsigned segments;
73 unsigned offset;
74
75 35 segments = bytestream2_get_le32(gb);
76 35 offset = bytestream2_get_le32(gb);
77
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
35 if (segments == 0 && offset == frame_end - frame)
78 1 return 0; // skip frame
79
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 if (frame_end - frame <= offset)
80 return AVERROR_INVALIDDATA;
81 34 frame += offset;
82
2/2
✓ Branch 0 taken 566883 times.
✓ Branch 1 taken 32 times.
566915 while (segments--) {
83
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 566881 times.
566883 if (bytestream2_get_bytes_left(gb) < 2)
84 2 return AVERROR_INVALIDDATA;
85
2/2
✓ Branch 0 taken 35445 times.
✓ Branch 1 taken 531436 times.
566881 if (mask == 0x10000) {
86 35445 bitbuf = bytestream2_get_le16u(gb);
87 35445 mask = 1;
88 }
89
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 566881 times.
566881 if (frame_end - frame < 2)
90 return AVERROR_INVALIDDATA;
91
2/2
✓ Branch 0 taken 222937 times.
✓ Branch 1 taken 343944 times.
566881 if (bitbuf & mask) {
92 222937 v = bytestream2_get_le16(gb);
93 222937 offset = (v & 0x1FFF) << 1;
94 222937 count = ((v >> 13) + 2) << 1;
95
2/4
✓ Branch 0 taken 222937 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 222937 times.
222937 if (frame - frame_start < offset || frame_end - frame < count)
96 return AVERROR_INVALIDDATA;
97 222937 av_memcpy_backptr(frame, offset, count);
98 222937 frame += count;
99 } else {
100 343944 *frame++ = bytestream2_get_byte(gb);
101 343944 *frame++ = bytestream2_get_byte(gb);
102 }
103 566881 mask <<= 1;
104 }
105
106 32 return 0;
107 }
108
109 121 static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
110 {
111 121 const uint8_t *frame_start = frame;
112 121 const uint8_t *frame_end = frame + width * height;
113 121 int mask = 0x10000, bitbuf = 0;
114 int v, offset, count, segments;
115
116 121 segments = bytestream2_get_le16(gb);
117
2/2
✓ Branch 0 taken 460846 times.
✓ Branch 1 taken 116 times.
460962 while (segments--) {
118
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 460841 times.
460846 if (bytestream2_get_bytes_left(gb) < 2)
119 5 return AVERROR_INVALIDDATA;
120
2/2
✓ Branch 0 taken 57659 times.
✓ Branch 1 taken 403182 times.
460841 if (mask == 0x10000) {
121 57659 bitbuf = bytestream2_get_le16u(gb);
122 57659 mask = 1;
123 }
124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 460841 times.
460841 if (frame_end - frame < 2)
125 return AVERROR_INVALIDDATA;
126
2/2
✓ Branch 0 taken 124238 times.
✓ Branch 1 taken 336603 times.
460841 if (bitbuf & mask) {
127 124238 v = bytestream2_get_le16(gb);
128 124238 offset = (v & 0x1FFF) << 1;
129 124238 count = ((v >> 13) + 2) << 1;
130
2/4
✓ Branch 0 taken 124238 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 124238 times.
124238 if (frame - frame_start < offset || frame_end - frame < count)
131 return AVERROR_INVALIDDATA;
132 124238 av_memcpy_backptr(frame, offset, count);
133 124238 frame += count;
134
2/2
✓ Branch 0 taken 70168 times.
✓ Branch 1 taken 266435 times.
336603 } else if (bitbuf & (mask << 1)) {
135 70168 frame += bytestream2_get_le16(gb);
136 } else {
137 266435 *frame++ = bytestream2_get_byte(gb);
138 266435 *frame++ = bytestream2_get_byte(gb);
139 }
140 460841 mask <<= 2;
141 }
142
143 116 return 0;
144 }
145
146 static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height)
147 {
148 const uint8_t *frame_start = frame;
149 const uint8_t *frame_end = frame + width * height;
150 int mask = 0x10000, bitbuf = 0;
151 int i, v, offset, count, segments;
152
153 if ((width | height) & 1)
154 return AVERROR_INVALIDDATA;
155 segments = bytestream2_get_le16(gb);
156 while (segments--) {
157 if (bytestream2_get_bytes_left(gb) < 2)
158 return AVERROR_INVALIDDATA;
159 if (mask == 0x10000) {
160 bitbuf = bytestream2_get_le16u(gb);
161 mask = 1;
162 }
163
164 if (bitbuf & mask) {
165 v = bytestream2_get_le16(gb);
166 offset = (v & 0x1FFF) << 2;
167 count = ((v >> 13) + 2) << 1;
168 if (frame - frame_start < offset || frame_end - frame < count*2 + width)
169 return AVERROR_INVALIDDATA;
170 for (i = 0; i < count; i++) {
171 frame[0] = frame[1] =
172 frame[width] = frame[width + 1] = frame[-offset];
173
174 frame += 2;
175 }
176 } else if (bitbuf & (mask << 1)) {
177 v = bytestream2_get_le16(gb)*2;
178 if (frame - frame_end < v)
179 return AVERROR_INVALIDDATA;
180 frame += v;
181 } else {
182 if (width < 4 || frame_end - frame < width + 4)
183 return AVERROR_INVALIDDATA;
184 frame[0] = frame[1] =
185 frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
186 frame += 2;
187 frame[0] = frame[1] =
188 frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
189 frame += 2;
190 }
191 mask <<= 2;
192 }
193
194 return 0;
195 }
196
197 static int decode_bdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
198 {
199 uint8_t *line_ptr;
200 int count, lines, segments;
201
202 count = bytestream2_get_le16(gb);
203 if (count >= height)
204 return AVERROR_INVALIDDATA;
205 frame += width * count;
206 lines = bytestream2_get_le16(gb);
207 if (count + lines > height)
208 return AVERROR_INVALIDDATA;
209
210 while (lines--) {
211 if (bytestream2_get_bytes_left(gb) < 1)
212 return AVERROR_INVALIDDATA;
213 line_ptr = frame;
214 frame += width;
215 segments = bytestream2_get_byteu(gb);
216 while (segments--) {
217 if (frame - line_ptr <= bytestream2_peek_byte(gb))
218 return AVERROR_INVALIDDATA;
219 line_ptr += bytestream2_get_byte(gb);
220 count = (int8_t)bytestream2_get_byte(gb);
221 if (count >= 0) {
222 if (frame - line_ptr < count)
223 return AVERROR_INVALIDDATA;
224 if (bytestream2_get_buffer(gb, line_ptr, count) != count)
225 return AVERROR_INVALIDDATA;
226 } else {
227 count = -count;
228 if (frame - line_ptr < count)
229 return AVERROR_INVALIDDATA;
230 memset(line_ptr, bytestream2_get_byte(gb), count);
231 }
232 line_ptr += count;
233 }
234 }
235
236 return 0;
237 }
238
239 11 static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
240 {
241 11 const uint8_t *frame_end = frame + width * height;
242 uint8_t *line_ptr;
243 int count, i, v, lines, segments;
244 11 int y = 0;
245
246 11 lines = bytestream2_get_le16(gb);
247
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
11 if (lines > height)
248 return AVERROR_INVALIDDATA;
249
250
2/2
✓ Branch 0 taken 1438 times.
✓ Branch 1 taken 10 times.
1448 while (lines--) {
251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1438 times.
1438 if (bytestream2_get_bytes_left(gb) < 2)
252 return AVERROR_INVALIDDATA;
253 1438 segments = bytestream2_get_le16u(gb);
254
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1438 times.
1452 while ((segments & 0xC000) == 0xC000) {
255 14 unsigned skip_lines = -(int16_t)segments;
256 14 int64_t delta = -((int16_t)segments * (int64_t)width);
257
2/4
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
14 if (frame_end - frame <= delta || y + lines + skip_lines > height)
258 return AVERROR_INVALIDDATA;
259 14 frame += delta;
260 14 y += skip_lines;
261 14 segments = bytestream2_get_le16(gb);
262 }
263
264
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1438 times.
1438 if (frame_end <= frame)
265 return AVERROR_INVALIDDATA;
266
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1438 times.
1438 if (segments & 0x8000) {
267 frame[width - 1] = segments & 0xFF;
268 segments = bytestream2_get_le16(gb);
269 }
270 1438 line_ptr = frame;
271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1438 times.
1438 if (frame_end - frame < width)
272 return AVERROR_INVALIDDATA;
273 1438 frame += width;
274 1438 y++;
275
2/2
✓ Branch 0 taken 5140 times.
✓ Branch 1 taken 1437 times.
6577 while (segments--) {
276
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5140 times.
5140 if (frame - line_ptr <= bytestream2_peek_byte(gb))
277 return AVERROR_INVALIDDATA;
278 5140 line_ptr += bytestream2_get_byte(gb);
279 5140 count = (int8_t)bytestream2_get_byte(gb);
280
2/2
✓ Branch 0 taken 4691 times.
✓ Branch 1 taken 449 times.
5140 if (count >= 0) {
281
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4691 times.
4691 if (frame - line_ptr < count * 2)
282 return AVERROR_INVALIDDATA;
283
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 4690 times.
4691 if (bytestream2_get_buffer(gb, line_ptr, count * 2) != count * 2)
284 1 return AVERROR_INVALIDDATA;
285 4690 line_ptr += count * 2;
286 } else {
287 449 count = -count;
288
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 449 times.
449 if (frame - line_ptr < count * 2)
289 return AVERROR_INVALIDDATA;
290 449 v = bytestream2_get_le16(gb);
291
2/2
✓ Branch 0 taken 16595 times.
✓ Branch 1 taken 449 times.
17044 for (i = 0; i < count; i++)
292 16595 bytestream_put_le16(&line_ptr, v);
293 }
294 }
295 }
296
297 10 return 0;
298 }
299
300 static int decode_tdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
301 {
302 const uint8_t *frame_end = frame + width * height;
303 uint32_t segments = bytestream2_get_le32(gb);
304 int skip, copy;
305
306 while (segments--) {
307 if (bytestream2_get_bytes_left(gb) < 2)
308 return AVERROR_INVALIDDATA;
309 copy = bytestream2_get_byteu(gb) * 2;
310 skip = bytestream2_get_byteu(gb) * 2;
311 if (frame_end - frame < copy + skip ||
312 bytestream2_get_bytes_left(gb) < copy)
313 return AVERROR_INVALIDDATA;
314 frame += skip;
315 bytestream2_get_buffer(gb, frame, copy);
316 frame += copy;
317 }
318
319 return 0;
320 }
321
322 static int decode_blck(GetByteContext *gb, uint8_t *frame, int width, int height)
323 {
324 memset(frame, 0, width * height);
325 return 0;
326 }
327
328
329 typedef int (*chunk_decoder)(GetByteContext *gb, uint8_t *frame, int width, int height);
330
331 static const chunk_decoder decoder[8] = {
332 decode_copy, decode_tsw1, decode_bdlt, decode_wdlt,
333 decode_tdlt, decode_dsw1, decode_blck, decode_dds1,
334 };
335
336 static const char chunk_name[8][5] = {
337 "COPY", "TSW1", "BDLT", "WDLT", "TDLT", "DSW1", "BLCK", "DDS1"
338 };
339
340 172 static int dfa_decode_frame(AVCodecContext *avctx, AVFrame *frame,
341 int *got_frame, AVPacket *avpkt)
342 {
343 172 DfaContext *s = avctx->priv_data;
344 GetByteContext gb;
345 172 const uint8_t *buf = avpkt->data;
346 uint32_t chunk_type, chunk_size;
347 uint8_t *dst;
348 int ret;
349 int i, pal_elems;
350
1/2
✓ Branch 0 taken 172 times.
✗ Branch 1 not taken.
172 int version = avctx->extradata_size==2 ? AV_RL16(avctx->extradata) : 0;
351
352
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 172 times.
172 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
353 return ret;
354
355 172 bytestream2_init(&gb, avpkt->data, avpkt->size);
356
1/2
✓ Branch 1 taken 343 times.
✗ Branch 2 not taken.
343 while (bytestream2_get_bytes_left(&gb) > 0) {
357
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 343 times.
343 if (bytestream2_get_bytes_left(&gb) < 12)
358 return AVERROR_INVALIDDATA;
359 343 bytestream2_skip(&gb, 4);
360 343 chunk_size = bytestream2_get_le32(&gb);
361 343 chunk_type = bytestream2_get_le32(&gb);
362
2/2
✓ Branch 0 taken 164 times.
✓ Branch 1 taken 179 times.
343 if (!chunk_type)
363 164 break;
364
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 167 times.
179 if (chunk_type == 1) {
365
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 pal_elems = FFMIN(chunk_size / 3, 256);
366
2/2
✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 12 times.
3084 for (i = 0; i < pal_elems; i++) {
367 3072 s->pal[i] = bytestream2_get_be24(&gb) << 2;
368 3072 s->pal[i] |= 0xFFU << 24 | (s->pal[i] >> 6) & 0x30303;
369 }
370
1/2
✓ Branch 0 taken 167 times.
✗ Branch 1 not taken.
167 } else if (chunk_type <= 9) {
371
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 159 times.
167 if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) {
372 8 av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n",
373 8 chunk_name[chunk_type - 2]);
374 8 return AVERROR_INVALIDDATA;
375 }
376 } else {
377 av_log(avctx, AV_LOG_WARNING,
378 "Ignoring unknown chunk type %"PRIu32"\n",
379 chunk_type);
380 }
381 171 buf += chunk_size;
382 }
383
384 164 buf = s->frame_buf;
385 164 dst = frame->data[0];
386
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 164 times.
164 if (version == 0x100) {
387 for (i = 0; i < avctx->height; i++) {
388 int j;
389 const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width;
390 int stride = (avctx->height/4)*avctx->width;
391 for(j = 0; j < avctx->width/4; j++) {
392 dst[4*j+0] = buf1[j + 0*stride];
393 dst[4*j+1] = buf1[j + 1*stride];
394 dst[4*j+2] = buf1[j + 2*stride];
395 dst[4*j+3] = buf1[j + 3*stride];
396 }
397 j *= 4;
398 for(; j < avctx->width; j++) {
399 dst[j] = buf1[(j/4) + (j&3)*stride];
400 }
401 dst += frame->linesize[0];
402 }
403 } else
404 164 av_image_copy_plane(dst, frame->linesize[0], buf, avctx->width,
405 avctx->width, avctx->height);
406
407 164 memcpy(frame->data[1], s->pal, sizeof(s->pal));
408
409 164 *got_frame = 1;
410
411 164 return avpkt->size;
412 }
413
414 22 static av_cold int dfa_decode_end(AVCodecContext *avctx)
415 {
416 22 DfaContext *s = avctx->priv_data;
417
418 22 av_freep(&s->frame_buf);
419
420 22 return 0;
421 }
422
423 const FFCodec ff_dfa_decoder = {
424 .p.name = "dfa",
425 CODEC_LONG_NAME("Chronomaster DFA"),
426 .p.type = AVMEDIA_TYPE_VIDEO,
427 .p.id = AV_CODEC_ID_DFA,
428 .priv_data_size = sizeof(DfaContext),
429 .init = dfa_decode_init,
430 .close = dfa_decode_end,
431 FF_CODEC_DECODE_CB(dfa_decode_frame),
432 .p.capabilities = AV_CODEC_CAP_DR1,
433 };
434

什么牌子的电动车好 canyou是什么意思 吃了螃蟹不能吃什么 肝郁化火吃什么中成药 脑萎缩有什么症状
什么运动可以瘦脸 姝字五行属什么的 符号叫什么 大连靠近什么海 白狐寓意着什么
舌头上有齿痕是什么原因 三月二十三是什么星座 脚底长鸡眼是什么原因 喉咙痒痒的吃什么药 7月中旬是什么时候
8月6号什么星座 木薯淀粉可以做什么 跟着好人学好人下句是什么 外面下着雨犹如我心血在滴什么歌 姨妈期可以吃什么水果
缺维生素D吃什么补得最快hcv8jop4ns6r.cn 肚子疼呕吐是什么原因引起的hcv9jop2ns4r.cn 桎梏什么意思shenchushe.com 朋友是什么意思hcv8jop3ns4r.cn 吃什么能让胸变大hcv8jop9ns6r.cn
皮下紫癜是什么引起的hcv8jop1ns5r.cn 什么鱼适合红烧hcv8jop6ns4r.cn 什么叫肾病综合征hcv9jop0ns2r.cn 今年二十岁属什么生肖hcv9jop0ns8r.cn 血管瘤是什么样子的zsyouku.com
膝盖酸痛什么原因hcv8jop0ns7r.cn 静脉曲张什么症状hcv9jop2ns0r.cn nz是什么意思hcv9jop6ns0r.cn 植物油是什么hcv8jop7ns7r.cn 结甲可能是什么意思hebeidezhi.com
阴囊湿疹长什么样图片hcv8jop8ns6r.cn 酱油是什么时候发明的hcv9jop1ns3r.cn 70年产权是从什么时候开始算hcv9jop5ns3r.cn 石敢当是什么意思hcv9jop6ns3r.cn 梦见女鬼是什么意思hcv8jop4ns2r.cn
百度