Commit 90cd0205 authored by Clément Bœsch's avatar Clément Bœsch

lavfi/deshake: use FF_CEIL_RSHIFT()

parent 84a967df
...@@ -62,9 +62,6 @@ ...@@ -62,9 +62,6 @@
#include "deshake.h" #include "deshake.h"
#include "deshake_opencl.h" #include "deshake_opencl.h"
#define CHROMA_WIDTH(link) (-((-(link)->w) >> av_pix_fmt_desc_get((link)->format)->log2_chroma_w))
#define CHROMA_HEIGHT(link) (-((-(link)->h) >> av_pix_fmt_desc_get((link)->format)->log2_chroma_h))
#define OFFSET(x) offsetof(DeshakeContext, x) #define OFFSET(x) offsetof(DeshakeContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
...@@ -439,6 +436,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) ...@@ -439,6 +436,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
float alpha = 2.0 / deshake->refcount; float alpha = 2.0 / deshake->refcount;
char tmp[256]; char tmp[256];
int ret = 0; int ret = 0;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
const int chroma_width = FF_CEIL_RSHIFT(link->w, desc->log2_chroma_w);
const int chroma_height = FF_CEIL_RSHIFT(link->h, desc->log2_chroma_h);
out = ff_get_video_buffer(outlink, outlink->w, outlink->h); out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) { if (!out) {
...@@ -527,9 +527,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) ...@@ -527,9 +527,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
// Generate a luma transformation matrix // Generate a luma transformation matrix
avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, 1.0 + t.zoom / 100.0, matrix_y); avfilter_get_matrix(t.vec.x, t.vec.y, t.angle, 1.0 + t.zoom / 100.0, matrix_y);
// Generate a chroma transformation matrix // Generate a chroma transformation matrix
avfilter_get_matrix(t.vec.x / (link->w / CHROMA_WIDTH(link)), t.vec.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix_uv); 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);
// Transform the luma and chroma planes // Transform the luma and chroma planes
ret = deshake->transform(link->dst, link->w, link->h, CHROMA_WIDTH(link), CHROMA_HEIGHT(link), ret = deshake->transform(link->dst, link->w, link->h, chroma_width, chroma_height,
matrix_y, matrix_uv, INTERPOLATE_BILINEAR, deshake->edge, in, out); matrix_y, matrix_uv, INTERPOLATE_BILINEAR, deshake->edge, in, out);
// Cleanup the old reference frame // Cleanup the old reference frame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment