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

📄 options.c

📁 linux下将各类格式图片转换工具
💻 C
📖 第 1 页 / 共 2 页
字号:
      return 0;   }   else if (max_block_level < 6)   {      set_error (_("Maximum prediction block size has to be "		   "at least level 6"));      return 0;   }   else if (min_block_level < 6)   {      set_error (_("Minimum prediction block size has to be "		   "at least level 6"));      return 0;   }   else if (max_block_level < min_block_level)   {      set_error (_("Maximum prediction block size has to be larger or "		   "equal minimum block size."));      return 0;   }   else   {      this->p_min_level = min_block_level;      this->p_max_level = max_block_level;      this->prediction  = intra_prediction;            return 1;   }}intfiasco_c_options_set_video_param (fiasco_c_options_t *options,				  unsigned frames_per_second,				  int half_pixel_prediction,				  int cross_B_search,				  int B_as_past_ref)/* *  Set various parameters used for video compensation. *  'frames_per_second' defines the frame rate which should be *  used when the video is decoded. This value has no effect during coding, *  it is just passed to the FIASCO output file. *  If 'half_pixel_prediction' is not 0 then half pixel precise *  motion compensated prediction is used. *  If 'cross_B_search' is not 0 then the fast Cross-B-Search algorithm is *  used to determine the motion vectors of interpolated prediction. Otherwise *  exhaustive search (in the given search range) is used. *  If 'B_as_past_ref' is not 0 then B frames are allowed to be used *  for B frame predicion. *   *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   else   {      this->fps 	  	  = frames_per_second;      this->half_pixel_prediction = half_pixel_prediction;      this->cross_B_search 	  = cross_B_search;      this->B_as_past_ref 	  = B_as_past_ref;      return 1;   }}intfiasco_c_options_set_quantization (fiasco_c_options_t *options,				   unsigned mantissa,				   fiasco_rpf_range_e range,				   unsigned dc_mantissa,				   fiasco_rpf_range_e dc_range)/* *  Set accuracy of coefficients quantization. *  DC coefficients (of the constant dictionary vector f(x,y) = 1) *  are quantized to values of the interval [-`dc_range', `dc_range'] using *  #`dc_mantissa' bits. All other quantized coefficients are quantized in *  an analogous way using the parameters `range' and `mantissa'. *   *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   else if (mantissa < 2 || mantissa > 8 || dc_mantissa < 2 || dc_mantissa > 8)   {      set_error (_("Number of RPF mantissa bits `%d', `%d' have to be in "		   "the interval [2,8]."), mantissa, dc_mantissa);      return 0;   }   else   {      if ((range == FIASCO_RPF_RANGE_0_75	  || range == FIASCO_RPF_RANGE_1_00	  || range == FIASCO_RPF_RANGE_1_50	   || range == FIASCO_RPF_RANGE_2_00)	  &&	  (dc_range == FIASCO_RPF_RANGE_0_75	   || dc_range == FIASCO_RPF_RANGE_1_00	   || dc_range == FIASCO_RPF_RANGE_1_50	   || dc_range == FIASCO_RPF_RANGE_2_00))      {	 this->rpf_range       = range;	 this->dc_rpf_range    = dc_range;	 this->rpf_mantissa    = mantissa;	 this->dc_rpf_mantissa = dc_mantissa;	 return 1;      }      else      {	 set_error (_("Invalid RPF ranges `%d', `%d' specified."),		    range, dc_range);	 return 0;      }   }}intfiasco_c_options_set_progress_meter (fiasco_c_options_t *options,				     fiasco_progress_e type)/* *  Set type of progress meter. * *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   switch (type)   {      case FIASCO_PROGRESS_BAR:      case FIASCO_PROGRESS_PERCENT:      case FIASCO_PROGRESS_NONE:	 this->progress_meter = type;	 break;      default:	 set_error (_("Invalid progress meter `%d' specified "		      "(valid values are 0, 1, or 2)."), type);	 return 0;   }   return 1;}intfiasco_c_options_set_smoothing (fiasco_c_options_t *options, int smoothing)/* *  Define `smoothing'-percentage along partitioning borders. *   *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   else if (smoothing < -1 || smoothing > 100)   {      set_error (_("Smoothing percentage must be in the range [-1, 100]."));      return 0;   }   else   {      this->smoothing = smoothing;      return 1;   }}intfiasco_c_options_set_comment (fiasco_c_options_t *options, const char *comment)/* *  Define `comment' of FIASCO stream. *   *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   else if (!comment)   {      set_error (_("Parameter `%s' not defined (NULL)."), "title");      return 0;   }   else   {      this->comment = strdup (comment);      return 1;   }}intfiasco_c_options_set_title (fiasco_c_options_t *options, const char *title)/* *  Define `title' of FIASCO stream. *   *  Return value: *	1 on success *	0 otherwise */{   c_options_t *this = (c_options_t *) cast_c_options (options);   if (!this)   {      return 0;   }   else if (!title)   {      set_error (_("Parameter `%s' not defined (NULL)."), "title");      return 0;   }   else   {      this->title = strdup (title);      return 1;   }}c_options_t *cast_c_options (fiasco_c_options_t *options)/* *  Cast generic pointer `options' to type c_options_t. *  Check whether `options' is a valid object of type c_options_t. * *  Return value: *	pointer to options struct on success *      NULL otherwise */{   c_options_t *this = (c_options_t *) options->private;   if (this)   {      if (!streq (this->id, "COFIASCO"))      {	 set_error (_("Parameter `options' doesn't match required type."));	 return NULL;      }   }   else   {      set_error (_("Parameter `%s' not defined (NULL)."), "options");   }   return this;}/*****************************************************************************************************************************************************			       DECODER*****************************************************************************************************************************************************/fiasco_d_options_t *fiasco_d_options_new (void)/* *  FIASCO options constructor. *  Allocate memory for the FIASCO coder options structure and *  fill in default values. * *  Return value: *	pointer to the new option structure */{   d_options_t 	      *options = calloc (1, sizeof (d_options_t));   fiasco_d_options_t *public  = calloc (1, sizeof (fiasco_d_options_t));   if (!options || !public)   {      set_error (_("Out of memory."));      return NULL;   }   public->private 	      = options;   public->delete 	      = fiasco_d_options_delete;   public->set_smoothing      = fiasco_d_options_set_smoothing;   public->set_magnification  = fiasco_d_options_set_magnification;   public->set_4_2_0_format   = fiasco_d_options_set_4_2_0_format;      strcpy (options->id, "DOFIASCO");   /*    *  Set default value of fiasco decoder options    */   options->smoothing 	  = 70;   options->magnification = 0;   options->image_format  = FORMAT_4_4_4;      return public;}voidfiasco_d_options_delete (fiasco_d_options_t *options)/* *  FIASCO options destructor. *  Free memory of FIASCO options struct. * *  No return value. * *  Side effects: *	structure 'options' is discarded. */{   d_options_t *this = cast_d_options (options);   if (!this)      return;      Free (this);   return;}intfiasco_d_options_set_smoothing (fiasco_d_options_t *options, int smoothing)/* *  Define `smoothing'-percentage along partitioning borders. *   *  Return value: *	1 on success *	0 otherwise */{   d_options_t *this = (d_options_t *) cast_d_options (options);   if (!this)   {      return 0;   }   else if (smoothing < -1 || smoothing > 100)   {      set_error (_("Smoothing percentage must be in the range [-1, 100]."));      return 0;   }   else   {      this->smoothing = smoothing;      return 1;   }}intfiasco_d_options_set_magnification (fiasco_d_options_t *options, int level)/* *  Set magnification-'level' of decoded image. *  0: width x height of original image *  1: (2 * width) x (2 * height) of original image *  -1: (width / 2 ) x (height / 2) of original image *  etc. * *  Return value: *	1 on success *	0 otherwise */{   d_options_t *this = (d_options_t *) cast_d_options (options);   if (!this)   {      return 0;   }   else   {      this->magnification = level;      return 1;   }}intfiasco_d_options_set_4_2_0_format (fiasco_d_options_t *options, int format)/* *  Set image format to 4:2:0 or 4:4:4. *   *  Return value: *	1 on success *	0 otherwise */{   d_options_t *this = (d_options_t *) cast_d_options (options);   if (!this)   {      return 0;   }   else   {      this->image_format = format ? FORMAT_4_2_0 : FORMAT_4_4_4;      return 1;   }}d_options_t *cast_d_options (fiasco_d_options_t *options)/* *  Cast generic pointer `options' to type d_options_t. *  Check whether `options' is a valid object of type d_options_t. * *  Return value: *	pointer to options struct on success *      NULL otherwise */{   d_options_t *this = (d_options_t *) options->private;      if (this)   {      if (!streq (this->id, "DOFIASCO"))      {	 set_error (_("Parameter `options' doesn't match required type."));	 return NULL;      }   }   else   {      set_error (_("Parameter `%s' not defined (NULL)."), "options");   }   return this;}

⌨️ 快捷键说明

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