FFmpeg
Loading...
Searching...
No Matches
scale_eval.c File Reference
#include <inttypes.h>
#include <stdint.h>
#include "scale_eval.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Enumerations

enum  var_name {
  VAR_IN_W , VAR_IW , VAR_IN_H , VAR_IH ,
  VAR_OUT_W , VAR_OW , VAR_OUT_H , VAR_OH ,
  VAR_A , VAR_SAR , VAR_DAR , VAR_HSUB ,
  VAR_VSUB , VAR_OHSUB , VAR_OVSUB , VARS_NB
}
 

Functions

int ff_scale_eval_dimensions (void *log_ctx, const char *w_expr, const char *h_expr, AVFilterLink *inlink, AVFilterLink *outlink, int *ret_w, int *ret_h)
 Parse and evaluate string expressions for width and height.
 
int ff_scale_adjust_dimensions (AVFilterLink *inlink, int *ret_w, int *ret_h, int force_original_aspect_ratio, int force_divisible_by, double w_adj)
 Transform evaluated width and height obtained from ff_scale_eval_dimensions into actual target width and height for scaling.
 

Variables

static const char *const var_names []
 

Enumeration Type Documentation

◆ var_name

enum var_name
Enumerator
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VAR_OHSUB 
VAR_OVSUB 
VARS_NB 

Definition at line 43 of file scale_eval.c.

Function Documentation

◆ ff_scale_eval_dimensions()

int ff_scale_eval_dimensions ( void * ctx,
const char * w_expr,
const char * h_expr,
AVFilterLink * inlink,
AVFilterLink * outlink,
int * ret_w,
int * ret_h )

Parse and evaluate string expressions for width and height.

Upon success, ff_scale_adjust_dimensions must be called with evaluated width and height to obtain actual target dimensions.

Returns 0 upon success, negative value if one of the expressions could not be parsed or if NaN was the result of their evaluation.

Definition at line 58 of file scale_eval.c.

Referenced by amf_init_filter_config(), cudascale_config_props(), libplacebo_config_output(), scale_d3d11_config_props(), scale_d3d12_config_props(), scale_vaapi_config_output(), scale_vt_config_output(), and scale_vulkan_config_output().

◆ ff_scale_adjust_dimensions()

int ff_scale_adjust_dimensions ( AVFilterLink * inlink,
int * ret_w,
int * ret_h,
int force_original_aspect_ratio,
int force_divisible_by,
double w_adj )

Transform evaluated width and height obtained from ff_scale_eval_dimensions into actual target width and height for scaling.

Adjustment can occur if one or both of the evaluated values are of the form '-n' or if force_original_aspect_ratio is set. force_divisible_by is used only when force_original_aspect_ratio is set and must be at least 1. w_adj is the input SAR when the output dimensions are intended to be square pixels, else should be 1.

Returns negative error code on error or non negative on success

Definition at line 123 of file scale_eval.c.

Referenced by amf_init_filter_config(), config_props(), config_props(), cudascale_config_props(), libplacebo_config_output(), scale_d3d12_config_props(), scale_vaapi_config_output(), scale_vt_config_output(), and scale_vulkan_config_output().

Variable Documentation

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"in_w", "iw",
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
"a",
"sar",
"dar",
"hsub",
"vsub",
"ohsub",
"ovsub",
}
#define NULL
Definition coverity.c:32

Definition at line 28 of file scale_eval.c.