20#include <va/va_enc_vp8.h>
47#define vseq_var(name) vseq->name, name
48#define vseq_field(name) vseq->seq_fields.bits.name, name
49#define vpic_var(name) vpic->name, name
50#define vpic_field(name) vpic->pic_fields.bits.name, name
57 VAEncSequenceParameterBufferVP8 *vseq =
ctx->codec_sequence_params;
59 vseq->frame_width = avctx->
width;
60 vseq->frame_height = avctx->
height;
62 vseq->frame_width_scale = 0;
63 vseq->frame_height_scale = 0;
65 vseq->error_resilient = 0;
68 if (!(
ctx->va_rc_mode & VA_RC_CQP)) {
69 vseq->bits_per_second =
ctx->va_bit_rate;
70 vseq->intra_period = base_ctx->
gop_size;
92 vpic->ref_flags.bits.force_kf = 1;
93 vpic->ref_last_frame =
100 vpic->ref_flags.bits.no_ref_last = 0;
101 vpic->ref_flags.bits.no_ref_gf = 1;
102 vpic->ref_flags.bits.no_ref_arf = 1;
103 vpic->ref_last_frame =
105 vpic->ref_arf_frame =
113 vpic->pic_flags.bits.show_frame = 1;
115 vpic->pic_flags.bits.refresh_last = 1;
116 vpic->pic_flags.bits.refresh_golden_frame = 1;
117 vpic->pic_flags.bits.refresh_alternate_frame = 1;
119 vpic->pic_flags.bits.version = 0;
120 vpic->pic_flags.bits.loop_filter_type = 0;
121 for (
i = 0;
i < 4;
i++)
125 vpic->clamp_qindex_low = 0;
126 vpic->clamp_qindex_high = 127;
134 char *
data,
size_t *data_len)
137 VAQMatrixBufferVP8
quant;
143 if (*data_len <
sizeof(
quant))
145 *
type = VAQMatrixBufferType;
146 *data_len =
sizeof(
quant);
155 for (
i = 0;
i < 4;
i++)
156 quant.quantization_index[
i] = q;
157 for (
i = 0;
i < 5;
i++)
158 quant.quantization_index_delta[
i] = 0;
184 { 0 , 8, 3, 1, 1, VAProfileVP8Version0_3 },
193 .default_quality = 40,
195 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferVP8),
198 .picture_params_size =
sizeof(VAEncPictureParameterBufferVP8),
213 ctx->desired_packed_headers = 0;
218#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
219#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
225 {
"loop_filter_level",
"Loop filter level",
227 {
"loop_filter_sharpness",
"Loop filter sharpness",
243 .class_name =
"vp8_vaapi",
250 .p.name =
"vp8_vaapi",
267 .p.wrapper_name =
"vaapi",
const FFCodec ff_vp8_vaapi_encoder
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_RECEIVE_PACKET_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
common internal and external API header
#define AV_PROFILE_UNKNOWN
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#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_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
#define AVERROR_EOF
End of file.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
#define HW_BASE_ENCODE_COMMON_OPTIONS
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
common internal API header
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Describe the class of an AVClass context structure.
main external API structure.
int width
picture width / height.
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
float i_quant_offset
qscale offset between P and I-frames
int nb_refs[MAX_REFERENCE_LIST_NUM]
struct FFHWBaseEncodePicture * refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]
void * codec_picture_params
VASurfaceID recon_surface
VAAPIEncodeContext common
int loop_filter_sharpness
#define VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx)
static const VAAPIEncodeProfile vaapi_encode_vp8_profiles[]
static int vaapi_encode_vp8_write_quant_table(AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, int index, int *type, char *data, size_t *data_len)
static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
static const AVOption vaapi_encode_vp8_options[]
static const FFCodecDefault vaapi_encode_vp8_defaults[]
static const VAAPIEncodeType vaapi_encode_type_vp8
static const AVClass vaapi_encode_vp8_class
static int vaapi_encode_vp8_init_sequence_params(AVCodecContext *avctx)
static const uint8_t quant[64]