宝鸡以前叫什么| 621什么星座| alpha什么意思| 雷诺氏病是一种什么病| 6.10号是什么星座| 虎皮羊质是指什么生肖| svc是什么意思| 什么叫梅核气| 内分泌失调吃什么调理| bv是什么意思| 五月四号什么星座| 口腔溃疡需要补充什么维生素| a股是什么| 测心率手表什么牌子好| 什么是气虚| 猫咪吐黄水有泡沫没有精神吃什么药| 首台套是什么意思| cocoon是什么意思| 手痒脱皮是什么原因| 女生下面长什么样| 腿肿是什么原因引起的怎么办| 蒲地蓝消炎片治什么病| 五谷指什么| 藩王是什么意思| 吃什么补脑子| 蘑菇什么季节长出来| 牛子什么意思| 股癣是什么样的| 为什么记忆力很差| 四个月念什么| 市政协常委是什么级别| 病入膏肓是什么意思| 黄痰黄鼻涕吃什么药| tsh是什么| 字形是什么意思| 5月25号是什么星座| 出阁宴是什么意思| 火加田读什么| 苦瓜对肝脏有什么好处| 蝉联的意思是什么| hbeag阳性是什么意思| 议论纷纷是什么意思| 卵巢囊性占位是什么意思| 鼻炎是什么原因引起的| 什么药治脂肪肝| 发烧喝什么粥| 爱恨就在一瞬间是什么歌| 外周血是什么意思| 血脂高什么东西不能吃| 晚上蝴蝶来家什么预兆| py什么意思| 什么是有意义的东西| 镜面是什么意思| 和氏璧是什么玉| 累觉不爱是什么意思| 女孩缺金取什么名字好| 黄金发红是什么原因| 关节退行性变是什么意思| 交通运输是干什么的| 解脲脲原体是什么意思| 亚硝酸钠是什么| 痛风打什么针见效最快| 微量元素检查挂什么科| 胃肠彩超能检查出什么| 什么鬼什么神| 避孕药吃多了有什么副作用| s和m是什么| 开市是什么意思| 肠易激综合征吃什么药好| 昙花一现什么意思| 起床眼睛肿是什么原因| 苏菲是什么意思| 皮肤过敏不能吃什么食物| 每天喝奶茶有什么危害| 玫瑰花有什么功效| 为什么老虎头上有王字| 精神伴侣是什么意思| 皮肤属于什么组织| 中华田园犬为什么禁养| 智能手环什么品牌好| r表示什么| 药师佛手里拿什么法器| 感悟是什么意思| 加白是什么意思| 什么是体位性低血压| 什么可以保护眼睛| 缺心眼是什么意思| 养老院和敬老院有什么区别| 2.5什么星座| ex是什么| 肚脐下三寸是什么位置| 为什么风团会在晚上爆发| 经常咬手指甲是什么原因| 变色龙指什么人| 配偶什么意思| 喝中药尿黄是什么原因| 酸奶能做什么美食| 竖心旁的字与什么有关| 陶字五行属什么| 什么主皮毛| bottle是什么意思| 为什么阴道会放气| 胎位lsa是什么意思| 异曲同工是什么意思| 2017什么年| 水字五行属什么| 悟空是什么意思| 腹部包块是什么样子的| 舌头麻是什么病的前兆| 姑娘是什么意思| 热敷肚子有什么好处| 转氨酶异常有什么症状| 来大姨妈吃什么水果好| 昂热为什么认识路鸣泽| 查血管堵塞做什么检查| 静是什么意思| 什么食物补血效果最好最快| 三焦是什么器官| 牛肉不能和什么水果一起吃| 上颚疼痛吃什么药| 无力感什么意思| 什么原因导致有幽门杆菌| 打嗝用什么药| 双开是什么意思| 1960年属鼠的是什么命| 梦见下雪是什么| tm是什么| 人云亦什么| 查尿酸挂什么科| 真实写照的意思是什么| 男朋友发烧该说些什么| 什么叫世家| 众生是什么意思| 宿便是什么颜色| 新疆人是什么民族| 牙龈萎缩是什么原因| 有点想吐是什么原因| 变性乙醇是什么东西| 长此以往什么意思| 学业是什么意思| 嗓子有粘痰什么原因| 身上长红点是什么原因| 打呼噜是什么原因造成的| 什么的舞台| 理性是什么意思| sec是什么单位| 胃黏膜病变是什么意思| 双肾尿酸盐结晶是什么意思| 我可以组什么词| 山梨糖醇是什么| 慢阻肺吃什么药| 策字五行属什么| 子宫内膜是什么| junior什么意思| 促甲状腺激素高是什么意思| 六个点是什么意思| 中年人手抖是什么原因| 经期吃什么食物比较好| 白羊座的幸运色是什么颜色| 不全纵隔子宫是什么意思| 住院医师是什么职称| 右眼跳代表什么| 繁星是什么意思| 肩胛骨疼挂什么科| 早上吃什么水果最好| 今晚吃什么| 紫色是什么颜色调出来的| 海鸥吃什么食物| 脑管瘤的症状是什么| 舌头发麻什么原因| 男性全身皮肤瘙痒是什么原因| 香港为什么叫香港| 儿童看牙齿挂什么科| 胎儿肠管扩张是什么原因造成的| 什么降血糖| 喉咙疼是什么原因| 一个兹一个子念什么| 生是什么结构的字| 如期而至是什么意思| 吃什么对眼睛有好处| 透析病人磷高了吃什么降磷| 雾灯什么时候开| nike是什么牌子| 聚乙二醇是什么| 摇摇欲坠是什么意思| 小便尿不出来什么原因| 乳腺发炎有什么症状| 无聊可以干什么| pyq是什么意思| ebohr手表什么牌子多少钱| 为什么晒太阳能补钙| 睡觉爱流口水是什么原因| 屁股眼痒是什么原因| 潮吹是什么样的| 肺寒吃什么药| 剖腹产可以吃什么| 打耳洞去医院挂什么科| 不爱喝水是什么原因| 冬瓜炖什么好吃| 证过二是什么意思| 漂洗什么意思| 做造影对身体有什么伤害| 喝柠檬水有什么好处和坏处| 什么防辐射最好| 马口鱼是什么鱼| 博士在古代是什么意思| 杠杠滴是什么意思| 舌尖痛吃什么药| 什么降血脂效果最好的| 网球肘是什么症状| 贫血吃什么比较好| anode是什么意思| 纹身的人是什么心理| 又什么又什么造句| 阳虚吃什么调理| 谁也不知道下一秒会发生什么| 脑干诱发电位检查是检查什么| 亮晶晶的什么| 孕妇为什么要躲着白事| 日照香炉生紫烟的香炉是什么意思| 什么是轻食| 脾虚如何调理吃什么药| 吃什么治疗湿气重| 黄瓜是绿色的为什么叫黄瓜| 肝寒吃什么中成药| 来月经量少吃什么可以增加月经量| 双子是什么意思| 雨花石是什么石头| 莫名是什么意思| 阴道发痒是什么原因| 梦见很多人是什么意思| 白色情人节什么意思| 救世主是什么意思| 食管在什么位置图片| 子夜是指什么时间| 用什么| 因加一笔是什么字| 金牛座与什么星座最配| 伪善是什么意思| 巡查是什么意思| 净高是什么意思| 暴跳如雷是什么意思| 什么是疱疹| 新生儿上户口需要什么资料| tod是什么| 林冲为什么叫豹子头| 怀孕初期怕冷是什么原因| 点痣挂什么科| 君子兰的寓意是什么| 白居易号什么居士| 三十八岁属什么生肖| 顺产和剖腹产有什么区别| 反映是什么意思| 胸闷气短挂什么科室| 手发胀是什么原因| 什么原因导致胎停| 血压低吃什么补得最快| 乌龟喜欢吃什么食物| 太平果是什么水果| 攫住是什么意思| 基友是什么关系| 蹂躏是什么意思| 白牡丹属于什么茶| 湿疹什么原因引起的| 百度

