...
|
...
|
@@ -251,7 +251,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
|
251
|
251
|
int contrast;
|
252
|
252
|
|
253
|
253
|
int pos;
|
254
|
|
- double *angles= av_malloc(sizeof(double)*width*height/(16*deshake->blocksize));
|
|
254
|
+ double *angles = av_malloc(sizeof(*angles) * width * height / (16 * deshake->blocksize));
|
255
|
255
|
double totalangles = 0;
|
256
|
256
|
|
257
|
257
|
int center_x = 0, center_y = 0;
|
...
|
...
|
@@ -333,7 +333,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
|
333
|
333
|
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
|
334
|
334
|
{
|
335
|
335
|
DeshakeContext *deshake = ctx->priv;
|
336
|
|
- char filename[256]={0};
|
|
336
|
+ char filename[256] = {0};
|
337
|
337
|
|
338
|
338
|
deshake->rx = 16;
|
339
|
339
|
deshake->ry = 16;
|
...
|
...
|
@@ -356,9 +356,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
|
356
|
356
|
deshake->contrast = av_clip(deshake->contrast, 1, 255);
|
357
|
357
|
deshake->search = av_clip(deshake->search, EXHAUSTIVE, SEARCH_COUNT - 1);
|
358
|
358
|
}
|
359
|
|
- if(strlen(filename))
|
|
359
|
+ if (strlen(filename))
|
360
|
360
|
deshake->fp = fopen(filename, "w");
|
361
|
|
- if(deshake->fp)
|
|
361
|
+ if (deshake->fp)
|
362
|
362
|
fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", sizeof(char), 104, deshake->fp);
|
363
|
363
|
|
364
|
364
|
av_log(ctx, AV_LOG_INFO, "rx: %d, ry: %d, edge: %d blocksize: %d contrast: %d search: %d\n",
|
...
|
...
|
@@ -390,7 +390,7 @@ static int config_props(AVFilterLink *link)
|
390
|
390
|
deshake->last.angle = 0;
|
391
|
391
|
deshake->last.zoom = 0;
|
392
|
392
|
|
393
|
|
- deshake->avctx= avcodec_alloc_context3(NULL);
|
|
393
|
+ deshake->avctx = avcodec_alloc_context3(NULL);
|
394
|
394
|
dsputil_init(&deshake->c, deshake->avctx);
|
395
|
395
|
|
396
|
396
|
return 0;
|
...
|
...
|
@@ -401,7 +401,7 @@ static av_cold void uninit(AVFilterContext *ctx)
|
401
|
401
|
DeshakeContext *deshake = ctx->priv;
|
402
|
402
|
|
403
|
403
|
avfilter_unref_buffer(deshake->ref);
|
404
|
|
- if(deshake->fp)
|
|
404
|
+ if (deshake->fp)
|
405
|
405
|
fclose(deshake->fp);
|
406
|
406
|
}
|
407
|
407
|
|
...
|
...
|
@@ -444,7 +444,7 @@ static void end_frame(AVFilterLink *link)
|
444
|
444
|
t.angle *= -1;
|
445
|
445
|
|
446
|
446
|
// Write statistics to file
|
447
|
|
- if(deshake->fp){
|
|
447
|
+ if (deshake->fp) {
|
448
|
448
|
snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
|
449
|
449
|
fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp);
|
450
|
450
|
}
|