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 },
222 .p.priv_class = &
class,
225 .p.wrapper_name =
"qsv",
const FFCodec ff_av1_qsv_encoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
common internal and external API header
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
#define AV_CODEC_CAP_HYBRID
Codec is potentially backed by a hardware implementation, but not necessarily.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Memory handling functions.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full 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...
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR)
int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet)
const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[]
#define QSV_OPTION_LOW_DELAY_BRC
#define QSV_OPTION_B_STRATEGY
#define QSV_OPTION_MAX_FRAME_SIZE
#define QSV_OPTION_ADAPTIVE_I
#define QSV_OPTION_EXTBRC
#define QSV_OPTION_ADAPTIVE_B
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 const FFCodecDefault qsv_enc_defaults[]
static av_cold int qsv_enc_init(AVCodecContext *avctx)
static av_cold int qsv_enc_close(AVCodecContext *avctx)
The bitstream filter state.
AVCodecParameters * par_in
Parameters of the input stream.
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
int flags
AV_CODEC_FLAG_*.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
unsigned MaxFALL
Max average light level per frame (cd/m^2).
unsigned MaxCLL
Max content light level (cd/m^2).
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
AVBSFContext * extra_data_bsf
SetEncodeCtrlCB * set_encode_ctrl_cb
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)