FFmpeg
Loading...
Searching...
No Matches
lcevcdec.c
Go to the documentation of this file.
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 "libavutil/avassert.h"
20#include "libavutil/frame.h"
21#include "libavutil/imgutils.h"
22#include "libavutil/log.h"
23#include "libavutil/mem.h"
24#include "libavutil/opt.h"
25#include "libavutil/refstruct.h"
26
27#include "cbs.h"
28#include "cbs_lcevc.h"
29#include "decode.h"
30#include "lcevc_parse.h"
31#include "lcevcdec.h"
32#include "lcevctab.h"
33
34static LCEVC_ColorFormat map_format(int format)
35{
36 switch (format) {
38 return LCEVC_I420_8;
40 return LCEVC_I420_10_LE;
42 return LCEVC_I420_12_LE;
44 return LCEVC_I420_14_LE;
46 return LCEVC_I422_8;
48 return LCEVC_I422_10_LE;
50 return LCEVC_I422_12_LE;
52 return LCEVC_I422_14_LE;
54 return LCEVC_I444_8;
56 return LCEVC_I444_10_LE;
58 return LCEVC_I444_12_LE;
60 return LCEVC_I444_14_LE;
61 case AV_PIX_FMT_NV12:
62 return LCEVC_NV12_8;
63 case AV_PIX_FMT_NV21:
64 return LCEVC_NV21_8;
66 return LCEVC_GRAY_8;
68 return LCEVC_GRAY_10_LE;
70 return LCEVC_GRAY_12_LE;
72 return LCEVC_GRAY_14_LE;
73 }
74
75 return LCEVC_ColorFormat_Unknown;
76}
77
79 const AVFrame *frame, LCEVC_PictureHandle *picture)
80{
81 LCEVC_PictureDesc desc;
82 LCEVC_ColorFormat fmt = map_format(frame->format);
83 LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 };
84 int width = frame->width - frame->crop_left - frame->crop_right;
85 int height = frame->height - frame->crop_top - frame->crop_bottom;
86 LCEVC_ReturnCode res;
87
88 res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height);
89 if (res != LCEVC_Success)
90 return AVERROR_EXTERNAL;
91
92 desc.cropTop = frame->crop_top;
93 desc.cropBottom = frame->crop_bottom;
94 desc.cropLeft = frame->crop_left;
95 desc.cropRight = frame->crop_right;
96 desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num;
97 desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den;
98
99 for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) {
100 planes[i].firstSample = frame->data[i];
101 planes[i].rowByteStride = frame->linesize[i];
102 }
103
104 /* Allocate LCEVC Picture */
105 res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
106 if (res != LCEVC_Success) {
107 return AVERROR_EXTERNAL;
108 }
109
110 return 0;
111}
112
113static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx,
114 LCEVC_PictureHandle *picture)
115{
116 FFLCEVCContext *lcevc = frame_ctx->lcevc;
117 LCEVC_PictureDesc desc ;
118 LCEVC_ColorFormat fmt = map_format(frame_ctx->frame->format);
119 LCEVC_PicturePlaneDesc planes[4] = { 0 };
120 LCEVC_ReturnCode res;
121
122 res = LCEVC_DefaultPictureDesc(&desc, fmt, frame_ctx->frame->width, frame_ctx->frame->height);
123 if (res != LCEVC_Success)
124 return AVERROR_EXTERNAL;
125
126 /* Set plane description */
127 for (int i = 0; i < 4; i++) {
128 planes[i].firstSample = frame_ctx->frame->data[i];
129 planes[i].rowByteStride = frame_ctx->frame->linesize[i];
130 }
131
132 /* Allocate LCEVC Picture */
133 res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
134 if (res != LCEVC_Success) {
135 return AVERROR_EXTERNAL;
136 }
137 return 0;
138}
139
140static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
141{
142 FFLCEVCContext *lcevc = frame_ctx->lcevc;
143 LCEVC_ColorFormat fmt = map_format(in->format);
145 AVFrame *opaque;
146 LCEVC_PictureHandle picture;
147 LCEVC_ReturnCode res;
148 int ret;
149
150 if (!sd || fmt == LCEVC_ColorFormat_Unknown)
151 return 1;
152
153 res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, lcevc->last_pts,
154 sd->data, sd->size);
155 if (res != LCEVC_Success) {
156 ret = AVERROR_EXTERNAL;
157 goto end;
158 }
159
160 ret = alloc_base_frame(lcevc, in, &picture);
161 if (ret < 0)
162 goto end;
163
164 opaque = av_frame_clone(in);
165 if (!opaque) {
166 LCEVC_FreePicture(lcevc->decoder, picture);
167 ret = AVERROR(ENOMEM);
168 goto end;
169 }
170
171 res = LCEVC_SetPictureUserData(lcevc->decoder, picture, opaque);
172 if (res != LCEVC_Success) {
173 LCEVC_FreePicture(lcevc->decoder, picture);
174 av_frame_free(&opaque);
175 ret = AVERROR_EXTERNAL;
176 goto end;
177 }
178
179 res = LCEVC_SendDecoderBase(lcevc->decoder, lcevc->last_pts, picture, -1, opaque);
180 if (res != LCEVC_Success) {
181 LCEVC_FreePicture(lcevc->decoder, picture);
182 av_frame_free(&opaque);
183 ret = AVERROR_EXTERNAL;
184 goto end;
185 }
186
187 memset(&picture, 0, sizeof(picture));
188 ret = alloc_enhanced_frame(frame_ctx, &picture);
189 if (ret < 0)
190 goto end;
191
192 res = LCEVC_SendDecoderPicture(lcevc->decoder, picture);
193 if (res != LCEVC_Success) {
194 LCEVC_FreePicture(lcevc->decoder, picture);
195 ret = AVERROR_EXTERNAL;
196 goto end;
197 }
198
199 ret = 0;
200end:
201 lcevc->last_pts++;
202
203 return ret;
204}
205
206static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
207{
208 FFLCEVCContext *lcevc = frame_ctx->lcevc;
209 LCEVC_PictureDesc desc;
210 LCEVC_DecodeInformation info;
211 LCEVC_PictureHandle picture;
212 LCEVC_ReturnCode res;
213
214 do {
215 res = LCEVC_ReceiveDecoderPicture(lcevc->decoder, &picture, &info);
216 } while (res == LCEVC_Again);
217 if (res != LCEVC_Success)
218 return AVERROR_EXTERNAL;
219
220 res = LCEVC_GetPictureDesc(lcevc->decoder, picture, &desc);
221 if (res != LCEVC_Success) {
222 LCEVC_FreePicture(lcevc->decoder, picture);
223 return AVERROR_EXTERNAL;
224 }
225
227 av_frame_copy_props(frame_ctx->frame, (AVFrame *)info.baseUserData);
228 av_frame_move_ref(out, frame_ctx->frame);
229
230 out->crop_top = desc.cropTop;
231 out->crop_bottom = desc.cropBottom;
232 out->crop_left = desc.cropLeft;
233 out->crop_right = desc.cropRight;
234 out->sample_aspect_ratio.num = desc.sampleAspectRatioNum;
235 out->sample_aspect_ratio.den = desc.sampleAspectRatioDen;
236 out->width = desc.width + out->crop_left + out->crop_right;
237 out->height = desc.height + out->crop_top + out->crop_bottom;
238
239 av_log(lcevc, AV_LOG_DEBUG, "out PTS %"PRId64", %dx%d, "
240 "%zu/%zu/%zu/%zu, "
241 "SAR %d:%d, "
242 "hasEnhancement %d, enhanced %d\n",
243 out->pts, out->width, out->height,
244 out->crop_top, out->crop_bottom, out->crop_left, out->crop_right,
245 out->sample_aspect_ratio.num, out->sample_aspect_ratio.den,
246 info.hasEnhancement, info.enhanced);
247
248 res = LCEVC_FreePicture(lcevc->decoder, picture);
249 if (res != LCEVC_Success)
250 return AVERROR_EXTERNAL;
251
252 return 0;
253}
254
256{
257 LCEVC_PictureHandle picture;
258 LCEVC_ReturnCode res;
259
260 while (1) {
261 AVFrame *base = NULL;
262 res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
263 if (res != LCEVC_Success && res != LCEVC_Again)
264 return AVERROR_EXTERNAL;
265
266 if (res == LCEVC_Again)
267 break;
268
269 LCEVC_GetPictureUserData(lcevc->decoder, picture, (void **)&base);
271
272 res = LCEVC_FreePicture(lcevc->decoder, picture);
273 if (res != LCEVC_Success)
274 return AVERROR_EXTERNAL;
275 }
276
277 return 0;
278}
279
281{
282 FFLCEVCContext *lcevc = frame_ctx->lcevc;
283 int ret;
284
285 ret = generate_output(frame_ctx, out);
286 if (ret < 0)
287 return ret;
288
289 return lcevc_flush_pictures(lcevc);
290}
291
292static const uint8_t level_map[LCEVC_LogLevelCount] = {
293 [LCEVC_LogFatal] = AV_LOG_FATAL,
294 [LCEVC_LogError] = AV_LOG_ERROR,
295 [LCEVC_LogWarning] = AV_LOG_WARNING,
296 [LCEVC_LogInfo] = AV_LOG_INFO,
297 [LCEVC_LogDebug] = AV_LOG_DEBUG,
298 [LCEVC_LogTrace] = AV_LOG_TRACE,
299};
300
301static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
302 LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info,
303 const uint8_t *data, uint32_t size, void *logctx)
304{
305 switch (event) {
306 case LCEVC_Log: {
307 unsigned int level = 0;
308 if (size < 3)
309 break;
310 int ret = sscanf(data, "%u ", &level);
311 if (ret != 1 || level >= LCEVC_LogLevelCount || !level_map[level])
312 break;
313 av_log(logctx, level_map[level], "%s\n", data + 2);
314 break;
315 }
316 default:
317 break;
318 }
319}
320
321static void lcevc_free(AVRefStructOpaque unused, void *obj)
322{
323 FFLCEVCContext *lcevc = obj;
324 if (lcevc->initialized == FF_LCEVCDEC_INIT) {
325 LCEVC_FlushDecoder(lcevc->decoder);
327 LCEVC_DestroyDecoder(lcevc->decoder);
328 }
329 if (lcevc->frag)
330 ff_cbs_fragment_free(lcevc->frag);
331 av_freep(&lcevc->frag);
332 ff_cbs_close(&lcevc->cbc);
334 memset(lcevc, 0, sizeof(*lcevc));
335}
336
338{
340
341 frame->frame = av_frame_alloc();
342 if (!frame->frame)
343 return AVERROR(ENOMEM);
344 return 0;
345}
346
348{
350
351 av_frame_unref(frame->frame);
352 av_refstruct_unref(&frame->lcevc);
353}
354
356{
358
359 av_frame_free(&frame->frame);
360}
361
362static int get_log_level(int level)
363{
364 if (level <= AV_LOG_QUIET)
365 return LCEVC_LogDisabled;
366 if (level <= AV_LOG_FATAL)
367 return LCEVC_LogFatal;
368 if (level <= AV_LOG_ERROR)
369 return LCEVC_LogError;
370 if (level <= AV_LOG_WARNING)
371 return LCEVC_LogWarning;
372 if (level <= AV_LOG_INFO)
373 return LCEVC_LogInfo;
374 if (level <= AV_LOG_DEBUG)
375 return LCEVC_LogDebug;
376
377 return LCEVC_LogTrace;
378}
379
380static int lcevc_init(FFLCEVCContext *lcevc)
381{
382 LCEVC_AccelContextHandle dummy = { 0 };
383 const int32_t event = LCEVC_Log;
384 LCEVC_ReturnCode res;
385 int level;
386
388
389 if (LCEVC_CreateDecoder(&lcevc->decoder, dummy) != LCEVC_Success) {
390 av_log(lcevc, AV_LOG_ERROR, "Failed to create LCEVC decoder\n");
391 return AVERROR_EXTERNAL;
392 }
393
394 if (lcevc->pipeline) {
395 res = LCEVC_ConfigureDecoderString(lcevc->decoder, "pipeline", lcevc->pipeline);
396 if (res != LCEVC_Success) {
397 av_log(lcevc, AV_LOG_ERROR, "Failed to set pipeline to \"%s\"\n", lcevc->pipeline);
398 LCEVC_DestroyDecoder(lcevc->decoder);
399 return AVERROR_EXTERNAL;
400 }
401 }
402
403 level = get_log_level(lcevc->loglevel);
404
405 LCEVC_ConfigureDecoderInt(lcevc->decoder, "log_level", level);
406 res = LCEVC_ConfigureDecoderInt(lcevc->decoder, "threads", lcevc->threads);
407 if (res != LCEVC_Success) {
408 av_log(lcevc, AV_LOG_ERROR, "Failed to set threads to %d\n", lcevc->threads);
409 LCEVC_DestroyDecoder(lcevc->decoder);
410 return AVERROR_EXTERNAL;
411 }
412 res = LCEVC_ConfigureDecoderInt(lcevc->decoder, "passthrough_mode", lcevc->passthrough_mode);
413 if (res != LCEVC_Success) {
414 av_log(lcevc, AV_LOG_ERROR, "Failed to set passthrough_mode to %d\n", lcevc->passthrough_mode);
415 LCEVC_DestroyDecoder(lcevc->decoder);
416 return AVERROR_EXTERNAL;
417 }
418 res = LCEVC_ConfigureDecoderBool(lcevc->decoder, "allow_dithering", lcevc->allow_dithering);
419 if (res != LCEVC_Success) {
420 av_log(lcevc, AV_LOG_ERROR, "Failed to set allow_dithering to %d\n", lcevc->allow_dithering);
421 LCEVC_DestroyDecoder(lcevc->decoder);
422 return AVERROR_EXTERNAL;
423 }
424 res = LCEVC_ConfigureDecoderBool(lcevc->decoder, "highlight_residuals", lcevc->highlight_residuals);
425 if (res != LCEVC_Success) {
426 av_log(lcevc, AV_LOG_ERROR, "Failed to set highlight_residuals to %d\n", lcevc->highlight_residuals);
427 LCEVC_DestroyDecoder(lcevc->decoder);
428 return AVERROR_EXTERNAL;
429 }
430 LCEVC_ConfigureDecoderIntArray(lcevc->decoder, "events", 1, &event);
431 LCEVC_SetDecoderEventCallback(lcevc->decoder, event_callback, lcevc);
432
433 if (LCEVC_InitializeDecoder(lcevc->decoder) != LCEVC_Success) {
434 av_log(lcevc, AV_LOG_ERROR, "Failed to initialize LCEVC decoder\n");
435 LCEVC_DestroyDecoder(lcevc->decoder);
436 return AVERROR_EXTERNAL;
437 }
438
440
441 return 0;
442}
443
444int ff_lcevc_process(void *logctx, AVFrame *frame)
445{
446 FrameDecodeData *fdd = frame->private_ref;
447 FFLCEVCFrame *frame_ctx = fdd->post_process_opaque;
448 FFLCEVCContext *lcevc = frame_ctx->lcevc;
449 int ret;
450
451 if (lcevc->initialized == FF_LCEVCDEC_UNINIT) {
452 ret = lcevc_init(lcevc);
453 if (ret < 0)
454 return ret;
455 } else if (lcevc->initialized == FF_LCEVCDEC_FAIL)
456 return 0;
457
458 av_assert0(frame_ctx->frame);
459
460
461 ret = lcevc_send_frame(frame_ctx, frame);
462 if (ret)
463 return ret < 0 ? ret : 0;
464
465 ret = lcevc_receive_frame(frame_ctx, frame);
466 if (ret < 0)
467 return ret;
468
470
471 return 0;
472}
473
475 enum AVPixelFormat *format, int *width, int *height)
476{
478 const LCEVCRawGlobalConfig *gc;
480 int ret;
481
482 ret = ff_cbs_read(lcevc->cbc, lcevc->frag, NULL, sd->data, sd->size);
483 if (ret < 0) {
484 av_log(lcevc, AV_LOG_ERROR, "Failed to parse Access Unit.\n");
485 goto end;
486 }
487
488 ret = ff_cbs_lcevc_find_process_block(lcevc->cbc, lcevc->frag,
490 if (ret < 0) {
491 ret = 0;
492 goto end;
493 }
494
495 gc = block->payload;
496
498 if (gc->resolution_type < 63) {
501 } else {
504 }
505
506 ret = 0;
507end:
508 ff_cbs_fragment_reset(lcevc->frag);
509
510 return ret;
511}
512
517
518#define OFFSET(x) offsetof(FFLCEVCContext, x)
519#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM)
520static const AVOption lcevc_opts[] = {
521 { "passthrough_mode", "Set passthrough mode", OFFSET(passthrough_mode), AV_OPT_TYPE_INT,
522 { .i64 = 0 }, -1, 2, FLAGS, .unit = "passthrough_mode" },
523 { "disable", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, .unit = "passthrough_mode" },
524 { "allow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .unit = "passthrough_mode" },
525 { "force", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .unit = "passthrough_mode" },
526 { "scale", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .unit = "passthrough_mode" },
527 { "allow_dithering", "Allow dithering", OFFSET(allow_dithering), AV_OPT_TYPE_BOOL,
528 { .i64 = 1 }, 0, 1, FLAGS },
529 { "highlight_residuals", "Highlight residuals", OFFSET(highlight_residuals), AV_OPT_TYPE_BOOL,
530 { .i64 = 0 }, 0, 1, FLAGS },
531 { "threads", "Thread count", OFFSET(threads), AV_OPT_TYPE_INT,
532 { .i64 = 1 }, 0, INT_MAX, FLAGS },
533 { "pipeline", "Decoding pipeline", OFFSET(pipeline), AV_OPT_TYPE_STRING,
534 { .str = NULL }, 0, 0, FLAGS },
535 { NULL },
536};
537#undef OFFSET
538#undef FLAGS
539
541 .class_name = "liblcevc_dec",
542 .item_name = av_default_item_name,
543 .option = lcevc_opts,
544 .version = LIBAVUTIL_VERSION_INT,
545 .category = AV_CLASS_CATEGORY_DECODER,
546};
547
548int ff_lcevc_alloc(FFLCEVCContext **plcevc, AVDictionary **options, int loglevel)
549{
550 FFLCEVCContext *lcevc = NULL;
551 const AVDictionaryEntry *t;
552 int ret;
553
554 lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
555 if (!lcevc)
556 return AVERROR(ENOMEM);
557
559 av_opt_set_defaults(lcevc);
560
561 lcevc->loglevel = loglevel;
562
563 ret = av_opt_set_dict2(lcevc, options, 0);
564 if (ret < 0)
565 return ret;
566
567 if (t = av_dict_iterate(*options, NULL)) {
568 av_log(NULL, AV_LOG_FATAL, "liblcevc-dec option %s not found.\n", t->key);
570 }
571
572 lcevc->frag = av_mallocz(sizeof(*lcevc->frag));
573 if (!lcevc->frag) {
574 ret = AVERROR(ENOMEM);
575 goto fail;
576 }
577
578 ret = ff_cbs_init(&lcevc->cbc, AV_CODEC_ID_LCEVC, lcevc);
579 if (ret < 0)
580 goto fail;
581
584
589 if (!lcevc->frame_pool) {
590 ret = AVERROR(ENOMEM);
591 goto fail;
592 }
593
594 *plcevc = lcevc;
595 return 0;
596fail:
597 av_refstruct_unref(&lcevc);
598 return ret;
599}
static const char *const format[]
Definition af_aiir.c:445
static FILE * out
static const CodedBitstreamUnitType decompose_unit_types[]
Definition apv_parser.c:178
int32_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
int ff_cbs_lcevc_find_process_block(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, uint32_t payload_type, LCEVCRawProcessBlock **iter)
Iterate over blocks with the given payload type in an access unit.
Definition cbs_lcevc.c:662
#define FLAGS
Definition cmdutils.c:596
#define NULL
Definition coverity.c:32
static int16_t block[64]
Definition dct.c:125
static AVFrame * frame
static int dummy
Definition ffplay.c:4657
reference-counted frame API
#define fail
Definition test.h:479
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
@ AV_CODEC_ID_LCEVC
Definition codec_id.h:613
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition dict.c:42
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition error.h:59
#define AVERROR(e)
Definition error.h:45
#define AVERROR_OPTION_NOT_FOUND
Option not found.
Definition error.h:63
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition frame.c:496
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:659
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
Definition frame.c:725
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition frame.c:523
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
Definition frame.h:236
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition log.h:236
#define AV_LOG_QUIET
Print no output.
Definition log.h:192
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition log.h:204
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition opt.c:1758
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
Definition opt.c:2042
misc image utilities
static LCEVC_ColorFormat map_format(int format)
Definition lcevcdec.c:34
static av_cold int lcevc_frame_init_cb(AVRefStructOpaque unused, void *obj)
Definition lcevcdec.c:337
static int alloc_base_frame(FFLCEVCContext *lcevc, const AVFrame *frame, LCEVC_PictureHandle *picture)
Definition lcevcdec.c:78
static void lcevc_frame_reset_cb(AVRefStructOpaque unused, void *obj)
Definition lcevcdec.c:347
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame, enum AVPixelFormat *format, int *width, int *height)
Definition lcevcdec.c:474
static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx, LCEVC_PictureHandle *picture)
Definition lcevcdec.c:113
static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
Definition lcevcdec.c:206
int ff_lcevc_process(void *logctx, AVFrame *frame)
Definition lcevcdec.c:444
static int lcevc_receive_frame(FFLCEVCFrame *frame_ctx, AVFrame *out)
Definition lcevcdec.c:280
static const AVOption lcevc_opts[]
Definition lcevcdec.c:520
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
Definition lcevcdec.c:255
static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event, LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info, const uint8_t *data, uint32_t size, void *logctx)
Definition lcevcdec.c:301
static av_cold void lcevc_frame_free_entry_cb(AVRefStructOpaque unused, void *obj)
Definition lcevcdec.c:355
static const uint8_t level_map[LCEVC_LogLevelCount]
Definition lcevcdec.c:292
static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
Definition lcevcdec.c:140
static int lcevc_init(FFLCEVCContext *lcevc)
Definition lcevcdec.c:380
int ff_lcevc_alloc(FFLCEVCContext **plcevc, AVDictionary **options, int loglevel)
Definition lcevcdec.c:548
#define OFFSET(x)
Definition lcevcdec.c:518
static void lcevc_free(AVRefStructOpaque unused, void *obj)
Definition lcevcdec.c:321
static const AVClass lcevcdec_context_class
Definition lcevcdec.c:540
@ FF_LCEVCDEC_INIT
Definition lcevcdec.h:39
@ FF_LCEVCDEC_FAIL
Definition lcevcdec.h:40
@ FF_LCEVCDEC_UNINIT
Definition lcevcdec.h:38
uintptr_t LCEVC_DecoderHandle
Definition lcevcdec.h:31
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition cbs.h:66
@ LCEVC_PAYLOAD_TYPE_GLOBAL_CONFIG
Definition lcevc.h:71
@ LCEVC_NON_IDR_NUT
Definition lcevc.h:60
@ LCEVC_IDR_NUT
Definition lcevc.h:61
enum AVPixelFormat ff_lcevc_depth_type[4][4]
Definition lcevctab.c:38
const struct FFLCEVCDim ff_lcevc_resolution_type[63]
Definition lcevctab.c:22
#define av_cold
Definition attributes.h:117
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
@ AV_CLASS_CATEGORY_DECODER
Definition log.h:35
Memory handling functions.
static const char * obj
Definition mscl.c:57
const char data[16]
Definition mxf.c:149
AVOptions.
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:555
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:548
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:553
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
Definition pixfmt.h:40
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:549
#define AV_PIX_FMT_YUV420P14
Definition pixfmt.h:556
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition pixfmt.h:96
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition pixfmt.h:321
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition pixfmt.h:97
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition pixfmt.h:319
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition pixfmt.h:361
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
#define AV_PIX_FMT_YUV422P14
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:551
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition refstruct.c:121
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
Definition refstruct.h:292
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
Definition refstruct.h:94
static AVRefStructPool * av_refstruct_pool_alloc_ext(size_t size, unsigned flags, void *opaque, int(*init_cb)(AVRefStructOpaque opaque, void *obj), void(*reset_cb)(AVRefStructOpaque opaque, void *obj), void(*free_entry_cb)(AVRefStructOpaque opaque, void *obj), void(*free_cb)(AVRefStructOpaque opaque))
A wrapper around av_refstruct_pool_alloc_ext_c() for the common case of a non-const qualified opaque.
Definition refstruct.h:258
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
Definition log.h:76
char * key
Definition dict.h:91
Structure to hold side data for an AVFrame.
Definition frame.h:334
size_t size
Definition frame.h:337
uint8_t * data
Definition frame.h:336
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:500
int width
Definition frame.h:551
int height
Definition frame.h:551
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:524
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:566
AVOption.
Definition opt.h:428
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
Definition cbs.h:255
int nb_decompose_unit_types
Length of the decompose_unit_types array.
Definition cbs.h:259
int passthrough_mode
Definition lcevcdec.h:52
struct CodedBitstreamContext * cbc
Definition lcevcdec.h:46
int64_t last_pts
Definition lcevcdec.h:49
int highlight_residuals
Definition lcevcdec.h:54
LCEVC_DecoderHandle decoder
Definition lcevcdec.h:45
uint8_t * pipeline
Definition lcevcdec.h:55
struct CodedBitstreamFragment * frag
Definition lcevcdec.h:47
struct AVRefStructPool * frame_pool
pool of FFLCEVCFrame
Definition lcevcdec.h:48
int allow_dithering
Definition lcevcdec.h:53
const AVClass * class
Definition lcevcdec.h:44
FFLCEVCContext * lcevc
Definition lcevcdec.h:62
struct AVFrame * frame
Definition lcevcdec.h:63
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
Definition decode.h:33
void * post_process_opaque
RefStruct reference.
Definition decode.h:45
uint8_t chroma_sampling_type
Definition cbs_lcevc.h:53
uint16_t custom_resolution_width
Definition cbs_lcevc.h:82
uint8_t resolution_type
Definition cbs_lcevc.h:51
uint8_t enhancement_depth_type
Definition cbs_lcevc.h:55
uint16_t custom_resolution_height
Definition cbs_lcevc.h:83
uint8_t level
Definition svq3.c:208
#define av_mallocz(s)
#define av_freep(p)
#define av_log(a,...)
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99
int size
RefStruct is an API for creating reference-counted objects with minimal overhead.
Definition refstruct.h:58
static enum pl_log_level get_log_level(void)
uint8_t base
Definition vp3data.h:128