去年中国网游用户规模超4亿 精品在全球获成功


Directory: ../../../ffmpeg/
File: src/tests/api/api-band-test.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 87 127 68.5%
Functions: 3 3 100.0%
Branches: 34 56 60.7%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2015 Ludmila Glinskih
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23 /**
24 * draw_horiz_band test.
25 */
26
27 #include "libavutil/adler32.h"
28 #include "libavutil/mem.h"
29 #include "libavcodec/avcodec.h"
30 #include "libavformat/avformat.h"
31 #include "libavutil/imgutils.h"
32
33 uint8_t *slice_byte_buffer;
34 int draw_horiz_band_called;
35
36 3350 static void draw_horiz_band(AVCodecContext *ctx, const AVFrame *fr, int offset[4],
37 int slice_position, int type, int height)
38 {
39 int i;
40 const AVPixFmtDescriptor *pix_fmt_desc;
41 int chroma_w, chroma_h;
42 int shift_slice_position;
43 int shift_height;
44
45 3350 draw_horiz_band_called = 1;
46
47 3350 pix_fmt_desc = av_pix_fmt_desc_get(ctx->pix_fmt);
48 3350 chroma_w = -((-ctx->width) >> pix_fmt_desc->log2_chroma_w);
49 3350 chroma_h = -((-height) >> pix_fmt_desc->log2_chroma_h);
50 3350 shift_slice_position = -((-slice_position) >> pix_fmt_desc->log2_chroma_h);
51 3350 shift_height = -((-ctx->height) >> pix_fmt_desc->log2_chroma_h);
52
53
2/2
✓ Branch 0 taken 53400 times.
✓ Branch 1 taken 3350 times.
56750 for (i = 0; i < height; i++) {
54 53400 memcpy(slice_byte_buffer + ctx->width * slice_position + i * ctx->width,
55 53400 fr->data[0] + offset[0] + i * fr->linesize[0], ctx->width);
56 }
57
2/2
✓ Branch 0 taken 26700 times.
✓ Branch 1 taken 3350 times.
30050 for (i = 0; i < chroma_h; i++) {
58 26700 memcpy(slice_byte_buffer + ctx->width * ctx->height + chroma_w * shift_slice_position + i * chroma_w,
59 26700 fr->data[1] + offset[1] + i * fr->linesize[1], chroma_w);
60 }
61
2/2
✓ Branch 0 taken 26700 times.
✓ Branch 1 taken 3350 times.
30050 for (i = 0; i < chroma_h; i++) {
62 26700 memcpy(slice_byte_buffer + ctx->width * ctx->height + chroma_w * shift_height + chroma_w * shift_slice_position + i * chroma_w,
63 26700 fr->data[2] + offset[2] + i * fr->linesize[2], chroma_w);
64 }
65 3350 }
66
67 1 static int video_decode(const char *input_filename)
68 {
69 1 const AVCodec *codec = NULL;
70 1 AVCodecContext *ctx= NULL;
71 1 AVCodecParameters *origin_par = NULL;
72 1 uint8_t *byte_buffer = NULL;
73 1 AVFrame *fr = NULL;
74 AVPacket *pkt;
75 1 AVFormatContext *fmt_ctx = NULL;
76 int number_of_written_bytes;
77 int video_stream;
78 int byte_buffer_size;
79 int result;
80
81 1 draw_horiz_band_called = 0;
82
83 1 result = avformat_open_input(&fmt_ctx, input_filename, NULL, NULL);
84
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (result < 0) {
85 av_log(NULL, AV_LOG_ERROR, "Can't open file\n");
86 return result;
87 }
88
89 1 result = avformat_find_stream_info(fmt_ctx, NULL);
90
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (result < 0) {
91 av_log(NULL, AV_LOG_ERROR, "Can't get stream info\n");
92 return result;
93 }
94
95 1 video_stream = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
96
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (video_stream < 0) {
97 av_log(NULL, AV_LOG_ERROR, "Can't find video stream in input file\n");
98 return -1;
99 }
100
101 1 origin_par = fmt_ctx->streams[video_stream]->codecpar;
102
103 1 codec = avcodec_find_decoder(origin_par->codec_id);
104
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!codec) {
105 av_log(NULL, AV_LOG_ERROR, "Can't find decoder\n");
106 return -1;
107 }
108
109
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!(codec->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND)) {
110 av_log(NULL, AV_LOG_ERROR, "Codec does not support draw_horiz_band\n");
111 return -1;
112 }
113
114 1 ctx = avcodec_alloc_context3(codec);
115
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!ctx) {
116 av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n");
117 return AVERROR(ENOMEM);
118 }
119
120 1 result = avcodec_parameters_to_context(ctx, origin_par);
121
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (result) {
122 av_log(NULL, AV_LOG_ERROR, "Can't copy decoder context\n");
123 return result;
124 }
125
126 1 ctx->draw_horiz_band = draw_horiz_band;
127 1 ctx->thread_count = 1;
128
129 1 result = avcodec_open2(ctx, codec, NULL);
130
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (result < 0) {
131 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
132 return result;
133 }
134
135 1 fr = av_frame_alloc();
136
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!fr) {
137 av_log(NULL, AV_LOG_ERROR, "Can't allocate frame\n");
138 return AVERROR(ENOMEM);
139 }
140
141 1 pkt = av_packet_alloc();
142
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!pkt) {
143 av_log(NULL, AV_LOG_ERROR, "Cannot allocate packet\n");
144 return AVERROR(ENOMEM);
145 }
146
147 1 byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 32);
148 1 byte_buffer = av_malloc(byte_buffer_size);
149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!byte_buffer) {
150 av_log(NULL, AV_LOG_ERROR, "Can't allocate buffer\n");
151 return AVERROR(ENOMEM);
152 }
153
154 1 slice_byte_buffer = av_malloc(byte_buffer_size);
155
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (!slice_byte_buffer) {
156 av_log(NULL, AV_LOG_ERROR, "Can't allocate buffer\n");
157 return AVERROR(ENOMEM);
158 }
159 1 memset(slice_byte_buffer, 0, byte_buffer_size);
160
161 1 result = 0;
162
1/2
✓ Branch 0 taken 151 times.
✗ Branch 1 not taken.
151 while (result >= 0) {
163 151 result = av_read_frame(fmt_ctx, pkt);
164
3/4
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 150 times.
151 if (result >= 0 && pkt->stream_index != video_stream) {
165 av_packet_unref(pkt);
166 continue;
167 }
168
169 // pkt will be empty on read error/EOF
170 151 result = avcodec_send_packet(ctx, pkt);
171
172 151 av_packet_unref(pkt);
173
174
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 151 times.
151 if (result < 0) {
175 av_log(NULL, AV_LOG_ERROR, "Error submitting a packet for decoding\n");
176 return result;
177 }
178
179
1/2
✓ Branch 0 taken 301 times.
✗ Branch 1 not taken.
301 while (result >= 0) {
180 301 result = avcodec_receive_frame(ctx, fr);
181
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 300 times.
301 if (result == AVERROR_EOF)
182 1 goto finish;
183
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 150 times.
300 else if (result == AVERROR(EAGAIN)) {
184 150 result = 0;
185 150 break;
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 } else if (result < 0) {
187 av_log(NULL, AV_LOG_ERROR, "Error decoding frame\n");
188 return result;
189 }
190
191 150 number_of_written_bytes = av_image_copy_to_buffer(byte_buffer, byte_buffer_size,
192 150 (const uint8_t* const *)fr->data, (const int*) fr->linesize,
193 150 ctx->pix_fmt, ctx->width, ctx->height, 1);
194
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 if (number_of_written_bytes < 0) {
195 av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n");
196 return number_of_written_bytes;
197 }
198
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 if (draw_horiz_band_called == 0) {
199 av_log(NULL, AV_LOG_ERROR, "draw_horiz_band haven't been called!\n");
200 return -1;
201 }
202 150 if (av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes) !=
203
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_adler32_update(0, (const uint8_t*)slice_byte_buffer, number_of_written_bytes)) {
204 av_log(NULL, AV_LOG_ERROR, "Decoded frames with and without draw_horiz_band are not the same!\n");
205 return -1;
206 }
207 150 av_frame_unref(fr);
208 }
209 }
210
211 finish:
212 1 av_packet_free(&pkt);
213 1 av_frame_free(&fr);
214 1 avformat_close_input(&fmt_ctx);
215 1 avcodec_free_context(&ctx);
216 1 av_freep(&byte_buffer);
217 1 av_freep(&slice_byte_buffer);
218 1 return 0;
219 }
220
221 1 int main(int argc, char **argv)
222 {
223
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (argc < 2)
224 {
225 av_log(NULL, AV_LOG_ERROR, "Incorrect input: expected %s <name of a video file>\n", argv[0]);
226 return 1;
227 }
228
229
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 if (video_decode(argv[1]) != 0)
230 return 1;
231
232 1 return 0;
233 }
234

