typedef struct FlipContext {
const AVClass *class;
int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes
+ int bayer_plus1; ///< 1 .. not a Bayer input format, 2 .. Bayer input format
int planewidth[4]; ///< width of each plane
int planeheight[4]; ///< height of each plane
s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
s->planeheight[0] = s->planeheight[3] = inlink->h;
s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
+ s->bayer_plus1 = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1;
nb_planes = av_pix_fmt_count_planes(inlink->format);
int i;
for (i = 0; i < nb_planes; i++) {
+ step[i] *= s->bayer_plus1;
switch (step[i]) {
case 1: s->flip_line[i] = hflip_byte_c; break;
case 2: s->flip_line[i] = hflip_short_c; break;
int i, plane, step;
for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
- const int width = s->planewidth[plane];
+ const int width = s->planewidth[plane] / s->bayer_plus1;
const int height = s->planeheight[plane];
const int start = (height * job ) / nb_jobs;
const int end = (height * (job+1)) / nb_jobs;
int i;
int step_array[4] = {1, 1, 1, 1};
FlipContext s;
+ s.bayer_plus1 = 1;
declare_func(void, const uint8_t *src, uint8_t *dst, int w);