39 #define HUE_DEFAULT_VAL 0
40 #define SAT_DEFAULT_VAL 1
42 #define HUE_DEFAULT_VAL_STRING AV_STRINGIFY(HUE_DEFAULT_VAL)
43 #define SAT_DEFAULT_VAL_STRING AV_STRINGIFY(SAT_DEFAULT_VAL)
45 #define SAT_MIN_VAL -10
46 #define SAT_MAX_VAL 10
85 #define OFFSET(x) offsetof(HueContext, x)
86 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
110 #define SET_EXPRESSION(attr, name) do { \
111 if (hue->attr##_expr) { \
112 if ((ret = av_expr_parse(&hue->attr##_pexpr, hue->attr##_expr, var_names, \
113 NULL, NULL, NULL, NULL, 0, ctx)) < 0) { \
114 av_log(ctx, AV_LOG_ERROR, \
115 "Parsing failed for expression " #name "='%s'", \
117 hue->attr##_expr = old_##attr##_expr; \
118 hue->attr##_pexpr = old_##attr##_pexpr; \
119 return AVERROR(EINVAL); \
120 } else if (old_##attr##_pexpr) { \
121 av_freep(&old_##attr##_expr); \
122 av_expr_free(old_##attr##_pexpr); \
123 old_##attr##_pexpr = NULL; \
126 hue->attr##_expr = old_##attr##_expr; \
135 char *old_hue_expr, *old_hue_deg_expr, *old_saturation_expr;
136 AVExpr *old_hue_pexpr, *old_hue_deg_pexpr, *old_saturation_pexpr;
140 if (strchr(args,
'=')) {
157 "H and h options are incompatible and cannot be specified "
158 "at the same time\n");
172 "H_expr:%s h_deg_expr:%s s_expr:%s\n",
178 if (n != 1 && (n != 3 || c1 !=
':')) {
180 "Invalid syntax for argument '%s': "
181 "must be in the form 'hue[:saturation]'\n", args);
187 "Invalid value for saturation %0.1f: "
188 "must be included between range %d and +%d\n",
197 "H:%0.1f h:%0.1f s:%0.1f\n",
211 hue->
class = &hue_class;
281 for (i = 0; i < w; i++) {
292 new_u = ((c * u) - (s * v) + (1 << 15) + (128 << 16)) >> 16;
293 new_v = ((s * u) + (c * v) + (1 << 15) + (128 << 16)) >> 16;
300 usrc += src_linesize;
301 vsrc += src_linesize;
302 udst += dst_linesize;
303 vdst += dst_linesize;
307 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
308 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
333 "Saturation value not in range [%d,%d]: clipping value to %0.1f\n",
346 "H:%0.1f s:%0.f t:%0.1f n:%d\n",
357 inlink->
w, inlink->
h);
361 inlink->
w >> hue->
hsub, inlink->
h >> hue->
vsub,
369 char *res,
int res_len,
int flags)
371 if (!strcmp(cmd,
"reinit"))
408 .priv_class = &hue_class,