diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-05-07 16:31:02 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-05-09 16:59:42 +0200 |
commit | 570d63eef3f911869672cd20fa9c2abedb11093d (patch) | |
tree | 2b993b08de62362e2e59e8049e28a92e6c2bb0af /libavfilter | |
parent | d9cb1e0e15e5cabb0b36f10cba079ea6532ed8e7 (diff) | |
download | ffmpeg-570d63eef3f911869672cd20fa9c2abedb11093d.tar.gz |
lavu: add FF_CEIL_RSHIFT and use it in various places.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/deshake_opencl.c | 3 | ||||
-rw-r--r-- | libavfilter/vf_gradfun.c | 4 | ||||
-rw-r--r-- | libavfilter/vf_tinterlace.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/libavfilter/deshake_opencl.c b/libavfilter/deshake_opencl.c index adca5ea2cb..eea873ea4a 100644 --- a/libavfilter/deshake_opencl.c +++ b/libavfilter/deshake_opencl.c @@ -135,7 +135,8 @@ int ff_opencl_deshake_process_inout_buf(AVFilterContext *ctx, AVFrame *in, AVFra int ret = 0; AVFilterLink *link = ctx->inputs[0]; DeshakeContext *deshake = ctx->priv; - int chroma_height = -((-link->h) >> av_pix_fmt_desc_get(link->format)->log2_chroma_h); + const int hshift = av_pix_fmt_desc_get(link->format)->log2_chroma_h; + int chroma_height = FF_CEIL_RSHIFT(link->h, hshift); if ((!deshake->opencl_ctx.cl_inbuf) || (!deshake->opencl_ctx.cl_outbuf)) { deshake->opencl_ctx.in_plane_size[0] = (in->linesize[0] * in->height); diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 48ac378e6a..52c67ffedc 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -172,8 +172,8 @@ static int config_input(AVFilterLink *inlink) if (!gf->buf) return AVERROR(ENOMEM); - gf->chroma_w = -((-inlink->w) >> hsub); - gf->chroma_h = -((-inlink->h) >> vsub); + gf->chroma_w = FF_CEIL_RSHIFT(inlink->w, hsub); + gf->chroma_h = FF_CEIL_RSHIFT(inlink->h, vsub); gf->chroma_r = av_clip(((((gf->radius >> hsub) + (gf->radius >> vsub)) / 2 ) + 1) & ~1, 4, 32); return 0; diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 598e3147b9..f6bf054a0f 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -175,7 +175,7 @@ void copy_picture_field(uint8_t *dst[4], int dst_linesize[4], int h, i; for (plane = 0; plane < desc->nb_components; plane++) { - int lines = plane == 1 || plane == 2 ? -((-src_h) >> vsub) : src_h; + int lines = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(src_h, vsub) : src_h; int linesize = av_image_get_linesize(format, w, plane); uint8_t *dstp = dst[plane]; const uint8_t *srcp = src[plane]; |