Go to the documentation of this file.
40 #define XEVD_PARAM_BAD_NAME -1
41 #define XEVD_PARAM_BAD_VALUE -2
43 #define EVC_NAL_HEADER_SIZE 2
72 memset(cdsc, 0,
sizeof(XEVD_CDSC));
78 cdsc->threads = XEVD_MAX_TASK_CNT;
94 if (bs_size == XEVD_NAL_UNIT_LENGTH_BYTE) {
95 ret = xevd_info((
void *)bs, XEVD_NAL_UNIT_LENGTH_BYTE, 1, &
info);
96 if (XEVD_FAILED(
ret)) {
125 if (XEVD_FAILED(
ret)) {
131 if (XEVD_FAILED(
ret)) {
136 ret = xevd_config(xectx->
id, XEVD_CFG_GET_WIDTH, &avctx->
width, &
size);
137 if (XEVD_FAILED(
ret)) {
142 ret = xevd_config(xectx->
id, XEVD_CFG_GET_HEIGHT, &avctx->
height, &
size);
143 if (XEVD_FAILED(
ret)) {
148 ret = xevd_config(xectx->
id, XEVD_CFG_GET_COLOR_SPACE, &color_space, &
size);
149 if (XEVD_FAILED(
ret)) {
153 switch(color_space) {
154 case XEVD_CS_YCBCR400_10LE:
157 case XEVD_CS_YCBCR420_10LE:
160 case XEVD_CS_YCBCR422_10LE:
163 case XEVD_CS_YCBCR444_10LE:
174 if (XEVD_FAILED(
ret)) {
193 if (imgb->cs != XEVD_CS_YCBCR420_10LE) {
198 if (imgb->w[0] != avctx->
width || imgb->h[0] != avctx->
height) {
211 imgb->w[0], imgb->h[0]);
226 XEVD_CDSC *cdsc = &(xectx->
cdsc);
232 xectx->
id = xevd_create(&(xectx->
cdsc),
NULL);
295 frame->pkt_dts = imgb->ts[XEVD_TS_DTS];
296 frame->pts = imgb->ts[XEVD_TS_PTS];
319 XEVD_IMGB *imgb =
NULL;
351 while(pkt_au->
size > (bs_read_pos + XEVD_NAL_UNIT_LENGTH_BYTE)) {
352 memset(&stat, 0,
sizeof(XEVD_STAT));
355 if (nalu_size == 0) {
362 bs_read_pos += XEVD_NAL_UNIT_LENGTH_BYTE;
364 bitb.addr = pkt_au->
data + bs_read_pos;
365 bitb.ssize = nalu_size;
366 bitb.pdata[0] = pkt_au;
367 bitb.ts[XEVD_TS_DTS] = pkt_au->
dts;
370 xevd_ret = xevd_decode(xectx->
id, &bitb, &stat);
371 if (XEVD_FAILED(xevd_ret)) {
378 bs_read_pos += nalu_size;
380 if (stat.nalu_type == XEVD_NUT_SPS) {
389 if (stat.read != nalu_size)
390 av_log(avctx,
AV_LOG_INFO,
"Different reading of bitstream (in:%d, read:%d)\n,", nalu_size, stat.read);
393 if (stat.fnum >= 0) {
395 xevd_ret = xevd_pull(xectx->
id, &imgb);
397 if (XEVD_FAILED(xevd_ret)) {
398 av_log(avctx,
AV_LOG_ERROR,
"Failed to pull the decoded image (xevd error code: %d, frame#=%d)\n", xevd_ret, stat.fnum);
403 }
else if (xevd_ret == XEVD_OK_FRM_DELAYED) {
404 if(bs_read_pos == pkt_au->
size) {
409 if(bs_read_pos == pkt_au->
size) {
416 if (stat.stype == XEVD_ST_I) {
427 xevd_ret = xevd_pull(xectx->
id, &imgb);
429 if (xevd_ret == XEVD_ERR_UNEXPECTED) {
433 }
else if (XEVD_FAILED(xevd_ret)) {
434 av_log(avctx,
AV_LOG_ERROR,
"Failed to pull the decoded image (xevd error code: %d)\n", xevd_ret);
461 xevd_delete(xectx->
id);
483 .p.wrapper_name =
"libxevd",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
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
static atomic_int cpu_count
#define AVERROR_EOF
End of file.
The structure stores all the states associated with the instance of Xeve MPEG-5 EVC decoder.
const FFCodec ff_libxevd_decoder
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUV420P10
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
static uint32_t read_nal_unit_length(const uint8_t *bs, int bs_size, AVCodecContext *avctx)
Read NAL unit length.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
AVCodec p
The public AVCodec.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
static int libxevd_return_frame(AVCodecContext *avctx, AVFrame *frame, XEVD_IMGB *imgb, AVPacket **pkt_au)
int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt)
Set various frame properties from the provided packet.
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
int has_b_frames
Size of the frame reordering buffer in the decoder.
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
const AVProfile ff_evc_profiles[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_cold int libxevd_close(AVCodecContext *avctx)
Destroy decoder.
#define CODEC_LONG_NAME(str)
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
static av_cold int libxevd_init(AVCodecContext *avctx)
Initialize decoder Create a decoder instance and allocate all the needed resources.
static int export_stream_params(const XevdContext *xectx, AVCodecContext *avctx)
static void get_conf(AVCodecContext *avctx, XEVD_CDSC *cdsc)
The function populates the XEVD_CDSC structure.
@ AV_PICTURE_TYPE_I
Intra.
static int libxevd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Decode frame with decoupled packet/frame dataflow.
static int libxevd_image_copy(struct AVCodecContext *avctx, XEVD_IMGB *imgb, struct AVFrame *frame)
Copy image in imgb to frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define FF_CODEC_CAP_SETS_FRAME_PROPS
Codec handles output frame properties internally instead of letting the internal logic derive them fr...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
#define AV_LOG_INFO
Standard information.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define FFSWAP(type, a, b)
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
main external API structure.
#define FF_CODEC_RECEIVE_FRAME_CB(func)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int coded_width
Bitstream width / height, may be different from width/height e.g.
This structure stores compressed data.
int width
picture width / height.
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_image_copy(uint8_t *const dst_data[4], const int dst_linesizes[4], const uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.