The calculation that determines the 'scrolling' of the test pattern
could 'jump': the counters could become negative and taking the
modulus of a negative number doesn't always do what you expect.
Ensure that the step values are always positive to prevent this issue.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
tpg->mv_hor_step = 0;
break;
}
- tpg->mv_hor_step *= factor;
+ if (factor < 0)
+ tpg->mv_hor_step = tpg->src_width - tpg->mv_hor_step;
factor = tpg->mv_vert_mode > TPG_MOVE_NONE ? -1 : 1;
switch (tpg->mv_vert_mode) {
tpg->mv_vert_step = 0;
break;
}
- tpg->mv_vert_step *= factor;
+ if (factor < 0)
+ tpg->mv_vert_step = tpg->src_height - tpg->mv_vert_step;
}
/* Map the line number relative to the crop rectangle to a frame line number */