2016-07-13 49 views
1

在霓虹燈內部函數中,有四個內在函數(vld1 vld2 vld3 vld4)執行單向去交錯。但是如何實現8路解交織?如何在霓虹燈中執行8路去交錯

例如,數據是:

uint8_t src[64] = {0,1,2,3,4,5,6,7,```63}; 

將數據裝載到氖寄存器,並且執行8路解交織後,希望src_reg1和src_reg2的值可以是這樣的:

uint8x8x4_t src_reg1; 
uint8x8x4_t src_reg2; 
src_reg1.val[0] = {0,8, 16,24,32,40,48,56} 
src_reg1.val[1] = {1,9, 17,25,```} 
src_reg1.val[2] = {2,10,18,26,```} 
src_reg1.val[3] = {3,11,19,27,```} 
src_reg2.val[0] = {4,12,20,28,```} 
src_reg2.val[1] = {5,13,21,29,```} 
src_reg2.val[2] = {6,14,22,30,```} 
src_reg2.val[3] = {7,15,23,31,39,47,55,63} 

有誰知道如何做到這一點?非常感謝!

回答

4

這是因爲這樣做兩個4單元載荷得到兩套4路去交織的數據,然後通過寄存器交錯處理的一個進一步的解交織那些套彼此,例如:

uint8x8x4_t src_reg1 = vld4_u8(src); 
uint8x8x4_t src_reg2 = vld4_u8(src + 32); 
for (int i = 0; i < 4; i++) { 
    // This a bit of a faff thanks to the intrinsic datatypes, but 
    // compiling at -O3 tidies it all up into sensible code 
    uint8x8x2_t tmp = vuzp_u8(src_reg1.val[i], src_reg2.val[i]); 
    src_reg1.val[i] = tmp.val[0]; 
    src_reg2.val[i] = tmp.val[1]; 
} 
一樣簡單