⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x264_gtk.c.svn-base

📁 此段代码是h.264在linux下的编码源程序,在linux下编译可以得到可执行程序
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
    x264_gtk->pframe_search_8 = 0;  if (CHECK_FLAG(param.analyse.inter, X264_ANALYSE_BSUB16x16))    x264_gtk->bframe_search_8 = 1;  else    x264_gtk->bframe_search_8 = 0;  if (CHECK_FLAG(param.analyse.inter, X264_ANALYSE_PSUB8x8))    x264_gtk->pframe_search_4 = 1;  else    x264_gtk->pframe_search_4 = 0;  x264_gtk->inter_search_8 = CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I8x8);  x264_gtk->inter_search_4 = CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I4x4);  x264_gtk->bframe_pyramid = param.b_bframe_pyramid;  x264_gtk->bidir_me = param.analyse.b_bidir_me;  x264_gtk->bframe_adaptive = param.b_bframe_adaptive;  x264_gtk->weighted_bipred = param.analyse.b_weighted_bipred;  x264_gtk->bframe = param.i_bframe;  x264_gtk->bframe_bias = param.i_bframe_bias;  x264_gtk->direct_mode = param.analyse.i_direct_mv_pred;  /* more */  x264_gtk->bframe_rdo = param.analyse.b_bframe_rdo;  x264_gtk->partition_decision = param.analyse.i_subpel_refine - 1;  x264_gtk->me_method = param.analyse.i_me_method;  x264_gtk->range = param.analyse.i_me_range;  x264_gtk->chroma_me = param.analyse.b_chroma_me;  x264_gtk->max_ref_frames = param.i_frame_reference;  x264_gtk->mixed_refs = param.analyse.b_mixed_references;  x264_gtk->fast_pskip = param.analyse.b_fast_pskip;  x264_gtk->dct_decimate = param.analyse.b_dct_decimate;  x264_gtk->sample_ar_x = param.vui.i_sar_width;  x264_gtk->sample_ar_y = param.vui.i_sar_height;  x264_gtk->threads = param.i_threads;  x264_gtk->cabac = param.b_cabac;  x264_gtk->trellis = param.analyse.i_trellis;  x264_gtk->noise_reduction = param.analyse.i_noise_reduction;  x264_gtk->deblocking_filter = param.b_deblocking_filter;  x264_gtk->strength = param.i_deblocking_filter_alphac0;  x264_gtk->threshold = param.i_deblocking_filter_beta;  x264_gtk->debug_method = param.i_log_level + 1;  memcpy (x264_gtk->fourcc, "H264", 5);  /* cqm */  x264_gtk->cqm_preset = param.i_cqm_preset;  if (param.psz_cqm_file && (param.psz_cqm_file[0] != '\0'))    memcpy (x264_gtk->cqm_file, param.psz_cqm_file,  strlen (param.psz_cqm_file) + 1);  memcpy (x264_gtk->cqm_4iy, param.cqm_4iy, 16);  memcpy (x264_gtk->cqm_4ic, param.cqm_4ic, 16);  memcpy (x264_gtk->cqm_4py, param.cqm_4py, 16);  memcpy (x264_gtk->cqm_4pc, param.cqm_4pc, 16);  memcpy (x264_gtk->cqm_8iy, param.cqm_8iy, 64);  memcpy (x264_gtk->cqm_8py, param.cqm_8py, 64);}static void_current_set (X264_Gui_Config *config, X264_Gtk *x264_gtk){  gchar buf[4096];  gint  i;  if (!config)    return;  /* bitrate */  gtk_combo_box_set_active (GTK_COMBO_BOX (config->bitrate.pass), x264_gtk->pass);  g_snprintf (buf, 5, "%d", x264_gtk->average_bitrate);  gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_average_bitrate), buf);  gtk_range_set_range (GTK_RANGE (config->bitrate.w_quantizer),                       0.0,                       51.0);  gtk_range_set_value (GTK_RANGE (config->bitrate.w_quantizer), x264_gtk->quantizer);  g_snprintf (buf, 5, "%d", x264_gtk->target_bitrate);  gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_target_bitrate), buf);  switch (gtk_combo_box_get_active (GTK_COMBO_BOX (config->bitrate.pass)))  {  case 0:  case 1:    gtk_widget_set_sensitive (config->bitrate.update_statfile, FALSE);    gtk_widget_set_sensitive (config->bitrate.statsfile_name, FALSE);    break;  case 2:  case 3:  case 4:  default:    gtk_widget_set_sensitive (config->bitrate.update_statfile, TRUE);    break;  }  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->bitrate.update_statfile), x264_gtk->update_statfile);  gtk_entry_set_text (GTK_ENTRY (config->bitrate.statsfile_name), x264_gtk->statsfile_name);  if (x264_gtk->update_statfile)    gtk_widget_set_sensitive (config->bitrate.statsfile_name, TRUE);  else    gtk_widget_set_sensitive (config->bitrate.statsfile_name, FALSE);  /* rate control */  g_snprintf (buf, 5, "%d", x264_gtk->keyframe_boost);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.keyframe_boost), buf);  g_snprintf (buf, 5, "%d", x264_gtk->bframes_reduction);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bframes_reduction), buf);  g_snprintf (buf, 5, "%d", x264_gtk->bitrate_variability);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bitrate_variability), buf);  g_snprintf (buf, 5, "%d", x264_gtk->min_qp);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.min_qp), buf);  g_snprintf (buf, 5, "%d", x264_gtk->max_qp);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp), buf);  g_snprintf (buf, 5, "%d", x264_gtk->max_qp_step);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp_step), buf);  g_snprintf (buf, 5, "%d", x264_gtk->scene_cut_threshold);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.scene_cut_threshold), buf);  g_snprintf (buf, 5, "%d", x264_gtk->min_idr_frame_interval);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.min_idr_frame_interval), buf);  g_snprintf (buf, 5, "%d", x264_gtk->max_idr_frame_interval);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.max_idr_frame_interval), buf);  g_snprintf (buf, 5, "%d", x264_gtk->vbv_max_bitrate);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_max_bitrate), buf);  g_snprintf (buf, 5, "%d", x264_gtk->vbv_buffer_size);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_size), buf);  g_snprintf (buf, 5, "%.1f", x264_gtk->vbv_buffer_init);  gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_init), buf);  /* mb */  if (x264_gtk->transform_8x8)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), FALSE);  if (x264_gtk->pframe_search_8)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_8), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_8), FALSE);  if (x264_gtk->bframe_search_8)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.bframe_search_8), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.bframe_search_8), FALSE);  if (x264_gtk->pframe_search_4)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_4), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_4), FALSE);  if (x264_gtk->inter_search_8)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), FALSE);  if (x264_gtk->inter_search_4)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_4), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_4), FALSE);  /* mb - bframes */  if (x264_gtk->bframe_pyramid)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_pyramid), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_pyramid), FALSE);  if (x264_gtk->bidir_me)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bidir_me), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bidir_me), FALSE);  if (x264_gtk->bframe_adaptive)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_adaptive), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_adaptive), FALSE);  if (x264_gtk->weighted_bipred)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.weighted_bipred), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.weighted_bipred), FALSE);  g_snprintf (buf, 5, "%d", x264_gtk->bframe);  gtk_entry_set_text (GTK_ENTRY (config->mb.bframes.bframe), buf);  gtk_range_set_value (GTK_RANGE (config->mb.bframes.bframe_bias), (gdouble)x264_gtk->bframe_bias);  gtk_combo_box_set_active (GTK_COMBO_BOX (config->mb.bframes.direct_mode), x264_gtk->direct_mode);  /* more */  if (x264_gtk->bframe_rdo)    gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), X264_PD_6b);  else    gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), x264_gtk->partition_decision);  gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.method), x264_gtk->me_method);  g_snprintf (buf, 5, "%d", x264_gtk->range);  gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.range), buf);  if (x264_gtk->chroma_me)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.chroma_me), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.chroma_me), FALSE);  g_snprintf (buf, 5, "%d", x264_gtk->max_ref_frames);  gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames), buf);  if (x264_gtk->mixed_refs && (x264_gtk->max_ref_frames >= 2))    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.mixed_refs), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.mixed_refs), FALSE);  if (x264_gtk->fast_pskip)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.fast_pskip), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.fast_pskip), FALSE);  if (x264_gtk->dct_decimate)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.dct_decimate), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.dct_decimate), FALSE);  g_snprintf (buf, 5, "%d", x264_gtk->sample_ar_x);  gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_x), buf);  g_snprintf (buf, 5, "%d", x264_gtk->sample_ar_y);  gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_y), buf);  gtk_spin_button_set_value (GTK_SPIN_BUTTON (config->more.misc.threads), x264_gtk->threads);  if (x264_gtk->cabac)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.cabac), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.cabac), FALSE);  gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.misc.trellis), x264_gtk->trellis);  g_snprintf (buf, 64, "%d", x264_gtk->noise_reduction);  gtk_entry_set_text (GTK_ENTRY (config->more.misc.noise_reduction), buf);  if (x264_gtk->deblocking_filter)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.df.deblocking_filter), TRUE);  else    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.df.deblocking_filter), FALSE);  gtk_range_set_value (GTK_RANGE (config->more.misc.df.strength), (gdouble)x264_gtk->strength);  gtk_range_set_value (GTK_RANGE (config->more.misc.df.threshold), (gdouble)x264_gtk->threshold);  gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.debug.log_level), x264_gtk->debug_method);  gtk_entry_set_text (GTK_ENTRY (config->more.debug.fourcc), x264_gtk->fourcc);  /* cqm */  switch (x264_gtk->cqm_preset) {  case X264_CQM_PRESET_FLAT:    // workaround: gtk fails to update the matrix entries if we activate the button    // that was already active.    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE);    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_flat), TRUE);    break;  case X264_CQM_PRESET_JVT:    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE);    break;  case X264_CQM_PRESET_CUSTOM:    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_custom), TRUE);    break;  }  if (x264_gtk->cqm_file && (x264_gtk->cqm_file[0] != '\0'))    gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (config->cqm.cqm_file), x264_gtk->cqm_file);  for (i = 0; i < 16; i++) {    gchar buf[4];    g_snprintf (buf, 4, "%d", x264_gtk->cqm_4iy[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4iy[i]), buf);    g_snprintf (buf, 4, "%d", x264_gtk->cqm_4ic[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4ic[i]), buf);    g_snprintf (buf, 4, "%d", x264_gtk->cqm_4py[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4py[i]), buf);    g_snprintf (buf, 4, "%d", x264_gtk->cqm_4pc[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4pc[i]), buf);  }  for (i = 0; i < 64; i++) {    gchar buf[4];    g_snprintf (buf, 4, "%d", x264_gtk->cqm_8iy[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8iy[i]), buf);    g_snprintf (buf, 4, "%d", x264_gtk->cqm_8py[i]);    gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8py[i]), buf);  }}static void_current_get (X264_Gui_Config *gconfig, X264_Gtk *x264_gtk){  const gchar *text;  gint         i;  if (!gconfig)    return;  if (!x264_gtk)    g_print (_("problem...\n"));  /* bitrate */  switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->bitrate.pass)))  {  case 0:    x264_gtk->pass = X264_PASS_SINGLE_BITRATE;    text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.w_average_bitrate));    x264_gtk->average_bitrate = (gint)g_ascii_strtoull (text, NULL, 10);    x264_gtk->stat_write = 0;    x264_gtk->stat_read = 0;    break;  case 1:    x264_gtk->pass = X264_PASS_SINGLE_QUANTIZER;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -