23#include <LCEVC/lcevc_dec.h>
41 return LCEVC_I420_10_LE;
43 return LCEVC_I420_12_LE;
47 return LCEVC_I422_10_LE;
49 return LCEVC_I422_12_LE;
53 return LCEVC_I444_10_LE;
55 return LCEVC_I444_12_LE;
63 return LCEVC_GRAY_10_LE;
65 return LCEVC_GRAY_12_LE;
68 return LCEVC_ColorFormat_Unknown;
75 return LCEVC_ColorRange_Limited;
77 return LCEVC_ColorRange_Full;
80 return LCEVC_ColorRange_Unknown;
86 case LCEVC_ColorRange_Limited:
88 case LCEVC_ColorRange_Full:
96 LCEVC_PictureHandle *picture)
100 LCEVC_PictureDesc
desc;
105 LCEVC_ReturnCode res;
108 if (res != LCEVC_Success) {
126 desc.matrixCoefficients = (LCEVC_MatrixCoefficients)in->
colorspace;
127 desc.transferCharacteristics = (LCEVC_TransferCharacteristics)in->
color_trc;
136 if (res != LCEVC_Success) {
148 LCEVC_PictureHandle picture;
150 LCEVC_ReturnCode res;
159 if (res == LCEVC_Again)
161 else if (res != LCEVC_Success) {
167 res = LCEVC_SetPictureUserData(lcevc->
decoder, picture, in);
168 if (res != LCEVC_Success) {
170 LCEVC_FreePicture(lcevc->
decoder, picture);
174 res = LCEVC_SendDecoderBase(lcevc->
decoder, in->
pts, picture, -1, in);
175 if (res != LCEVC_Success) {
177 LCEVC_FreePicture(lcevc->
decoder, picture);
185 LCEVC_PictureHandle *picture)
189 LCEVC_PictureDesc
desc;
192 LCEVC_ReturnCode res;
194 res = LCEVC_DefaultPictureDesc(&
desc, fmt,
out->width,
out->height);
195 if (res != LCEVC_Success)
204 if (res != LCEVC_Success) {
205 av_log(
ctx,
AV_LOG_ERROR,
"LCEVC_AllocPictureExternal to allocate a buffer for an enhanced frame\n");
217 LCEVC_PictureDesc
desc;
218 LCEVC_DecodeInformation info;
219 LCEVC_PictureHandle picture;
220 LCEVC_ReturnCode res;
222 res = LCEVC_ReceiveDecoderPicture(lcevc->
decoder, &picture, &info);
223 if (res == LCEVC_Again) {
233 }
else if (res != LCEVC_Success) {
241 res = LCEVC_GetPictureDesc(lcevc->
decoder, picture, &
desc);
242 LCEVC_FreePicture(lcevc->
decoder, picture);
245 out->crop_bottom =
desc.cropBottom;
246 out->crop_left =
desc.cropLeft;
247 out->crop_right =
desc.cropRight;
254 out->width = outlink->
w =
desc.width +
out->crop_left +
out->crop_right;
255 out->height = outlink->
h =
desc.height +
out->crop_top +
out->crop_bottom;
260 "hasEnhancement %d, enhanced %d\n",
262 out->crop_top,
out->crop_bottom,
out->crop_left,
out->crop_right,
263 out->sample_aspect_ratio.num,
out->sample_aspect_ratio.den,
264 info.hasEnhancement, info.enhanced);
273 LCEVC_PictureHandle picture;
274 LCEVC_ReturnCode res;
281 res = LCEVC_SendDecoderPicture(lcevc->
decoder, picture);
282 if (res != LCEVC_Success) {
296 outlink->
w = lcevc->
w = inlink->
w * 2;
297 outlink->
h = lcevc->
h = inlink->
h * 2;
306 LCEVC_PictureHandle picture;
308 while (LCEVC_ReceiveDecoderBase(lcevc->
decoder, &picture) == LCEVC_Success) {
310 LCEVC_GetPictureUserData(lcevc->
decoder, picture, (
void **)&
base);
311 LCEVC_FreePicture(lcevc->
decoder, picture);
340 if (in->
width != inlink->
w ||
373 LCEVC_PictureHandle pic,
const LCEVC_DecodeInformation *info,
374 const uint8_t *
data, uint32_t
size,
void *logctx)
376 if (event != LCEVC_Log)
388 LCEVC_AccelContextHandle
dummy = { 0 };
389 const int32_t event = LCEVC_Log;
390 LCEVC_ReturnCode res;
393 if (res != LCEVC_Success) {
398 res = LCEVC_ConfigureDecoderInt(lcevc->
decoder,
"log_level", 4);
399 if (res != LCEVC_Success) {
403 res = LCEVC_ConfigureDecoderIntArray(lcevc->
decoder,
"events", 1, &event);
404 if (res != LCEVC_Success) {
409 if (res != LCEVC_Success) {
414 res = LCEVC_InitializeDecoder(lcevc->
decoder);
415 if (res != LCEVC_Success) {
427 LCEVC_FlushDecoder(lcevc->
decoder);
429 LCEVC_DestroyDecoder(lcevc->
decoder);
static const char *const format[]
const FFFilter ff_vf_lcevc
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
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_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.
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
uintptr_t LCEVC_DecoderHandle
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
#define FILTER_PIXFMTS_ARRAY(array)
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static const struct @257111027162314367033347246032313251342043035002 planes[]
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
AVColorRange
Visual content value range.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
#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
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_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
#define AV_PIX_FMT_YUV444P10
AVColorSpace
YUV colorspace type.
static int config_props(AVBitStreamFilterLink *link)
AVFilterLink ** inputs
array of pointers to input links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
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.
enum AVColorPrimaries color_primaries
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum AVColorTransferCharacteristic color_trc
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Rational number (pair of numerator and denominator).
LCEVC_DecoderHandle decoder
static AVFormatContext * ctx
static LCEVC_ColorFormat map_format(int format)
static int alloc_base_frame(AVFilterLink *inlink, const AVFrame *in, LCEVC_PictureHandle *picture)
static LCEVC_ColorRange map_range(int range)
static int config_props(AVFilterLink *outlink)
static int alloc_enhanced_frame(AVFilterLink *inlink, const AVFrame *out, LCEVC_PictureHandle *picture)
static enum AVColorRange map_av_range(int range)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int generate_output(AVFilterLink *inlink, AVFrame *out)
static void log_callback(LCEVC_DecoderHandle dec, LCEVC_Event event, LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info, const uint8_t *data, uint32_t size, void *logctx)
static const AVFilterPad lcevc_outputs[]
static int receive_frame(AVFilterLink *inlink, AVFrame *out)
static int send_frame(AVFilterLink *inlink, AVFrame *in)
static void flush_bases(AVFilterContext *ctx)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.