甲钴胺片主要治什么病| lv属于什么档次| 孤独的最高境界是什么| 白露是什么时候| 符号叫什么| 审计署是什么级别| 制加手念什么| pubg什么意思| 中暑是什么原因| 李世民是什么生肖| 农历十月是什么月| 犯太岁是什么意思啊| 经常感冒发烧是什么原因| 解构是什么意思| 景五行属什么| 孤独的最高境界是什么| 面粉是什么粉| 眉心中间有痣代表什么| 农历10月是什么月| 脱皮缺什么维生素| 蜂蜜什么时候喝最好| 柱镜度数是什么意思| 刘邦字什么| 射精无力是什么原因| 阳历是什么意思| 少字加一笔是什么字| 一什么千什么| 北京市长属于什么级别| 玛丽珍鞋是什么意思| dr拍片是检查什么的| 女性检查生育挂什么科| 神仙是什么生肖| 中产家庭的标准是什么| alyx是什么牌子| 肝囊性灶是什么意思| 杜甫自号什么| 什么是轻断食| 高级别上皮内瘤变是什么意思| lp是什么的简称| 他达拉非是什么药| 正骨是什么意思| 甲亢甲减有什么症状| 打茶围是什么意思| 髂胫束在什么位置| 升是什么意思| 产检挂什么科| 1947年属什么| 金牛座和什么星座最不配| 生蚝有什么功效与作用| omega什么牌子手表| 脂肪球是什么意思| 舌苔厚白中间有裂纹吃什么药| hpv是什么病毒| 小螃蟹吃什么| 淋巴细胞是什么| 记忆是什么意思| 促甲状腺激素偏高是什么意思| 孔雀开屏寓意什么意思| 特别容易饿是什么原因| 11月2日什么星座| 梦见鱼是什么意思| 经常犯困是什么原因| 检查妇科清洁度三是什么意思| 郭德纲什么学历| 三阳开泰是什么意思| 流脑是什么| 月经不能吃什么水果| 人体自由基是什么| 佑字五行属什么| 左边肚子疼是什么原因| ad医学上是什么意思| 做梦相亲是什么意思| 为什么男人吃石榴壮阳| 去海边玩需要带什么| 明星经纪人是干什么的| 深海鱼油的作用是什么| 怀孕头三个月吃什么好| 室性期前收缩是什么病| 枕头发黄是什么原因| 排卵期出血有什么症状| 化干戈为玉帛是什么意思| 睡午觉有什么好处| 珊瑚是什么| 俄罗斯什么东西值得买| 虚火旺吃什么去火最快| 护理专业学什么| 杏鲍菇不能和什么一起吃| iwc手表是什么档次| 画龙点睛是什么生肖| 春什么秋什么的成语| 5.5号是什么星座| 脉跳的快是什么原因| 全能神是什么| 梦见吃螃蟹是什么预兆| 容易口腔溃疡什么原因| 掉头发补充什么维生素| 老鼠为什么会飞| 怀孕什么症状| 唯爱是什么意思| 为什么老被蚊子咬| 硫酸铜是什么颜色| 马栗是什么植物| elaine是什么意思| 胃烧心是什么原因| 2021年是什么年| 灵芝有什么作用与功效| 杀跌是什么意思| 法是什么| 猴子是什么颜色| 安络血又叫什么名| 猪尾巴炖什么好吃| 老年人吃什么增强免疫力| 药店最怕什么样的举报| 77年的蛇是什么命| 子宫偏大是什么原因| 口关读什么| 三花聚顶是什么修为| 八面玲珑指什么生肖| ldl是什么意思| 黑客帝国4什么时候上映| 广义货币m2是什么意思| 臭虫怕什么| 炸毛是什么意思| 1972属什么| 公安厅长是什么级别| 清真是什么意思啊| 5岁属什么生肖| 警察为什么叫条子| 打嗝用什么药| 阴虚火旺有什么症状| 怀字五行属什么| 宫缩疼是什么感觉| 苹果a1660是什么型号| 7月20号什么星座| 胡子长得快是什么原因| 衣原体感染有什么症状| 斗破苍穹什么时候出的| 燃气泄露是什么味道| 梨花是什么颜色| 减肥期间可以喝什么饮料| 一什么田野| 大象的鼻子为什么那么长| 舌吻有什么好处| 腋窝下疼痛是什么原因| 减肥吃什么瘦的快| 感冒没胃口吃什么好| 怀孕吃什么会流产| 首级是什么意思| 血管瘤是什么样子的| 甲醇是什么东西| 什么体质容易长结石| 扫把星代表什么生肖| 为什么舌头老是有灼烧感| 头顶头发稀少是什么原因| 眉头有痣代表什么| 尿频繁吃什么药最见效| 胃溃疡吃什么药好得快| 安居乐业是什么意思| 梦见挖土豆是什么意思| 耳朵痛用什么药| 藕是什么季节的| 什么是内分泌失调| 眉毛痒痒代表什么预兆| 爱拍马屁的动物是什么生肖| 吕洞宾代表什么生肖| 跨境电商是做什么的| 怹是什么意思| 头孢是治疗什么的| 牛鬼蛇神是什么意思| 广东属于什么气候| 膝盖积液挂什么科| 胃不好吃什么蔬菜| 水军是什么意思| 鼻子痒是什么原因| 8月11日是什么星座| 心脏早搏有什么危害| 剖腹产第四天可以吃什么| 什么人容易得红斑狼疮| m代表什么意思| 大便臭是什么原因| 金色搭配什么颜色好看| 月子吃什么| 董监高是什么意思| 胃胆汁反流是什么原因引起的| bcr是什么意思| 排卵期出血有什么症状| 学海无涯苦作舟的上一句是什么| 送男朋友什么礼物合适| 邮箱地址填什么| 人为什么会感冒| 米干是什么| 静脉曲张有什么表现| 吸烟有害健康为什么国家还生产烟| 动漫是什么意思| 滴虫性阴炎有什么症状表现| 肠胃炎拉肚子吃什么药| 过期的钙片有什么用途| 趴在桌子上睡觉有什么坏处| 不着相是什么意思| 晚上睡觉遗精是什么原因| 奶茶有什么危害| 经常头疼什么原因| 为什么会得抑郁症| 阳历3月是什么星座| 副脾结节是什么意思| 尽性是什么意思| cn什么意思| b7是什么意思| 转氨酶高吃什么药效果好| 董事长是什么职位| 心里堵得慌是什么原因| 戒指带中指什么意思| 挚友是指什么的朋友| 秦王是什么生肖| 女人更年期有什么症状| 继发性不孕是什么意思| 嘤嘤嘤什么意思| 什么地方| 雄鱼是什么鱼| 怀孕的脉象是什么样的| 包茎是什么| 吃什么药通气放屁最快| 十八岁属什么生肖| 肋下未及是什么意思| jeans什么意思| 食管炎有什么症状| 复合是什么意思| 传统是什么意思| 菠萝不能和什么一起吃| 宝贝是什么意思| 黯淡是什么意思| 什么眉什么眼| 苦瓜和什么搭配最好| 2016属什么生肖| 贫血的人来姨妈会有什么症状| 2006年是什么命| 什么是便秘| 八零年属什么生肖| 一是什么意思| 悬案是什么意思| 恒字属于五行属什么| 梦见发洪水是什么征兆| 梦见撒尿是什么意思| kp是什么| 甜五行属什么| 蚊子怕什么| hmo是什么| 前列腺增大是什么意思| 什么叫尿潜血| jumper是什么衣服| 红颜是什么意思| 赭石色是什么颜色| 天上的云朵像什么| 无创是什么检查| 广州为什么叫花城| 1922年属什么生肖| 雷尼替丁主要治什么胃病| 梦见黑狗是什么意思| 摘胆对身体有什么影响| 狼狈是什么动物| 甘油三酯高是什么意思| 珩字五行属什么| 吃螃蟹不能喝什么饮料| 为什么老被蚊子咬| 百度

