Fixes part of ticket #8819.
Showing the changes to libavfilter (2 of 3 files). Show all
Unified · Split
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | typedef struct FlipContext { | 27 | typedef struct FlipContext { |
| 28 | const AVClass *class; | 28 | const AVClass *class; |
| 29 | int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes | 29 | int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes |
| 30 | int bayer_plus1; ///< 1 .. not a Bayer input format, 2 .. Bayer input format | ||
| 30 | int planewidth[4]; ///< width of each plane | 31 | int planewidth[4]; ///< width of each plane |
| 31 | int planeheight[4]; ///< height of each plane | 32 | int planeheight[4]; ///< height of each plane |
| 32 | 33 | ||
| @@ -138,6 +138,7 @@ static int config_props(AVFilterLink *inlink) · 137 unmodified lines | |||
| 138 | s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub); | 138 | s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub); |
| 139 | s->planeheight[0] = s->planeheight[3] = inlink->h; | 139 | s->planeheight[0] = s->planeheight[3] = inlink->h; |
| 140 | s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub); | 140 | s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub); |
| 141 | s->bayer_plus1 = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1; | ||
| 141 | 142 | ||
| 142 | nb_planes = av_pix_fmt_count_planes(inlink->format); | 143 | nb_planes = av_pix_fmt_count_planes(inlink->format); |
| 143 | 144 | ||
| @@ -149,6 +150,7 @@ int ff_hflip_init(FlipContext *s, int step[4], int nb_planes) · 5 unmodified lines | |||
| 149 | int i; | 150 | int i; |
| 150 | 151 | ||
| 151 | for (i = 0; i < nb_planes; i++) { | 152 | for (i = 0; i < nb_planes; i++) { |
| 153 | step[i] *= s->bayer_plus1; | ||
| 152 | switch (step[i]) { | 154 | switch (step[i]) { |
| 153 | case 1: s->flip_line[i] = hflip_byte_c; break; | 155 | case 1: s->flip_line[i] = hflip_byte_c; break; |
| 154 | case 2: s->flip_line[i] = hflip_short_c; break; | 156 | case 2: s->flip_line[i] = hflip_short_c; break; |
| @@ -180,7 +182,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) · 25 unmodified lines | |||
| 180 | int i, plane, step; | 182 | int i, plane, step; |
| 181 | 183 | ||
| 182 | for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) { | 184 | for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) { |
| 183 | const int width = s->planewidth[plane]; | 185 | const int width = s->planewidth[plane] / s->bayer_plus1; |
| 184 | const int height = s->planeheight[plane]; | 186 | const int height = s->planeheight[plane]; |
| 185 | const int start = (height * job ) / nb_jobs; | 187 | const int start = (height * job ) / nb_jobs; |
| 186 | const int end = (height * (job+1)) / nb_jobs; | 188 | const int end = (height * (job+1)) / nb_jobs; |