Lines Matching defs:avctx
95 static int vaapi_encode_h265_write_access_unit(AVCodecContext *avctx,
99 VAAPIEncodeH265Context *priv = avctx->priv_data;
104 av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n");
109 av_log(avctx, AV_LOG_ERROR, "Access unit too large: "
121 static int vaapi_encode_h265_add_nal(AVCodecContext *avctx,
131 av_log(avctx, AV_LOG_ERROR, "Failed to add NAL unit: "
139 static int vaapi_encode_h265_write_sequence_header(AVCodecContext *avctx,
142 VAAPIEncodeH265Context *priv = avctx->priv_data;
147 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_aud);
153 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_vps);
157 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_sps);
161 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_pps);
165 err = vaapi_encode_h265_write_access_unit(avctx, data, data_len, au);
171 static int vaapi_encode_h265_write_slice_header(AVCodecContext *avctx,
176 VAAPIEncodeH265Context *priv = avctx->priv_data;
181 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_aud);
187 err = vaapi_encode_h265_add_nal(avctx, au, &priv->raw_slice);
191 err = vaapi_encode_h265_write_access_unit(avctx, data, data_len, au);
197 static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
202 VAAPIEncodeH265Context *priv = avctx->priv_data;
208 err = vaapi_encode_h265_add_nal(avctx, au, &priv->aud);
232 err = vaapi_encode_h265_write_access_unit(avctx, data, data_len, au);
249 static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
251 VAAPIEncodeContext *ctx = avctx->priv_data;
252 VAAPIEncodeH265Context *priv = avctx->priv_data;
281 av_log(avctx, AV_LOG_ERROR, "Chroma format of input pixel format "
306 ptl->general_profile_idc = avctx->profile;
337 if (avctx->level != FF_LEVEL_UNKNOWN) {
338 ptl->general_level_idc = avctx->level;
342 level = ff_h265_guess_level(ptl, avctx->bit_rate,
347 av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name);
350 av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to "
368 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
369 vps->vps_num_units_in_tick = avctx->framerate.den;
370 vps->vps_time_scale = avctx->framerate.num;
374 vps->vps_num_units_in_tick = avctx->time_base.num;
375 vps->vps_time_scale = avctx->time_base.den;
404 if (avctx->width != ctx->surface_width ||
405 avctx->height != ctx->surface_height) {
409 (ctx->surface_width - avctx->width) >> desc->log2_chroma_w;
412 (ctx->surface_height - avctx->height) >> desc->log2_chroma_h;
497 if (avctx->sample_aspect_ratio.num != 0 &&
498 avctx->sample_aspect_ratio.den != 0) {
507 av_reduce(&num, &den, avctx->sample_aspect_ratio.num,
508 avctx->sample_aspect_ratio.den, 65535);
527 avctx->color_range == AVCOL_RANGE_JPEG;
528 vui->colour_primaries = avctx->color_primaries;
529 vui->transfer_characteristics = avctx->color_trc;
530 vui->matrix_coefficients = avctx->colorspace;
531 if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
532 avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
533 avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
535 if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED ||
539 if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
543 avctx->chroma_sample_location - 1;
753 static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
756 VAAPIEncodeContext *ctx = avctx->priv_data;
757 VAAPIEncodeH265Context *priv = avctx->priv_data;
952 static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
956 VAAPIEncodeContext *ctx = avctx->priv_data;
957 VAAPIEncodeH265Context *priv = avctx->priv_data;
1029 av_log(avctx, AV_LOG_DEBUG, "RPS for POC %d:",
1032 av_log(avctx, AV_LOG_DEBUG, " (%d,%d)",
1035 av_log(avctx, AV_LOG_DEBUG, "\n");
1164 static av_cold int vaapi_encode_h265_get_encoder_caps(AVCodecContext *avctx)
1166 VAAPIEncodeContext *ctx = avctx->priv_data;
1167 VAAPIEncodeH265Context *priv = avctx->priv_data;
1179 av_log(avctx, AV_LOG_ERROR, "Failed to query encoder "
1183 av_log(avctx, AV_LOG_WARNING, "Driver does not advertise "
1193 av_log(avctx, AV_LOG_ERROR, "Failed to query encoder "
1197 av_log(avctx, AV_LOG_WARNING, "Driver does not advertise "
1214 av_log(avctx, AV_LOG_VERBOSE, "Using CTU size %dx%d, "
1218 ctx->surface_width = FFALIGN(avctx->width, priv->min_cb_size);
1219 ctx->surface_height = FFALIGN(avctx->height, priv->min_cb_size);
1226 static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
1228 VAAPIEncodeContext *ctx = avctx->priv_data;
1229 VAAPIEncodeH265Context *priv = avctx->priv_data;
1232 err = ff_cbs_init(&priv->cbc, AV_CODEC_ID_HEVC, avctx);
1242 if (avctx->i_quant_factor > 0.0)
1244 av_clip((avctx->i_quant_factor * priv->fixed_qp_p +
1245 avctx->i_quant_offset) + 0.5, 1, 51);
1248 if (avctx->b_quant_factor > 0.0)
1250 av_clip((avctx->b_quant_factor * priv->fixed_qp_p +
1251 avctx->b_quant_offset) + 0.5, 1, 51);
1255 av_log(avctx, AV_LOG_DEBUG, "Using fixed QP = "
1318 static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
1320 VAAPIEncodeContext *ctx = avctx->priv_data;
1321 VAAPIEncodeH265Context *priv = avctx->priv_data;
1325 if (avctx->profile == FF_PROFILE_UNKNOWN)
1326 avctx->profile = priv->profile;
1327 if (avctx->level == FF_LEVEL_UNKNOWN)
1328 avctx->level = priv->level;
1330 if (avctx->level != FF_LEVEL_UNKNOWN && avctx->level & ~0xff) {
1331 av_log(avctx, AV_LOG_ERROR, "Invalid level %d: must fit "
1332 "in 8-bit unsigned integer.\n", avctx->level);
1344 return ff_vaapi_encode_init(avctx);
1347 static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
1349 VAAPIEncodeH265Context *priv = avctx->priv_data;
1354 return ff_vaapi_encode_close(avctx);