墨龟为什么只能养一只| 晒伤用什么药| 一个火一个斤念什么| 猛犸象什么时候灭绝的| 矢量图是什么格式| 甘草有什么功效| 白带多是什么情况| 什么是无期徒刑| 口腔疱疹吃什么药| 幽门螺杆菌是什么引起的| 海马用什么呼吸| 霍家为什么娶郭晶晶| 1984年什么命| 用盐洗头发有什么好处| 经常犯困想睡觉是什么原因| 什么牌子的蜂胶最好| 眼屎多吃什么药| mj是什么意思| 一月八号是什么星座| 农历8月15是什么节日| 吃什么降羊水最快| 脸上长痣是什么原因| 送礼送什么烟比较好| 王不留行是什么| 丙肝是什么| 为什么乳头会痒| 小老头是什么意思| 睡觉后腰疼是什么原因引起的| 沥水是什么意思| 五月生日是什么星座| 乙肝通过什么传染| 看男性性功能挂什么科| 三点水加累读什么| 小米粥和什么搭配最好| 七月七是什么节日| 什么是芥菜| 滔滔不绝的绝什么意思| 陈小春什么星座| 军士长是什么级别| 鬼冢虎属于什么档次| 年薪10万算什么水平| 香松是什么| 淡奶油是什么| 金銮殿是什么意思| 剃光头有什么好处| 肠胃炎吃什么好| 醋泡姜用什么醋好| 鸡喜欢吃什么食物| 房客是什么意思| 眉心长痘是什么原因| 秋天吃什么| 脖子短适合什么发型| 睾丸炎吃什么药| 势在必得是什么意思| 橘络的功效与作用是什么| 木吉他什么牌子比较好| hv是什么意思| 什么学步| 吹风样杂音见于什么病| 伤官是什么意思| 智齿是什么意思| 独在异乡为异客是什么节日| 回乳是什么意思| 走读生是什么意思| 心电图pr间期缩短是什么意思| 喜欢吃酸的是什么原因| 扣字是什么意思| 中国的国菜是什么| 眼眶发青是什么原因| pt是什么材质| 什么是高利贷| 口臭喝什么茶效果最好| 萧字五行属什么| 扁桃体肿大有什么症状| tf口红什么牌子| 玫瑰糠疹用什么药| 乳腺结节是什么引起的| 什么字五行属水| 1960年属鼠的是什么命| 心服口服的意思是什么| 内分泌失调吃什么调理| 老鼠为什么会飞| 一什么桌子| 今年33岁属什么生肖的| 生吃紫苏叶有什么功效| 为什么不能在床上打坐| 1月22日什么星座| 燕子喜欢吃什么| 李白是什么星座| 血管疼是什么原因| 什么东西补钙| 杨桃什么季节成熟| 每个月14号都是什么情人节| 什么样的小河| 尿道口长肉芽是什么| 稷字五行属什么| 月经期间吃什么食物最好| 霉菌性阴道炎有什么症状| 99足银是什么意思| 冰雪什么| 什么是根管治疗牙齿| 骨折是什么感觉| 靶身高是什么意思| 姨妈痛吃什么药| 什么是呼吸性碱中毒| 殇读什么| 丁香是什么| 皮肤白斑是什么原因| 羊冲什么生肖| 美国属于什么洲| 忠厚是什么意思| 九月三号是什么日子| 微信什么时候有的| 什么叫染色体| nu11是什么意思| 蜜蜡是什么材质| 子宫和宫颈有什么区别| 户口本可以干什么坏事| msms筛查是什么意思| 54岁属什么的| 办银行卡需要什么证件| 什么叫类风湿| 一个不一个好念什么| 吃盐吃多了有什么危害| 嬴姓赵氏是什么意思| 刚生完孩子的产妇吃什么水果好| bv是什么牌子| 四川是什么生肖| 白带多什么原因| 文化是指什么| 69是什么意思| amor是什么意思| 龙涎香什么味道| 家里为什么有小飞虫| 曲拉是什么| 两岁宝宝不会说话但什么都知道| 智商高是什么意思| 脚底疼挂什么科| 油菜花什么时候开| 长期喝苦荞茶有什么好处| 满字是什么结构| 什么叫刺身| vs什么意思| 老流鼻血是什么原因| 脚趾第二个比第一个长有什么说法| 天上的彩虹像什么| 卵巢囊肿有什么症状| 淀粉和面粉有什么区别| 肚脐眼连接体内的什么器官| 经常眩晕是什么原因| 丰都为什么叫鬼城| 老鼠吃什么| 化疗后吃什么排毒最快| 跟腱为什么会断裂| 白矾是什么| 什么野菜降血糖| 13颗珠子的手串什么意思| 71属什么生肖| 护理学是干什么的| 虎落平阳被犬欺是什么生肖| 夜宵和宵夜有什么区别| 处口念什么| 思诺思是什么药| 女生的隐私部位长什么样| 干事是什么意思| 澎湃的什么| 什么是otc| 不加热血清反应素试验是什么| 才高八斗是什么动物| 手持吸尘器什么牌子好| 有什么病| 无的放矢是什么意思| 以梦为马什么意思| 小肠气是什么病| 尿血最坏的病是什么病| 藏干是什么意思| 发烧怕冷是什么原因| 外籍是什么意思| 毛孔粗大用什么洗面奶好| 醛固酮高有什么危害| 手指抽筋是什么原因| 马铃薯什么时候传入中国| 百日咳是什么引起的| 虚荣心是什么意思| 生肖猴和什么生肖最配| 硬度不够吃什么药| 白癜风的症状是什么| 胎儿什么时候入盆| 什么是老赖| n字鞋子是什么牌子| 肺部结节挂什么科| 十万个为什么作者是谁| 充电宝什么品牌最好| leep是什么意思| 肥肠炖什么好吃| 液氨是什么| 甲状腺结节看什么科室最好| cim是什么意思| 试管婴儿什么价格| 红骨髓是什么意思| 人脉是什么意思| 治疗阴虱子用什么药最好| 1991年什么命| 腿上有白点是什么原因| 反物质是什么| 思维敏捷是什么意思| 小狗咳嗽吃什么药好使| 智齿为什么会横着长| 全自动洗衣机漏水是什么原因| 男性阴囊潮湿是什么病| 睡觉多梦吃什么药| 羊脑炎什么症状怎么治| 96是什么意思| 润什么意思| 喝莓茶有什么好处| 精神衰弱吃什么能改善| 什么是尿酸| 二哥是什么意思| 尿蛋白什么意思| 三重一大是什么内容| 正痛片别名叫什么| 胃食管反流什么症状| 赛脸什么意思| 人性的弱点是什么| 女人腿肿应该检查什么| 葡萄籽有什么功效| 肌酐高吃什么中药| 牙疼有什么好办法| 盗窃是什么意思| 腿抽筋吃什么药| 龙井茶什么季节喝最好| 大姨妈能吃什么水果| 孕妇零食可以吃什么| 西柚是什么意思| 蝈蝈吃什么食物| 长期戴耳机有什么危害| 枪色是什么色| 什么是乳头瘤| 黄体什么意思| 渣男之首是什么星座| 腺样体是什么| 活字印刷术是什么时候发明的| std什么意思| 拍身份证照片穿什么颜色衣服好看| 十二生肖本领强是什么生肖| 盆腔炎吃什么药最好| 元素是什么| 手指发麻什么原因| 小孩脚底脱皮是什么原因造成的| 银手镯变黑是什么原因| 无名指下面的竖线代表什么| 甲状腺是什么功能| 头发轻轻一拉就掉了是什么原因| 每天早上起床口苦是什么原因| 梦见抬棺材是什么意思| 国家副主席是什么级别| 正常人的尿液是什么颜色| 数字7的风水含义是什么| 保和丸有什么功效| dos是什么| 恳谈会是什么意思| 钻石是什么材质| 胰腺在什么位置图片| 女人血虚吃什么补最快| 百度

