Go to the documentation of this file.
19 #include "config_components.h"
29 #if CONFIG_LIBLCEVC_DEC
36 return LCEVC_I420_10_LE;
45 return LCEVC_ColorFormat_Unknown;
51 LCEVC_PictureDesc
desc;
53 LCEVC_PictureLockHandle
lock;
55 int linesizes[4] = { 0 };
59 res = LCEVC_DefaultPictureDesc(&
desc, fmt,
frame->width,
frame->height);
60 if (res != LCEVC_Success)
67 desc.sampleAspectRatioNum =
frame->sample_aspect_ratio.num;
68 desc.sampleAspectRatioDen =
frame->sample_aspect_ratio.den;
72 if (res != LCEVC_Success) {
75 res = LCEVC_LockPicture(
decoder, *picture, LCEVC_Access_Write, &
lock);
76 if (res != LCEVC_Success)
80 if (res != LCEVC_Success)
84 LCEVC_PicturePlaneDesc plane;
86 res = LCEVC_GetPictureLockPlaneDesc(
decoder,
lock,
i, &plane);
87 if (res != LCEVC_Success)
90 data[
i] = plane.firstSample;
91 linesizes[
i] = plane.rowByteStride;
98 if (res != LCEVC_Success)
107 LCEVC_PictureDesc
desc ;
109 LCEVC_PicturePlaneDesc
planes[4] = { 0 };
112 LCEVC_ReturnCode res;
115 if (res != LCEVC_Success)
119 for (
int i = 0;
i < 4;
i++) {
126 if (res != LCEVC_Success) {
135 LCEVC_PictureHandle picture;
136 LCEVC_ReturnCode res;
142 res = LCEVC_SendDecoderEnhancementData(lcevc->
decoder, in->
pts, 0, sd->
data, sd->
size);
143 if (res != LCEVC_Success)
150 res = LCEVC_SendDecoderBase(lcevc->
decoder, in->
pts, 0, picture, -1,
NULL);
151 if (res != LCEVC_Success)
154 memset(&picture, 0,
sizeof(picture));
159 res = LCEVC_SendDecoderPicture(lcevc->
decoder, picture);
160 if (res != LCEVC_Success)
168 LCEVC_PictureDesc
desc;
169 LCEVC_DecodeInformation
info;
170 LCEVC_PictureHandle picture;
171 LCEVC_ReturnCode res;
173 res = LCEVC_ReceiveDecoderPicture(lcevc->
decoder, &picture, &
info);
174 if (res != LCEVC_Success)
177 res = LCEVC_GetPictureDesc(lcevc->
decoder, picture, &
desc);
178 if (res != LCEVC_Success)
182 out->crop_bottom =
desc.cropBottom;
183 out->crop_left =
desc.cropLeft;
184 out->crop_right =
desc.cropRight;
185 out->sample_aspect_ratio.num =
desc.sampleAspectRatioNum;
186 out->sample_aspect_ratio.den =
desc.sampleAspectRatioDen;
188 out->height =
desc.height +
out->crop_top +
out->crop_bottom;
190 res = LCEVC_FreePicture(lcevc->
decoder, picture);
191 if (res != LCEVC_Success)
199 LCEVC_PictureHandle picture;
200 LCEVC_ReturnCode res;
208 res = LCEVC_ReceiveDecoderBase (lcevc->
decoder, &picture);
209 if (res != LCEVC_Success && res != LCEVC_Again)
212 if (res == LCEVC_Again)
215 res = LCEVC_FreePicture(lcevc->
decoder, picture);
216 if (res != LCEVC_Success)
224 LCEVC_PictureHandle pic,
const LCEVC_DecodeInformation *
info,
225 const uint8_t *
data, uint32_t
size,
void *logctx)
240 LCEVC_DestroyDecoder(lcevc->
decoder);
241 memset(lcevc, 0,
sizeof(*lcevc));
247 #if CONFIG_LIBLCEVC_DEC
248 LCEVC_AccelContextHandle
dummy = { 0 };
249 const int32_t event = LCEVC_Log;
255 #if CONFIG_LIBLCEVC_DEC
256 if (LCEVC_CreateDecoder(&lcevc->
decoder,
dummy) != LCEVC_Success) {
261 LCEVC_ConfigureDecoderInt(lcevc->
decoder,
"log_level", 4);
262 LCEVC_ConfigureDecoderIntArray(lcevc->
decoder,
"events", 1, &event);
263 LCEVC_SetDecoderEventCallback(lcevc->
decoder, event_callback, logctx);
265 if (LCEVC_InitializeDecoder(lcevc->
decoder) != LCEVC_Success) {
267 LCEVC_DestroyDecoder(lcevc->
decoder);
289 #if CONFIG_LIBLCEVC_DEC
290 ret = lcevc_send_frame(logctx, lcevc,
frame);
294 lcevc_receive_frame(logctx, lcevc,
frame);
307 #if CONFIG_LIBLCEVC_DEC
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
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
int ff_lcevc_alloc(FFLCEVCContext **plcevc)
static void * ff_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(FFRefStructOpaque opaque, void *obj))
A wrapper around ff_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
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).
static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
#define AV_PIX_FMT_YUV420P10
RefStruct is an API for creating reference-counted objects with minimal overhead.
static LCEVC_ColorFormat map_format(int format)
LCEVC_DecoderHandle decoder
static const struct @466 planes[]
static const chunk_decoder decoder[8]
int ff_lcevc_process(void *logctx, AVFrame *frame)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * post_process_opaque
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int alloc_enhanced_frame(AVFilterLink *inlink, const AVFrame *out, LCEVC_PictureHandle *picture)
static int generate_output(AVFilterLink *inlink, AVFrame *out)
void ff_lcevc_unref(void *opaque)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
uintptr_t LCEVC_DecoderHandle
static int alloc_base_frame(AVFilterLink *inlink, const AVFrame *in, LCEVC_PictureHandle *picture)
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AV_LOG_INFO
Standard information.
static pthread_mutex_t lock
#define i(width, name, range_min, range_max)
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ 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...
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
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Structure to hold side data for an AVFrame.
void ff_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...