mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/vf_maskedclamp: fix bug when copying >8bit plane(s)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
16c88465a1
commit
9d1f9ba582
|
@ -37,6 +37,7 @@ typedef struct MaskedClampContext {
|
||||||
int undershoot;
|
int undershoot;
|
||||||
int overshoot;
|
int overshoot;
|
||||||
|
|
||||||
|
int linesize[4];
|
||||||
int width[4], height[4];
|
int width[4], height[4];
|
||||||
int nb_planes;
|
int nb_planes;
|
||||||
int depth;
|
int depth;
|
||||||
|
@ -112,7 +113,7 @@ static int process_frame(FFFrameSync *fs)
|
||||||
for (p = 0; p < s->nb_planes; p++) {
|
for (p = 0; p < s->nb_planes; p++) {
|
||||||
if (!((1 << p) & s->planes)) {
|
if (!((1 << p) & s->planes)) {
|
||||||
av_image_copy_plane(out->data[p], out->linesize[p], base->data[p], base->linesize[p],
|
av_image_copy_plane(out->data[p], out->linesize[p], base->data[p], base->linesize[p],
|
||||||
s->width[p], s->height[p]);
|
s->linesize[p], s->height[p]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,10 +196,13 @@ static int config_input(AVFilterLink *inlink)
|
||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
MaskedClampContext *s = ctx->priv;
|
MaskedClampContext *s = ctx->priv;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
int vsub, hsub;
|
int vsub, hsub, ret;
|
||||||
|
|
||||||
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
|
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
|
||||||
|
|
||||||
|
if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
hsub = desc->log2_chroma_w;
|
hsub = desc->log2_chroma_w;
|
||||||
vsub = desc->log2_chroma_h;
|
vsub = desc->log2_chroma_h;
|
||||||
s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
|
s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
|
||||||
|
|
Loading…
Reference in New Issue