Example #1
0
        public Int32[] GetMbBits4x4(CommonYuvLine_t line, CommonEltMbDataType_t type, uint x, uint y)
        {
            if (x >= (m_Width[(int)line] >> 2) || y >= (m_Height[(int)line] >> 2))
            {
                return(null);
            }
            Int32[] bits       = GetMbBits(line, type);
            Int32[] bits4x4    = new Int32[16];
            uint    indexStart = ((y << 2) * m_Width[(int)line]) + (x << 2);
            uint    k          = 0;

            for (uint j = 0; j < 4; j++, indexStart += m_Width[(int)line])
            {
                for (uint i = 0; i < 4; i++)
                {
                    bits4x4[k++] = bits[indexStart + i];
                }
            }
            return(bits4x4);
        }
Example #2
0
        String ComputeMD5(CommonYuvLine_t line, CommonEltMbDataType_t type)
        {
            String md5String;

            Int32[] a = Mb.GetMbBits(line, type);
            byte[]  b = new byte[a.Length];
            for (int i = 0; i < b.Length; ++i)
            {
                b[i] = /*BitConverter.GetBytes*/ (byte)(a[i] & 0xFF);
            }
            IntPtr ptr = Marshal.AllocHGlobal(b.Length);

            Marshal.Copy(b, 0, ptr, b.Length);
            Md5 md5Ctx = new Md5();

            md5String = md5Ctx.compute(ptr, (uint)b.Length);
            Marshal.FreeHGlobal(ptr);
            md5Ctx.Dispose();

            return(md5String);
        }
Example #3
0
        public uint getHeight(CommonYuvLine_t eLine)
        {
            uint ret = commonWRAPPINVOKE.CommonMb_getHeight(swigCPtr, (int)eLine);

            return(ret);
        }
Example #4
0
 public virtual IntPtr getData(CommonEltMbDataType_t eType, CommonYuvLine_t eLine)
 {
     return(commonWRAPPINVOKE.CommonMb_getData(swigCPtr, (int)eType, (int)eLine));
 }
Example #5
0
        public unsafe void CopyAsU8(IntPtr pictDataPtr, UInt32 pictWidthForLine, UInt32 pictHeightForLine, CommonYuvLine_t eLine, CommonEltMbDataType_t eType)
        {
            byte *_pictDataPtr = (byte *)pictDataPtr.ToPointer();

            UInt32 nPicStartIndex = (m_Y * (pictWidthForLine * m_Height[(int)eLine])) + (m_X * m_Width[(int)eLine]);
            UInt32 nLastIndex     = (pictWidthForLine * pictHeightForLine);
            UInt32 nMbStartIndex  = 0;

            // if (nStartIndex + ())
            for (UInt32 j = 0; j < m_Height[(int)eLine]; ++j)
            {
                for (UInt32 i = 0; i < m_Width[(int)eLine]; ++i)
                {
                    fixed(Int32 *pMb = m_Data[(int)eLine][(int)eType])
                    {
                        _pictDataPtr[nPicStartIndex + i] = (byte)pMb[nMbStartIndex++];
                    }
                }
                if ((nPicStartIndex + pictWidthForLine) > nLastIndex)
                {
                    break;
                }
                nPicStartIndex += pictWidthForLine;
            }
        }
Example #6
0
 public Int32[] GetMbBits(CommonYuvLine_t line, CommonEltMbDataType_t type)
 {
     return(m_Data[(int)line][(int)type]);
 }
Example #7
0
 public Int32[] GetMbBits4x4(CommonYuvLine_t line, CommonEltMbDataType_t type, uint x, uint y)
 {
     if (x >= (m_Width[(int)line] >> 2) || y >= (m_Height[(int)line] >> 2))
     {
         return null;
     }
     Int32[] bits = GetMbBits(line, type);
     Int32[] bits4x4 = new Int32[16];
     uint indexStart = ((y << 2) * m_Width[(int)line]) + (x << 2);
     uint k = 0;
     for (uint j = 0; j < 4; j++, indexStart += m_Width[(int)line])
     {
         for (uint i = 0; i < 4; i++)
         {
             bits4x4[k++] = bits[indexStart + i];
         }
     }
     return bits4x4;
 }
Example #8
0
        public void CopyAsU8(byte[] pictData, UInt32 pictWidthForLine, UInt32 pictHeightForLine, CommonYuvLine_t eLine, CommonEltMbDataType_t eType)
        {
            UInt32 nStartIndex = (m_X * m_Y * m_Height[(int)eLine] * m_Width[(int)eLine]);

            for (UInt32 j = 0; j < m_Height[(int)eLine]; ++j)
            {
                for (UInt32 i = 0; i < m_Width[(int)eLine]; ++i)
                {
                    pictData[nStartIndex + i] = (byte)m_Data[(int)eLine][(int)eType][i * j];
                }
                nStartIndex += pictWidthForLine;
                if ((nStartIndex + pictWidthForLine) >= pictData.Length)
                {
                    break;
                }
            }
        }
Example #9
0
 public Int32[] GetMbBits(CommonYuvLine_t line, CommonEltMbDataType_t type)
 {
     return m_Data[(int)line][(int)type];
 }
Example #10
0
        public unsafe void CopyAsU8(IntPtr pictDataPtr, UInt32 pictWidthForLine, UInt32 pictHeightForLine, CommonYuvLine_t eLine, CommonEltMbDataType_t eType)
        {
            byte* _pictDataPtr = (byte*)pictDataPtr.ToPointer();

            UInt32 nPicStartIndex = (m_Y * (pictWidthForLine * m_Height[(int)eLine])) + (m_X * m_Width[(int)eLine]);
            UInt32 nLastIndex = (pictWidthForLine * pictHeightForLine);
            UInt32 nMbStartIndex = 0;
            // if (nStartIndex + ())
            for (UInt32 j = 0; j < m_Height[(int)eLine]; ++j)
            {
                for (UInt32 i = 0; i < m_Width[(int)eLine]; ++i)
                {
                    fixed (Int32* pMb = m_Data[(int)eLine][(int)eType])
                    {
                        _pictDataPtr[nPicStartIndex + i] = (byte)pMb[nMbStartIndex++];
                    }
                }
                if ((nPicStartIndex + pictWidthForLine) > nLastIndex)
                {
                    break;
                }
                nPicStartIndex += pictWidthForLine;
            }
        }
Example #11
0
 public void CopyAsU8(byte[] pictData, UInt32 pictWidthForLine, UInt32 pictHeightForLine, CommonYuvLine_t eLine, CommonEltMbDataType_t eType)
 {
     UInt32 nStartIndex = (m_X * m_Y * m_Height[(int)eLine] * m_Width[(int)eLine]);
     for (UInt32 j = 0; j < m_Height[(int)eLine]; ++j)
     {
         for (UInt32 i = 0; i < m_Width[(int)eLine]; ++i)
         {
             pictData[nStartIndex + i] = (byte)m_Data[(int)eLine][(int)eType][i * j];
         }
         nStartIndex += pictWidthForLine;
         if ((nStartIndex + pictWidthForLine) >= pictData.Length)
         {
             break;
         }
     }
 }
Example #12
0
 public uint getWidth(CommonYuvLine_t eLine)
 {
     uint ret = commonWRAPPINVOKE.CommonMb_getWidth(swigCPtr, (int)eLine);
     return ret;
 }
Example #13
0
 public virtual IntPtr getData(CommonEltMbDataType_t eType, CommonYuvLine_t eLine)
 {
     return commonWRAPPINVOKE.CommonMb_getData(swigCPtr, (int)eType, (int)eLine);
 }