花生不能和什么食物一起吃| 什么车子寸步难行脑筋急转弯| 吃什么水果补血| 后背沉重感是什么原因引起的| hyper是什么意思| 衣原体感染男性吃什么药| 天成是什么意思| 后背凉凉的是什么原因| 望远镜什么牌子好| 女人梦见蛇是什么预兆| 寒热往来什么意思| abr是什么检查| 坐月子能吃什么水果| 膝盖痛吃什么药好| 格列卫是什么药| 属羊的和什么属相最配| 引以为傲是什么意思| 铁蛋白偏低是什么意思| 三言两语是什么生肖| 大肠炒什么菜好吃| 回不到我们的从前是什么歌| fog是什么牌子| 太息是什么意思| 最近老坏东西暗示什么| apc是什么| 儿童牙疼吃什么药| 后腰出汗多是什么原因| 深圳有什么好吃的| 金字旁有什么字| 险资举牌什么意思| 龙傲天是什么意思| 嗓子哑是什么病的前兆| 金牛后面是什么星座| 缺钾会有什么症状| 痛风应该挂什么科| 为什么身份证后面有个x| 高考成绩什么时间公布| cb是什么| 征兵初检检查什么| 95511是什么电话| 乳糖酶是什么| 血管变窄吃什么能改善| 什么叫能量| 扁平疣用什么药膏除根| 阴阳数字是什么数| 青少年膝盖痛什么原因| 宝宝流鼻血是什么原因| 鼠的三合生肖是什么| 刚刚邹城出什么大事了| 鸭子炖什么好吃| 赖是什么意思| geneva是什么牌子手表| 日斤读什么字| 老叹气是什么原因| 电饭煲内胆什么材质好| 白色糠疹是什么原因引起的| 糖吃多了有什么危害| 狗狗为什么喜欢舔人| 尿道灼热感吃什么药| 意面是什么面| 为什么会孕酮低| 迎刃而解是什么意思| 肛门指检是检查什么| 尿道口流白色液体是什么病| 桃花劫是什么意思| 善太息是什么意思| 地球属于什么星系| 梦见老鼠是什么征兆| 脑梗怎么形成的原因是什么| 眼睛疼吃什么药效果最好| 嗓子痒咳嗽吃什么药| 一抹是什么意思| 尿特别黄是什么原因| 机械表是什么意思| 胃出血是什么原因引起的| 多发纳氏囊肿是什么意思| 桑葚干和什么搭配泡水| 病毒性结膜炎用什么眼药水| 检查肝挂什么科| 四级专家是什么级别| 感冒喉咙痛吃什么药好| 宝宝乳糖不耐受喝什么奶粉比较好| 黄喉是什么动物身上的| 甲状腺4级是什么意思| 什么是痰湿| 美容美体是干什么的| rh血型D阳性是什么意思| 男孩子什么时候刮胡子| 茹什么饮什么| 溶液是什么| 乙肝表面抗原阴性是什么意思| gree是什么牌子| 一级医院是什么意思| 什么会引起高血压| 7月15是什么星座的| 尿酸高吃什么水果好| 五月二十一是什么星座| 发物是什么意思| 浔是什么意思| 血糖高要注意什么| 男人为什么喜欢吃奶| 淋巴细胞偏低什么意思| 蒲地蓝消炎片治什么病| 小腹坠胀是什么原因| 腺样体肥大吃什么药| 什么叫潮吹| prich是什么牌子| 张起灵和吴邪什么关系| jbl是什么牌子| 四个火读什么字| 吗啡是什么药| 小孩吃鼻屎是什么原因| 经期可以吃什么水果| 单核细胞百分比偏高是什么意思| 欧阳修号什么| 扑街什么意思| 不排卵是什么原因造成| 阴虚火旺是什么症状| 狗狗喝什么水| 为什么邓超对鹿晗很好| 眼白有点黄是什么原因| 气血两虚是什么意思| 指甲脱层是什么原因| 经常挖鼻孔有什么危害| 肿瘤标志物五项检测是什么| 拔完牙吃什么消炎药| 吃牛肉有什么好处| 黑枸杞泡水是什么颜色| 体征是什么意思| 桃子不能和什么食物一起吃| 3d打印是什么意思| 舒肝解郁胶囊治什么病| 寒风吹起细雨迷离是什么歌| 虎皮羊质是指什么生肖| 尿发黄是什么原因男性| 南方是什么生肖| 大学毕业送什么花| 770是什么意思| 什么水果清肝火| 稀料是什么| 平躺头晕是什么原因| 男性尿道刺痛吃什么药| 腺体增生是什么意思| 双手麻木是什么原因| 为什么会肌酐高| 柴鸡是什么鸡| 2月是什么月| 体重一直不变说明什么| 激动是什么意思| kr是什么货币| g代表什么| 大腿根疼是什么原因| 梅毒螺旋体抗体阳性是什么意思| 肚子一直响是什么原因| 阿斯伯格综合征是什么| p53野生型是什么意思| 丹青是什么| 新生儿痤疮是什么引起的| 幽门螺旋杆菌挂什么科| 咽炎挂什么科室| 藤椒是什么| 肚脐眼叫什么穴位| 桎梏什么意思| 嗓子哑是什么病的前兆| 协会是什么意思| 治疗神经痛用什么药最有效| c4是什么意思| 不景气是什么意思| 右小指麻木是什么征兆| 眼睛模糊是什么原因引起的| 乔迁送什么礼物好| 田野里有什么| 走路对身体有什么好处| 排卵期有什么感觉| 吃卡培他滨禁止吃什么| 合作医疗是什么| 心脏上有个小洞是什么病| 细胞是什么| 一什么云| 胸椎退变是什么意思| 什么是口播| 中阴身是什么意思| blood什么意思| 吐舌头是什么意思| 桃花是什么季节开的| 梦见佛像是什么意思| 天才是什么意思| 右眼皮跳有什么预兆| 丹参片和复方丹参片有什么区别| 有编制是什么意思| 洞房是什么意思| 下寒上热体质吃什么中成药| 福禄双全是什么意思| 抵税是什么意思| 左侧淋巴结肿大是什么原因| 小麦粉可以做什么| 多梦是什么原因造成的| twin什么意思| 吃什么可以解酒| 谌读什么| 妇科炎症是什么原因引起的| 孩子鼻子流鼻血是什么原因| 眼睛疲劳用什么眼药水| 白头发吃什么能变黑| 魅惑是什么意思| 水灵灵是什么意思| 出痧的颜色代表什么| 咽喉炎吃什么好| 逼长什么样| 属猴与什么属相最配| 老来得子是什么意思| 海肠是什么东西| 咖啡色是什么颜色| 黑裙配什么颜色的上衣| 杰字属于五行属什么| 用什么回奶最快最有效| 为什么低烧比高烧可怕| 口比念什么| 剖腹产第四天可以吃什么| 今日是什么日子| 金代表什么生肖| 鼻涕带血是什么原因| 亚急性甲状腺炎吃什么药| 什么水果含糖量低| 痛风吃什么中药最有效| 眼角长痘痘是什么原因| 看输卵管是否堵塞做什么检查| 肾气虚吃什么中成药| 托腮是什么意思| 一月7日是什么星座| 什么啤酒好| 三叉戟是什么车| 婴儿坐高铁需要什么证件| 为什么身份证后面有个x| KTV服务员主要做什么| 血管炎是什么病| 碳13是检查什么的| bso是什么意思| 女性气血不足吃什么调理| 穷极一生是什么意思| 秀米是什么| 什么叫出轨| 三月20号是什么星座| 破伤风是什么意思| 小猫的尾巴有什么作用| 脂肪肝浸润是什么意思| 香砂六君丸治什么病| 睾丸炎吃什么药好得快| 喜欢闻汽油味是什么原因| 供不应求是什么意思| 心脏房颤是什么意思| 烂脚丫用什么药能治除根| 女性白带有血丝是什么原因| 背后长痘痘什么原因| 为什么叫天津卫| 教学相长什么意思| 脚底发黄是什么原因| 尿频尿急尿不尽吃什么药| 玩游戏有什么好处| ab型和o型生的孩子是什么血型| cr医学上是什么意思| 秋天吃什么| 鄙人不才是什么意思| 什么是男人| 百度

