[FFmpeg-devel] Optimised math functions in FFMPEG?

Paul B Mahol onemda at gmail.com
Sun Aug 15 18:09:03 EEST 2021


On Sun, Aug 15, 2021 at 3:43 PM Paul Buxton <paulbuxton.mail at googlemail.com>
wrote:

> Thanks both.
>
> I have implemented the algorithm in this paper
>
> https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging
>
> Which basically converts to an L A B (not CIELAB) colorspace, subtracts the
> average value of the frame from each pixel and converts back.
>
> Yes I did put the linearisation /de-linearisation into the filter. Not
> applying it produces noticeably incorrect results. Is there instead a way
> to tell the filtergraph that the filter expects and outputs linear data?
>

There is no automated thing yet, but for converting to/from linear use
zscale filter.

Also if input is 8bit depth I doubt there can be recovered much if there is
no red component in video.
If input is in float that is completely different story....


>
> I can investigate an integer version.
>
>
> On Sun, Aug 15, 2021 at 2:31 PM Paul B Mahol <onemda at gmail.com> wrote:
>
> > On Sun, Aug 15, 2021 at 3:27 PM Nicolas George <george at nsup.org> wrote:
> >
> > > Paul Buxton (12021-08-15):
> > > > I have my filter working nicely but it is a little slow. I have
> > > > parallelised it where possible, but it is still a bit heavy. I am
> > > wondering
> > > > if there are any optimised implementations/approximations of some
> math
> > > > functions built in that I should use instead of the standard library
> > > > implementations.
> > > > Specifically any of
> > > > pow()
> > > > exp()
> > > > log()
> > > >
> > > > I have done a quick grep of the code but can't see any likely
> > contenders.
> > >
> > > I am not aware we have those. The kind of optimization you can do
> > > depends a lot on your use case. Please give a little details.
> > >
> > > If you want to speed your filter up, the best would be to make it work
> > > with integers. It would also allow to make reliable unit tests.
> > >
> >
> >
> > If you convert to/from linear light inside filter, that is wrong thing to
> > do.
> >
> >
> > >
> > > Regards,
> > >
> > > --
> > >   Nicolas George
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel at ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> > >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list