[FFmpeg-devel] [PATCH] lavfi: add quirc filter
Stefano Sabatini
stefasab at gmail.com
Wed Dec 27 03:19:38 EET 2023
On date Tuesday 2023-12-26 16:21:55 -0300, James Almer wrote:
> On 12/26/2023 1:20 PM, Stefano Sabatini wrote:
> > +static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> > +{
> > + AVFilterContext *ctx = inlink->dst;
> > + AVFilterLink *outlink = ctx->outputs[0];
> > + QuircContext *quirc = ctx->priv;
> > + int codes_count;
> > + int i, w, h;
> > + uint8_t *image, *imagep, *srcp;
> > +
> > + image = quirc_begin(quirc->quirc, &w, &h);
>
> Can't this fail?
> Or does the allocation take place in the quirc_resize()
> call?
correct
> > +
> > + /* copy input image to quirc buffer */
> > + imagep = image;
> > + srcp = frame->data[0];
> > + for (i = 0; i < inlink->h; i++) {
> > + memcpy(imagep, srcp, w);
>
> Can w differ from inlink->w?
No, given that the resize is done in config_inputs.
> > + imagep += w;
> > + srcp += frame->linesize[0];
> > + }
>
> Maybe instead do
>
> av_image_copy_plane(image, w, frame->data[0], frame->linesize[0],
> w, inlink->h);
good catch, thanks for the feedback
More information about the ffmpeg-devel
mailing list