SEARCH_COUNT
};
+typedef struct {
+ int x; ///< Horizontal shift
+ int y; ///< Vertical shift
+} IntMotionVector;
+
typedef struct {
double x; ///< Horizontal shift
double y; ///< Vertical shift
*/
static void find_block_motion(DeshakeContext *deshake, uint8_t *src1,
uint8_t *src2, int cx, int cy, int stride,
- MotionVector *mv)
+ IntMotionVector *mv)
{
int x, y;
int diff;
/**
* Find the rotation for a given block.
*/
-static double block_angle(int x, int y, int cx, int cy, MotionVector *shift)
+static double block_angle(int x, int y, int cx, int cy, IntMotionVector *shift)
{
double a1, a2, diff;
int width, int height, int stride, Transform *t)
{
int x, y;
- MotionVector mv = {0, 0};
+ IntMotionVector mv = {0, 0};
int counts[128][128];
int count_max_value = 0;
int contrast;
//av_log(NULL, AV_LOG_ERROR, "%d\n", contrast);
find_block_motion(deshake, src1, src2, x, y, stride, &mv);
if (mv.x != -1 && mv.y != -1) {
- counts[(int)(mv.x + deshake->rx)][(int)(mv.y + deshake->ry)] += 1;
+ counts[mv.x + deshake->rx][mv.y + deshake->ry] += 1;
if (x > deshake->rx && y > deshake->ry)
angles[pos++] = block_angle(x, y, 0, 0, &mv);
DeshakeContext *deshake = link->dst->priv;
AVFilterBufferRef *in = link->cur_buf;
AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
- Transform t;
+ Transform t = {{0},0}, orig = {{0},0};
float matrix[9];
float alpha = 2.0 / deshake->refcount;
char tmp[256];
- Transform orig;
if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
// Find the most likely global motion for the current frame
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
+ .inputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.draw_slice = draw_slice,
.end_frame = end_frame,
.min_perms = AV_PERM_READ, },
{ .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
+ .outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}},
};