Commit cdeb803e authored by Stefano Sabatini's avatar Stefano Sabatini

vf_lut: fix draw_slice() in case of non packed image data for packed RGB

The previous code was erroneously assuming that the linesize was
equivalent to width*pixel_step, which is not always true.
parent 9df1d329
...@@ -306,21 +306,25 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) ...@@ -306,21 +306,25 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *inpic = inlink ->cur_buf; AVFilterBufferRef *inpic = inlink ->cur_buf;
AVFilterBufferRef *outpic = outlink->out_buf; AVFilterBufferRef *outpic = outlink->out_buf;
uint8_t *inrow, *outrow; uint8_t *inrow, *outrow, *inrow0, *outrow0;
int i, j, k, plane; int i, j, k, plane;
if (lut->is_rgb) { if (lut->is_rgb) {
/* packed */ /* packed */
inrow = inpic ->data[0] + y * inpic ->linesize[0]; inrow0 = inpic ->data[0] + y * inpic ->linesize[0];
outrow = outpic->data[0] + y * outpic->linesize[0]; outrow0 = outpic->data[0] + y * outpic->linesize[0];
for (i = 0; i < h; i ++) { for (i = 0; i < h; i ++) {
inrow = inrow0;
outrow = outrow0;
for (j = 0; j < inlink->w; j++) { for (j = 0; j < inlink->w; j++) {
for (k = 0; k < lut->step; k++) for (k = 0; k < lut->step; k++)
outrow[k] = lut->lut[lut->rgba_map[k]][inrow[k]]; outrow[k] = lut->lut[lut->rgba_map[k]][inrow[k]];
outrow += lut->step; outrow += lut->step;
inrow += lut->step; inrow += lut->step;
} }
inrow0 += inpic ->linesize[0];
outrow0 += outpic->linesize[0];
} }
} else { } else {
/* planar */ /* planar */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment