1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Procedure RGBtoYUV(pdest,psrc:pbyte;w:longword;m_AChannel:pointer);
var
dst,src,ach:pbyte;
w2:longword;
r,g,b,y,u,v:byte;
begin
dst := pdest;
src := psrc;
Ach := m_AChannel;
w2 := w shr 1;
while (w2>0) do
begin
w2:=w2-1;
inc(integer(src));
B := src^;
inc(integer(src));
G := src^;
inc(integer(src));
R := src^;
if (Ach<>nil) then
begin
inc(integer(src));
Ach:=src;
inc(integer(Ach));
end;
Y := round(((219* 77*R + 219*150*G + 219* 29*B)shr 16)+16);
U := round(((219*131*B - 219* 87*G - 219* 44*R)shr 16)+128);
//#define clip(x) (((x) & 0xffffff00) ? ((x) & 0x80000000) ? 0 : 255 : (x))
// *dst++ = LIMIT(U);
// *dst++ = LIMIT(Y);
inc(integer(src));
B := src^;
inc(integer(src));
G := src^;
inc(integer(src));
R := src^;
if (Ach<>nil) then
begin
inc(integer(src));
Ach:=src;
inc(integer(Ach));
end;
Y := round(((219* 77*R + 219*150*G + 219* 29*B)shr 16)+16);
V := round(((219*131*R - 219*110*G - 219* 21*B)shr 16)+128);
// *dst++ = LIMIT(V);
// *dst++ = LIMIT(Y);
end;
end; |
Partager