Fast 24-bit array -> 32-bit array conversion?

后端 未结 4 1755
终归单人心
终归单人心 2020-12-08 22:47

Quick Summary:

I have an array of 24-bit values. Any suggestion on how to quickly expand the individual 24-bit array elements into 32-bit

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 23:27

    The different input/output sizes are not a barrier to using simd, just a speed bump. You would need to chunk the data so that you read and write in full simd words (16 bytes).

    In this case, you would read 3 SIMD words (48 bytes == 16 rgb pixels), do the expansion, then write 4 SIMD words.

    I'm just saying you can use SIMD, I'm not saying you should. The middle bit, the expansion, is still tricky since you have non-uniform shift sizes in different parts of the word.

提交回复
热议问题