FFmpeg
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/refstruct.h"
25 
26 #include "cbs.h"
27 #include "cbs_lcevc.h"
28 #include "decode.h"
29 #include "lcevc_parse.h"
30 #include "lcevcdec.h"
31 #include "lcevctab.h"
32 
33 static LCEVC_ColorFormat map_format(int format)
34 {
35  switch (format) {
36  case AV_PIX_FMT_YUV420P:
37  return LCEVC_I420_8;
39  return LCEVC_I420_10_LE;
41  return LCEVC_I420_12_LE;
43  return LCEVC_I420_14_LE;
44  case AV_PIX_FMT_YUV422P:
45  return LCEVC_I422_8;
47  return LCEVC_I422_10_LE;
49  return LCEVC_I422_12_LE;
51  return LCEVC_I422_14_LE;
52  case AV_PIX_FMT_YUV444P:
53  return LCEVC_I444_8;
55  return LCEVC_I444_10_LE;
57  return LCEVC_I444_12_LE;
59  return LCEVC_I444_14_LE;
60  case AV_PIX_FMT_NV12:
61  return LCEVC_NV12_8;
62  case AV_PIX_FMT_NV21:
63  return LCEVC_NV21_8;
64  case AV_PIX_FMT_GRAY8:
65  return LCEVC_GRAY_8;
67  return LCEVC_GRAY_10_LE;
69  return LCEVC_GRAY_12_LE;
71  return LCEVC_GRAY_14_LE;
72  }
73 
74  return LCEVC_ColorFormat_Unknown;
75 }
76 
77 static int alloc_base_frame(FFLCEVCContext *lcevc,
78  const AVFrame *frame, LCEVC_PictureHandle *picture)
79 {
80  LCEVC_PictureDesc desc;
81  LCEVC_ColorFormat fmt = map_format(frame->format);
82  LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 };
83  int width = frame->width - frame->crop_left - frame->crop_right;
84  int height = frame->height - frame->crop_top - frame->crop_bottom;
85  LCEVC_ReturnCode res;
86 
87  res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height);
88  if (res != LCEVC_Success)
89  return AVERROR_EXTERNAL;
90 
91  desc.cropTop = frame->crop_top;
92  desc.cropBottom = frame->crop_bottom;
93  desc.cropLeft = frame->crop_left;
94  desc.cropRight = frame->crop_right;
95  desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num;
96  desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den;
97 
98  for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) {
99  planes[i].firstSample = frame->data[i];
100  planes[i].rowByteStride = frame->linesize[i];
101  }
102 
103  /* Allocate LCEVC Picture */
104  res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
105  if (res != LCEVC_Success) {
106  return AVERROR_EXTERNAL;
107  }
108 
109  return 0;
110 }
111 
112 static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx,
113  LCEVC_PictureHandle *picture)
114 {
115  FFLCEVCContext *lcevc = frame_ctx->lcevc;
116  LCEVC_PictureDesc desc ;
117  LCEVC_ColorFormat fmt = map_format(frame_ctx->frame->format);
118  LCEVC_PicturePlaneDesc planes[4] = { 0 };
119  LCEVC_ReturnCode res;
120 
121  res = LCEVC_DefaultPictureDesc(&desc, fmt, frame_ctx->frame->width, frame_ctx->frame->height);
122  if (res != LCEVC_Success)
123  return AVERROR_EXTERNAL;
124 
125  /* Set plane description */
126  for (int i = 0; i < 4; i++) {
127  planes[i].firstSample = frame_ctx->frame->data[i];
128  planes[i].rowByteStride = frame_ctx->frame->linesize[i];
129  }
130 
131  /* Allocate LCEVC Picture */
132  res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
133  if (res != LCEVC_Success) {
134  return AVERROR_EXTERNAL;
135  }
136  return 0;
137 }
138 
139 static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
140 {
141  FFLCEVCContext *lcevc = frame_ctx->lcevc;
142  LCEVC_ColorFormat fmt = map_format(in->format);
144  AVFrame *opaque;
145  LCEVC_PictureHandle picture;
146  LCEVC_ReturnCode res;
147  int ret = 0;
148 
149  if (!sd || fmt == LCEVC_ColorFormat_Unknown)
150  return 1;
151 
152  res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, sd->data, sd->size);
153  if (res != LCEVC_Success)
154  return AVERROR_EXTERNAL;
155 
156  ret = alloc_base_frame(lcevc, in, &picture);
157  if (ret < 0)
158  return ret;
159 
160  opaque = av_frame_clone(in);
161  if (!opaque) {
162  LCEVC_FreePicture(lcevc->decoder, picture);
163  return AVERROR(ENOMEM);
164  }
165 
166  res = LCEVC_SetPictureUserData(lcevc->decoder, picture, opaque);
167  if (res != LCEVC_Success) {
168  LCEVC_FreePicture(lcevc->decoder, picture);
169  av_frame_free(&opaque);
170  return AVERROR_EXTERNAL;
171  }
172 
173  res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, picture, -1, opaque);
174  if (res != LCEVC_Success) {
175  LCEVC_FreePicture(lcevc->decoder, picture);
176  av_frame_free(&opaque);
177  return AVERROR_EXTERNAL;
178  }
179 
180  memset(&picture, 0, sizeof(picture));
181  ret = alloc_enhanced_frame(frame_ctx, &picture);
182  if (ret < 0)
183  return ret;
184 
185  res = LCEVC_SendDecoderPicture(lcevc->decoder, picture);
186  if (res != LCEVC_Success) {
187  LCEVC_FreePicture(lcevc->decoder, picture);
188  return AVERROR_EXTERNAL;
189  }
190 
191  return 0;
192 }
193 
194 static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
195 {
196  FFLCEVCContext *lcevc = frame_ctx->lcevc;
197  LCEVC_PictureDesc desc;
198  LCEVC_DecodeInformation info;
199  LCEVC_PictureHandle picture;
200  LCEVC_ReturnCode res;
201 
202  do {
203  res = LCEVC_ReceiveDecoderPicture(lcevc->decoder, &picture, &info);
204  } while (res == LCEVC_Again);
205  if (res != LCEVC_Success)
206  return AVERROR_EXTERNAL;
207 
208  res = LCEVC_GetPictureDesc(lcevc->decoder, picture, &desc);
209  if (res != LCEVC_Success) {
210  LCEVC_FreePicture(lcevc->decoder, picture);
211  return AVERROR_EXTERNAL;
212  }
213 
215  av_frame_copy_props(frame_ctx->frame, (AVFrame *)info.baseUserData);
216  av_frame_move_ref(out, frame_ctx->frame);
217 
218  out->crop_top = desc.cropTop;
219  out->crop_bottom = desc.cropBottom;
220  out->crop_left = desc.cropLeft;
221  out->crop_right = desc.cropRight;
222  out->sample_aspect_ratio.num = desc.sampleAspectRatioNum;
223  out->sample_aspect_ratio.den = desc.sampleAspectRatioDen;
224  out->width = desc.width + out->crop_left + out->crop_right;
225  out->height = desc.height + out->crop_top + out->crop_bottom;
226 
227  av_log(lcevc, AV_LOG_DEBUG, "out PTS %"PRId64", %dx%d, "
228  "%zu/%zu/%zu/%zu, "
229  "SAR %d:%d, "
230  "hasEnhancement %d, enhanced %d\n",
231  out->pts, out->width, out->height,
232  out->crop_top, out->crop_bottom, out->crop_left, out->crop_right,
233  out->sample_aspect_ratio.num, out->sample_aspect_ratio.den,
234  info.hasEnhancement, info.enhanced);
235 
236  res = LCEVC_FreePicture(lcevc->decoder, picture);
237  if (res != LCEVC_Success)
238  return AVERROR_EXTERNAL;
239 
240  return 0;
241 }
242 
244 {
245  LCEVC_PictureHandle picture;
246  LCEVC_ReturnCode res;
247 
248  while (1) {
249  AVFrame *base = NULL;
250  res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
251  if (res != LCEVC_Success && res != LCEVC_Again)
252  return AVERROR_EXTERNAL;
253 
254  if (res == LCEVC_Again)
255  break;
256 
257  LCEVC_GetPictureUserData(lcevc->decoder, picture, (void **)&base);
259 
260  res = LCEVC_FreePicture(lcevc->decoder, picture);
261  if (res != LCEVC_Success)
262  return AVERROR_EXTERNAL;
263  }
264 
265  return 0;
266 }
267 
268 static int lcevc_receive_frame(FFLCEVCFrame *frame_ctx, AVFrame *out)
269 {
270  FFLCEVCContext *lcevc = frame_ctx->lcevc;
271  int ret;
272 
273  ret = generate_output(frame_ctx, out);
274  if (ret < 0)
275  return ret;
276 
277  return lcevc_flush_pictures(lcevc);
278 }
279 
280 static const uint8_t level_map[LCEVC_LogLevelCount] = {
281  [LCEVC_LogFatal] = AV_LOG_FATAL,
282  [LCEVC_LogError] = AV_LOG_ERROR,
283  [LCEVC_LogWarning] = AV_LOG_WARNING,
284  [LCEVC_LogInfo] = AV_LOG_INFO,
285  [LCEVC_LogDebug] = AV_LOG_DEBUG,
286  [LCEVC_LogTrace] = AV_LOG_TRACE,
287 };
288 
289 static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
290  LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info,
291  const uint8_t *data, uint32_t size, void *logctx)
292 {
293  switch (event) {
294  case LCEVC_Log: {
295  unsigned int level = 0;
296  int ret = sscanf(data, "%u ", &level);
297  if (ret != 1 || level >= LCEVC_LogLevelCount || !level_map[level])
298  break;
299  av_log(logctx, level_map[level], "%s\n", data);
300  break;
301  }
302  default:
303  break;
304  }
305 }
306 
307 static void lcevc_free(AVRefStructOpaque unused, void *obj)
308 {
309  FFLCEVCContext *lcevc = obj;
310  if (lcevc->initialized) {
311  LCEVC_FlushDecoder(lcevc->decoder);
312  lcevc_flush_pictures(lcevc);
313  LCEVC_DestroyDecoder(lcevc->decoder);
314  }
315  if (lcevc->frag)
316  ff_cbs_fragment_free(lcevc->frag);
317  av_freep(&lcevc->frag);
318  ff_cbs_close(&lcevc->cbc);
320  memset(lcevc, 0, sizeof(*lcevc));
321 }
322 
323 static av_cold int lcevc_frame_init_cb(AVRefStructOpaque unused, void *obj)
324 {
325  FFLCEVCFrame *frame = obj;
326 
327  frame->frame = av_frame_alloc();
328  if (!frame->frame)
329  return AVERROR(ENOMEM);
330  return 0;
331 }
332 
333 static void lcevc_frame_reset_cb(AVRefStructOpaque unused, void *obj)
334 {
335  FFLCEVCFrame *frame = obj;
336 
337  av_frame_unref(frame->frame);
338  av_refstruct_unref(&frame->lcevc);
339 }
340 
342 {
343  FFLCEVCFrame *frame = obj;
344 
345  av_frame_free(&frame->frame);
346 }
347 
348 static int get_log_level(int level)
349 {
350  if (level <= AV_LOG_QUIET)
351  return LCEVC_LogDisabled;
352  if (level <= AV_LOG_FATAL)
353  return LCEVC_LogFatal;
354  if (level <= AV_LOG_ERROR)
355  return LCEVC_LogError;
356  if (level <= AV_LOG_WARNING)
357  return LCEVC_LogWarning;
358  if (level <= AV_LOG_INFO)
359  return LCEVC_LogInfo;
360  if (level <= AV_LOG_DEBUG)
361  return LCEVC_LogDebug;
362 
363  return LCEVC_LogTrace;
364 }
365 
366 static int lcevc_init(FFLCEVCContext *lcevc)
367 {
368  LCEVC_AccelContextHandle dummy = { 0 };
369  const int32_t event = LCEVC_Log;
370  int level;
371 
372  if (LCEVC_CreateDecoder(&lcevc->decoder, dummy) != LCEVC_Success) {
373  av_log(lcevc, AV_LOG_ERROR, "Failed to create LCEVC decoder\n");
374  return AVERROR_EXTERNAL;
375  }
376 
377  level = get_log_level(lcevc->loglevel);
378 
379  LCEVC_ConfigureDecoderInt(lcevc->decoder, "log_level", level);
380  LCEVC_ConfigureDecoderIntArray(lcevc->decoder, "events", 1, &event);
381  LCEVC_SetDecoderEventCallback(lcevc->decoder, event_callback, lcevc);
382 
383  if (LCEVC_InitializeDecoder(lcevc->decoder) != LCEVC_Success) {
384  av_log(lcevc, AV_LOG_ERROR, "Failed to initialize LCEVC decoder\n");
385  LCEVC_DestroyDecoder(lcevc->decoder);
386  return AVERROR_EXTERNAL;
387  }
388 
389  lcevc->initialized = 1;
390 
391  return 0;
392 }
393 
394 int ff_lcevc_process(void *logctx, AVFrame *frame)
395 {
396  FrameDecodeData *fdd = frame->private_ref;
397  FFLCEVCFrame *frame_ctx = fdd->post_process_opaque;
398  FFLCEVCContext *lcevc = frame_ctx->lcevc;
399  int ret;
400 
401  if (!lcevc->initialized) {
402  ret = lcevc_init(lcevc);
403  if (ret < 0)
404  return ret;
405  }
406 
407  av_assert0(frame_ctx->frame);
408 
409 
410  ret = lcevc_send_frame(frame_ctx, frame);
411  if (ret)
412  return ret < 0 ? ret : 0;
413 
414  ret = lcevc_receive_frame(frame_ctx, frame);
415  if (ret < 0)
416  return ret;
417 
419 
420  return 0;
421 }
422 
424  enum AVPixelFormat *format, int *width, int *height)
425 {
427  const LCEVCRawGlobalConfig *gc;
429  int ret;
430 
431  ret = ff_cbs_read(lcevc->cbc, lcevc->frag, NULL, sd->data, sd->size);
432  if (ret < 0) {
433  av_log(lcevc, AV_LOG_ERROR, "Failed to parse Access Unit.\n");
434  goto end;
435  }
436 
437  ret = ff_cbs_lcevc_find_process_block(lcevc->cbc, lcevc->frag,
439  if (ret < 0) {
440  ret = 0;
441  goto end;
442  }
443 
444  gc = block->payload;
445 
447  if (gc->resolution_type < 63) {
450  } else {
453  }
454 
455  ret = 0;
456 end:
457  ff_cbs_fragment_reset(lcevc->frag);
458 
459  return ret;
460 }
461 
465 };
466 
467 
469  .class_name = "liblcevc_dec",
470  .item_name = av_default_item_name,
471  .version = LIBAVUTIL_VERSION_INT,
472  .category = AV_CLASS_CATEGORY_DECODER,
473 };
474 
475 int ff_lcevc_alloc(FFLCEVCContext **plcevc, int loglevel)
476 {
477  FFLCEVCContext *lcevc = NULL;
478  int ret;
479 
480  lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
481  if (!lcevc)
482  return AVERROR(ENOMEM);
483 
484  lcevc->frag = av_mallocz(sizeof(*lcevc->frag));
485  if (!lcevc->frag) {
486  ret = AVERROR(ENOMEM);
487  goto fail;
488  }
489 
490  ret = ff_cbs_init(&lcevc->cbc, AV_CODEC_ID_LCEVC, lcevc);
491  if (ret < 0)
492  goto fail;
493 
496 
501  if (!lcevc->frame_pool) {
502  ret = AVERROR(ENOMEM);
503  goto fail;
504  }
505 
506  lcevc->class = &lcevcdec_context_class;
507  lcevc->loglevel = loglevel;
508 
509  *plcevc = lcevc;
510  return 0;
511 fail:
512  av_refstruct_unref(&lcevc);
513  return ret;
514 }
lcevcdec.h
cbs.h
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
level
uint8_t level
Definition: svq3.c:208
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AV_CLASS_CATEGORY_DECODER
@ AV_CLASS_CATEGORY_DECODER
Definition: log.h:35
out
static FILE * out
Definition: movenc.c:55
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:659
AV_LOG_QUIET
#define AV_LOG_QUIET
Print no output.
Definition: log.h:192
AVRefStructOpaque
RefStruct is an API for creating reference-counted objects with minimal overhead.
Definition: refstruct.h:58
av_cold
#define av_cold
Definition: attributes.h:119
AV_VIDEO_MAX_PLANES
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
Definition: pixfmt.h:40
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:64
FrameDecodeData
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
Definition: decode.h:33
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:466
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:568
AVFrame::width
int width
Definition: frame.h:538
ff_lcevc_alloc
int ff_lcevc_alloc(FFLCEVCContext **plcevc, int loglevel)
Definition: lcevcdec.c:475
FFLCEVCContext
Definition: lcevcdec.h:36
data
const char data[16]
Definition: mxf.c:149
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:539
LCEVCRawGlobalConfig::custom_resolution_width
uint16_t custom_resolution_width
Definition: cbs_lcevc.h:82
base
uint8_t base
Definition: vp3data.h:128
FFLCEVCContext::initialized
int initialized
Definition: lcevcdec.h:43
lcevc_parse.h
ff_lcevc_resolution_type
const struct FFLCEVCDim ff_lcevc_resolution_type[63]
Definition: lcevctab.c:22
AV_PIX_FMT_GRAY10LE
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition: pixfmt.h:321
dummy
static int dummy
Definition: ffplay.c:3751
LCEVCRawGlobalConfig
Definition: cbs_lcevc.h:49
FFLCEVCContext::decoder
LCEVC_DecoderHandle decoder
Definition: lcevcdec.h:38
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:487
FFLCEVCContext::loglevel
int loglevel
Definition: lcevcdec.h:42
lcevc_flush_pictures
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
Definition: lcevcdec.c:243
cbs_lcevc.h
ff_lcevc_process
int ff_lcevc_process(void *logctx, AVFrame *frame)
Definition: lcevcdec.c:394
lcevcdec_context_class
static const AVClass lcevcdec_context_class
Definition: lcevcdec.c:468
refstruct.h
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:52
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
avassert.h
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:236
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AVFrameSideData::size
size_t size
Definition: frame.h:324
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
planes
static const struct @594 planes[]
alloc_enhanced_frame
static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx, LCEVC_PictureHandle *picture)
Definition: lcevcdec.c:112
FrameDecodeData::post_process_opaque
void * post_process_opaque
RefStruct reference.
Definition: decode.h:45
lcevc_send_frame
static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
Definition: lcevcdec.c:139
info
MIPS optimizations info
Definition: mips.txt:2
lcevc_free
static void lcevc_free(AVRefStructOpaque unused, void *obj)
Definition: lcevcdec.c:307
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:42
av_refstruct_alloc_ext
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
CodedBitstreamUnitType
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition: cbs.h:54
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
decode.h
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:483
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
ff_lcevc_depth_type
enum AVPixelFormat ff_lcevc_depth_type[4][4]
Definition: lcevctab.c:38
ff_lcevc_parse_frame
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame, enum AVPixelFormat *format, int *width, int *height)
Definition: lcevcdec.c:423
map_format
static LCEVC_ColorFormat map_format(int format)
Definition: lcevcdec.c:33
fail
#define fail
Definition: test.h:478
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
FFLCEVCContext::cbc
struct CodedBitstreamContext * cbc
Definition: lcevcdec.h:39
NULL
#define NULL
Definition: coverity.c:32
lcevc_frame_free_entry_cb
static av_cold void lcevc_frame_free_entry_cb(AVRefStructOpaque unused, void *obj)
Definition: lcevcdec.c:341
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:599
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
lcevc_receive_frame
static int lcevc_receive_frame(FFLCEVCFrame *frame_ctx, AVFrame *out)
Definition: lcevcdec.c:268
LCEVC_IDR_NUT
@ LCEVC_IDR_NUT
Definition: lcevc.h:61
FFLCEVCContext::frame_pool
struct AVRefStructPool * frame_pool
pool of FFLCEVCFrame
Definition: lcevcdec.h:41
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
av_refstruct_pool_alloc_ext
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
FFLCEVCContext::class
const AVClass * class
Definition: lcevcdec.h:37
FFLCEVCFrame::lcevc
FFLCEVCContext * lcevc
Definition: lcevcdec.h:49
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
LCEVCRawGlobalConfig::resolution_type
uint8_t resolution_type
Definition: cbs_lcevc.h:51
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
lcevc_frame_init_cb
static av_cold int lcevc_frame_init_cb(AVRefStructOpaque unused, void *obj)
Definition: lcevcdec.c:323
event_callback
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:289
height
#define height
Definition: dsp.h:89
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
AV_FRAME_DATA_LCEVC
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
Definition: frame.h:236
size
int size
Definition: twinvq_data.h:10344
LCEVC_DecoderHandle
uintptr_t LCEVC_DecoderHandle
Definition: lcevcdec.h:30
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:319
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
AVFrameSideData::data
uint8_t * data
Definition: frame.h:323
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:553
LCEVCRawProcessBlock
Definition: cbs_lcevc.h:175
LCEVC_NON_IDR_NUT
@ LCEVC_NON_IDR_NUT
Definition: lcevc.h:60
frame.h
av_frame_remove_side_data
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
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_CODEC_ID_LCEVC
@ AV_CODEC_ID_LCEVC
Definition: codec_id.h:617
FFLCEVCDim::height
uint16_t height
Definition: lcevctab.h:29
LCEVCRawGlobalConfig::custom_resolution_height
uint16_t custom_resolution_height
Definition: cbs_lcevc.h:83
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
av_refstruct_unref
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:120
LCEVCRawGlobalConfig::enhancement_depth_type
uint8_t enhancement_depth_type
Definition: cbs_lcevc.h:55
log.h
av_frame_move_ref
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition: frame.c:523
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:496
decompose_unit_types
static const CodedBitstreamUnitType decompose_unit_types[]
Definition: lcevcdec.c:462
AV_PIX_FMT_NV21
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition: pixfmt.h:97
FFLCEVCDim::width
uint16_t width
Definition: lcevctab.h:28
ret
ret
Definition: filter_design.txt:187
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:204
AV_PIX_FMT_NV12
@ 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
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:81
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
lcevctab.h
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:548
lcevc_init
static int lcevc_init(FFLCEVCContext *lcevc)
Definition: lcevcdec.c:366
AVFrame::height
int height
Definition: frame.h:538
LCEVC_PAYLOAD_TYPE_GLOBAL_CONFIG
@ LCEVC_PAYLOAD_TYPE_GLOBAL_CONFIG
Definition: lcevc.h:71
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
desc
const char * desc
Definition: libsvtav1.c:83
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
mem.h
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:321
av_refstruct_pool_uninit
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
Definition: refstruct.h:292
AV_PIX_FMT_GRAY14LE
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition: pixfmt.h:361
ff_cbs_lcevc_find_process_block
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
CodedBitstreamContext::nb_decompose_unit_types
int nb_decompose_unit_types
Length of the decompose_unit_types array.
Definition: cbs.h:259
CodedBitstreamContext::decompose_unit_types
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
Definition: cbs.h:255
get_log_level
static int get_log_level(int level)
Definition: lcevcdec.c:348
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
int32_t
int32_t
Definition: audioconvert.c:56
FFLCEVCContext::frag
struct CodedBitstreamFragment * frag
Definition: lcevcdec.h:40
imgutils.h
AVFrame::linesize
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:511
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
generate_output
static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
Definition: lcevcdec.c:194
level_map
static const uint8_t level_map[LCEVC_LogLevelCount]
Definition: lcevcdec.c:280
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:549
width
#define width
Definition: dsp.h:89
LCEVCRawGlobalConfig::chroma_sampling_type
uint8_t chroma_sampling_type
Definition: cbs_lcevc.h:53
alloc_base_frame
static int alloc_base_frame(FFLCEVCContext *lcevc, const AVFrame *frame, LCEVC_PictureHandle *picture)
Definition: lcevcdec.c:77
FFLCEVCFrame
Definition: lcevcdec.h:48
lcevc_frame_reset_cb
static void lcevc_frame_reset_cb(AVRefStructOpaque unused, void *obj)
Definition: lcevcdec.c:333
FFLCEVCFrame::frame
struct AVFrame * frame
Definition: lcevcdec.h:50
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:547