39 #define SAT_MIN_VAL -10
40 #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
89 { .str = NULL }, .flags =
FLAGS },
91 { .str =
"1" }, .flags =
FLAGS },
93 { .str = NULL }, .flags =
FLAGS },
95 { .str =
"0" }, .flags =
FLAGS },
117 for (i = 0; i < 256; i++) {
118 h->
lut_l[i] = av_clip_uint8(i + b * 25.5);
131 for (i = 0; i < 256; i++) {
132 for (j = 0; j < 256; j++) {
143 new_u = ((c *
u) - (s * v) + (1 << 15) + (128 << 16)) >> 16;
144 new_v = ((s *
u) + (c * v) + (1 << 15) + (128 << 16)) >> 16;
147 h->
lut_u[i][j] = av_clip_uint8(new_u);
148 h->
lut_v[i][j] = av_clip_uint8(new_v);
154 const char *expr,
const char *
option,
void *log_ctx)
164 NULL, NULL, NULL, NULL, 0, log_ctx);
167 "Error when evaluating the expression '%s' for %s\n",
175 *pexpr_ptr = new_pexpr;
177 *expr_ptr = new_expr;
189 "H and h options are incompatible and cannot be specified "
190 "at the same time\n");
194 #define SET_EXPR(expr, option) \
195 if (hue->expr##_expr) do { \
196 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
197 hue->expr##_expr, option, ctx); \
208 "H_expr:%s h_deg_expr:%s s_expr:%s b_expr:%s\n",
259 uint8_t *ldst,
const int dst_linesize,
260 uint8_t *lsrc,
const int src_linesize,
266 for (i = 0; i < w; i++)
267 ldst[i] = s->
lut_l[lsrc[i]];
269 lsrc += src_linesize;
270 ldst += dst_linesize;
282 for (i = 0; i < w; i++) {
283 const int u = usrc[i];
284 const int v = vsrc[i];
290 usrc += src_linesize;
291 vsrc += src_linesize;
292 udst += dst_linesize;
293 vdst += dst_linesize;
297 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
298 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
331 "Saturation value not in range [%d,%d]: clipping value to %0.1f\n",
342 "Brightness value not in range [%d,%d]: clipping value to %0.1f\n",
356 "H:%0.1f*PI h:%0.1f s:%0.1f b:%0.f t:%0.1f n:%d\n",
371 inlink->
w, inlink->
h);
375 inlink->
w, inlink->
h);
399 #define SET_EXPR(expr, option) \
401 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
402 args, option, ctx); \
407 if (!strcmp(cmd,
"h")) {
410 }
else if (!strcmp(cmd,
"H")) {
413 }
else if (!strcmp(cmd,
"s")) {
415 }
else if (!strcmp(cmd,
"b")) {
451 .priv_class = &hue_class,