25 #include <sys/types.h>
26 #include <mfx/mfxvideo.h>
45 { MFX_PROFILE_AVC_BASELINE,
"baseline" },
46 { MFX_PROFILE_AVC_MAIN,
"main" },
47 { MFX_PROFILE_AVC_EXTENDED,
"extended" },
48 { MFX_PROFILE_AVC_HIGH,
"high" },
49 #if QSV_VERSION_ATLEAST(1, 15)
50 { MFX_PROFILE_AVC_HIGH_422,
"high 422" },
52 #if QSV_VERSION_ATLEAST(1, 4)
53 { MFX_PROFILE_AVC_CONSTRAINED_BASELINE,
"constrained baseline" },
54 { MFX_PROFILE_AVC_CONSTRAINED_HIGH,
"constrained high" },
55 { MFX_PROFILE_AVC_PROGRESSIVE_HIGH,
"progressive high" },
57 { MFX_PROFILE_MPEG2_SIMPLE,
"simple" },
58 { MFX_PROFILE_MPEG2_MAIN,
"main" },
59 { MFX_PROFILE_MPEG2_HIGH,
"high" },
60 { MFX_PROFILE_VC1_SIMPLE,
"simple" },
61 { MFX_PROFILE_VC1_MAIN,
"main" },
62 { MFX_PROFILE_VC1_ADVANCED,
"advanced" },
63 #if QSV_VERSION_ATLEAST(1, 8)
64 { MFX_PROFILE_HEVC_MAIN,
"main" },
65 { MFX_PROFILE_HEVC_MAIN10,
"main10" },
66 { MFX_PROFILE_HEVC_MAINSP,
"mainsp" },
83 { MFX_RATECONTROL_CBR,
"CBR" },
84 { MFX_RATECONTROL_VBR,
"VBR" },
85 { MFX_RATECONTROL_CQP,
"CQP" },
86 { MFX_RATECONTROL_AVBR,
"AVBR" },
88 { MFX_RATECONTROL_LA,
"LA" },
91 { MFX_RATECONTROL_ICQ,
"ICQ" },
92 { MFX_RATECONTROL_LA_ICQ,
"LA_ICQ" },
95 { MFX_RATECONTROL_VCM,
"VCM" },
97 #if QSV_VERSION_ATLEAST(1, 10)
98 { MFX_RATECONTROL_LA_EXT,
"LA_EXT" },
101 { MFX_RATECONTROL_LA_HRD,
"LA_HRD" },
104 { MFX_RATECONTROL_QVBR,
"QVBR" },
119 if (val == MFX_CODINGOPTION_ON)
121 else if (val == MFX_CODINGOPTION_OFF)
127 mfxExtBuffer **coding_opts)
129 mfxInfoMFX *info = &q->
param.mfx;
131 mfxExtCodingOption *co = (mfxExtCodingOption*)coding_opts[0];
133 mfxExtCodingOption2 *co2 = (mfxExtCodingOption2*)coding_opts[1];
136 mfxExtCodingOption3 *co3 = (mfxExtCodingOption3*)coding_opts[2];
143 info->GopPicSize, info->GopRefDist);
144 if (info->GopOptFlag & MFX_GOP_CLOSED)
146 if (info->GopOptFlag & MFX_GOP_STRICT)
153 if (info->RateControlMethod == MFX_RATECONTROL_CBR ||
154 info->RateControlMethod == MFX_RATECONTROL_VBR
156 || info->RateControlMethod == MFX_RATECONTROL_VCM
160 "InitialDelayInKB: %"PRIu16
"; TargetKbps: %"PRIu16
"; MaxKbps: %"PRIu16
"\n",
161 info->InitialDelayInKB, info->TargetKbps, info->MaxKbps);
162 }
else if (info->RateControlMethod == MFX_RATECONTROL_CQP) {
164 info->QPI, info->QPP, info->QPB);
165 }
else if (info->RateControlMethod == MFX_RATECONTROL_AVBR) {
167 "TargetKbps: %"PRIu16
"; Accuracy: %"PRIu16
"; Convergence: %"PRIu16
"\n",
168 info->TargetKbps, info->Accuracy, info->Convergence);
171 else if (info->RateControlMethod == MFX_RATECONTROL_LA
173 || info->RateControlMethod == MFX_RATECONTROL_LA_HRD
177 "TargetKbps: %"PRIu16
"; LookAheadDepth: %"PRIu16
"\n",
178 info->TargetKbps, co2->LookAheadDepth);
182 else if (info->RateControlMethod == MFX_RATECONTROL_ICQ) {
184 }
else if (info->RateControlMethod == MFX_RATECONTROL_LA_ICQ) {
186 info->ICQQuality, co2->LookAheadDepth);
190 else if (info->RateControlMethod == MFX_RATECONTROL_QVBR) {
197 info->NumSlice, info->NumRefFrame);
203 "RecoveryPointSEI: %s IntRefType: %"PRIu16
"; IntRefCycleSize: %"PRIu16
"; IntRefQPDelta: %"PRId16
"\n",
204 print_threestate(co->RecoveryPointSEI), co2->IntRefType, co2->IntRefCycleSize, co2->IntRefQPDelta);
207 #if QSV_HAVE_MAX_SLICE_SIZE
213 "BitrateLimit: %s; MBBRC: %s; ExtBRC: %s\n",
219 if (co2->Trellis & MFX_TRELLIS_OFF) {
221 }
else if (!co2->Trellis) {
231 #if QSV_VERSION_ATLEAST(1, 8)
233 "RepeatPPS: %s; NumMbPerSlice: %"PRIu16
"; LookAheadDS: ",
235 switch (co2->LookAheadDS) {
245 switch (co2->BRefType) {
253 #if QSV_VERSION_ATLEAST(1, 9)
255 "MinQPI: %"PRIu8
"; MaxQPI: %"PRIu8
"; MinQPP: %"PRIu8
"; MaxQPP: %"PRIu8
"; MinQPB: %"PRIu8
"; MaxQPB: %"PRIu8
"\n",
256 co2->MinQPI, co2->MaxQPI, co2->MinQPP, co2->MaxQPP, co2->MinQPB, co2->MaxQPB);
262 co->CAVLC == MFX_CODINGOPTION_ON ?
"CAVLC" :
"CABAC", co->MaxDecFrameBuffering);
264 "NalHrdConformance: %s; SingleSeiNalUnit: %s; VuiVclHrdParameters: %s VuiNalHrdParameters: %s\n",
277 int want_vcm = q->
vcm;
281 "Lookahead ratecontrol mode requested, but is not supported by this SDK version\n");
286 "VCM ratecontrol mode requested, but is not supported by this SDK version\n");
290 if (want_la + want_qscale + want_vcm > 1) {
292 "More than one of: { constant qscale, lookahead, VCM } requested, "
293 "only one of them can be used at a time.\n");
298 rc_mode = MFX_RATECONTROL_CQP;
299 rc_desc =
"constant quantization parameter (CQP)";
303 rc_mode = MFX_RATECONTROL_VCM;
304 rc_desc =
"video conferencing mode (VCM)";
309 rc_mode = MFX_RATECONTROL_LA;
310 rc_desc =
"VBR with lookahead (LA)";
314 rc_mode = MFX_RATECONTROL_LA_ICQ;
315 rc_desc =
"intelligent constant quality with lookahead (LA_ICQ)";
322 rc_mode = MFX_RATECONTROL_ICQ;
323 rc_desc =
"intelligent constant quality (ICQ)";
327 rc_mode = MFX_RATECONTROL_CBR;
328 rc_desc =
"constant bitrate (CBR)";
330 rc_mode = MFX_RATECONTROL_AVBR;
331 rc_desc =
"average variable bitrate (AVBR)";
333 rc_mode = MFX_RATECONTROL_VBR;
334 rc_desc =
"variable bitrate (VBR)";
345 mfxVideoParam param_out = { .mfx.CodecId = q->
param.mfx.CodecId };
348 ret = MFXVideoENCODE_Query(q->
session, &q->
param, ¶m_out);
350 param_out.mfx.RateControlMethod != q->
param.mfx.RateControlMethod)
363 q->
param.mfx.CodecId = ret;
367 if (avctx->
level > 0)
379 q->
param.mfx.EncodedOrder = 0;
380 q->
param.mfx.BufferSizeInKB = 0;
382 q->
param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
383 q->
param.mfx.FrameInfo.CropX = 0;
384 q->
param.mfx.FrameInfo.CropY = 0;
389 q->
param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
390 q->
param.mfx.FrameInfo.BitDepthLuma = 8;
391 q->
param.mfx.FrameInfo.BitDepthChroma = 8;
400 q->
param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
403 q->
param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
420 switch (q->
param.mfx.RateControlMethod) {
421 case MFX_RATECONTROL_CBR:
422 case MFX_RATECONTROL_VBR:
424 case MFX_RATECONTROL_VCM:
430 case MFX_RATECONTROL_CQP:
434 q->
param.mfx.QPP = av_clip(quant, 0, 51);
438 case MFX_RATECONTROL_AVBR:
444 case MFX_RATECONTROL_LA:
449 case MFX_RATECONTROL_LA_ICQ:
451 case MFX_RATECONTROL_ICQ:
461 q->
extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION;
464 MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
467 MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
470 q->
extco.RateDistortionOpt = q->
rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
475 MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
488 q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2;
489 q->extco2.Header.BufferSz =
sizeof(q->extco2);
499 q->extco2.BitrateLimit = q->
bitrate_limit ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
501 q->extco2.MBBRC = q->
mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
503 q->extco2.ExtBRC = q->
extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
507 #if QSV_HAVE_MAX_SLICE_SIZE
513 q->extco2.Trellis = q->
trellis;
516 #if QSV_HAVE_BREF_TYPE
517 #if FF_API_PRIVATE_OPT
524 q->extco2.BRefType = q->
b_strategy ? MFX_B_REF_PYRAMID : MFX_B_REF_OFF;
526 q->extco2.AdaptiveI = q->
adaptive_i ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
528 q->extco2.AdaptiveB = q->
adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
542 "Selected ratecontrol mode is not supported by the QSV "
543 "runtime. Choose a different mode.\n");
557 mfxExtCodingOptionSPSPPS extradata = {
558 .Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS,
559 .Header.BufferSz =
sizeof(extradata),
560 .SPSBuffer = sps_buf, .SPSBufSize =
sizeof(sps_buf),
561 .PPSBuffer = pps_buf, .PPSBufSize =
sizeof(pps_buf)
564 mfxExtCodingOption co = {
565 .Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
566 .Header.BufferSz =
sizeof(co),
569 mfxExtCodingOption2 co2 = {
570 .Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
571 .Header.BufferSz =
sizeof(co2),
575 mfxExtCodingOption3 co3 = {
576 .Header.BufferId = MFX_EXTBUFF_CODING_OPTION3,
577 .Header.BufferSz =
sizeof(co3),
581 mfxExtBuffer *ext_buffers[] = {
582 (mfxExtBuffer*)&extradata,
595 q->
param.ExtParam = ext_buffers;
598 ret = MFXVideoENCODE_GetVideoParam(q->
session, &q->
param);
604 if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)) {
614 memcpy(avctx->
extradata, sps_buf, extradata.SPSBufSize);
616 memcpy(avctx->
extradata + extradata.SPSBufSize, pps_buf, extradata.PPSBufSize);
617 avctx->
extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
636 mfxFrameSurface1 *surfaces;
650 for (i = 0; i < nb_surfaces; i++) {
651 surfaces[i].Info = q->
req.Info;
655 q->
opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
672 int opaque_alloc = 0;
675 q->
param.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
679 (
sizeof(
AVPacket) +
sizeof(mfxSyncPoint) +
sizeof(mfxBitstream*)));
706 if (MFX_WRN_PARTIAL_ACCELERATION==ret) {
708 }
else if (ret < 0) {
744 if (j < qsv->nb_ext_buffers)
755 if (MFX_WRN_PARTIAL_ACCELERATION==ret) {
757 }
else if (ret < 0) {
778 mfxPayload* pay = enc_ctrl->Payload[i];
779 av_free(enc_ctrl->Payload[i]->Data);
782 enc_ctrl->NumPayload = 0;
882 MFX_PICSTRUCT_FIELD_BFF;
906 if (q->
param.mfx.CodecId == MFX_CODEC_AVC) {
907 if (q->
param.mfx.CodecProfile == MFX_PROFILE_AVC_BASELINE ||
908 q->
param.mfx.CodecLevel < MFX_LEVEL_AVC_21 ||
909 q->
param.mfx.CodecLevel > MFX_LEVEL_AVC_41)
911 "Interlaced coding is supported"
912 " at Main/High Profile Level 2.1-4.1\n");
922 mfxFrameSurface1 *surf =
NULL;
923 mfxSyncPoint sync =
NULL;
925 mfxEncodeCtrl* enc_ctrl =
NULL;
951 bs->Data = new_pkt.
data;
952 bs->MaxLength = new_pkt.
size;
959 ret = MFXVideoENCODE_EncodeFrameAsync(q->
session, enc_ctrl, surf, bs, &sync);
960 if (ret == MFX_WRN_DEVICE_BUSY) {
970 if (ret == MFX_ERR_MORE_DATA)
976 if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM) {
981 "EncodeFrameAsync returned 'incompatible param' code\n");
1015 ret = MFXVideoCORE_SyncOperation(q->
session, sync, 1000);
1016 }
while (ret == MFX_WRN_IN_EXECUTION);
1020 new_pkt.size = bs->DataLength;
1022 if (bs->FrameType & MFX_FRAMETYPE_IDR ||
1023 bs->FrameType & MFX_FRAMETYPE_xIDR)
1026 #if FF_API_CODED_FRAME
1028 if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI)
1030 else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP)
1032 else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB)
1040 if (
pkt->
size < new_pkt.size) {
1047 memcpy(
pkt->
data, new_pkt.data, new_pkt.size);
1068 MFXVideoENCODE_Close(q->
session);
static const struct @88 rc_names[]
const char const char void * val
#define QSV_MAX_ENC_PAYLOAD
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
AVBufferRef * opaque_alloc_buf
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
#define AV_LOG_WARNING
Something somehow does not look correct.
mfxExtOpaqueSurfaceAlloc opaque_alloc
int64_t bit_rate
the average bitrate
memory handling functions
int max_bitrate
Maximum bitrate of the stream, in bits per second.
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...
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
int repeat_pict
When decoding, this signals how much the picture must be delayed.
static int get_free_frame(QSVEncContext *q, QSVFrame **f)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
mfxFrameSurface1 * surface
int av_usleep(unsigned usec)
Sleep for a period of time.
int nb_opaque_surfaces
Encoding only, and only if opaque_alloc is set to non-zero.
static void print_interlace_msg(AVCodecContext *avctx, QSVEncContext *q)
float i_quant_offset
qscale offset between P and I-frames
int min_bitrate
Minimum bitrate of the stream, in bits per second.
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet)
AVFifoBuffer * async_fifo
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
void * hwaccel_context
Hardware accelerator context.
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
mfxExtBuffer * extparam_internal[2+QSV_HAVE_CO2]
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int av_fifo_space(const AVFifoBuffer *f)
Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write int...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int opaque_alloc
Encoding only.
mfxFrameSurface1 ** opaque_surfaces
#define AV_LOG_VERBOSE
Detailed information.
void av_fifo_free(AVFifoBuffer *f)
Free an AVFifoBuffer.
int interlaced_frame
The content of the picture is interlaced.
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
static const char * print_threestate(mfxU16 val)
int opaque_alloc_type
Encoding only, and only if opaque_alloc is set to non-zero.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static int rc_supported(QSVEncContext *q)
#define QSV_VERSION_ATLEAST(MAJOR, MINOR)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
int flags
AV_CODEC_FLAG_*.
float i_quant_factor
qscale factor between P and I-frames If > 0 then the last p frame quantizer will be used (q= lastp_q*...
int max_dec_frame_buffering
int iopattern
The IO pattern to use.
int ff_qsv_close_internal_session(QSVSession *qs)
static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
int rc_buffer_size
decoder bitstream buffer size
int64_t rc_min_rate
minimum bitrate
int refs
number of reference frames
static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, mfxExtBuffer **coding_opts)
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
enum AVPictureType pict_type
Picture type of the frame.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
int width
picture width / height.
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q)
mfxFrameSurface1 surface_internal
static const char * print_profile(mfxU16 profile)
preferred ID for MPEG-1/2 video decoding
attribute_deprecated int coder_type
int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins)
Initialize a MSDK session.
#define FF_ARRAY_ELEMS(a)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
This structure describes the bitrate properties of an encoded bitstream.
Libavcodec external API header.
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
mfxExtBuffer ** ext_buffers
Extra buffers to pass to encoder or decoder initialization.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
attribute_deprecated int b_frame_strategy
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * data
The data buffer.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void free_encoder_ctrl_payloads(mfxEncodeCtrl *enc_ctrl)
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
AVBufferRef * opaque_surfaces
Encoding only, and only if opaque_alloc is set to non-zero.
#define FF_CODER_TYPE_VLC
#define FF_COMPLIANCE_NORMAL
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
rational number numerator/denominator
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
float b_quant_offset
qscale offset between IP and B-frames
This struct is used for communicating QSV parameters between libavcodec and the caller.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int global_quality
Global quality for codecs which cannot change it per frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
common internal and external API header
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
int ff_qsv_error(int mfx_err)
Convert a libmfx error code into a ffmpeg error code.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int slices
Number of slices.
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
#define FF_ENABLE_DEPRECATION_WARNINGS
int top_field_first
If the content is interlaced, is top field displayed first.
int avg_bitrate
Average bitrate of the stream, in bits per second.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static void * av_mallocz_array(size_t nmemb, size_t size)
int look_ahead_downsampling
static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
static const char * print_ratecontrol(mfxU16 rc_mode)
#define av_malloc_array(a, b)
#define AV_CODEC_FLAG_CLOSED_GOP
This structure stores compressed data.
static int qsv_init_opaque_alloc(AVCodecContext *avctx, QSVEncContext *q)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
mfxSession session
If non-NULL, the session to use for encoding or decoding.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame)
static int submit_frame(QSVEncContext *q, const AVFrame *frame, QSVFrame **new_frame)
int64_t rc_max_rate
maximum bitrate
static const struct @87 profile_names[]
SetEncodeCtrlCB * set_encode_ctrl_cb
static void clear_unused_frames(QSVEncContext *q)