Go to the documentation of this file.
23 #include <sys/types.h>
55 const int chroma_den = 1 << 16;
56 const int max_luma_den = 1 << 8;
57 const int min_luma_den = 1 << 14;
58 mfxExtMasteringDisplayColourVolume *mdcv =
av_mallocz(
sizeof(*mdcv));
62 mdcv->Header.BufferId = MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME;
63 mdcv->Header.BufferSz =
sizeof(*mdcv);
65 for (
int i = 0;
i < 3;
i++) {
66 mdcv->DisplayPrimariesX[
i] =
69 mdcv->DisplayPrimariesY[
i] =
81 mdcv->MaxDisplayMasteringLuminance =
84 mdcv->MinDisplayMasteringLuminance =
88 enc_ctrl->ExtParam[enc_ctrl->NumExtParam++] = (mfxExtBuffer *)mdcv;
95 mfxExtContentLightLevelInfo *clli =
av_mallocz(
sizeof(*clli));
99 clli->Header.BufferId = MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO;
100 clli->Header.BufferSz =
sizeof(*clli);
102 clli->MaxContentLightLevel = clm->
MaxCLL;
103 clli->MaxPicAverageLightLevel = clm->
MaxFALL;
105 enc_ctrl->ExtParam[enc_ctrl->NumExtParam++] = (mfxExtBuffer *)clli;
152 "failed to send input packet\n");
159 "failed to receive output packet\n");
176 #define OFFSET(x) offsetof(QSVAV1EncContext, x)
177 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
187 {
"unknown" ,
NULL, 0,
AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_UNKNOWN }, INT_MIN, INT_MAX,
VE, .unit =
"profile" },
188 {
"main" ,
NULL, 0,
AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_AV1_MAIN }, INT_MIN, INT_MAX,
VE, .unit =
"profile" },
189 {
"tile_cols",
"Number of columns for tiled encoding",
OFFSET(qsv.tile_cols),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX,
VE },
190 {
"tile_rows",
"Number of rows for tiled encoding",
OFFSET(qsv.tile_rows),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX,
VE },
191 {
"look_ahead_depth",
"Depth of look ahead in number frames, available when extbrc option is enabled",
OFFSET(qsv.look_ahead_depth),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100,
VE },
225 .p.priv_class = &
class,
228 .p.wrapper_name =
"qsv",
AVCodecParameters * par_in
Parameters of the input stream.
AVPixelFormat
Pixel format.
#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
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
#define QSV_OPTION_ADAPTIVE_B
unsigned MaxCLL
Max content light level (cd/m^2).
This structure describes decoded (raw) audio or video data.
@ AVCOL_RANGE_JPEG
Full range content.
void(* filter)(uint8_t *src, int stride, int qscale)
static const FFCodecDefault qsv_enc_defaults[]
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
The bitstream filter state.
AVBSFContext * extra_data_bsf
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
AVCodec p
The public AVCodec.
int flags
AV_CODEC_FLAG_*.
#define FF_CODEC_ENCODE_CB(func)
static av_cold int qsv_enc_close(AVCodecContext *avctx)
const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
#define LIBAVUTIL_VERSION_INT
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
Describe the class of an AVClass context structure.
#define QSV_OPTION_LOW_DELAY_BRC
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
static const AVOption options[]
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
#define QSV_OPTION_ADAPTIVE_I
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
static int qsv_enc_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
static int qsv_av1_set_encode_ctrl(AVCodecContext *avctx, const AVFrame *frame, mfxEncodeCtrl *enc_ctrl)
static av_cold int qsv_enc_init(AVCodecContext *avctx)
#define QSV_OPTION_EXTBRC
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
SetEncodeCtrlCB * set_encode_ctrl_cb
#define i(width, name, range_min, range_max)
FFCodec ff_av1_qsv_encoder
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ 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...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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
#define QSV_OPTION_MAX_FRAME_SIZE
main external API structure.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#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 ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
#define AV_CODEC_CAP_HYBRID
Codec is potentially backed by a hardware implementation, but not necessarily.
int avcodec_parameters_from_context(struct AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
Structure to hold side data for an AVFrame.
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet)
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define QSV_OPTION_B_STRATEGY