summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-26 21:24:00 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:12 +0100
commitba2e20414a86546e18b7b9fd9e28498e2888ebf1 (patch)
tree082934539caa0866de1fe2e8a7b3edd80304d12c /video
parentf282d0b290afbb8c4043316d36ea0085f427779e (diff)
downloadmpv-ba2e20414a86546e18b7b9fd9e28498e2888ebf1.tar.bz2
mpv-ba2e20414a86546e18b7b9fd9e28498e2888ebf1.tar.xz
vf_divtc: reduce code duplication
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_divtc.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/video/filter/vf_divtc.c b/video/filter/vf_divtc.c
index 19b23ac481..093b70f5b6 100644
--- a/video/filter/vf_divtc.c
+++ b/video/filter/vf_divtc.c
@@ -199,20 +199,13 @@ static int imgop(int(*planeop)(unsigned char *, unsigned char *,
int, int, int, int, int),
mp_image_t *dst, mp_image_t *src, int arg)
{
- if(dst->flags&MP_IMGFLAG_PLANAR)
- return planeop(dst->planes[0], src?src->planes[0]:0,
- dst->w, dst->h,
- dst->stride[0], src?src->stride[0]:0, arg)+
- planeop(dst->planes[1], src?src->planes[1]:0,
- dst->chroma_width, dst->chroma_height,
- dst->stride[1], src?src->stride[1]:0, arg)+
- planeop(dst->planes[2], src?src->planes[2]:0,
- dst->chroma_width, dst->chroma_height,
- dst->stride[2], src?src->stride[2]:0, arg);
-
- return planeop(dst->planes[0], src?src->planes[0]:0,
- dst->w*(dst->bpp/8), dst->h,
- dst->stride[0], src?src->stride[0]:0, arg);
+ int sum = 0;
+ for (int p = 0; p < dst->num_planes; p++) {
+ sum += planeop(dst->planes[p], src ? src->planes[p] : NULL,
+ dst->w * (dst->fmt.bpp[p] / 8), dst->plane_h[p],
+ dst->stride[p], src ? src->stride[p] : 0, arg);
+ }
+ return sum;
}
/*