裸装上阵拥抱春天 欢乐谷千人光猪跑春光乍泄


Directory: ../../../ffmpeg/
File: src/libavcodec/lcevcdec.c
Date: 2025-08-04 11:35:17
Exec Total Coverage
Lines: 4 22 18.2%
Functions: 1 4 25.0%
Branches: 0 4 0.0%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include "config_components.h"
20
21 #include "libavutil/avassert.h"
22 #include "libavutil/frame.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/log.h"
25 #include "libavutil/mem.h"
26 #include "libavutil/refstruct.h"
27
28 #include "decode.h"
29 #include "lcevcdec.h"
30
31 #if CONFIG_LIBLCEVC_DEC
32 static LCEVC_ColorFormat map_format(int format)
33 {
34 switch (format) {
35 case AV_PIX_FMT_YUV420P:
36 return LCEVC_I420_8;
37 case AV_PIX_FMT_YUV420P10:
38 return LCEVC_I420_10_LE;
39 case AV_PIX_FMT_NV12:
40 return LCEVC_NV12_8;
41 case AV_PIX_FMT_NV21:
42 return LCEVC_NV21_8;
43 case AV_PIX_FMT_GRAY8:
44 return LCEVC_GRAY_8;
45 }
46
47 return LCEVC_ColorFormat_Unknown;
48 }
49
50 static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc,
51 const AVFrame *frame, LCEVC_PictureHandle *picture)
52 {
53 LCEVC_PictureDesc desc;
54 LCEVC_ColorFormat fmt = map_format(frame->format);
55 LCEVC_PictureLockHandle lock;
56 uint8_t *data[4] = { NULL };
57 int linesizes[4] = { 0 };
58 uint32_t planes;
59 LCEVC_ReturnCode res;
60
61 res = LCEVC_DefaultPictureDesc(&desc, fmt, frame->width, frame->height);
62 if (res != LCEVC_Success)
63 return AVERROR_EXTERNAL;
64
65 desc.cropTop = frame->crop_top;
66 desc.cropBottom = frame->crop_bottom;
67 desc.cropLeft = frame->crop_left;
68 desc.cropRight = frame->crop_right;
69 desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num;
70 desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den;
71
72 /* Allocate LCEVC Picture */
73 res = LCEVC_AllocPicture(lcevc->decoder, &desc, picture);
74 if (res != LCEVC_Success) {
75 return AVERROR_EXTERNAL;
76 }
77 res = LCEVC_LockPicture(lcevc->decoder, *picture, LCEVC_Access_Write, &lock);
78 if (res != LCEVC_Success)
79 return AVERROR_EXTERNAL;
80
81 res = LCEVC_GetPicturePlaneCount(lcevc->decoder, *picture, &planes);
82 if (res != LCEVC_Success)
83 return AVERROR_EXTERNAL;
84
85 for (unsigned i = 0; i < planes; i++) {
86 LCEVC_PicturePlaneDesc plane;
87
88 res = LCEVC_GetPictureLockPlaneDesc(lcevc->decoder, lock, i, &plane);
89 if (res != LCEVC_Success)
90 return AVERROR_EXTERNAL;
91
92 data[i] = plane.firstSample;
93 linesizes[i] = plane.rowByteStride;
94 }
95
96 av_image_copy2(data, linesizes, frame->data, frame->linesize,
97 frame->format, frame->width, frame->height);
98
99 res = LCEVC_UnlockPicture(lcevc->decoder, lock);
100 if (res != LCEVC_Success)
101 return AVERROR_EXTERNAL;
102
103 return 0;
104 }
105
106 static int alloc_enhanced_frame(void *logctx, FFLCEVCFrame *frame_ctx,
107 LCEVC_PictureHandle *picture)
108 {
109 FFLCEVCContext *lcevc = frame_ctx->lcevc;
110 LCEVC_PictureDesc desc ;
111 LCEVC_ColorFormat fmt = map_format(frame_ctx->frame->format);
112 LCEVC_PicturePlaneDesc planes[4] = { 0 };
113 LCEVC_ReturnCode res;
114
115 res = LCEVC_DefaultPictureDesc(&desc, fmt, frame_ctx->frame->width, frame_ctx->frame->height);
116 if (res != LCEVC_Success)
117 return AVERROR_EXTERNAL;
118
119 /* Set plane description */
120 for (int i = 0; i < 4; i++) {
121 planes[i].firstSample = frame_ctx->frame->data[i];
122 planes[i].rowByteStride = frame_ctx->frame->linesize[i];
123 }
124
125 /* Allocate LCEVC Picture */
126 res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
127 if (res != LCEVC_Success) {
128 return AVERROR_EXTERNAL;
129 }
130 return 0;
131 }
132
133 static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame *in)
134 {
135 FFLCEVCContext *lcevc = frame_ctx->lcevc;
136 const AVFrameSideData *sd = av_frame_get_side_data(in, AV_FRAME_DATA_LCEVC);
137 LCEVC_PictureHandle picture;
138 LCEVC_ReturnCode res;
139 int ret = 0;
140
141 if (!sd)
142 return 1;
143
144 res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size);
145 if (res != LCEVC_Success)
146 return AVERROR_EXTERNAL;
147
148 ret = alloc_base_frame(logctx, lcevc, in, &picture);
149 if (ret < 0)
150 return ret;
151
152 res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, NULL);
153 if (res != LCEVC_Success)
154 return AVERROR_EXTERNAL;
155
156 memset(&picture, 0, sizeof(picture));
157 ret = alloc_enhanced_frame(logctx, frame_ctx, &picture);
158 if (ret < 0)
159 return ret;
160
161 res = LCEVC_SendDecoderPicture(lcevc->decoder, picture);
162 if (res != LCEVC_Success)
163 return AVERROR_EXTERNAL;
164
165 return 0;
166 }
167
168 static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
169 {
170 FFLCEVCContext *lcevc = frame_ctx->lcevc;
171 LCEVC_PictureDesc desc;
172 LCEVC_DecodeInformation info;
173 LCEVC_PictureHandle picture;
174 LCEVC_ReturnCode res;
175
176 res = LCEVC_ReceiveDecoderPicture(lcevc->decoder, &picture, &info);
177 if (res != LCEVC_Success)
178 return AVERROR_EXTERNAL;
179
180 res = LCEVC_GetPictureDesc(lcevc->decoder, picture, &desc);
181 if (res != LCEVC_Success)
182 return AVERROR_EXTERNAL;
183
184 out->crop_top = desc.cropTop;
185 out->crop_bottom = desc.cropBottom;
186 out->crop_left = desc.cropLeft;
187 out->crop_right = desc.cropRight;
188 out->sample_aspect_ratio.num = desc.sampleAspectRatioNum;
189 out->sample_aspect_ratio.den = desc.sampleAspectRatioDen;
190
191 av_frame_copy_props(frame_ctx->frame, out);
192 av_frame_unref(out);
193 av_frame_move_ref(out, frame_ctx->frame);
194
195 out->width = desc.width + out->crop_left + out->crop_right;
196 out->height = desc.height + out->crop_top + out->crop_bottom;
197
198 res = LCEVC_FreePicture(lcevc->decoder, picture);
199 if (res != LCEVC_Success)
200 return AVERROR_EXTERNAL;
201
202 return 0;
203 }
204
205 static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
206 {
207 FFLCEVCContext *lcevc = frame_ctx->lcevc;
208 LCEVC_PictureHandle picture;
209 LCEVC_ReturnCode res;
210 int ret;
211
212 ret = generate_output(logctx, frame_ctx, out);
213 if (ret < 0)
214 return ret;
215
216 while (1) {
217 res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
218 if (res != LCEVC_Success && res != LCEVC_Again)
219 return AVERROR_EXTERNAL;
220
221 if (res == LCEVC_Again)
222 break;
223
224 res = LCEVC_FreePicture(lcevc->decoder, picture);
225 if (res != LCEVC_Success)
226 return AVERROR_EXTERNAL;
227 }
228
229 return 0;
230 }
231
232 static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
233 LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info,
234 const uint8_t *data, uint32_t size, void *logctx)
235 {
236 switch (event) {
237 case LCEVC_Log:
238 av_log(logctx, AV_LOG_INFO, "%s\n", data);
239 break;
240 default:
241 break;
242 }
243 }
244
245 static void lcevc_free(AVRefStructOpaque unused, void *obj)
246 {
247 FFLCEVCContext *lcevc = obj;
248 if (lcevc->initialized)
249 LCEVC_DestroyDecoder(lcevc->decoder);
250 memset(lcevc, 0, sizeof(*lcevc));
251 }
252 #endif
253
254 static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
255 {
256 #if CONFIG_LIBLCEVC_DEC
257 LCEVC_AccelContextHandle dummy = { 0 };
258 const int32_t event = LCEVC_Log;
259
260 if (LCEVC_CreateDecoder(&lcevc->decoder, dummy) != LCEVC_Success) {
261 av_log(logctx, AV_LOG_ERROR, "Failed to create LCEVC decoder\n");
262 return AVERROR_EXTERNAL;
263 }
264
265 LCEVC_ConfigureDecoderInt(lcevc->decoder, "log_level", 4);
266 LCEVC_ConfigureDecoderIntArray(lcevc->decoder, "events", 1, &event);
267 LCEVC_SetDecoderEventCallback(lcevc->decoder, event_callback, logctx);
268
269 if (LCEVC_InitializeDecoder(lcevc->decoder) != LCEVC_Success) {
270 av_log(logctx, AV_LOG_ERROR, "Failed to initialize LCEVC decoder\n");
271 LCEVC_DestroyDecoder(lcevc->decoder);
272 return AVERROR_EXTERNAL;
273 }
274
275 #endif
276 lcevc->initialized = 1;
277
278 return 0;
279 }
280
281 int ff_lcevc_process(void *logctx, AVFrame *frame)
282 {
283 FrameDecodeData *fdd = frame->private_ref;
284 FFLCEVCFrame *frame_ctx = fdd->post_process_opaque;
285 FFLCEVCContext *lcevc = frame_ctx->lcevc;
286 int ret;
287
288 if (!lcevc->initialized) {
289 ret = lcevc_init(lcevc, logctx);
290 if (ret < 0)
291 return ret;
292 }
293
294 #if CONFIG_LIBLCEVC_DEC
295 av_assert0(frame_ctx->frame);
296
297
298 ret = lcevc_send_frame(logctx, frame_ctx, frame);
299 if (ret)
300 return ret < 0 ? ret : 0;
301
302 lcevc_receive_frame(logctx, frame_ctx, frame);
303 if (ret < 0)
304 return ret;
305
306 av_frame_remove_side_data(frame, AV_FRAME_DATA_LCEVC);
307 #endif
308
309 return 0;
310 }
311
312 15730 int ff_lcevc_alloc(FFLCEVCContext **plcevc)
313 {
314 15730 FFLCEVCContext *lcevc = NULL;
315 #if CONFIG_LIBLCEVC_DEC
316 lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
317 if (!lcevc)
318 return AVERROR(ENOMEM);
319 #endif
320 15730 *plcevc = lcevc;
321 15730 return 0;
322 }
323
324 void ff_lcevc_unref(void *opaque)
325 {
326 FFLCEVCFrame *lcevc = opaque;
327 av_refstruct_unref(&lcevc->lcevc);
328 av_frame_free(&lcevc->frame);
329 av_free(opaque);
330 }
331

