Go to the documentation of this file.
24 #include "config_components.h"
28 #include <sys/types.h>
55 #include <mfxdispatcher.h>
57 #define MFXUnload(a) do { } while(0)
62 #define PTS_TO_MFX_PTS(pts, pts_tb) ((pts) == AV_NOPTS_VALUE ? \
63 MFX_TIMESTAMP_UNKNOWN : pts_tb.num ? \
64 av_rescale_q(pts, pts_tb, mfx_tb) : pts)
66 #define MFX_PTS_TO_PTS(mfx_pts, pts_tb) ((mfx_pts) == MFX_TIMESTAMP_UNKNOWN ? \
67 AV_NOPTS_VALUE : pts_tb.num ? \
68 av_rescale_q(mfx_pts, mfx_tb, pts_tb) : mfx_pts)
186 if (q->
gpu_copy == MFX_GPUCOPY_ON &&
187 !(q->
iopattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY)) {
189 "only works in system memory mode.\n");
194 }
else if (hw_frames_ref) {
208 q->
iopattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY,
219 }
else if (hw_device_ref) {
242 if (MFXQueryVersion(q->
session, &q->
ver) != MFX_ERR_NONE) {
260 MFXVideoDECODE_Close(q->
session);
267 mfxSession session =
NULL;
307 frames_hwctx = hwframes_ctx->
hwctx;
313 frames_hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
330 if (frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME)
331 iopattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
332 else if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
333 iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
335 if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
336 iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
342 iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
365 avctx->
width = param->mfx.FrameInfo.CropW;
366 avctx->
height = param->mfx.FrameInfo.CropH;
369 avctx->
level = param->mfx.CodecLevel;
370 avctx->
profile = param->mfx.CodecProfile;
377 "Error initializing the MFX video decoder");
389 mfxVideoParam *param)
392 mfxExtVideoSignalInfo video_signal_info = { 0 };
393 mfxExtBuffer *header_ext_params[1] = { (mfxExtBuffer *)&video_signal_info };
394 mfxBitstream bs = { 0 };
397 bs.Data = avpkt->
data;
398 bs.DataLength = avpkt->
size;
399 bs.MaxLength = bs.DataLength;
402 bs.DataFlag |= MFX_BITSTREAM_COMPLETE_FRAME;
417 param->mfx.CodecId =
ret;
418 video_signal_info.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO;
419 video_signal_info.Header.BufferSz =
sizeof(video_signal_info);
422 param->ExtParam = header_ext_params;
423 param->NumExtParam = 1;
424 ret = MFXVideoDECODE_DecodeHeader(q->
session, &bs, param);
425 if (MFX_ERR_MORE_DATA ==
ret) {
430 "Error decoding stream header");
434 if (video_signal_info.ColourDescriptionPresent) {
436 avctx->
color_trc = video_signal_info.TransferCharacteristics;
437 avctx->
colorspace = video_signal_info.MatrixCoefficients;
443 #if QSV_VERSION_ATLEAST(1, 34)
483 frame->surface.Data.ExtParam =
frame->ext_param;
484 frame->surface.Data.NumExtParam = 0;
485 frame->num_ext_params = 0;
486 frame->dec_info.Header.BufferId = MFX_EXTBUFF_DECODED_FRAME_INFO;
487 frame->dec_info.Header.BufferSz =
sizeof(
frame->dec_info);
489 #if QSV_VERSION_ATLEAST(1, 34)
491 frame->av1_film_grain_param.Header.BufferId = MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM;
492 frame->av1_film_grain_param.Header.BufferSz =
sizeof(
frame->av1_film_grain_param);
493 frame->av1_film_grain_param.FilmGrainFlags = 0;
498 #if QSV_VERSION_ATLEAST(1, 35)
500 frame->mdcv.Header.BufferId = MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME;
501 frame->mdcv.Header.BufferSz =
sizeof(
frame->mdcv);
503 frame->mdcv.InsertPayloadToggle = 0;
506 frame->clli.Header.BufferId = MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO;
507 frame->clli.Header.BufferSz =
sizeof(
frame->clli);
509 frame->clli.InsertPayloadToggle = 0;
545 *surf = &
frame->surface;
567 *surf = &
frame->surface;
583 #if QSV_VERSION_ATLEAST(1, 34)
590 if (!(ext_param->FilmGrainFlags & MFX_FILM_GRAIN_APPLY))
599 fgp->
seed = ext_param->GrainSeed;
607 aom->
overlap_flag = !!(ext_param->FilmGrainFlags & MFX_FILM_GRAIN_OVERLAP);
608 aom->
limit_output_range = !!(ext_param->FilmGrainFlags & MFX_FILM_GRAIN_CLIP_TO_RESTRICTED_RANGE);
613 aom->
y_points[
i][0] = ext_param->PointY[
i].Value;
614 aom->
y_points[
i][1] = ext_param->PointY[
i].Scaling;
620 aom->
uv_points[0][
i][0] = ext_param->PointCb[
i].Value;
621 aom->
uv_points[0][
i][1] = ext_param->PointCb[
i].Scaling;
627 aom->
uv_points[1][
i][0] = ext_param->PointCr[
i].Value;
628 aom->
uv_points[1][
i][1] = ext_param->PointCr[
i].Scaling;
631 for (
i = 0;
i < 24;
i++)
634 for (
i = 0;
i < 25;
i++) {
639 aom->
uv_mult[0] = ext_param->CbMult;
640 aom->
uv_mult[1] = ext_param->CrMult;
650 #if QSV_VERSION_ATLEAST(1, 35)
651 static int qsv_export_hdr_side_data(
AVCodecContext *avctx, mfxExtMasteringDisplayColourVolume *mdcv,
655 if (mdcv->InsertPayloadToggle) {
657 const int mapping[3] = {2, 0, 1};
658 const int chroma_den = 50000;
659 const int luma_den = 10000;
665 for (
i = 0;
i < 3;
i++) {
666 const int j = mapping[
i];
682 if (clli->InsertPayloadToggle) {
688 light->
MaxCLL = clli->MaxContentLightLevel;
689 light->
MaxFALL = clli->MaxPicAverageLightLevel;
701 mfxFrameSurface1 *insurf;
702 mfxFrameSurface1 *outsurf;
704 mfxBitstream bs = { { { 0 } } };
708 bs.Data = avpkt->
data;
709 bs.DataLength = avpkt->
size;
710 bs.MaxLength = bs.DataLength;
713 bs.DataFlag |= MFX_BITSTREAM_COMPLETE_FRAME;
730 insurf, &outsurf, sync);
731 if (
ret == MFX_WRN_DEVICE_BUSY)
734 }
while (
ret == MFX_WRN_DEVICE_BUSY ||
ret == MFX_ERR_MORE_SURFACE);
736 if (
ret == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) {
743 if (
ret != MFX_ERR_NONE &&
744 ret != MFX_ERR_MORE_DATA &&
745 ret != MFX_WRN_VIDEO_PARAM_CHANGED &&
746 ret != MFX_ERR_MORE_SURFACE) {
749 "Error during QSV decoding.");
754 if (!*sync && !bs.DataOffset) {
755 bs.DataOffset = avpkt->
size;
769 "The returned surface does not correspond to any frame\n");
793 }
while (
ret == MFX_WRN_IN_EXECUTION);
807 #if QSV_VERSION_ATLEAST(1, 34)
811 ret = qsv_export_film_grain(avctx, &aframe.
frame->av1_film_grain_param,
frame);
818 #if QSV_VERSION_ATLEAST(1, 35)
820 ret = qsv_export_hdr_side_data(avctx, &aframe.
frame->mdcv, &aframe.
frame->clli,
frame);
828 outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_TRIPLING ? 4 :
829 outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_DOUBLING ? 2 :
830 outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_REPEATED ? 1 : 0;
832 !!(outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF);
834 !(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);
846 ((mfxFrameSurface1*)
frame->
data[3])->Info = outsurf->Info;
851 return bs.DataOffset;
859 MFXVideoDECODE_Close(q->
session);
886 mfxVideoParam param = { 0 };
908 if (
ret < 0 || *got_frame)
913 mfxFrameAllocRequest request;
914 memset(&request, 0,
sizeof(request));
932 ret = MFXVideoDECODE_QueryIOSurf(q->
session, ¶m, &request);
1004 uid =
"f622394d8d87452f878c51f2fc9b4131";
1006 uid =
"a922394d8d87452f878c51f2fc9b4131";
1009 static const char *
const uid_hevcdec_sw =
"15dd936825ad475ea34e35f3f54217a6";
1010 static const char *
const uid_hevcdec_hw =
"33a61c0b4c27454ca8d85dde757c6f8e";
1012 if (
s->qsv.load_plugins[0]) {
1014 "load_plugins is not empty, but load_plugin is not set to 'none'."
1015 "The load_plugin value will be ignored.\n");
1018 uid = uid_hevcdec_sw;
1020 uid = uid_hevcdec_hw;
1026 if (!
s->qsv.load_plugins)
1033 if (!
s->packet_fifo) {
1064 while (!*got_frame) {
1066 if (
s->buffer_pkt.size <= 0) {
1071 if (!
s->qsv.reinit_flag) {
1087 if (
s->qsv.reinit_flag)
1090 s->buffer_pkt.size -=
ret;
1091 s->buffer_pkt.data +=
ret;
1104 s->qsv.initialized = 0;
1107 #define OFFSET(x) offsetof(QSVDecContext, x)
1108 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1110 #define DEFINE_QSV_DECODER_WITH_OPTION(x, X, bsf_name, opt) \
1111 static const AVClass x##_qsv_class = { \
1112 .class_name = #x "_qsv", \
1113 .item_name = av_default_item_name, \
1115 .version = LIBAVUTIL_VERSION_INT, \
1117 const FFCodec ff_##x##_qsv_decoder = { \
1118 .p.name = #x "_qsv", \
1119 CODEC_LONG_NAME(#X " video (Intel Quick Sync Video acceleration)"), \
1120 .priv_data_size = sizeof(QSVDecContext), \
1121 .p.type = AVMEDIA_TYPE_VIDEO, \
1122 .p.id = AV_CODEC_ID_##X, \
1123 .init = qsv_decode_init, \
1124 FF_CODEC_DECODE_CB(qsv_decode_frame), \
1125 .flush = qsv_decode_flush, \
1126 .close = qsv_decode_close, \
1128 .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID, \
1129 .p.priv_class = &x##_qsv_class, \
1130 .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, \
1133 AV_PIX_FMT_YUYV422, \
1140 AV_PIX_FMT_NONE }, \
1141 .hw_configs = qsv_hw_configs, \
1142 .p.wrapper_name = "qsv", \
1143 .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
1146 #define DEFINE_QSV_DECODER(x, X, bsf_name) DEFINE_QSV_DECODER_WITH_OPTION(x, X, bsf_name, options)
1148 #if CONFIG_HEVC_QSV_DECODER
1157 {
"load_plugins",
"A :-separate list of hexadecimal plugin UIDs to load in an internal session",
1160 {
"gpu_copy",
"A GPU-accelerated copy between video and system memory",
OFFSET(qsv.gpu_copy),
AV_OPT_TYPE_INT, { .i64 = MFX_GPUCOPY_DEFAULT }, MFX_GPUCOPY_DEFAULT, MFX_GPUCOPY_OFF,
VD,
"gpu_copy"},
1172 {
"gpu_copy",
"A GPU-accelerated copy between video and system memory",
OFFSET(qsv.gpu_copy),
AV_OPT_TYPE_INT, { .i64 = MFX_GPUCOPY_DEFAULT }, MFX_GPUCOPY_DEFAULT, MFX_GPUCOPY_OFF,
VD,
"gpu_copy"},
1179 #if CONFIG_H264_QSV_DECODER
1183 #if CONFIG_MPEG2_QSV_DECODER
1187 #if CONFIG_VC1_QSV_DECODER
1191 #if CONFIG_MJPEG_QSV_DECODER
1195 #if CONFIG_VP8_QSV_DECODER
1199 #if CONFIG_VP9_QSV_DECODER
1203 #if CONFIG_AV1_QSV_DECODER
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int frame_type
A combination of MFX_MEMTYPE_* describing the frame pool.
void * hwaccel_context
Legacy hardware accelerator context.
AVBufferPool * av_buffer_pool_init(size_t size, AVBufferRef *(*alloc)(size_t size))
Allocate and initialize a buffer pool.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
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
enum AVColorSpace colorspace
YUV colorspace type.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
AVBufferRef * hw_frames_ctx
@ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
The codec supports this format via the hw_frames_ctx interface.
uint8_t * data
The data buffer.
static const AVOption options[]
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
uint8_t uv_points[2][10][2]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
unsigned MaxCLL
Max content light level (cd/m^2).
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
int ff_qsv_close_internal_session(QSVSession *qs)
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).
enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type)
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
@ AVCOL_RANGE_JPEG
Full range content.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
enum AVFieldOrder field_order
Field order.
union AVFilmGrainParams::@337 codec
Additional fields may be added both here and in any structure included.
static void qsv_decode_close_qsvcontext(QSVContext *q)
int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame)
QSVFrame * work_frames
a linked list of frames currently being used by QSV
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
int width
The allocated dimensions of the frames in this pool.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static int qsv_decode_init_context(AVCodecContext *avctx, QSVContext *q, mfxVideoParam *param)
int iopattern
The IO pattern to use.
uint64_t seed
Seed to use for the synthesis process, if the codec allows for it.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins, int gpu_copy)
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
int ff_qsv_map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
static void qsv_decode_flush(AVCodecContext *avctx)
static int qsv_decode(AVCodecContext *avctx, QSVContext *q, AVFrame *frame, int *got_frame, const AVPacket *avpkt)
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int grain_scale_shift
Signals the down shift applied to the generated gaussian numbers during synthesis.
int limit_output_range
Signals to clip to limited color levels after film grain application.
int num_y_points
Number of points, and the scale and value for each point of the piecewise linear scaling function for...
This structure describes how to handle film grain synthesis for AOM codecs.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **surf)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_qsv_print_warning(void *log_ctx, mfxStatus err, const char *warning_string)
#define ASYNC_DEPTH_DEFAULT
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
QSVFramesContext frames_ctx
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
static enum AVPixelFormat pix_fmt
static const AVRational mfx_tb
static int qsv_process_data(AVCodecContext *avctx, QSVContext *q, AVFrame *frame, int *got_frame, const AVPacket *pkt)
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
AVFilmGrainParams * av_film_grain_params_create_side_data(AVFrame *frame)
Allocate a complete AVFilmGrainParams and add it to the frame.
#define MFX_PTS_TO_PTS(mfx_pts, pts_tb)
static enum AVPixelFormat pix_fmts[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVPixelFormat pix_fmt
For decoders, a hardware pixel format which that decoder may be able to decode to if suitable hardwar...
int av_usleep(unsigned usec)
Sleep for a period of time.
int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *psession, QSVFramesContext *qsv_frames_ctx, const char *load_plugins, int opaque, int gpu_copy)
Describe the class of an AVClass context structure.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Rational number (pair of numerator and denominator).
static int qsv_decode_preinit(AVCodecContext *avctx, QSVContext *q, enum AVPixelFormat pix_fmt, mfxVideoParam *param)
int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string)
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
size_t av_fifo_can_read(const AVFifo *f)
static int qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame, AVBufferPool *pool)
static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int level
Encoding level descriptor.
mfxExtBuffer ** ext_buffers
int num_uv_points[2]
If chroma_scaling_from_luma is set to 0, signals the chroma scaling function parameters.
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define DEFINE_QSV_DECODER_WITH_OPTION(x, X, bsf_name, opt)
mfxSession session
If non-NULL, the session to use for encoding or decoding.
static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session, AVBufferRef *hw_frames_ref, AVBufferRef *hw_device_ref)
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static av_cold int qsv_decode_close(AVCodecContext *avctx)
This structure describes how to handle film grain synthesis in video for specific codecs.
static void qsv_clear_unused_frames(QSVContext *q)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
mfxExtBuffer ** ext_buffers
Extra buffers to pass to encoder or decoder initialization.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters.
#define AVERROR_EXTERNAL
Generic error in an external library.
int8_t ar_coeffs_y[24]
Luma auto-regression coefficients.
#define AV_LOG_INFO
Standard information.
static int qsv_decode_header(AVCodecContext *avctx, QSVContext *q, const AVPacket *avpkt, enum AVPixelFormat pix_fmt, mfxVideoParam *param)
enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static const AVCodecHWConfigInternal *const qsv_hw_configs[]
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int scaling_shift
Specifies the shift applied to the chroma components.
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
This struct describes a set or pool of "hardware" frames (i.e.
static QSVFrame * find_frame(QSVContext *q, mfxFrameSurface1 *surf)
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
@ 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...
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
main external API structure.
int ar_coeff_lag
Specifies the auto-regression lag.
enum AVPixelFormat orig_pix_fmt
int uv_offset[2]
Offset used for component scaling function.
This struct is used for communicating QSV parameters between libavcodec and the caller.
enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc)
int uv_mult[2]
Specifies the luma/chroma multipliers for the index to the component scaling function.
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
static int qsv_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
int overlap_flag
Signals whether to overlap film grain blocks.
This struct is allocated as AVHWFramesContext.hwctx.
int coded_width
Bitstream width / height, may be different from width/height e.g.
int initial_pool_size
Initial size of the frame pool.
char * av_strdup(const char *s)
Duplicate a string.
A reference to a data buffer.
static av_cold int qsv_decode_init(AVCodecContext *avctx)
mfxExtDecodedFrameInfo dec_info
int ff_attach_decode_data(AVFrame *frame)
static void qsv_clear_buffers(QSVDecContext *s)
#define DEFINE_QSV_DECODER(x, X, bsf_name)
unsigned MaxFALL
Max average light level per frame (cd/m^2).
This structure stores compressed data.
int width
picture width / height.
#define PTS_TO_MFX_PTS(pts, pts_tb)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
int chroma_scaling_from_luma
Signals whether to derive the chroma scaling function from the luma.
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
void ff_qsv_frame_add_ext_param(AVCodecContext *avctx, QSVFrame *frame, mfxExtBuffer *param)
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
@ AV_FILM_GRAIN_PARAMS_AV1
The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string)
enum AVFilmGrainParamsType type
Specifies the codec for which this structure is valid.
int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy)
int repeat_pict
Number of fields in this frame which should be repeated, i.e.
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN
Decoding only.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
int ar_coeff_shift
Specifies the range of the auto-regressive coefficients.
int8_t ar_coeffs_uv[2][25]
Chroma auto-regression coefficients.