20 #include <va/va_enc_vp8.h> 45 #define vseq_var(name) vseq->name, name 46 #define vseq_field(name) vseq->seq_fields.bits.name, name 47 #define vpic_var(name) vpic->name, name 48 #define vpic_field(name) vpic->pic_fields.bits.name, name 56 vseq->frame_width = avctx->
width;
57 vseq->frame_height = avctx->
height;
59 vseq->frame_width_scale = 0;
60 vseq->frame_height_scale = 0;
62 vseq->error_resilient = 0;
66 vseq->bits_per_second = avctx->
bit_rate;
67 vseq->intra_period = avctx->
gop_size;
89 vpic->ref_flags.bits.force_kf = 1;
90 vpic->ref_last_frame =
97 vpic->ref_flags.bits.no_ref_last = 0;
98 vpic->ref_flags.bits.no_ref_gf = 1;
99 vpic->ref_flags.bits.no_ref_arf = 1;
100 vpic->ref_last_frame =
102 vpic->ref_arf_frame =
110 vpic->pic_flags.bits.show_frame = 1;
112 vpic->pic_flags.bits.refresh_last = 1;
113 vpic->pic_flags.bits.refresh_golden_frame = 1;
114 vpic->pic_flags.bits.refresh_alternate_frame = 1;
116 vpic->pic_flags.bits.version = 0;
117 vpic->pic_flags.bits.loop_filter_type = 0;
118 for (i = 0; i < 4; i++)
122 vpic->clamp_qindex_low = 0;
123 vpic->clamp_qindex_high = 127;
131 char *
data,
size_t *data_len)
135 VAQMatrixBufferVP8
quant;
141 if (*data_len <
sizeof(quant))
143 *type = VAQMatrixBufferType;
144 *data_len =
sizeof(
quant);
151 for (i = 0; i < 4; i++)
152 quant.quantization_index[i] = q;
153 for (i = 0; i < 5; i++)
154 quant.quantization_index_delta[i] = 0;
156 memcpy(data, &quant,
sizeof(quant));
182 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferVP8),
185 .picture_params_size =
sizeof(VAEncPictureParameterBufferVP8),
226 #define OFFSET(x) (offsetof(VAAPIEncodeContext, codec_options_data) + \ 227 offsetof(VAAPIEncodeVP8Options, x)) 228 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) 230 {
"loop_filter_level",
"Loop filter level",
232 {
"loop_filter_sharpness",
"Loop filter sharpness",
241 {
"global_quality",
"40" },
262 .priv_class = &vaapi_encode_vp8_class,
264 .
defaults = vaapi_encode_vp8_defaults,
269 .wrapper_name =
"vaapi",
static const AVCodecDefault vaapi_encode_vp8_defaults[]
VAEntrypoint va_entrypoint
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
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...
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
const char * av_default_item_name(void *ptr)
Return the context name.
static int vaapi_encode_vp8_write_quant_table(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
void * codec_sequence_params
float i_quant_offset
qscale offset between P and I-frames
unsigned int va_packed_headers
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...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVCodec ff_vp8_vaapi_encoder
#define AVERROR_EOF
End of file.
VASurfaceID recon_surface
int(* configure)(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int vaapi_encode_vp8_init_sequence_params(AVCodecContext *avctx)
int flags
AV_CODEC_FLAG_*.
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
static const AVCodecDefault defaults[]
void * codec_picture_params
static const AVClass vaapi_encode_vp8_class
common internal API header
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
int width
picture width / height.
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
unsigned int va_rt_format
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
const struct VAAPIEncodeType * codec
Libavcodec external API header.
main external API structure.
Describe the class of an AVClass context structure.
static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static enum AVPixelFormat pix_fmts[]
int global_quality
Global quality for codecs which cannot change it per frame.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
static const AVOption vaapi_encode_vp8_options[]
common internal api header.
common internal and external API header
int loop_filter_sharpness
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
static const VAAPIEncodeType vaapi_encode_type_vp8
AVPixelFormat
Pixel format.
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx)
int64_t rc_max_rate
maximum bitrate