X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_deshake.c;h=b516ea2d59d26e121338ac1d4fc934c72aed0476;hb=8446318502bf21347a4867a5a1fcd8d9bfbd6a41;hp=55ce5e18a1cdca1ab016cff860b18a1ccf450d6e;hpb=c0a647644f2703e1da980dcf988cefd81528d8c9;p=ffmpeg diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 55ce5e18a1c..b516ea2d59d 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -196,7 +196,7 @@ static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize) for (i = 0; i <= blocksize * 2; i++) { // We use a width of 16 here to match the sad function for (j = 0; j <= 15; j++) { - pos = (y - i) * stride + (x - j); + pos = (y + i) * stride + (x + j); if (src[pos] < lowest) lowest = src[pos]; else if (src[pos] > highest) { @@ -421,6 +421,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) const int chroma_width = AV_CEIL_RSHIFT(link->w, desc->log2_chroma_w); const int chroma_height = AV_CEIL_RSHIFT(link->h, desc->log2_chroma_h); int aligned; + float transform_zoom; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { @@ -505,10 +506,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) deshake->last.angle = t.angle; deshake->last.zoom = t.zoom; + transform_zoom = 1.0 + t.zoom / 100.0; + // Generate a luma transformation matrix - avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, 1.0 + t.zoom / 100.0, matrix_y); + ff_get_matrix(t.vec.x, t.vec.y, t.angle, transform_zoom, transform_zoom, matrix_y); // Generate a chroma transformation matrix - avfilter_get_matrix(t.vec.x / (link->w / chroma_width), t.vec.y / (link->h / chroma_height), t.angle, 1.0 + t.zoom / 100.0, matrix_uv); + ff_get_matrix(t.vec.x / (link->w / chroma_width), t.vec.y / (link->h / chroma_height), t.angle, transform_zoom, transform_zoom, matrix_uv); // Transform the luma and chroma planes ret = deshake->transform(link->dst, link->w, link->h, chroma_width, chroma_height, matrix_y, matrix_uv, INTERPOLATE_BILINEAR, deshake->edge, in, out);