39 return LCEVC_I420_10_LE;
41 return LCEVC_I420_12_LE;
43 return LCEVC_I420_14_LE;
47 return LCEVC_I422_10_LE;
49 return LCEVC_I422_12_LE;
51 return LCEVC_I422_14_LE;
55 return LCEVC_I444_10_LE;
57 return LCEVC_I444_12_LE;
59 return LCEVC_I444_14_LE;
67 return LCEVC_GRAY_10_LE;
69 return LCEVC_GRAY_12_LE;
71 return LCEVC_GRAY_14_LE;
74 return LCEVC_ColorFormat_Unknown;
80 LCEVC_PictureDesc
desc;
88 if (res != LCEVC_Success)
95 desc.sampleAspectRatioNum =
frame->sample_aspect_ratio.num;
96 desc.sampleAspectRatioDen =
frame->sample_aspect_ratio.den;
105 if (res != LCEVC_Success) {
113 LCEVC_PictureHandle *picture)
116 LCEVC_PictureDesc
desc ;
118 LCEVC_PicturePlaneDesc
planes[4] = { 0 };
119 LCEVC_ReturnCode res;
122 if (res != LCEVC_Success)
126 for (
int i = 0;
i < 4;
i++) {
133 if (res != LCEVC_Success) {
145 LCEVC_PictureHandle picture;
146 LCEVC_ReturnCode res;
149 if (!sd || fmt == LCEVC_ColorFormat_Unknown)
153 if (res != LCEVC_Success)
162 LCEVC_FreePicture(lcevc->
decoder, picture);
166 res = LCEVC_SetPictureUserData(lcevc->
decoder, picture, opaque);
167 if (res != LCEVC_Success) {
168 LCEVC_FreePicture(lcevc->
decoder, picture);
173 res = LCEVC_SendDecoderBase(lcevc->
decoder, in->
pts, picture, -1, opaque);
174 if (res != LCEVC_Success) {
175 LCEVC_FreePicture(lcevc->
decoder, picture);
180 memset(&picture, 0,
sizeof(picture));
185 res = LCEVC_SendDecoderPicture(lcevc->
decoder, picture);
186 if (res != LCEVC_Success) {
187 LCEVC_FreePicture(lcevc->
decoder, picture);
197 LCEVC_PictureDesc
desc;
198 LCEVC_DecodeInformation info;
199 LCEVC_PictureHandle picture;
200 LCEVC_ReturnCode res;
203 res = LCEVC_ReceiveDecoderPicture(lcevc->
decoder, &picture, &info);
204 }
while (res == LCEVC_Again);
205 if (res != LCEVC_Success)
208 res = LCEVC_GetPictureDesc(lcevc->
decoder, picture, &
desc);
209 if (res != LCEVC_Success) {
210 LCEVC_FreePicture(lcevc->
decoder, picture);
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;
225 out->height =
desc.height +
out->crop_top +
out->crop_bottom;
230 "hasEnhancement %d, enhanced %d\n",
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);
236 res = LCEVC_FreePicture(lcevc->
decoder, picture);
237 if (res != LCEVC_Success)
245 LCEVC_PictureHandle picture;
246 LCEVC_ReturnCode res;
250 res = LCEVC_ReceiveDecoderBase (lcevc->
decoder, &picture);
251 if (res != LCEVC_Success && res != LCEVC_Again)
254 if (res == LCEVC_Again)
257 LCEVC_GetPictureUserData(lcevc->
decoder, picture, (
void **)&
base);
260 res = LCEVC_FreePicture(lcevc->
decoder, picture);
261 if (res != LCEVC_Success)
290 LCEVC_PictureHandle pic,
const LCEVC_DecodeInformation *info,
291 const uint8_t *
data, uint32_t
size,
void *logctx)
295 unsigned int level = 0;
311 LCEVC_FlushDecoder(lcevc->
decoder);
313 LCEVC_DestroyDecoder(lcevc->
decoder);
316 ff_cbs_fragment_free(lcevc->
frag);
318 ff_cbs_close(&lcevc->
cbc);
320 memset(lcevc, 0,
sizeof(*lcevc));
351 return LCEVC_LogDisabled;
353 return LCEVC_LogFatal;
355 return LCEVC_LogError;
357 return LCEVC_LogWarning;
359 return LCEVC_LogInfo;
361 return LCEVC_LogDebug;
363 return LCEVC_LogTrace;
368 LCEVC_AccelContextHandle
dummy = { 0 };
369 const int32_t event = LCEVC_Log;
372 if (LCEVC_CreateDecoder(&lcevc->
decoder,
dummy) != LCEVC_Success) {
379 LCEVC_ConfigureDecoderInt(lcevc->
decoder,
"log_level",
level);
380 LCEVC_ConfigureDecoderIntArray(lcevc->
decoder,
"events", 1, &event);
383 if (LCEVC_InitializeDecoder(lcevc->
decoder) != LCEVC_Success) {
385 LCEVC_DestroyDecoder(lcevc->
decoder);
412 return ret < 0 ? ret : 0;
457 ff_cbs_fragment_reset(lcevc->
frag);
469 .class_name =
"liblcevc_dec",
static const char *const format[]
static const CodedBitstreamUnitType decompose_unit_types[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
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.
reference-counted frame API
#define AVERROR_EXTERNAL
Generic error in an external library.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_QUIET
Print no output.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static LCEVC_ColorFormat map_format(int format)
static av_cold int lcevc_frame_init_cb(AVRefStructOpaque unused, void *obj)
static int alloc_base_frame(FFLCEVCContext *lcevc, const AVFrame *frame, LCEVC_PictureHandle *picture)
static void lcevc_frame_reset_cb(AVRefStructOpaque unused, void *obj)
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame, enum AVPixelFormat *format, int *width, int *height)
static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx, LCEVC_PictureHandle *picture)
static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
int ff_lcevc_process(void *logctx, AVFrame *frame)
static int lcevc_receive_frame(FFLCEVCFrame *frame_ctx, AVFrame *out)
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
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)
static av_cold void lcevc_frame_free_entry_cb(AVRefStructOpaque unused, void *obj)
static const uint8_t level_map[LCEVC_LogLevelCount]
static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
static int lcevc_init(FFLCEVCContext *lcevc)
int ff_lcevc_alloc(FFLCEVCContext **plcevc, int loglevel)
static void lcevc_free(AVRefStructOpaque unused, void *obj)
static const AVClass lcevcdec_context_class
uintptr_t LCEVC_DecoderHandle
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
@ LCEVC_PAYLOAD_TYPE_GLOBAL_CONFIG
enum AVPixelFormat ff_lcevc_depth_type[4][4]
const struct FFLCEVCDim ff_lcevc_resolution_type[63]
static const struct @257111027162314367033347246032313251342043035002 planes[]
@ AV_CLASS_CATEGORY_DECODER
Memory handling functions.
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ 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...
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P10
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
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.
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.
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
const CodedBitstreamUnitType * decompose_unit_types
Array of unit types which should be decomposed when reading.
int nb_decompose_unit_types
Length of the decompose_unit_types array.
struct CodedBitstreamContext * cbc
LCEVC_DecoderHandle decoder
struct CodedBitstreamFragment * frag
struct AVRefStructPool * frame_pool
pool of FFLCEVCFrame
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
void * post_process_opaque
RefStruct reference.
uint8_t chroma_sampling_type
uint16_t custom_resolution_width
uint8_t enhancement_depth_type
uint16_t custom_resolution_height
RefStruct is an API for creating reference-counted objects with minimal overhead.
static enum pl_log_level get_log_level(void)