90 #define OFFSET(x) offsetof(RotContext, x)
91 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
155 float sinx = sin(angle);
156 float cosx = cos(angle);
158 return FFMAX(0, inh * sinx) +
FFMAX(0, -inw * cosx) +
167 float sinx = sin(angle);
168 float cosx = cos(angle);
170 return FFMAX(0, -inh * cosx) +
FFMAX(0, -inw * sinx) +
174 static double (*
const func1[])(
void *, double) = {
216 "Error occurred parsing angle expression '%s'\n", rot->
angle_expr_str);
220 #define SET_SIZE_EXPR(name, opt_name) do { \
221 ret = av_expr_parse_and_eval(&res, expr = rot->name##_expr_str, \
222 var_names, rot->var_values, \
223 func1_names, func1, NULL, NULL, rot, 0, ctx); \
224 if (ret < 0 || isnan(res) || isinf(res) || res <= 0) { \
225 av_log(ctx, AV_LOG_ERROR, \
226 "Error parsing or evaluating expression for option %s: " \
227 "invalid expression '%s' or non-positive or indefinite value %f\n", \
228 opt_name, expr, res); \
237 rot->
outw = res + 0.5;
240 rot->
outh = res + 0.5;
245 rot->
outw = res + 0.5;
249 outlink->
w = rot->
outw;
250 outlink->
h = rot->
outh;
255 #define INT_PI 205887 //(M_PI * FIXP)
273 for (i = 2; i < 7; i += 2) {
275 a = -a*a2 / (
FIXP*i*(i+1));
285 const uint8_t *
src,
int src_linesize,
int src_linestep,
286 int x,
int y,
int max_x,
int max_y)
288 int int_x = av_clip(x>>16, 0, max_x);
289 int int_y = av_clip(y>>16, 0, max_y);
290 int frac_x = x&0xFFFF;
291 int frac_y = y&0xFFFF;
293 int int_x1 =
FFMIN(int_x+1, max_x);
294 int int_y1 =
FFMIN(int_y+1, max_y);
296 for (i = 0; i < src_linestep; i++) {
297 int s00 = src[src_linestep * int_x + i + src_linesize * int_y ];
298 int s01 = src[src_linestep * int_x1 + i + src_linesize * int_y ];
299 int s10 = src[src_linestep * int_x + i + src_linesize * int_y1];
300 int s11 = src[src_linestep * int_x1 + i + src_linesize * int_y1];
301 int s0 = (((1<<16) - frac_x)*s00 + frac_x*s01);
302 int s1 = (((1<<16) - frac_x)*s10 + frac_x*s11);
304 dst_color[i] = ((int64_t)((1<<16) - frac_y)*s0 + (int64_t)frac_y*
s1) >> 32;
310 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
318 const int outw = td->
outw, outh = td->
outh;
319 const int inw = td->
inw, inh = td->
inh;
320 const int plane = td->
plane;
321 const int xi = td->
xi, yi = td->
yi;
322 const int c = td->
c,
s = td->
s;
323 const int start = (outh * job ) / nb_jobs;
324 const int end = (outh * (job+1)) / nb_jobs;
325 int xprime = td->
xprime + start *
s;
326 int yprime = td->
yprime + start *
c;
329 for (j = start; j <
end; j++) {
330 x = xprime + xi +
FIXP*inw/2;
331 y = yprime + yi +
FIXP*inh/2;
333 for (i = 0; i < outw; i++) {
343 if (x1 >= -1 && x1 <= inw && y1 >= -1 && y1 <= inh) {
351 int x2 = av_clip(x1, 0, inw-1);
352 int y2 = av_clip(y1, 0, inh-1);
360 *((uint16_t *)pout) = *((uint16_t *)pin);
367 *((uint32_t *)pout) = *((uint32_t *)pin);
388 int angle_int,
s,
c, plane;
405 angle_int = res *
FIXP;
412 0, 0, outlink->
w, outlink->
h);
414 for (plane = 0; plane < rot->
nb_planes; plane++) {
415 int hsub = plane == 1 || plane == 2 ? rot->
hsub : 0;
416 int vsub = plane == 1 || plane == 2 ? rot->
vsub : 0;
422 .outh = outh, .outw = outw,
423 .xi = -outw/2 *
c, .yi = outw/2 *
s,
424 .xprime = -outh/2 *
s,
425 .yprime = -outh/2 *
c,
426 .plane = plane, .c =
c, .s = s };
442 if (!strcmp(cmd,
"angle") || !strcmp(cmd,
"a")) {
445 NULL, NULL, NULL, NULL, 0, ctx);
448 "Error when parsing the expression '%s' for angle command\n", args);
487 .priv_class = &rotate_class,