Fast vectorized conversion from RGB to BGRA

后端 未结 4 711
夕颜
夕颜 2020-12-10 07:32

In a follow-up to some previous questions on converting RGB to RGBA, and ARGB to BGR, I would like to speed up a RGB to BGRA conversion with SSE

4条回答
  •  眼角桃花
    2020-12-10 08:10

    I personally found that implementing the following gave me the best result for converting BGR-24 to ARGB-32.

    This code runs at about 8.8ms on an image whereas the 128-bit vectorization code presented above came in at 14.5ms per image.

    void PixelFix(u_int32_t *buff,unsigned char *diskmem)
    {
        int i,j;
        int picptr, srcptr;
        int w = 1920;
        int h = 1080;
    
        for (j=0; j

    Previously, I had been using this routine (about 13.2ms per image). Here, buff is an unsigned char*.

    for (j=0; j

    Running a 2012 MacMini 2.6ghz/i7.

提交回复
热议问题