Lines Matching defs:avctx
128 static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
132 AmfContext *ctx = avctx->priv_data;
139 AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
140 int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
142 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
143 framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
145 framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num * avctx->ticks_per_frame);
148 if ((ret = ff_amf_encode_init(avctx)) != 0)
158 switch (avctx->profile) {
181 profile_level = avctx->level;
190 if (avctx->refs != -1) {
191 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_MAX_NUM_REFRAMES, avctx->refs);
193 if (avctx->sample_aspect_ratio.den && avctx->sample_aspect_ratio.num) {
194 AMFRatio ratio = AMFConstructRatio(avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
199 if (avctx->color_range == AVCOL_RANGE_JPEG) {
208 } else if (avctx->rc_max_rate > 0 ) {
231 if (avctx->rc_buffer_size != 0) {
232 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_VBV_BUFFER_SIZE, avctx->rc_buffer_size);
233 if (avctx->rc_initial_buffer_occupancy != 0) {
234 int amf_buffer_fullness = avctx->rc_initial_buffer_occupancy * 64 / avctx->rc_buffer_size;
251 if (avctx->qmin != -1) {
252 int qval = avctx->qmin > 51 ? 51 : avctx->qmin;
255 if (avctx->qmax != -1) {
256 int qval = avctx->qmax > 51 ? 51 : avctx->qmax;
268 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_TARGET_BITRATE, avctx->bit_rate);
271 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_PEAK_BITRATE, avctx->bit_rate);
273 if (avctx->rc_max_rate) {
274 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_PEAK_BITRATE, avctx->rc_max_rate);
280 res = ctx->encoder->pVtbl->Init(ctx->encoder, ctx->format, avctx->width, avctx->height);
297 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_B_PIC_PATTERN, avctx->max_b_frames);
301 avctx->max_b_frames, (int)var.int64Value);
302 avctx->max_b_frames = (int)var.int64Value;
304 if (avctx->max_b_frames) {
311 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, avctx->gop_size);
320 if (avctx->slices > 1)
321 AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_SLICES_PER_FRAME, avctx->slices);
347 avctx->extradata_size = (int)buffer->pVtbl->GetSize(buffer);
348 avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
349 if (!avctx->extradata) {
354 memcpy(avctx->extradata, buffer->pVtbl->GetNative(buffer), avctx->extradata_size);