Re: YUYVYUYV -> YYYY,UU,VV. How can I do this using SSE ?
From: Bernie (spamtrap_at_crayne.org)
Date: 09/22/04
- Previous message: Erdemal : "Thanks : Re: How to get Code Segment Base Address in PM"
- In reply to: kamil: "YUYVYUYV -> YYYY,UU,VV. How can I do this using SSE ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 22 Sep 2004 17:51:42 +0000 (UTC)
"kamil" <spamtrap@crayne.org> a écrit dans le message de
news:cfinoj$ach$1@nemesis.news.tpi.pl...
> I have byte data in following format :
>
> src_ptr1: Y U Y V Y U Y V .....
>
> and I need it to be written as:
>
> dst_ptr1: Y Y Y Y ...
> dst_ptr2: U U ...
> dst_ptr3: V V ...
>
> Cound you give me some advice ? which instruction should be used to unpack
> this data ?
>
> Thanks in advance,
> Kamil
>
>
Based on the following you could write full split and join function :
void SPLITTER_YUV422_YUYV(unsigned char* pimage, unsigned char* lumi)
{
static _declspec(align(16)) unsigned char xmmAndmaskSplit[16] =
{ 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF,
0x0, 0xFF, 0x0};
_declspec(align(16)) unsigned char* msk = xmmAndmaskSplit;
int step = 720*2;
unsigned char* src;
unsigned char* Y;
for (int y=0; y<576; y++ )
{
Y=lumi + y*720;
src=pimage + y*step;
for (int x=0; x<720; x+=16)
{
_asm
{
mov eax, src;
mov edx, Y;
mov esi, msk;
pxor xmm6, xmm6;
movdqa xmm4, [esi]; //Load byte mask in mm4 register
//0 FF 0 FF 0 FF 0 FF 0 FF 0 FF 0 FF 0 FF 0 FF 0 FF
//LOAD FROM YUYV BUFFER 2x8 pels IN 2 XMM REGISTER
movdqa xmm0, [eax]; //128bits 16*8bits x15 x14 x13 x12 x11 x10 x9 x8 x7
x6 x5 x4 x3 x2 x1 x0
movdqa xmm2, [eax+16]; //y15 y14 y13 y12 y11 y10 y9 y8 y7 y6 y5 y4 y3 y2
y1 y0
pand xmm0, xmm4; //0 x14 0 x12 0 x10 0 x8 0 x6 0 x5 0 x3 0 x0
pand xmm2, xmm4; //0 y14 0 y12 0 y10 0 y8 0 y6 0 y5 0 y3 0 y0
//BUILD ==> y14 y12 y10 y8 y6 y5 y3 y0 x14 x12 x10 x8 x6 x5 x3 x0
packuswb xmm0, xmm2;
//SAVE TO INTERNAL BUFFER 2x8pels FROM 1 XMM REGISTER
movdqa [edx], xmm0;
}
Y+=16;
src+=32;
}
}
}
- Previous message: Erdemal : "Thanks : Re: How to get Code Segment Base Address in PM"
- In reply to: kamil: "YUYVYUYV -> YYYY,UU,VV. How can I do this using SSE ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|