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)) {
195 if (imgb->cs != XEVD_CS_YCBCR420_10LE) {
200 if (imgb->w[0] != avctx->
width || imgb->h[0] != avctx->
height) {
213 imgb->w[0], imgb->h[0]);
228 XEVD_CDSC *cdsc = &(xectx->
cdsc);
234 xectx->
id = xevd_create(&(xectx->
cdsc),
NULL);
321 XEVD_IMGB *imgb =
NULL;
353 while(pkt_au->
size > (bs_read_pos + XEVD_NAL_UNIT_LENGTH_BYTE)) {
354 memset(&stat, 0,
sizeof(XEVD_STAT));
357 if (nalu_size == 0) {
364 bs_read_pos += XEVD_NAL_UNIT_LENGTH_BYTE;
366 bitb.addr = pkt_au->
data + bs_read_pos;
367 bitb.ssize = nalu_size;
368 bitb.pdata[0] = pkt_au;
369 bitb.ts[XEVD_TS_DTS] = pkt_au->
dts;
372 xevd_ret = xevd_decode(xectx->
id, &bitb, &stat);
373 if (XEVD_FAILED(xevd_ret)) {
380 bs_read_pos += nalu_size;
382 if (stat.nalu_type == XEVD_NUT_SPS) {
391 if (stat.read != nalu_size)
392 av_log(avctx,
AV_LOG_INFO,
"Different reading of bitstream (in:%d, read:%d)\n,", nalu_size, stat.read);
395 if (stat.fnum >= 0) {
397 xevd_ret = xevd_pull(xectx->
id, &imgb);
399 if (XEVD_FAILED(xevd_ret)) {
400 av_log(avctx,
AV_LOG_ERROR,
"Failed to pull the decoded image (xevd error code: %d, frame#=%d)\n", xevd_ret, stat.fnum);
405 }
else if (xevd_ret == XEVD_OK_FRM_DELAYED) {
406 if(bs_read_pos == pkt_au->
size) {
411 if(bs_read_pos == pkt_au->
size) {
425 xevd_ret = xevd_pull(xectx->
id, &imgb);
427 if (xevd_ret == XEVD_ERR_UNEXPECTED) {
431 }
else if (XEVD_FAILED(xevd_ret)) {
432 av_log(avctx,
AV_LOG_ERROR,
"Failed to pull the decoded image (xevd error code: %d)\n", xevd_ret);
459 xevd_delete(xectx->
id);
481 .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.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#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.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
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.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
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)
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.
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#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.