[FFmpeg-devel] [PATCH] rgb2rgb: use optimized rgb32tobgr32() instead of shuffle_bytes_2103()

Ramiro Polla ramiro.polla
Sun Sep 12 15:03:58 CEST 2010


On Sun, Sep 12, 2010 at 8:10 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Sep 11, 2010 at 12:04:03PM -0300, Ramiro Polla wrote:
>> On Sat, Sep 11, 2010 at 5:47 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Sat, Sep 11, 2010 at 02:05:00AM -0300, Ramiro Polla wrote:
>> >> $subj
>> >
>> >> ?rgb2rgb.c | ? ?1 -
>> >> ?rgb2rgb.h | ? ?1 -
>> >> ?swscale.c | ? ?2 +-
>> >> ?3 files changed, 1 insertion(+), 3 deletions(-)
>> >> 84f4fae2b8681d2394a1ed40b3051221dacdc1c4 ?0001-rgb2rgb-use-optimized-rgb32tobgr32-instead-of-shu.patch
>> >> From 52540a23b9813ddfb436927903f1519aa58c6738 Mon Sep 17 00:00:00 2001
>> >> From: Ramiro Polla <ramiro.polla at gmail.com>
>> >> Date: Fri, 10 Sep 2010 22:42:50 -0300
>> >> Subject: [PATCH] rgb2rgb: use optimized rgb32tobgr32() instead of shuffle_bytes_2103()
>> >>
>> >> ---
>> >> ?rgb2rgb.c | ? ?1 -
>> >> ?rgb2rgb.h | ? ?1 -
>> >> ?swscale.c | ? ?2 +-
>> >> ?3 files changed, 1 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/rgb2rgb.c b/rgb2rgb.c
>> >> index 3eab9d8..2280ff7 100644
>> >> --- a/rgb2rgb.c
>> >> +++ b/rgb2rgb.c
>> >> @@ -435,7 +435,6 @@ void shuffle_bytes_##a##b##c##d(const uint8_t *src, uint8_t *dst, long src_size)
>> >>
>> >> ?DEFINE_SHUFFLE_BYTES(0, 3, 2, 1);
>> >> ?DEFINE_SHUFFLE_BYTES(1, 2, 3, 0);
>> >> -DEFINE_SHUFFLE_BYTES(2, 1, 0, 3);
>> >> ?DEFINE_SHUFFLE_BYTES(3, 0, 1, 2);
>> >> ?DEFINE_SHUFFLE_BYTES(3, 2, 1, 0);
>> >>
>> >> diff --git a/rgb2rgb.h b/rgb2rgb.h
>> >> index 2e182dd..af6097c 100644
>> >> --- a/rgb2rgb.h
>> >> +++ b/rgb2rgb.h
>> >> @@ -65,7 +65,6 @@ void bgr8torgb8 ?(const uint8_t *src, uint8_t *dst, long src_size);
>> >>
>> >> ?void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, long src_size);
>> >> ?void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, long src_size);
>> >> -void shuffle_bytes_2103(const uint8_t *src, uint8_t *dst, long src_size);
>> >> ?void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, long src_size);
>> >> ?void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, long src_size);
>> >>
>> >> diff --git a/swscale.c b/swscale.c
>> >> index 6ceddfd..92c4fc9 100644
>> >> --- a/swscale.c
>> >> +++ b/swscale.c
>> >> @@ -1495,7 +1495,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[],
>> >> ? ? ? ? ?else if (CONV_IS(ABGR, BGRA)
>> >> ? ? ? ? ? ? ? ?|| CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;
>> >> ? ? ? ? ?else if (CONV_IS(BGRA, RGBA)
>> >> - ? ? ? ? ? ? ?|| CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;
>> >> + ? ? ? ? ? ? ?|| CONV_IS(RGBA, BGRA)) conv = rgb32tobgr32;
>> >
>> > there is no reason to make the function name inconsistent
>>
>> Attached patch renames rgb32tobgr32 to shuffle_bytes_2103 instead.
>>
>> > and a benchmark may be interresting
>>
>> shuffle_bytes_2103:
>> 151142394 dezicycles in bgra 1024x1024 --> rgba 1024x1024, 1024 runs, 0 skips
>> rgb32tobgr32:
>> 74295543 dezicycles in bgra 1024x1024 --> rgba 1024x1024, 1024 runs, 0 skips
>> speed in mmx/mmx2/c is almost the same.
>
>> ?rgb2rgb.c ? ? ? ? ?| ? ?3 +--
>> ?rgb2rgb.h ? ? ? ? ?| ? ?3 +--
>> ?rgb2rgb_template.c | ? ?4 ++--
>> ?3 files changed, 4 insertions(+), 6 deletions(-)
>> c8d2046dcd0a081f1bb80ab286883c2ff65893a2 ?shuffle_bytes_2103.diff
>
> ok

Applied.



More information about the ffmpeg-devel mailing list