[FFmpeg-devel] [PATCH v4] libavfilter/vf_cover_rect: support for cover image with more pixel format and different width and height
Michael Niedermayer
michael at niedermayer.cc
Sun Jun 16 10:26:41 EEST 2019
On Sun, Jun 16, 2019 at 07:11:27AM +0800, Lance Wang wrote:
> On Sun, Jun 16, 2019 at 6:20 AM Michael Niedermayer <michael at niedermayer.cc>
> wrote:
>
> > On Fri, Jun 14, 2019 at 11:52:47PM +0800, Lance Wang wrote:
> > > On Fri, Jun 14, 2019 at 5:31 PM Michael Niedermayer
> > <michael at niedermayer.cc>
> > > wrote:
[...]
> >
> > >
> > >
> > > >
> > > >
> > > > > + if (!cover->match_frame || (w != cover->match_frame->width
> > || h
> > > > != cover->match_frame->height
> > > > > + || in_format != cover->match_frame->format)) {
> > > > > + if (cover->match_frame)
> > > > > + av_freep(&cover->match_frame->data[0]);
> > > > > + else if (!(cover->match_frame = av_frame_alloc()))
> > > > > + return AVERROR(ENOMEM);
> > > > > +
> > > >
> > > > > + if ((ret = ff_scale_image(cover->match_frame->data,
> > > > cover->match_frame->linesize,
> > > > > + w, h, in_format,
> > cover->cover_frame->data,
> > > > cover->cover_frame->linesize,
> > > > > + cover->cover_frame->width,
> > > > cover->cover_frame->height,
> > > > > + cover->cover_frame->format, ctx)) < 0)
> > > > > + return AVERROR(ENOMEM);
> > > >
> > > > This sort of reimplements the scale filter and it
> > > > doesnt consider some parameters like AVCOL_RANGE*
> > > >
> > >
> > > the ff_scale_image is implemented and used by other alike place, I try
> > to
> > > reuse the function anyway.
> > > If we need other parameters for scale, we may improve the function later,
> > > now it's OK for my testing as
> > > the cover image is logo mostly.
> >
> > I think one could argue that the scale filter should be used for converting
> > this way the cover image would become one externally vissible input. (which
> > then subsequently also could change over time and not just be a static
> > image ...)
> >
> >
> For now, the code is simple and prefer to use it. How about to improve all
> other function which use ff_scale_image in future.
if you add no new ff_scale_image(), sure theres no need to clean it up
but if you add more bad code, no thats not ok IMO.
Thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190616/ae35843c/attachment.sig>
More information about the ffmpeg-devel
mailing list