什么叫哮喘 人肉是什么味道的 文采是什么意思 1880年是什么朝代 风包念什么
为什么会长囊肿 9月9号是什么星座 黔驴技穷的意思是什么 尔昌尔炽什么意思 头发秃一块是什么原因
颈椎病最怕干什么活 分开后我会笑着说是什么歌 刚感染艾滋病什么症状 心电图是什么 黄芪主治什么病
如是观是什么意思 月经褐色是什么原因 山竹不能和什么水果一起吃 九霄云外是什么生肖 alexanderwang是什么牌子
长癣是什么原因引起的hcv8jop8ns0r.cn 梅毒rpr是什么hcv8jop9ns4r.cn 暴饮暴食会得什么病hcv9jop5ns8r.cn diff什么意思0297y7.com 甲醛超标有什么危害hcv9jop4ns5r.cn
甜字五行属什么hcv9jop3ns9r.cn 利湿是什么意思hcv8jop9ns2r.cn 什么网站可以看黄色视频sanhestory.com 老鼠疮是什么病hcv9jop7ns0r.cn 天天晚上睡觉做梦是什么原因hcv8jop1ns9r.cn
京东发什么快递hcv8jop4ns4r.cn 福报是什么意思hcv9jop1ns9r.cn 雯五行属什么hcv8jop7ns6r.cn 云南有什么好吃的hcv8jop6ns6r.cn 爬山需要准备什么东西hcv9jop7ns5r.cn
1990年属马的是什么命hcv8jop1ns4r.cn 月经不调有什么危害hcv8jop1ns6r.cn 奶霜是什么hcv9jop4ns4r.cn 今夕何夕是什么意思hcv7jop5ns6r.cn 精液的主要成分是什么aiwuzhiyu.com
百度