[FFmpeg-devel] [PATCH] lavfi: add quirc filter
James Almer
jamrial at gmail.com
Tue Dec 26 21:21:55 EET 2023
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?
> +
> + /* 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?
> + imagep += w;
> + srcp += frame->linesize[0];
> + }
Maybe instead do
av_image_copy_plane(image, w, frame->data[0], frame->linesize[0],
w, inlink->h);
More information about the ffmpeg-devel
mailing list