吃什么都吐是什么原因


Directory: ../../../ffmpeg/
File: src/libavcodec/midivid.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 0 149 0.0%
Functions: 0 6 0.0%
Branches: 0 82 0.0%

Line Branch Exec Source
1 /*
2 * MidiVid decoder
3 * Copyright (c) 2019 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/imgutils.h"
23 #include "libavutil/internal.h"
24 #include "libavutil/mem.h"
25
26 #define BITSTREAM_READER_LE
27 #include "avcodec.h"
28 #include "get_bits.h"
29 #include "bytestream.h"
30 #include "codec_internal.h"
31 #include "decode.h"
32
33 typedef struct MidiVidContext {
34 GetByteContext gb;
35
36 uint8_t *uncompressed;
37 unsigned int uncompressed_size;
38 uint8_t *skip;
39
40 AVFrame *frame;
41 } MidiVidContext;
42
43 static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
44 {
45 GetByteContext *gb = &s->gb;
46 GetBitContext mask;
47 GetByteContext idx9;
48 uint16_t nb_vectors, intra_flag;
49 const uint8_t *vec;
50 const uint8_t *mask_start;
51 uint8_t *skip;
52 uint32_t mask_size;
53 int idx9bits = 0;
54 int idx9val = 0;
55 uint32_t nb_blocks;
56
57 nb_vectors = bytestream2_get_le16(gb);
58 intra_flag = !!bytestream2_get_le16(gb);
59 if (intra_flag) {
60 nb_blocks = (avctx->width / 2) * (avctx->height / 2);
61 } else {
62 int ret, skip_linesize, padding;
63
64 nb_blocks = bytestream2_get_le32(gb);
65 skip_linesize = avctx->width >> 1;
66 mask_start = gb->buffer_start + bytestream2_tell(gb);
67 mask_size = (FFALIGN(avctx->width, 32) >> 2) * (avctx->height >> 2) >> 3;
68 padding = (FFALIGN(avctx->width, 32) - avctx->width) >> 2;
69
70 if (bytestream2_get_bytes_left(gb) < mask_size)
71 return AVERROR_INVALIDDATA;
72
73 ret = init_get_bits8(&mask, mask_start, mask_size);
74 if (ret < 0)
75 return ret;
76 bytestream2_skip(gb, mask_size);
77 skip = s->skip;
78
79 for (int y = 0; y < avctx->height >> 2; y++) {
80 for (int x = 0; x < avctx->width >> 2; x++) {
81 int flag = !get_bits1(&mask);
82
83 skip[(y*2) *skip_linesize + x*2 ] = flag;
84 skip[(y*2) *skip_linesize + x*2+1] = flag;
85 skip[(y*2+1)*skip_linesize + x*2 ] = flag;
86 skip[(y*2+1)*skip_linesize + x*2+1] = flag;
87 }
88 skip_bits_long(&mask, padding);
89 }
90 }
91
92 vec = gb->buffer_start + bytestream2_tell(gb);
93 if (bytestream2_get_bytes_left(gb) < nb_vectors * 12)
94 return AVERROR_INVALIDDATA;
95 bytestream2_skip(gb, nb_vectors * 12);
96 if (nb_vectors > 256) {
97 if (bytestream2_get_bytes_left(gb) < (nb_blocks + 7 * !intra_flag) / 8)
98 return AVERROR_INVALIDDATA;
99 bytestream2_init(&idx9, gb->buffer_start + bytestream2_tell(gb), (nb_blocks + 7 * !intra_flag) / 8);
100 bytestream2_skip(gb, (nb_blocks + 7 * !intra_flag) / 8);
101 }
102
103 skip = s->skip;
104
105 for (int y = avctx->height - 2; y >= 0; y -= 2) {
106 uint8_t *dsty = frame->data[0] + y * frame->linesize[0];
107 uint8_t *dstu = frame->data[1] + y * frame->linesize[1];
108 uint8_t *dstv = frame->data[2] + y * frame->linesize[2];
109
110 for (int x = 0; x < avctx->width; x += 2) {
111 int idx;
112
113 if (!intra_flag && *skip++)
114 continue;
115 if (bytestream2_get_bytes_left(gb) <= 0)
116 return AVERROR_INVALIDDATA;
117 if (nb_vectors <= 256) {
118 idx = bytestream2_get_byte(gb);
119 } else {
120 if (idx9bits == 0) {
121 idx9val = bytestream2_get_byte(&idx9);
122 idx9bits = 8;
123 }
124 idx9bits--;
125 idx = bytestream2_get_byte(gb) | (((idx9val >> (7 - idx9bits)) & 1) << 8);
126 }
127 if (idx >= nb_vectors)
128 return AVERROR_INVALIDDATA;
129
130 dsty[x +frame->linesize[0]] = vec[idx * 12 + 0];
131 dsty[x+1+frame->linesize[0]] = vec[idx * 12 + 3];
132 dsty[x] = vec[idx * 12 + 6];
133 dsty[x+1] = vec[idx * 12 + 9];
134
135 dstu[x +frame->linesize[1]] = vec[idx * 12 + 1];
136 dstu[x+1+frame->linesize[1]] = vec[idx * 12 + 4];
137 dstu[x] = vec[idx * 12 + 7];
138 dstu[x+1] = vec[idx * 12 +10];
139
140 dstv[x +frame->linesize[2]] = vec[idx * 12 + 2];
141 dstv[x+1+frame->linesize[2]] = vec[idx * 12 + 5];
142 dstv[x] = vec[idx * 12 + 8];
143 dstv[x+1] = vec[idx * 12 +11];
144 }
145 }
146
147 return intra_flag;
148 }
149
150 static ptrdiff_t lzss_uncompress(MidiVidContext *s, GetByteContext *gb, uint8_t *dst, unsigned int size)
151 {
152 uint8_t *dst_start = dst;
153 uint8_t *dst_end = dst + size;
154
155 for (;bytestream2_get_bytes_left(gb) >= 3;) {
156 int op = bytestream2_get_le16(gb);
157
158 for (int i = 0; i < 16; i++) {
159 if (op & 1) {
160 int s0 = bytestream2_get_byte(gb);
161 int s1 = bytestream2_get_byte(gb);
162 int offset = ((s0 & 0xF0) << 4) | s1;
163 int length = (s0 & 0xF) + 3;
164
165 if (dst + length > dst_end ||
166 dst - offset < dst_start)
167 return AVERROR_INVALIDDATA;
168 if (offset > 0) {
169 for (int j = 0; j < length; j++) {
170 dst[j] = dst[j - offset];
171 }
172 }
173 dst += length;
174 } else {
175 if (dst >= dst_end)
176 return AVERROR_INVALIDDATA;
177 *dst++ = bytestream2_get_byte(gb);
178 }
179 op >>= 1;
180 }
181 }
182
183 return dst - dst_start;
184 }
185
186 static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
187 int *got_frame, AVPacket *avpkt)
188 {
189 MidiVidContext *s = avctx->priv_data;
190 GetByteContext *gb = &s->gb;
191 AVFrame *frame = s->frame;
192 int ret, key, uncompressed;
193
194 if (avpkt->size <= 13)
195 return AVERROR_INVALIDDATA;
196
197 bytestream2_init(gb, avpkt->data, avpkt->size);
198 bytestream2_skip(gb, 8);
199 uncompressed = bytestream2_get_le32(gb);
200
201 if (!uncompressed) {
202 av_fast_padded_malloc(&s->uncompressed, &s->uncompressed_size, 16LL * (avpkt->size - 12));
203 if (!s->uncompressed)
204 return AVERROR(ENOMEM);
205
206 ret = lzss_uncompress(s, gb, s->uncompressed, s->uncompressed_size);
207 if (ret < 0)
208 return ret;
209 bytestream2_init(gb, s->uncompressed, ret);
210 }
211
212 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
213 return ret;
214
215 ret = decode_mvdv(s, avctx, frame);
216
217 if (ret < 0)
218 return ret;
219 key = ret;
220
221 if ((ret = av_frame_ref(rframe, s->frame)) < 0)
222 return ret;
223
224 frame->pict_type = key ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
225 if (key)
226 frame->flags |= AV_FRAME_FLAG_KEY;
227 else
228 frame->flags &= ~AV_FRAME_FLAG_KEY;
229 *got_frame = 1;
230
231 return avpkt->size;
232 }
233
234 static av_cold int decode_init(AVCodecContext *avctx)
235 {
236 MidiVidContext *s = avctx->priv_data;
237 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
238
239 if (avctx->width & 3 || avctx->height & 3)
240 ret = AVERROR_INVALIDDATA;
241
242 if (ret < 0) {
243 av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
244 avctx->width, avctx->height);
245 return ret;
246 }
247
248 avctx->pix_fmt = AV_PIX_FMT_YUV444P;
249
250 s->frame = av_frame_alloc();
251 if (!s->frame)
252 return AVERROR(ENOMEM);
253 s->skip = av_calloc(avctx->width >> 1, avctx->height >> 1);
254 if (!s->skip)
255 return AVERROR(ENOMEM);
256
257 return 0;
258 }
259
260 static void decode_flush(AVCodecContext *avctx)
261 {
262 MidiVidContext *s = avctx->priv_data;
263
264 av_frame_unref(s->frame);
265 }
266
267 static av_cold int decode_close(AVCodecContext *avctx)
268 {
269 MidiVidContext *s = avctx->priv_data;
270
271 av_frame_free(&s->frame);
272 av_freep(&s->uncompressed);
273 av_freep(&s->skip);
274
275 return 0;
276 }
277
278 const FFCodec ff_mvdv_decoder = {
279 .p.name = "mvdv",
280 CODEC_LONG_NAME("MidiVid VQ"),
281 .p.type = AVMEDIA_TYPE_VIDEO,
282 .p.id = AV_CODEC_ID_MVDV,
283 .priv_data_size = sizeof(MidiVidContext),
284 .init = decode_init,
285 FF_CODEC_DECODE_CB(decode_frame),
286 .flush = decode_flush,
287 .close = decode_close,
288 .p.capabilities = AV_CODEC_CAP_DR1,
289 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
290 };
291

第一胎打掉会有什么影响 脾阳虚吃什么食物好 什么是polo衫 不放屁是什么原因 懒惰是什么意思
什么牌子的空调好 佟丽娅什么民族 什么是汛期 人乳头瘤病毒是什么 来例假可以吃什么水果
善存片适合什么人吃 吃什么降胆固醇 59年属什么生肖 灼是什么意思 伤口用什么消毒
咳嗽吃什么药 尿白蛋白高是什么原因 1987年什么命 恩施玉露是什么茶 老放屁是什么病的征兆
幼猫能吃什么hcv8jop4ns4r.cn 爱奇艺积分有什么用hcv9jop3ns5r.cn 如履薄冰什么意思hcv9jop2ns9r.cn cems是什么意思hcv8jop3ns7r.cn 捉虫是什么意思hcv7jop5ns5r.cn
骑马野战指什么生肖hcv8jop3ns9r.cn 胡思乱想是什么意思hcv7jop7ns0r.cn 阴道为什么会排气hcv7jop6ns3r.cn 鱼油吃多了有什么副作用hcv9jop2ns0r.cn 胸外科是看什么病的hcv7jop4ns7r.cn
脚腿肿是什么原因引起的hcv9jop6ns7r.cn 肉苁蓉有什么功效dajiketang.com 甍是什么意思hcv7jop5ns0r.cn 被迫是什么意思hcv9jop0ns5r.cn 玉米淀粉能做什么美食hcv7jop9ns3r.cn
生完孩子可以吃什么水果hcv8jop6ns7r.cn 肥胖纹长什么样hcv8jop6ns0r.cn 带状疱疹什么样子hcv9jop2ns2r.cn 牛蒡茶有什么功效hcv9jop5ns0r.cn 什么水果可以减肥hcv8jop0ns1r.cn
百度