[FFmpeg-devel] [PATCH] lavfi/kerndeint: use aligned linesizes for the temporary buffer.
Paul B Mahol
onemda at gmail.com
Fri Feb 15 20:10:48 CET 2013
On 2/15/13, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Sunday 2013-01-06 19:39:20 +0100, Stefano Sabatini encoded:
>> On date Sunday 2013-01-06 19:34:16 +0100, Clement Boesch encoded:
>> > This improves the performances just enough to match mp=kerndeint.
>> > ---
>> > libavfilter/vf_kerndeint.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c
>> > index 382b8a7..a929714 100644
>> > --- a/libavfilter/vf_kerndeint.c
>> > +++ b/libavfilter/vf_kerndeint.c
>> > @@ -102,7 +102,7 @@ static int config_props(AVFilterLink *inlink)
>> > kerndeint->vsub = desc->log2_chroma_h;
>> >
>> > ret = av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_bwidth,
>> > - inlink->w, inlink->h, inlink->format, 1);
>> > + inlink->w, inlink->h, inlink->format, 16);
>>
>> so now you should rename tmp_bwidth to tmp_linesize.
>>
>> > if (ret < 0)
>> > return ret;
>> > memset(kerndeint->tmp_data[0], 0, ret);
>> > @@ -157,7 +157,7 @@ static int filter_frame(AVFilterLink *inlink,
>> > AVFilterBufferRef *inpic)
>> >
>> > for (plane = 0; inpic->data[plane] && plane < 4; plane++) {
>> > h = plane == 0 ? inlink->h : inlink->h >> kerndeint->vsub;
>> > - bwidth = kerndeint->tmp_bwidth[plane];
>> > + bwidth = av_image_get_linesize(inlink->format, inlink->w,
>> > plane);
>>
>> Alternatively, compute bwidth in config_props and store it in the
>> kerndeint context, so you don't have to do it at each iteration.
>
> Updated, with some times obtained with the command:
> ffmpeg -f lavfi -i testsrc=d=1000,format=yuv420p -vf kerndeint -f null -
> -nostats
>
> 25718880 decicycles in mp=kerndeint, 1 runs, 0 skips
> 21470880 decicycles in mp=kerndeint, 2 runs, 0 skips
> 19555522 decicycles in mp=kerndeint, 4 runs, 0 skips
> 18633052 decicycles in mp=kerndeint, 8 runs, 0 skips
> 18255161 decicycles in mp=kerndeint, 16 runs, 0 skips
> 17916630 decicycles in mp=kerndeint, 32 runs, 0 skips
> 17702259 decicycles in mp=kerndeint, 64 runs, 0 skips
> 17529867 decicycles in mp=kerndeint, 128 runs, 0 skips
> 17474829 decicycles in mp=kerndeint, 256 runs, 0 skips
> 17408026 decicycles in mp=kerndeint, 512 runs, 0 skips
> 17368836 decicycles in mp=kerndeint, 1024 runs, 0 skips
> 17427387 decicycles in mp=kerndeint, 2048 runs, 0 skips
> 17379097 decicycles in mp=kerndeint, 4096 runs, 0 skips
> 17351296 decicycles in mp=kerndeint, 8192 runs, 0 skips
> 17335514 decicycles in mp=kerndeint, 16384 runs, 0 skips
>
> 22046340 decicycles in kerndeint, 1 runs, 0 skips
> 19678950 decicycles in kerndeint, 2 runs, 0 skips
> 18574402 decicycles in kerndeint, 4 runs, 0 skips
> 17944616 decicycles in kerndeint, 8 runs, 0 skips
> 17824359 decicycles in kerndeint, 16 runs, 0 skips
> 17973234 decicycles in kerndeint, 32 runs, 0 skips
> 17672557 decicycles in kerndeint, 64 runs, 0 skips
> 17516272 decicycles in kerndeint, 128 runs, 0 skips
> 17364357 decicycles in kerndeint, 256 runs, 0 skips
> 17343821 decicycles in kerndeint, 512 runs, 0 skips
> 17297656 decicycles in kerndeint, 1024 runs, 0 skips
> 17269867 decicycles in kerndeint, 2048 runs, 0 skips
> 17303302 decicycles in kerndeint, 4096 runs, 0 skips
> 17280306 decicycles in kerndeint, 8192 runs, 0 skips
> 17242940 decicycles in kerndeint, 16384 runs, 0 skips
>
> I can't see any significant difference.
> --
> FFmpeg = Fancy & Furious Meaningful Portable Extravagant Genius
>
Fine for me.
More information about the ffmpeg-devel
mailing list