Lines Matching defs:avctx

548 static av_cold int X264_close(AVCodecContext *avctx)
550 X264Context *x4 = avctx->priv_data;
567 static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param)
569 X264Context *x4 = avctx->priv_data;
574 av_log(avctx, AV_LOG_ERROR,
579 av_log(avctx, AV_LOG_ERROR,
584 av_log(avctx, AV_LOG_ERROR,
630 av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
634 static av_cold int X264_init(AVCodecContext *avctx)
636 X264Context *x4 = avctx->priv_data;
641 if (avctx->global_quality > 0)
642 av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is recommended.\n");
645 if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
652 x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER;
657 av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %s/%s.\n", x4->preset, x4->tune);
658 av_log(avctx, AV_LOG_INFO, "Possible presets:");
660 av_log(avctx, AV_LOG_INFO, " %s", x264_preset_names[i]);
661 av_log(avctx, AV_LOG_INFO, "\n");
662 av_log(avctx, AV_LOG_INFO, "Possible tunes:");
664 av_log(avctx, AV_LOG_INFO, " %s", x264_tune_names[i]);
665 av_log(avctx, AV_LOG_INFO, "\n");
669 if (avctx->level > 0)
670 x4->params.i_level_idc = avctx->level;
673 x4->params.p_log_private = avctx;
675 x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);
677 x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
682 if (avctx->bit_rate) {
683 if (avctx->bit_rate / 1000 > INT_MAX || avctx->rc_max_rate / 1000 > INT_MAX) {
684 av_log(avctx, AV_LOG_ERROR, "bit_rate and rc_max_rate > %d000 not supported by libx264\n", INT_MAX);
687 x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
690 x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
691 x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;
692 x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1;
693 if (avctx->flags & AV_CODEC_FLAG_PASS2) {
708 if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 &&
709 (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
711 (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
716 if (avctx->i_quant_factor > 0)
717 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
718 if (avctx->b_quant_factor > 0)
719 x4->params.rc.f_pb_factor = avctx->b_quant_factor;
724 if (avctx->gop_size >= 0)
725 x4->params.i_keyint_max = avctx->gop_size;
726 if (avctx->max_b_frames >= 0)
727 x4->params.i_bframe = avctx->max_b_frames;
732 if (avctx->qmin >= 0)
733 x4->params.rc.i_qp_min = avctx->qmin;
734 if (avctx->qmax >= 0)
735 x4->params.rc.i_qp_max = avctx->qmax;
736 if (avctx->max_qdiff >= 0)
737 x4->params.rc.i_qp_step = avctx->max_qdiff;
738 if (avctx->qblur >= 0)
739 x4->params.rc.f_qblur = avctx->qblur; /* temporally blur quants */
740 if (avctx->qcompress >= 0)
741 x4->params.rc.f_qcompress = avctx->qcompress; /* 0.0 => cbr, 1.0 => constant qp */
742 if (avctx->refs >= 0)
743 x4->params.i_frame_reference = avctx->refs;
746 int mbn = AV_CEIL_RSHIFT(avctx->width, 4) * AV_CEIL_RSHIFT(avctx->height, 4);
754 if (avctx->trellis >= 0)
755 x4->params.analyse.i_trellis = avctx->trellis;
756 if (avctx->me_range >= 0)
757 x4->params.analyse.i_me_range = avctx->me_range;
760 if (avctx->me_subpel_quality >= 0)
761 x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;
762 if (avctx->keyint_min >= 0)
763 x4->params.i_keyint_min = avctx->keyint_min;
764 if (avctx->me_cmp >= 0)
765 x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA;
798 av_log(avctx, AV_LOG_ERROR,
804 av_log(avctx, AV_LOG_ERROR,
839 switch (avctx->profile) {
877 av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile);
878 av_log(avctx, AV_LOG_INFO, "Possible profiles:");
880 av_log(avctx, AV_LOG_INFO, " %s", x264_profile_names[i]);
881 av_log(avctx, AV_LOG_INFO, "\n");
885 x4->params.i_width = avctx->width;
886 x4->params.i_height = avctx->height;
887 av_reduce(&sw, &sh, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 4096);
890 x4->params.i_timebase_den = avctx->time_base.den;
891 x4->params.i_timebase_num = avctx->time_base.num;
892 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
893 x4->params.i_fps_num = avctx->framerate.num;
894 x4->params.i_fps_den = avctx->framerate.den;
896 x4->params.i_fps_num = avctx->time_base.den;
897 x4->params.i_fps_den = avctx->time_base.num * avctx->ticks_per_frame;
900 x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;
902 x4->params.i_threads = avctx->thread_count;
903 if (avctx->thread_type)
904 x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE;
906 x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT;
908 x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP);
910 x4->params.i_slice_count = avctx->slices;
912 if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
913 x4->params.vui.b_fullrange = avctx->color_range == AVCOL_RANGE_JPEG;
914 else if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
915 avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
916 avctx->pix_fmt == AV_PIX_FMT_YUVJ444P)
919 if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
920 x4->params.vui.i_colmatrix = avctx->colorspace;
921 if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
922 x4->params.vui.i_colorprim = avctx->color_primaries;
923 if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
924 x4->params.vui.i_transfer = avctx->color_trc;
925 if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED)
926 x4->params.vui.i_chroma_loc = avctx->chroma_sample_location - 1;
928 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)
936 ret = parse_opts(avctx, param, "1");
940 ret = parse_opts(avctx, param, val);
961 av_log(avctx, AV_LOG_WARNING,
973 avctx->has_b_frames = x4->params.i_bframe ?
975 if (avctx->max_b_frames < 0)
976 avctx->max_b_frames = 0;
978 avctx->bit_rate = x4->params.rc.i_bitrate*1000LL;
984 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
990 avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
997 av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
1008 avctx->extradata_size = p - avctx->extradata;
1011 cpb_props = ff_add_cpb_side_data(avctx);