23 #include <sys/types.h> 25 #include <mfx/mfxvideo.h> 63 uint8_t vps_buf[128], vps_rbsp_buf[128];
66 int ret, i,
type, vps_size;
110 memcpy(&vps.
ptl, &sps.
ptl,
sizeof(vps.
ptl));
136 bytestream2_put_be32(&pbc, 1);
138 bytestream2_put_byte(&pbc, 1);
141 uint32_t
b = bytestream2_peek_be24(&gbc);
143 bytestream2_put_be24(&pbc, 3);
146 bytestream2_put_byte(&pbc, bytestream2_get_byte(&gbc));
153 memcpy(new_extradata, vps_buf, vps_size);
169 static const char *
const uid_hevcenc_sw =
"2fca99749fdb49aeb121a5b63ef568f7";
170 static const char *
const uid_hevcenc_hw =
"6fadc791a0c2eb479ab6dcd5ea9da347";
174 "load_plugins is not empty, but load_plugin is not set to 'none'." 175 "The load_plugin value will be ignored.\n");
221 #define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_SW 223 #define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_HW 226 #define OFFSET(x) offsetof(QSVHEVCEncContext, x) 227 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM 232 {
"begin_only",
"Output an IDR-frame only at the beginning of the stream", 0,
AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0,
VE,
"idr_interval" },
238 {
"load_plugins",
"A :-separate list of hexadecimal plugin UIDs to load in an internal session",
264 {
"flags",
"+cgop" },
265 #if FF_API_PRIVATE_OPT 266 {
"b_strategy",
"-1" },
285 .priv_class = &
class,
288 .wrapper_name =
"qsv",
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVCodec ff_hevc_qsv_encoder
This structure describes decoded (raw) audio or video data.
int vui_num_ticks_poc_diff_one_minus1
int max_dec_pic_buffering
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
int vps_num_ticks_poc_diff_one
vps_num_ticks_poc_diff_one_minus1 + 1
unsigned int vps_max_latency_increase[HEVC_MAX_SUB_LAYERS]
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
const char * av_default_item_name(void *ptr)
Return the context name.
int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id, uint8_t *buf, int buf_size)
static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
unsigned int vps_max_dec_pic_buffering[HEVC_MAX_SUB_LAYERS]
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
static int qsv_enc_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#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_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet)
uint8_t vps_timing_info_present_flag
int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx)
Parse the SPS from the bitstream into the provided HEVCSPS struct.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int vps_max_sub_layers
vps_max_temporal_layers_minus1 + 1
bitstream reader API header.
int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
int vui_timing_info_present_flag
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define LOAD_PLUGIN_DEFAULT
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
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.
int vui_poc_proportional_to_timing_flag
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
uint32_t vps_num_units_in_tick
int vps_num_layer_sets
vps_num_layer_sets_minus1 + 1
static const AVCodecDefault qsv_enc_defaults[]
uint8_t vps_poc_proportional_to_timing_flag
unsigned int vps_num_reorder_pics[HEVC_MAX_SUB_LAYERS]
static av_cold int qsv_enc_close(AVCodecContext *avctx)
char * av_strdup(const char *s)
Duplicate a string.
Libavcodec external API header.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
uint32_t vui_num_units_in_tick
#define AV_CODEC_CAP_HYBRID
Codec is potentially backed by a hardware implementation, but not necessarily.
int rbsp_buffer_alloc_size
Describe the class of an AVClass context structure.
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static enum AVPixelFormat pix_fmts[]
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
common internal api header.
common internal and external API header
struct HEVCSPS::@71 temporal_layer[HEVC_MAX_SUB_LAYERS]
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static av_cold int qsv_enc_init(AVCodecContext *avctx)
int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645RBSP *rbsp, H2645NAL *nal, int small_padding)
Extract the raw (unescaped) bitstream.
AVPixelFormat
Pixel format.
This structure stores compressed data.
int vps_sub_layer_ordering_info_present_flag
static const AVOption options[]