正团级是什么军衔


Directory: ../../../ffmpeg/
File: src/libavcodec/jvdec.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 110 121 90.9%
Functions: 6 6 100.0%
Branches: 73 86 84.9%

Line Branch Exec Source
1 /*
2 * Bitmap Brothers JV video decoder
3 * Copyright (c) 2011 Peter Ross <pross@xvid.org>
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 /**
23 * @file
24 * Bitmap Brothers JV video decoder
25 * @author Peter Ross <pross@xvid.org>
26 */
27
28 #include "libavutil/intreadwrite.h"
29
30 #include "avcodec.h"
31 #include "blockdsp.h"
32 #include "codec_internal.h"
33 #include "decode.h"
34 #include "get_bits.h"
35
36 typedef struct JvContext {
37 BlockDSPContext bdsp;
38 AVFrame *frame;
39 uint32_t palette[AVPALETTE_COUNT];
40 } JvContext;
41
42 3 static av_cold int decode_init(AVCodecContext *avctx)
43 {
44 3 JvContext *s = avctx->priv_data;
45
46
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 if (!avctx->width || !avctx->height ||
47
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 (avctx->width & 7) || (avctx->height & 7)) {
48 av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
49 avctx->width, avctx->height);
50 return AVERROR(EINVAL);
51 }
52
53 3 s->frame = av_frame_alloc();
54
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (!s->frame)
55 return AVERROR(ENOMEM);
56
57 3 avctx->pix_fmt = AV_PIX_FMT_PAL8;
58 3 ff_blockdsp_init(&s->bdsp);
59 3 return 0;
60 }
61
62 /**
63 * Decode 2x2 block
64 */
65 14056 static inline void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize)
66 {
67 int i, j, v[2];
68
69
4/4
✓ Branch 1 taken 348 times.
✓ Branch 2 taken 9984 times.
✓ Branch 3 taken 51 times.
✓ Branch 4 taken 3673 times.
14056 switch (get_bits(gb, 2)) {
70 348 case 1:
71 348 v[0] = get_bits(gb, 8);
72
2/2
✓ Branch 0 taken 696 times.
✓ Branch 1 taken 348 times.
1044 for (j = 0; j < 2; j++)
73 696 memset(dst + j * linesize, v[0], 2);
74 348 break;
75 9984 case 2:
76 9984 v[0] = get_bits(gb, 8);
77 9984 v[1] = get_bits(gb, 8);
78
2/2
✓ Branch 0 taken 19968 times.
✓ Branch 1 taken 9984 times.
29952 for (j = 0; j < 2; j++)
79
2/2
✓ Branch 0 taken 39936 times.
✓ Branch 1 taken 19968 times.
59904 for (i = 0; i < 2; i++)
80 39936 dst[j * linesize + i] = v[get_bits1(gb)];
81 9984 break;
82 51 case 3:
83
2/2
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 51 times.
153 for (j = 0; j < 2; j++)
84
2/2
✓ Branch 0 taken 204 times.
✓ Branch 1 taken 102 times.
306 for (i = 0; i < 2; i++)
85 204 dst[j * linesize + i] = get_bits(gb, 8);
86 }
87 14056 }
88
89 /**
90 * Decode 4x4 block
91 */
92 17028 static inline void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize)
93 {
94 int i, j, v[2];
95
96
4/4
✓ Branch 1 taken 139 times.
✓ Branch 2 taken 11062 times.
✓ Branch 3 taken 3514 times.
✓ Branch 4 taken 2313 times.
17028 switch (get_bits(gb, 2)) {
97 139 case 1:
98 139 v[0] = get_bits(gb, 8);
99
2/2
✓ Branch 0 taken 556 times.
✓ Branch 1 taken 139 times.
695 for (j = 0; j < 4; j++)
100 556 memset(dst + j * linesize, v[0], 4);
101 139 break;
102 11062 case 2:
103 11062 v[0] = get_bits(gb, 8);
104 11062 v[1] = get_bits(gb, 8);
105
2/2
✓ Branch 0 taken 22124 times.
✓ Branch 1 taken 11062 times.
33186 for (j = 2; j >= 0; j -= 2) {
106
2/2
✓ Branch 0 taken 88496 times.
✓ Branch 1 taken 22124 times.
110620 for (i = 0; i < 4; i++)
107 88496 dst[j * linesize + i] = v[get_bits1(gb)];
108
2/2
✓ Branch 0 taken 88496 times.
✓ Branch 1 taken 22124 times.
110620 for (i = 0; i < 4; i++)
109 88496 dst[(j + 1) * linesize + i] = v[get_bits1(gb)];
110 }
111 11062 break;
112 3514 case 3:
113
2/2
✓ Branch 0 taken 7028 times.
✓ Branch 1 taken 3514 times.
10542 for (j = 0; j < 4; j += 2)
114
2/2
✓ Branch 0 taken 14056 times.
✓ Branch 1 taken 7028 times.
21084 for (i = 0; i < 4; i += 2)
115 14056 decode2x2(gb, dst + j * linesize + i, linesize);
116 }
117 17028 }
118
119 /**
120 * Decode 8x8 block
121 */
122 6000 static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize,
123 BlockDSPContext *bdsp)
124 {
125 int i, j, v[2];
126
127
4/4
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 218 times.
✓ Branch 3 taken 4257 times.
✓ Branch 4 taken 1496 times.
6000 switch (get_bits(gb, 2)) {
128 29 case 1:
129 29 v[0] = get_bits(gb, 8);
130 29 bdsp->fill_block_tab[1](dst, v[0], linesize, 8);
131 29 break;
132 218 case 2:
133 218 v[0] = get_bits(gb, 8);
134 218 v[1] = get_bits(gb, 8);
135
2/2
✓ Branch 0 taken 1744 times.
✓ Branch 1 taken 218 times.
1962 for (j = 7; j >= 0; j--)
136
2/2
✓ Branch 0 taken 13952 times.
✓ Branch 1 taken 1744 times.
15696 for (i = 0; i < 8; i++)
137 13952 dst[j * linesize + i] = v[get_bits1(gb)];
138 218 break;
139 4257 case 3:
140
2/2
✓ Branch 0 taken 8514 times.
✓ Branch 1 taken 4257 times.
12771 for (j = 0; j < 8; j += 4)
141
2/2
✓ Branch 0 taken 17028 times.
✓ Branch 1 taken 8514 times.
25542 for (i = 0; i < 8; i += 4)
142 17028 decode4x4(gb, dst + j * linesize + i, linesize);
143 }
144 6000 }
145
146 9 static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
147 int *got_frame, AVPacket *avpkt)
148 {
149 9 JvContext *s = avctx->priv_data;
150 9 const uint8_t *buf = avpkt->data;
151 9 const uint8_t *buf_end = buf + avpkt->size;
152 int video_size, video_type, i, j, ret;
153
154
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (avpkt->size < 6)
155 return AVERROR_INVALIDDATA;
156
157 9 video_size = AV_RL32(buf);
158 9 video_type = buf[4];
159 9 buf += 5;
160
161
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
9 if (video_size) {
162
3/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 7 times.
8 if (video_size < 0 || video_size > avpkt->size - 5) {
163 1 av_log(avctx, AV_LOG_ERROR, "video size %d invalid\n", video_size);
164 1 return AVERROR_INVALIDDATA;
165 }
166
167
3/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1 times.
7 if (video_type == 0 || video_type == 1) {
168 GetBitContext gb;
169 6 init_get_bits(&gb, buf, 8 * video_size);
170
171
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
6 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
172 return ret;
173
174
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (avctx->height/8 * (avctx->width/8) > 4 * video_size) {
175 av_log(avctx, AV_LOG_ERROR, "Insufficient input data for dimensions\n");
176 return AVERROR_INVALIDDATA;
177 }
178
179
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 6 times.
156 for (j = 0; j < avctx->height; j += 8)
180
2/2
✓ Branch 0 taken 6000 times.
✓ Branch 1 taken 150 times.
6150 for (i = 0; i < avctx->width; i += 8)
181 6000 decode8x8(&gb,
182 6000 s->frame->data[0] + j * s->frame->linesize[0] + i,
183 6000 s->frame->linesize[0], &s->bdsp);
184
185 6 buf += video_size;
186
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 } else if (video_type == 2) {
187 1 int v = *buf++;
188
189 1 av_frame_unref(s->frame);
190
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 if ((ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF)) < 0)
191 return ret;
192
193
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 1 times.
201 for (j = 0; j < avctx->height; j++)
194 200 memset(s->frame->data[0] + j * s->frame->linesize[0],
195 200 v, avctx->width);
196 } else {
197 av_log(avctx, AV_LOG_WARNING,
198 "unsupported frame type %i\n", video_type);
199 return AVERROR_INVALIDDATA;
200 }
201 }
202
203
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
8 if (buf_end - buf >= AVPALETTE_COUNT * 3) {
204
2/2
✓ Branch 0 taken 256 times.
✓ Branch 1 taken 1 times.
257 for (i = 0; i < AVPALETTE_COUNT; i++) {
205 256 uint32_t pal = AV_RB24(buf);
206 256 s->palette[i] = 0xFFU << 24 | pal << 2 | ((pal >> 4) & 0x30303);
207 256 buf += 3;
208 }
209 }
210
211
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1 times.
8 if (video_size) {
212 7 memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
213
214
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
7 if ((ret = av_frame_ref(rframe, s->frame)) < 0)
215 return ret;
216 7 *got_frame = 1;
217 }
218
219 8 return avpkt->size;
220 }
221
222 3 static av_cold int decode_close(AVCodecContext *avctx)
223 {
224 3 JvContext *s = avctx->priv_data;
225
226 3 av_frame_free(&s->frame);
227
228 3 return 0;
229 }
230
231 const FFCodec ff_jv_decoder = {
232 .p.name = "jv",
233 CODEC_LONG_NAME("Bitmap Brothers JV video"),
234 .p.type = AVMEDIA_TYPE_VIDEO,
235 .p.id = AV_CODEC_ID_JV,
236 .priv_data_size = sizeof(JvContext),
237 .init = decode_init,
238 .close = decode_close,
239 FF_CODEC_DECODE_CB(decode_frame),
240 .p.capabilities = AV_CODEC_CAP_DR1,
241 };
242