玄青色是什么颜色 唯有读书高的前一句是什么 突然膝盖疼是什么原因 金牛男喜欢什么样的女生 苏轼是什么居士
历史是个什么玩意儿 血脂高挂什么科 蚊子吃什么 一杆进洞叫什么球 1970年属狗的是什么命
panerai是什么牌子 肝介入治疗是什么意思 张飞的兵器是什么 茯苓有什么功效和作用 不饱和脂肪酸是什么意思
怎么知道自己是什么血型 乳头有点痛什么原因 尿检潜血是什么意思 bmi是什么 高铁跟动车有什么区别
吊瓜是什么瓜hcv8jop5ns5r.cn 什么动物眼睛是红色的520myf.com 胃怕凉怕冷是什么原因naasee.com 小孩子记忆力差是什么原因fenrenren.com 尿酸高什么症状hcv8jop1ns3r.cn
saa是什么检查hcv9jop8ns0r.cn 胃病吃什么食物养胃hcv8jop9ns0r.cn 农历六月十三是什么星座hcv8jop1ns5r.cn 竖小拇指什么意思hkuteam.com 为什么明明很困就是睡不着hcv7jop9ns9r.cn
吃什么能软化血管hcv9jop2ns8r.cn 双红出彩是什么生肖hcv8jop9ns1r.cn vintage是什么牌子hcv7jop9ns7r.cn 血糖高的人吃什么水果hcv7jop6ns4r.cn 腿凉是什么原因引起的hcv8jop9ns9r.cn
腰肌劳损看什么科hcv9jop0ns0r.cn 喝盐水有什么作用和功效naasee.com 国家为什么不承认鬼神hcv9jop2ns9r.cn 月经期间喝酒会有什么影响hcv8jop8ns4r.cn 青蛙什么hcv9jop6ns8r.cn
百度