Esempio n. 1
0
        unsafe public static void ConvertBgrToGreyUQ15(byte *ipstart, byte *opstart, int cb)
        {
            fixed(byte *gtstart = &LookupTables.SrgbGamma[0])
            {
                ushort *ip = (ushort *)ipstart, ipe = (ushort *)(ipstart + cb) - 3, op = (ushort *)opstart;
                byte *  gt = gtstart;

                while (ip <= ipe)
                {
                    uint y = Rec709.LumaFromBgr(ip[0], ip[1], ip[2]);
                    op[0] = gt[y];

                    ip += 3;
                    op++;
                }
            }
        }
Esempio n. 2
0
        unsafe public static void ConvertBgrxToGreyUQ15(byte *ipstart, byte *opstart, int cb)
        {
            fixed(byte *gtstart = LookupTables.Gamma)
            {
                ushort *ip = (ushort *)ipstart + 4, ipe = (ushort *)(ipstart + cb), op = (ushort *)opstart + 1;
                byte *  gt = gtstart;

                while (ip <= ipe)
                {
                    uint y = Rec709.LumaFromBgr(ip[-4], ip[-3], ip[-2]);
                    op[-1] = gt[y];

                    ip += 4;
                    op++;
                }
            }
        }
        unsafe public static void ConvertBgrToGreyUQ15(byte *ipstart, byte *opstart, int cb)
        {
            fixed(byte *gtstart = LookupTables.Gamma)
            {
                ushort *ip = (ushort *)ipstart + 3, ipe = (ushort *)(ipstart + cb);
                byte *  op = opstart + 1, gt = gtstart;

                while (ip <= ipe)
                {
                    ushort y = Rec709.LumaFromBgr(ip[-3], ip[-2], ip[-1]);
                    op[-1] = gt[ClampToUQ15(y)];

                    ip += 3;
                    op++;
                }
            }
        }