[FFmpeg-devel] [PATCH] swscale: avoid overread in planar2x

Ramiro Polla ramiro.polla
Mon Sep 13 16:25:35 CEST 2010


On Mon, Sep 13, 2010 at 10:48 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Sep 12, 2010 at 02:45:51PM -0300, Ramiro Polla wrote:
>> On Sun, Sep 12, 2010 at 11:33 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Sun, Sep 12, 2010 at 11:16:53AM -0300, Ramiro Polla wrote:
>> >> On Sun, Sep 12, 2010 at 10:43 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> >> > On Sun, Sep 12, 2010 at 10:00:07AM -0300, Ramiro Polla wrote:
>> >> >> On Sun, Sep 12, 2010 at 7:44 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> >> [...]
>> >> >> > after a second look i see that the C code overrides the first pixel and thus
>> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> >> >> > the output should not be affected, still my suggestion though seems nicer than
>> >> >> > requireing all buffers to have a byte allocated before them
>> >> >>
>> >> >> Thanks for the suggestion. Patch attached. No speed difference measured.
>> >> >
>> >> >> ?rgb2rgb_template.c | ? ?4 +++-
>> >> >> ?1 file changed, 3 insertions(+), 1 deletion(-)
>> >> >> 9c5b0f0bc55c99bcfbda486bff43d26c34cb96f5 ?planar2x_avoid_overread_2.diff
>> >> >> Index: rgb2rgb_template.c
>> >> >> ===================================================================
>> >> >> --- rgb2rgb_template.c ? ? ? ?(revision 32166)
>> >> >> +++ rgb2rgb_template.c ? ? ? ?(working copy)
>> >> >> @@ -1773,12 +1773,13 @@ static inline void RENAME(planar2x)(const uint8_t
>> >> >> ? ? ? ? ?const x86_reg mmxSize= srcWidth&~15;
>> >> >> ? ? ? ? ?__asm__ volatile(
>> >> >> ? ? ? ? ? ? ?"mov ? ? ? ? ? %4, %%"REG_a" ? ? ? ? ? ?\n\t"
>> >> >> + ? ? ? ? ? ?"movq ? ? ? ? (%0, %%"REG_a"), %%mm4 ? ?\n\t"
>> >> >> + ? ? ? ? ? ?"psllq ? ? ? ? ? ? ? ? ? ? $8, %%mm4 ? ?\n\t"
>> >> >
>> >> > the first value is then 0 which would lead to a darker border pixel
>> >>
>> >> Which is overwritten by the C code. Or did I miss something?
>> >
>> > dont you want to beat the c code speedwise?
>>
>> I didn't at first, but thanks for the push =). Patch attached.
>>
>> before:
>> 63750690 dezicycles in yuv410p 2048x2048 --> yuv420p 2048x2048, 2048
>> runs, 0 skips
>> after:
>> 62768947 dezicycles in yuv410p 2048x2048 --> yuv420p 2048x2048, 2048
>> runs, 0 skips
>
>> ?rgb2rgb.c ? ? ? ? ?| ? ?1 +
>> ?rgb2rgb_template.c | ? 17 ++++++++++++++---
>> ?2 files changed, 15 insertions(+), 3 deletions(-)
>> d4001ef2ab1fd368d66ea7f97223152d36dc6eed ?planar2x_avoid_overread_3.diff
>
> ok

Applied.



More information about the ffmpeg-devel mailing list