Lines Matching refs:x4
140 X264Context *x4 = ctx->priv_data; in encode_nals() local
142 uint64_t size = x4->sei_size; in encode_nals()
165 if (x4->sei_size > 0) { in encode_nals()
166 memcpy(p, x4->sei, x4->sei_size); in encode_nals()
167 p += x4->sei_size; in encode_nals()
168 size -= x4->sei_size; in encode_nals()
169 x4->sei_size = 0; in encode_nals()
170 av_freep(&x4->sei); in encode_nals()
204 X264Context *x4 = ctx->priv_data; in reconfig_encoder() local
208 if (x4->avcintra_class < 0) { in reconfig_encoder()
209 if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) { in reconfig_encoder()
211 x4->params.b_tff = frame->top_field_first; in reconfig_encoder()
212 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
214 …if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != ctx->sample_aspect_ratio.den * x4-… in reconfig_encoder()
215 x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den; in reconfig_encoder()
216 x4->params.vui.i_sar_width = ctx->sample_aspect_ratio.num; in reconfig_encoder()
217 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
220 if (x4->params.rc.i_vbv_buffer_size != ctx->rc_buffer_size / 1000 || in reconfig_encoder()
221 x4->params.rc.i_vbv_max_bitrate != ctx->rc_max_rate / 1000) { in reconfig_encoder()
222 x4->params.rc.i_vbv_buffer_size = ctx->rc_buffer_size / 1000; in reconfig_encoder()
223 x4->params.rc.i_vbv_max_bitrate = ctx->rc_max_rate / 1000; in reconfig_encoder()
224 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
227 if (x4->params.rc.i_rc_method == X264_RC_ABR && in reconfig_encoder()
228 x4->params.rc.i_bitrate != ctx->bit_rate / 1000) { in reconfig_encoder()
229 x4->params.rc.i_bitrate = ctx->bit_rate / 1000; in reconfig_encoder()
230 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
233 if (x4->crf >= 0 && in reconfig_encoder()
234 x4->params.rc.i_rc_method == X264_RC_CRF && in reconfig_encoder()
235 x4->params.rc.f_rf_constant != x4->crf) { in reconfig_encoder()
236 x4->params.rc.f_rf_constant = x4->crf; in reconfig_encoder()
237 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
240 if (x4->params.rc.i_rc_method == X264_RC_CQP && in reconfig_encoder()
241 x4->cqp >= 0 && in reconfig_encoder()
242 x4->params.rc.i_qp_constant != x4->cqp) { in reconfig_encoder()
243 x4->params.rc.i_qp_constant = x4->cqp; in reconfig_encoder()
244 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
247 if (x4->crf_max >= 0 && in reconfig_encoder()
248 x4->params.rc.f_rf_constant_max != x4->crf_max) { in reconfig_encoder()
249 x4->params.rc.f_rf_constant_max = x4->crf_max; in reconfig_encoder()
250 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
295 if (fpa_type != x4->params.i_frame_packing) { in reconfig_encoder()
296 x4->params.i_frame_packing = fpa_type; in reconfig_encoder()
297 x264_encoder_reconfig(x4->enc, &x4->params); in reconfig_encoder()
304 X264Context *x4 = ctx->priv_data; in free_picture() local
305 x264_picture_t *pic = &x4->pic; in free_picture()
317 X264Context *x4 = ctx->priv_data; in X264_frame() local
327 x264_picture_init( &x4->pic ); in X264_frame()
328 x4->pic.img.i_csp = x4->params.i_csp; in X264_frame()
330 bit_depth = x4->params.i_bitdepth; in X264_frame()
335 x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; in X264_frame()
336 x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt); in X264_frame()
339 x264_sei_t *sei = &x4->pic.extra_sei; in X264_frame()
342 for (i = 0; i < x4->pic.img.i_plane; i++) { in X264_frame()
343 x4->pic.img.plane[i] = frame->data[i]; in X264_frame()
344 x4->pic.img.i_stride[i] = frame->linesize[i]; in X264_frame()
347 x4->pic.i_pts = frame->pts; in X264_frame()
349 x4->reordered_opaque[x4->next_reordered_opaque].reordered_opaque = frame->reordered_opaque; in X264_frame()
350 x4->reordered_opaque[x4->next_reordered_opaque].wallclock = wallclock; in X264_frame()
352 x4->reordered_opaque[x4->next_reordered_opaque].wallclock = av_gettime(); in X264_frame()
353 x4->pic.opaque = &x4->reordered_opaque[x4->next_reordered_opaque]; in X264_frame()
354 x4->next_reordered_opaque++; in X264_frame()
355 x4->next_reordered_opaque %= x4->nb_reordered_opaque; in X264_frame()
359 x4->pic.i_type = x4->forced_idr > 0 ? X264_TYPE_IDR in X264_frame()
363 x4->pic.i_type = X264_TYPE_P; in X264_frame()
366 x4->pic.i_type = X264_TYPE_B; in X264_frame()
369 x4->pic.i_type = X264_TYPE_AUTO; in X264_frame()
374 if (x4->a53_cc) { in X264_frame()
382 x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); in X264_frame()
383 if (x4->pic.extra_sei.payloads == NULL) { in X264_frame()
387 x4->pic.extra_sei.sei_free = av_free; in X264_frame()
389 x4->pic.extra_sei.payloads[0].payload_size = sei_size; in X264_frame()
390 x4->pic.extra_sei.payloads[0].payload = sei_data; in X264_frame()
391 x4->pic.extra_sei.num_payloads = 1; in X264_frame()
392 x4->pic.extra_sei.payloads[0].payload_type = 4; in X264_frame()
399 if (x4->params.rc.i_aq_mode == X264_AQ_NONE) { in X264_frame()
400 if (!x4->roi_warned) { in X264_frame()
401 x4->roi_warned = 1; in X264_frame()
457 x4->pic.prop.quant_offsets = qoffsets; in X264_frame()
458 x4->pic.prop.quant_offsets_free = av_free; in X264_frame()
460 if (!x4->roi_warned) { in X264_frame()
461 x4->roi_warned = 1; in X264_frame()
468 if (x4->udu_sei) { in X264_frame()
496 if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) in X264_frame()
502 } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc)); in X264_frame()
511 if (out_opaque >= x4->reordered_opaque && in X264_frame()
512 out_opaque < &x4->reordered_opaque[x4->nb_reordered_opaque]) { in X264_frame()
550 X264Context *x4 = avctx->priv_data; in X264_close() local
552 av_freep(&x4->sei); in X264_close()
553 av_freep(&x4->reordered_opaque); in X264_close()
556 x264_param_cleanup(&x4->params); in X264_close()
559 if (x4->enc) { in X264_close()
560 x264_encoder_close(x4->enc); in X264_close()
561 x4->enc = NULL; in X264_close()
569 X264Context *x4 = avctx->priv_data; in parse_opts() local
572 if ((ret = x264_param_parse(&x4->params, opt, param)) < 0) { in parse_opts()
629 if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\
630 av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
636 X264Context *x4 = avctx->priv_data; in X264_init() local
646 x4->params.b_mpeg2 = 1; in X264_init()
647 x264_param_default_mpeg2(&x4->params); in X264_init()
650 x264_param_default(&x4->params); in X264_init()
652 x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER; in X264_init()
654 if (x4->preset || x4->tune) in X264_init()
655 if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) { in X264_init()
657 av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %s/%s.\n", x4->preset, x4->tune); in X264_init()
670 x4->params.i_level_idc = avctx->level; in X264_init()
672 x4->params.pf_log = X264_log; in X264_init()
673 x4->params.p_log_private = avctx; in X264_init()
674 x4->params.i_log_level = X264_LOG_DEBUG; in X264_init()
675 x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); in X264_init()
677 x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; in X264_init()
687 x4->params.rc.i_bitrate = avctx->bit_rate / 1000; in X264_init()
688 x4->params.rc.i_rc_method = X264_RC_ABR; in X264_init()
690 x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; in X264_init()
691 x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; in X264_init()
692 x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1; in X264_init()
694 x4->params.rc.b_stat_read = 1; in X264_init()
696 if (x4->crf >= 0) { in X264_init()
697 x4->params.rc.i_rc_method = X264_RC_CRF; in X264_init()
698 x4->params.rc.f_rf_constant = x4->crf; in X264_init()
699 } else if (x4->cqp >= 0) { in X264_init()
700 x4->params.rc.i_rc_method = X264_RC_CQP; in X264_init()
701 x4->params.rc.i_qp_constant = x4->cqp; in X264_init()
704 if (x4->crf_max >= 0) in X264_init()
705 x4->params.rc.f_rf_constant_max = x4->crf_max; in X264_init()
710 x4->params.rc.f_vbv_buffer_init = in X264_init()
717 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); in X264_init()
719 x4->params.rc.f_pb_factor = avctx->b_quant_factor; in X264_init()
721 if (x4->chroma_offset) in X264_init()
722 x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset; in X264_init()
725 x4->params.i_keyint_max = avctx->gop_size; in X264_init()
727 x4->params.i_bframe = avctx->max_b_frames; in X264_init()
729 if (x4->scenechange_threshold >= 0) in X264_init()
730 x4->params.i_scenecut_threshold = x4->scenechange_threshold; in X264_init()
733 x4->params.rc.i_qp_min = avctx->qmin; in X264_init()
735 x4->params.rc.i_qp_max = avctx->qmax; in X264_init()
737 x4->params.rc.i_qp_step = avctx->max_qdiff; in X264_init()
739 x4->params.rc.f_qblur = avctx->qblur; /* temporally blur quants */ in X264_init()
741 x4->params.rc.f_qcompress = avctx->qcompress; /* 0.0 => cbr, 1.0 => constant qp */ in X264_init()
743 x4->params.i_frame_reference = avctx->refs; in X264_init()
744 else if (x4->params.i_level_idc > 0) { in X264_init()
750 if (x264_levels[i].level_idc == x4->params.i_level_idc) in X264_init()
751 …x4->params.i_frame_reference = av_clip(x264_levels[i].dpb / mbn / scale, 1, x4->params.i_frame_ref… in X264_init()
755 x4->params.analyse.i_trellis = avctx->trellis; in X264_init()
757 x4->params.analyse.i_me_range = avctx->me_range; in X264_init()
758 if (x4->noise_reduction >= 0) in X264_init()
759 x4->params.analyse.i_noise_reduction = x4->noise_reduction; in X264_init()
761 x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; in X264_init()
763 x4->params.i_keyint_min = avctx->keyint_min; in X264_init()
765 x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; in X264_init()
767 if (x4->aq_mode >= 0) in X264_init()
768 x4->params.rc.i_aq_mode = x4->aq_mode; in X264_init()
769 if (x4->aq_strength >= 0) in X264_init()
770 x4->params.rc.f_aq_strength = x4->aq_strength; in X264_init()
775 if (x4->psy >= 0) in X264_init()
776 x4->params.analyse.b_psy = x4->psy; in X264_init()
777 if (x4->rc_lookahead >= 0) in X264_init()
778 x4->params.rc.i_lookahead = x4->rc_lookahead; in X264_init()
779 if (x4->weightp >= 0) in X264_init()
780 x4->params.analyse.i_weighted_pred = x4->weightp; in X264_init()
781 if (x4->weightb >= 0) in X264_init()
782 x4->params.analyse.b_weighted_bipred = x4->weightb; in X264_init()
783 if (x4->cplxblur >= 0) in X264_init()
784 x4->params.rc.f_complexity_blur = x4->cplxblur; in X264_init()
786 if (x4->ssim >= 0) in X264_init()
787 x4->params.analyse.b_ssim = x4->ssim; in X264_init()
788 if (x4->intra_refresh >= 0) in X264_init()
789 x4->params.b_intra_refresh = x4->intra_refresh; in X264_init()
790 if (x4->bluray_compat >= 0) { in X264_init()
791 x4->params.b_bluray_compat = x4->bluray_compat; in X264_init()
792 x4->params.b_vfr_input = 0; in X264_init()
794 if (x4->avcintra_class >= 0) in X264_init()
796 x4->params.i_avcintra_class = x4->avcintra_class; in X264_init()
802 if (x4->avcintra_class > 200) { in X264_init()
809 x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; in X264_init()
813 if (x4->b_bias != INT_MIN) in X264_init()
814 x4->params.i_bframe_bias = x4->b_bias; in X264_init()
815 if (x4->b_pyramid >= 0) in X264_init()
816 x4->params.i_bframe_pyramid = x4->b_pyramid; in X264_init()
817 if (x4->mixed_refs >= 0) in X264_init()
818 x4->params.analyse.b_mixed_references = x4->mixed_refs; in X264_init()
819 if (x4->dct8x8 >= 0) in X264_init()
820 x4->params.analyse.b_transform_8x8 = x4->dct8x8; in X264_init()
821 if (x4->fast_pskip >= 0) in X264_init()
822 x4->params.analyse.b_fast_pskip = x4->fast_pskip; in X264_init()
823 if (x4->aud >= 0) in X264_init()
824 x4->params.b_aud = x4->aud; in X264_init()
825 if (x4->mbtree >= 0) in X264_init()
826 x4->params.rc.b_mb_tree = x4->mbtree; in X264_init()
827 if (x4->direct_pred >= 0) in X264_init()
828 x4->params.analyse.i_direct_mv_pred = x4->direct_pred; in X264_init()
830 if (x4->slice_max_size >= 0) in X264_init()
831 x4->params.i_slice_max_size = x4->slice_max_size; in X264_init()
833 if (x4->fastfirstpass) in X264_init()
834 x264_param_apply_fastfirstpass(&x4->params); in X264_init()
836 x4->profile = x4->profile_opt; in X264_init()
838 if (!x4->profile) in X264_init()
841 x4->profile = "baseline"; in X264_init()
844 x4->profile = "high"; in X264_init()
847 x4->profile = "high10"; in X264_init()
850 x4->profile = "high422"; in X264_init()
853 x4->profile = "high444"; in X264_init()
856 x4->profile = "main"; in X264_init()
862 if (x4->nal_hrd >= 0) in X264_init()
863 x4->params.i_nal_hrd = x4->nal_hrd; in X264_init()
865 if (x4->motion_est >= 0) in X264_init()
866 x4->params.analyse.i_me_method = x4->motion_est; in X264_init()
868 if (x4->coder >= 0) in X264_init()
869 x4->params.b_cabac = x4->coder; in X264_init()
871 if (x4->b_frame_strategy >= 0) in X264_init()
872 x4->params.i_bframe_adaptive = x4->b_frame_strategy; in X264_init()
874 if (x4->profile) in X264_init()
875 if (x264_param_apply_profile(&x4->params, x4->profile) < 0) { in X264_init()
877 av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile); in X264_init()
885 x4->params.i_width = avctx->width; in X264_init()
886 x4->params.i_height = avctx->height; in X264_init()
888 x4->params.vui.i_sar_width = sw; in X264_init()
889 x4->params.vui.i_sar_height = sh; in X264_init()
890 x4->params.i_timebase_den = avctx->time_base.den; in X264_init()
891 x4->params.i_timebase_num = avctx->time_base.num; in X264_init()
893 x4->params.i_fps_num = avctx->framerate.num; in X264_init()
894 x4->params.i_fps_den = avctx->framerate.den; in X264_init()
896 x4->params.i_fps_num = avctx->time_base.den; in X264_init()
897 x4->params.i_fps_den = avctx->time_base.num * avctx->ticks_per_frame; in X264_init()
900 x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR; in X264_init()
902 x4->params.i_threads = avctx->thread_count; in X264_init()
904 x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE; in X264_init()
906 x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT; in X264_init()
908 x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP); in X264_init()
910 x4->params.i_slice_count = avctx->slices; in X264_init()
913 x4->params.vui.b_fullrange = avctx->color_range == AVCOL_RANGE_JPEG; in X264_init()
917 x4->params.vui.b_fullrange = 1; in X264_init()
920 x4->params.vui.i_colmatrix = avctx->colorspace; in X264_init()
922 x4->params.vui.i_colorprim = avctx->color_primaries; in X264_init()
924 x4->params.vui.i_transfer = avctx->color_trc; in X264_init()
926 x4->params.vui.i_chroma_loc = avctx->chroma_sample_location - 1; in X264_init()
929 x4->params.b_repeat_headers = 0; in X264_init()
931 if(x4->x264opts){ in X264_init()
932 const char *p= x4->x264opts; in X264_init()
953 if (x4->avcintra_class >= 0) in X264_init()
954 x4->params.b_repeat_headers = 1; in X264_init()
959 while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) { in X264_init()
960 if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) { in X264_init()
973 avctx->has_b_frames = x4->params.i_bframe ? in X264_init()
974 x4->params.i_bframe_pyramid ? 2 : 1 : 0; in X264_init()
978 avctx->bit_rate = x4->params.rc.i_bitrate*1000LL; in X264_init()
980 x4->enc = x264_encoder_open(&x4->params); in X264_init()
981 if (!x4->enc) in X264_init()
989 s = x264_encoder_headers(x4->enc, &nal, &nnal); in X264_init()
998 x4->sei_size = nal[i].i_payload; in X264_init()
999 x4->sei = av_malloc(x4->sei_size); in X264_init()
1000 if (!x4->sei) in X264_init()
1002 memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload); in X264_init()
1014 cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000; in X264_init()
1015 cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000LL; in X264_init()
1016 cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000LL; in X264_init()
1020 x4->nb_reordered_opaque = x264_encoder_maximum_delayed_frames(x4->enc) + 17; in X264_init()
1021 x4->reordered_opaque = av_malloc_array(x4->nb_reordered_opaque, in X264_init()
1022 sizeof(*x4->reordered_opaque)); in X264_init()
1023 if (!x4->reordered_opaque) in X264_init()