水柔棉是什么面料 翡翠五行属什么 儿童感冒吃什么药 鼻基底填充用什么材料比较好 为什么会得肺炎
马标志的车是什么牌子 肾尿盐结晶是什么意思 血脂低是什么原因 回民为什么不能吃猪肉 外面下着雨犹如我心血在滴什么歌
贵人多忘事什么意思 为什么喝水血糖也会高 abob白色药片是什么药 瓶颈期是什么意思 便溏是什么原因引起的
长期便秘是什么原因 海黄瓜是什么 右眼皮跳代表什么 日本豆腐是用什么做的 一什么冰雹
高铁上为什么没有e座hcv7jop9ns9r.cn 救济的近义词是什么hcv8jop7ns7r.cn 母乳是什么味hcv8jop8ns0r.cn 黄体不足吃什么药hcv7jop5ns3r.cn 退化是什么意思hcv9jop5ns2r.cn
维生素c偏高是什么原因hcv8jop4ns5r.cn 减肥期间吃什么水果hcv9jop3ns4r.cn 核磁共振是查什么的hcv9jop5ns2r.cn 吃什么升白细胞比较快hcv9jop4ns9r.cn 为什么会突发脑溢血hcv9jop3ns3r.cn
手机NFC什么意思hcv7jop9ns3r.cn cph是什么意思hcv9jop2ns3r.cn 头晕是什么引起的hcv8jop8ns9r.cn 梦见西红柿是什么预兆hcv9jop1ns0r.cn 什么的被子bjhyzcsm.com
bpc是什么意思hcv7jop5ns3r.cn 父亲节要送什么礼物好hcv8jop5ns7r.cn 耳洞为什么会发臭hcv8jop3ns5r.cn 踏空是什么意思hcv7jop6ns8r.cn cn是什么hcv8jop8ns3r.cn
百度