diff options
author | wm4 <wm4@nowhere> | 2012-12-26 21:24:00 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-13 20:04:12 +0100 |
commit | ba2e20414a86546e18b7b9fd9e28498e2888ebf1 (patch) | |
tree | 082934539caa0866de1fe2e8a7b3edd80304d12c /video/filter/vf_divtc.c | |
parent | f282d0b290afbb8c4043316d36ea0085f427779e (diff) | |
download | mpv-ba2e20414a86546e18b7b9fd9e28498e2888ebf1.tar.bz2 mpv-ba2e20414a86546e18b7b9fd9e28498e2888ebf1.tar.xz |
vf_divtc: reduce code duplication
Diffstat (limited to 'video/filter/vf_divtc.c')
-rw-r--r-- | video/filter/vf_divtc.c | 21 |
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; } /* |