static ConverterResizer()
        {
            m_pixelTypeMapper.Add(PixelAlignmentType.I420, SwScale.SwsPixelFormat.PIX_FMT_YUV420P);
            m_pixelTypeMapper.Add(PixelAlignmentType.Y800, SwScale.SwsPixelFormat.PIX_FMT_GRAY8);
            m_pixelTypeMapper.Add(PixelAlignmentType.NV12, SwScale.SwsPixelFormat.PIX_FMT_NV12);
            m_pixelTypeMapper.Add(PixelAlignmentType.NV21, SwScale.SwsPixelFormat.PIX_FMT_NV21);
            m_pixelTypeMapper.Add(PixelAlignmentType.UYVY, SwScale.SwsPixelFormat.PIX_FMT_UYVY422);
            m_pixelTypeMapper.Add(PixelAlignmentType.Y410, SwScale.SwsPixelFormat.PIX_FMT_YUV410P);
            m_pixelTypeMapper.Add(PixelAlignmentType.Y411, SwScale.SwsPixelFormat.PIX_FMT_YUV411P);
            m_pixelTypeMapper.Add(PixelAlignmentType.YUV, SwScale.SwsPixelFormat.PIX_FMT_YUV444P);
            m_pixelTypeMapper.Add(PixelAlignmentType.YUY2, SwScale.SwsPixelFormat.PIX_FMT_YUYV422);
            m_pixelTypeMapper.Add(PixelAlignmentType.YV12, SwScale.SwsPixelFormat.PIX_FMT_YUV420P);
            m_pixelTypeMapper.Add(PixelAlignmentType.Y16, SwScale.SwsPixelFormat.PIX_FMT_GRAY16BE);
            m_pixelTypeMapper.Add(PixelAlignmentType.RGB24, SwScale.SwsPixelFormat.PIX_FMT_BGR24);
            m_pixelTypeMapper.Add(PixelAlignmentType.RGBA, SwScale.SwsPixelFormat.PIX_FMT_RGBA);
            m_pixelTypeMapper.Add(PixelAlignmentType.ARGB, SwScale.SwsPixelFormat.PIX_FMT_ARGB);

            m_rgbMapper.Add(PixelFormat.Format8bppIndexed, SwScale.SwsPixelFormat.PIX_FMT_GRAY8);
            m_rgbMapper.Add(PixelFormat.Format32bppArgb, SwScale.SwsPixelFormat.PIX_FMT_BGRA);
            m_rgbMapper.Add(PixelFormat.Format24bppRgb, SwScale.SwsPixelFormat.PIX_FMT_BGR24);

            pInput = (byte**)Marshal.AllocHGlobal(sizeof(byte*) * 4).ToPointer();
            for (int i = 0; i < 4; i++)
            {
                pInput[i] = null;
            }
        }
        public PlanarPixelData(int[] lineSizes)
        {
            Sizes = lineSizes;

            Data = (byte**)MemoryHeap.Alloc(sizeof(byte*) * Sizes.Length);

            for (int i = 0; i < Sizes.Length; i++)
            {
                Data[i] = (byte*)MemoryHeap.Alloc(sizeof(byte) * Sizes[i]);
            }
        }
		partial void InitializeMemory()
		{
			// Use a RNG for uninitialized RAM simulation
			random = new Random();

			unsafe
			{
				segmentWriteHandlerArray = new MemoryWriteHandler[256];

				segmentMemoryBlock = new MemoryBlock(256 * sizeof(byte*)); // Allocate a memory segment table (256 segments)
				segmentArray = (byte**)segmentMemoryBlock.Pointer;

				externalRamBlock = new MemoryBlock(131072); // 128Kb maximum

				videoMemoryBlock = new MemoryBlock(16384); // 8Kb banks (only in CGB mode)
				videoMemory = (byte*)videoMemoryBlock.Pointer;

				workMemoryBlock = new MemoryBlock(32768); // 4Kb banks (switchable in CGB mode)
				workMemory = (byte*)workMemoryBlock.Pointer;

				objectAttributeMemoryBlock = new MemoryBlock(256); // 256 bytes of OAM
				objectAttributeMemory = (byte*)objectAttributeMemoryBlock.Pointer;

				portMemoryBlock = new MemoryBlock(256); // 256 bytes of High RAM
				portMemory = (byte*)portMemoryBlock.Pointer;

				paletteMemoryBlock = new MemoryBlock(16 * 4 * sizeof(ushort)); // 128 bytes of palette ram (only for CGB)
				paletteMemory = (byte*)paletteMemoryBlock.Pointer;

				generalMemoryBlock = new MemoryBlock(512); // 256 bytes of register memory and 256 bytes of 'trash' memory
				externalPortMemory = (byte*)generalMemoryBlock.Pointer;
				trashMemory = (byte*)generalMemoryBlock.Pointer + 256;

				dmgBootMemoryBlock = new MemoryBlock(0x100);
				dmgBootMemory = (byte*)dmgBootMemoryBlock.Pointer;
				sgbBootMemoryBlock = new MemoryBlock(0x100);
				sgbBootMemory = (byte*)sgbBootMemoryBlock.Pointer;
				cgbBootMemoryBlock = new MemoryBlock(0x800);
				cgbBootMemory = (byte*)cgbBootMemoryBlock.Pointer;
			}

			ResetSegments();
			ResetWriteHandlers();
		}
Exemple #4
0
		static VkDebug() {
			string[] Layers = new string[] {
				"VK_LAYER_LUNARG_threading",
				"VK_LAYER_LUNARG_mem_tracker",
				"VK_LAYER_LUNARG_object_tracker",
				"VK_LAYER_LUNARG_draw_state",
				"VK_LAYER_LUNARG_param_checker",
				"VK_LAYER_LUNARG_swapchain",
				"VK_LAYER_LUNARG_device_limits",
				"VK_LAYER_LUNARG_image",
				"VK_LAYER_GOOGLE_unique_objects"
			};

			LayerCount = (uint)Layers.Length;
			if (LayerCount > 0)
				LayerNames = (byte**)Marshal.AllocHGlobal(sizeof(byte*) * Layers.Length).ToPointer();
			else
				LayerNames = null;
			for (int i = 0; i < Layers.Length; i++)
				LayerNames[i] = Layers[i].AllocString();
		}
Exemple #5
0
 public virtual int GetSigFromToken(
     int standaloneSignature,
     [Out] byte **signature,
     [Out] int *signatureLength)
 => throw new NotImplementedException();
Exemple #6
0
 internal static unsafe extern SafeAsn1OctetStringHandle d2i_ASN1_OCTET_STRING(IntPtr zero, byte **ppin, int len);
 public HRESULT GetScanline0AndPitch(byte **pbScanline0, [NativeTypeName("LONG *")] int *plPitch)
 {
     return(((delegate * unmanaged <IMF2DBuffer2 *, byte **, int *, int>)(lpVtbl[5]))((IMF2DBuffer2 *)Unsafe.AsPointer(ref this), pbScanline0, plPitch));
 }
Exemple #8
0
        private static unsafe uint Compress(byte[] src, uint srcstart, uint srcLength, byte[] dst, uint dststart, uint dstlen, byte[] workmem, uint workmemstart)
        {
            uint tmp;

            if (srcLength <= M2_MAX_LEN + 5)
            {
                tmp    = (uint)srcLength;
                dstlen = 0;
            }
            else
            {
                fixed(byte *work = &workmem[workmemstart], input = &src[srcstart], output = &dst[dststart])
                {
                    byte **dict    = (byte **)work;
                    byte * in_end  = input + srcLength;
                    byte * ip_end  = input + srcLength - M2_MAX_LEN - 5;
                    byte * ii      = input;
                    byte * ip      = input + 4;
                    byte * op      = output;
                    bool   literal = false;
                    bool   match   = false;
                    uint   offset;
                    uint   length;
                    uint   index;
                    byte * pos;

                    for (; ;)
                    {
                        offset = 0;
                        index  = D_INDEX1(ip);
                        pos    = ip - (ip - dict[index]);
                        if (pos < input || (offset = (uint)(ip - pos)) <= 0 || offset > M4_MAX_OFFSET)
                        {
                            literal = true;
                        }
                        else if (offset <= M2_MAX_OFFSET || pos[3] == ip[3])
                        {
                        }
                        else
                        {
                            index = D_INDEX2(index);
                            pos   = ip - (ip - dict[index]);
                            if (pos < input || (offset = (uint)(ip - pos)) <= 0 || offset > M4_MAX_OFFSET)
                            {
                                literal = true;
                            }
                            else if (offset <= M2_MAX_OFFSET || pos[3] == ip[3])
                            {
                            }
                            else
                            {
                                literal = true;
                            }
                        }

                        if (!literal)
                        {
                            if (*((ushort *)pos) == *((ushort *)ip) && pos[2] == ip[2])
                            {
                                match = true;
                            }
                        }

                        literal = false;
                        if (!match)
                        {
                            dict[index] = ip;
                            ++ip;
                            if (ip >= ip_end)
                            {
                                break;
                            }
                            continue;
                        }
                        match       = false;
                        dict[index] = ip;
                        if (ip - ii > 0)
                        {
                            uint t = (uint)(ip - ii);
                            if (t <= 3)
                            {
                                //Debug.Assert(op - 2 > output);
                                op[-2] |= (byte)(t);
                            }
                            else if (t <= 18)
                            {
                                *op++ = (byte)(t - 3);
                            }
                            else
                            {
                                uint tt   = t - 18;
                                *    op++ = 0;
                                while (tt > 255)
                                {
                                    tt -= 255;
                                    *op++ = 0;
                                }
                                //Debug.Assert(tt > 0);
                                *op++ = (byte)(tt);
                            }
                            do
                            {
                                *op++ = *ii++;
                            } while (--t > 0);
                        }
                        //Debug.Assert(ii == ip);
                        ip += 3;
                        if (pos[3] != *ip++ || pos[4] != *ip++ || pos[5] != *ip++ ||
                            pos[6] != *ip++ || pos[7] != *ip++ || pos[8] != *ip++)
                        {
                            --ip;
                            length = (uint)(ip - ii);
                            //Debug.Assert(length >= 3);
                            //Debug.Assert(length <= M2_MAX_LEN);
                            if (offset <= M2_MAX_OFFSET)
                            {
                                --offset;
                                *op++ = (byte)(((length - 1) << 5) | ((offset & 7) << 2));
                                *op++ = (byte)(offset >> 3);
                            }
                            else if (offset <= M3_MAX_OFFSET)
                            {
                                --offset;
                                *op++ = (byte)(M3_MARKER | (length - 2));
                                *op++ = (byte)((offset & 63) << 2);
                                *op++ = (byte)(offset >> 6);
                            }
                            else
                            {
                                offset -= 0x4000;
                                //Debug.Assert(offset > 0);
                                //Debug.Assert(offset <= 0x7FFF);
                                *op++ = (byte)(M4_MARKER | ((offset & 0x4000) >> 11) | (length - 2));
                                *op++ = (byte)((offset & 63) << 2);
                                *op++ = (byte)(offset >> 6);
                            }
                        }
                        else
                        {
                            byte *m = pos + M2_MAX_LEN + 1;
                            while (ip < in_end && *m == *ip)
                            {
                                ++m;
                                ++ip;
                            }
                            length = (uint)(ip - ii);
                            //Debug.Assert(length > M2_MAX_LEN);
                            if (offset <= M3_MAX_OFFSET)
                            {
                                --offset;
                                if (length <= 33)
                                {
                                    *op++ = (byte)(M3_MARKER | (length - 2));
                                }
                                else
                                {
                                    length -= 33;
                                    *op++ = M3_MARKER | 0;
                                    while (length > 255)
                                    {
                                        length -= 255;
                                        *op++ = 0;
                                    }
                                    //Debug.Assert(length > 0);
                                    *op++ = (byte)(length);
                                }
                            }
                            else
                            {
                                offset -= 0x4000;
                                //Debug.Assert(offset > 0);
                                //Debug.Assert(offset <= 0x7FFF);
                                if (length <= M4_MAX_LEN)
                                {
                                    *op++ = (byte)(M4_MARKER | ((offset & 0x4000) >> 11) | (length - 2));
                                }
                                else
                                {
                                    length -= M4_MAX_LEN;
                                    *op++ = (byte)(M4_MARKER | ((offset & 0x4000) >> 11));
                                    while (length > 255)
                                    {
                                        length -= 255;
                                        *op++ = 0;
                                    }
                                    //Debug.Assert(length > 0);
                                    *op++ = (byte)(length);
                                }
                            }
                            *op++ = (byte)((offset & 63) << 2);
                            *op++ = (byte)(offset >> 6);
                        }
                        ii = ip;
                        if (ip >= ip_end)
                        {
                            break;
                        }
                    }
                    dstlen = (uint)(op - output);
                    tmp    = (uint)(in_end - ii);
                }
            }
            if (tmp > 0)
            {
                uint ii = (uint)srcLength - tmp + srcstart;
                if (dstlen == 0 && tmp <= 238)
                {
                    dst[dstlen++] = (byte)(17 + tmp);
                }
                else if (tmp <= 3)
                {
                    dst[dstlen - 2] |= (byte)(tmp);
                }
                else if (tmp <= 18)
                {
                    dst[dstlen++] = (byte)(tmp - 3);
                }
                else
                {
                    uint tt = tmp - 18;
                    dst[dstlen++] = 0;
                    while (tt > 255)
                    {
                        tt           -= 255;
                        dst[dstlen++] = 0;
                    }
                    //Debug.Assert(tt > 0);
                    dst[dstlen++] = (byte)(tt);
                }
                do
                {
                    dst[dstlen++] = src[ii++];
                } while (--tmp > 0);
            }
            dst[dstlen++] = M4_MARKER | 1;
            dst[dstlen++] = 0;
            dst[dstlen++] = 0;

            // Append the source count
            dst[dstlen++] = (byte)srcLength;
            dst[dstlen++] = (byte)(srcLength >> 8);
            dst[dstlen++] = (byte)(srcLength >> 16);
            dst[dstlen++] = (byte)(srcLength >> 24);

            return(dstlen);
        }
Exemple #9
0
		static extern void load_collation_resource (int resource_index, byte** data);
Exemple #10
0
 int IMetadataImport.GetPropertyProps(int propertyDef, int *declaringTypeDef, char *name, int nameBufferLength, int *nameLength, int *attributes, byte **signature, int *signatureLength, int *constantType, byte **constantValue, int *constantValueLength, int *setterMethodDef, int *getterMethodDef, int *outerMethodDefs, int outerMethodDefsBufferLength, int *otherMethodDefCount) => throw new NotImplementedException();
Exemple #11
0
 int IMetadataImport.GetCustomAttributeByName(int parent, string name, byte **value, int *valueLength) => throw new NotImplementedException();
Exemple #12
0
 public static extern void ImFontAtlas_GetTexDataAsAlpha8(NativeFontAtlas *atlas, byte **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel);
 public int GetCertificate([NativeTypeName("BYTE **")] byte **ppCert, [NativeTypeName("DWORD *")] uint *pcbCert)
 {
     return(((delegate * unmanaged <IMFSecureChannel *, byte **, uint *, int>)(lpVtbl[3]))((IMFSecureChannel *)Unsafe.AsPointer(ref this), ppCert, pcbCert));
 }
Exemple #14
0
 public unsafe void SendMessage(byte **message, int *sizes, int count)
 {
     throw new NotImplementedException();
 }
Exemple #15
0
 public unsafe void SendMessage(byte **message, int *sizes, int count, out TrinityResponse response)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 private static unsafe void CallMain(int numArgs, byte **args) => CurrentMain !(numArgs, args);
Exemple #17
0
 public static unsafe void RunApp(int numArgs, byte **args, nint callback)
 {
     BeginRun();
     CoreRunApp(numArgs, args, callback);
     EndRun();
 }
Exemple #18
0
 private static extern unsafe void CoreRunApp(int numArgs, byte **args, nint callback);
Exemple #19
0
 int IMetadataImport.GetMemberProps(int member, int *declaringTypeDef, char *name, int nameBufferLength, int *nameLength, int *attributes, byte **signature, int *signatureLength, int *relativeVirtualAddress, int *implAttributes, int *constantType, byte **constantValue, int *constantValueLength) => throw new NotImplementedException();
 public int GetBuffer([NativeTypeName("BYTE **")] byte **buffer, [NativeTypeName("UINT32 *")] uint *bufferLength)
 {
     return(((delegate * unmanaged <ISpatialAudioObject *, byte **, uint *, int>)(lpVtbl[3]))((ISpatialAudioObject *)Unsafe.AsPointer(ref this), buffer, bufferLength));
 }
Exemple #21
0
 int IMetadataImport.GetFieldProps(int fieldDef, int *declaringTypeDef, char *name, int nameBufferLength, int *nameLength, int *attributes, byte **signature, int *signatureLength, int *constantType, byte **constantValue, int *constantValueLength) => throw new NotImplementedException();
Exemple #22
0
 int IMetadataImport.GetMemberRefProps(int memberRef, int *declaringType, char *name, int nameBufferLength, int *nameLength, byte **signature, int *signatureLength) => throw new NotImplementedException();
Exemple #23
0
 int IMetadataImport.GetParamProps(int parameter, int *declaringMethodDef, int *sequenceNumber, char *name, int nameBufferLength, int *nameLength, int *attributes, int *constantType, byte **constantValue, int *constantValueLength) => throw new NotImplementedException();
Exemple #24
0
 int IMetadataImport.GetFieldMarshal(int fieldDef, byte **nativeTypeSignature, int *nativeTypeSignatureLengvth) => throw new NotImplementedException();
Exemple #25
0
 public int KeyExchange([NativeTypeName("GUID *")] Guid *pRandom, [NativeTypeName("BYTE **")] byte **VarLenCertGH, [NativeTypeName("DWORD *")] uint *pdwLengthCertGH)
 {
     return(((delegate * unmanaged <IAMCertifiedOutputProtection *, Guid *, byte **, uint *, int>)(lpVtbl[3]))((IAMCertifiedOutputProtection *)Unsafe.AsPointer(ref this), pRandom, VarLenCertGH, pdwLengthCertGH));
 }
Exemple #26
0
 int IMetadataImport.GetPermissionSetProps(int declSecurity, uint *action, byte **permissionBlob, int *permissionBlobLength) => throw new NotImplementedException();
Exemple #27
0
 public static unsafe void CompileShaderInclude(this ArbShadingLanguageInclude thisApi, [Flow(FlowDirection.In)] uint shader, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.In)] byte **path, [Count(Parameter = "count"), Flow(FlowDirection.In)] ReadOnlySpan <int> length)
 {
     // SpanOverloader
     thisApi.CompileShaderInclude(shader, count, path, in length.GetPinnableReference());
 }
        // Token: 0x06002AB6 RID: 10934 RVA: 0x000A4E00 File Offset: 0x000A3000
        public unsafe static void smethod_0(byte[] src, out byte[] dst)
        {
            uint num = (uint)(src.Length + src.Length / 16 + 64 + 3);

            dst = new byte[num];
            uint num2;

            if ((long)src.Length <= 13L)
            {
                num2 = (uint)src.Length;
                num  = 0U;
            }
            else
            {
                byte[] array = new byte[65539];
                byte[] array2;
                byte * ptr;
                if ((array2 = array) != null && array2.Length != 0)
                {
                    fixed(byte *ptr = &array2[0])
                    {
                    }
                }
                else
                {
                    ptr = null;
                }
                byte *ptr2;
                if (src != null && src.Length != 0)
                {
                    fixed(byte *ptr2 = &src[0])
                    {
                    }
                }
                else
                {
                    ptr2 = null;
                }
                byte[] array3;
                byte * ptr3;
                if ((array3 = dst) != null && array3.Length != 0)
                {
                    fixed(byte *ptr3 = &array3[0])
                    {
                    }
                }
                else
                {
                    ptr3 = null;
                }
                byte **ptr4  = (byte **)ptr;
                byte * ptr5  = ptr2 + src.Length;
                byte * ptr6  = ptr2 + src.Length - 8 - 5;
                byte * ptr7  = ptr2;
                byte * ptr8  = ptr2 + 4;
                byte * ptr9  = ptr3;
                bool   flag  = false;
                bool   flag2 = false;
                for (;;)
                {
                    uint  num3  = 0U;
                    uint  num4  = Class478.smethod_2(ptr8);
                    byte *ptr10 = ptr8 - (ptr8 - *(IntPtr *)(ptr4 + (ulong)num4 * (ulong)((long)sizeof(byte *)) / (ulong)sizeof(byte *))) / 1;
                    if (ptr10 >= ptr2 && (num3 = (uint)((long)(ptr8 - ptr10))) > 0U && num3 <= 49151U)
                    {
                        if (num3 > 2048U && ptr10[3] != ptr8[3])
                        {
                            num4  = Class478.smethod_3(num4);
                            ptr10 = ptr8 - (ptr8 - *(IntPtr *)(ptr4 + (ulong)num4 * (ulong)((long)sizeof(byte *)) / (ulong)sizeof(byte *))) / 1;
                            if (ptr10 >= ptr2 && (num3 = (uint)((long)(ptr8 - ptr10))) > 0U && num3 <= 49151U)
                            {
                                if (num3 > 2048U && ptr10[3] != ptr8[3])
                                {
                                    flag = true;
                                }
                            }
                            else
                            {
                                flag = true;
                            }
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                    if (!flag && *(ushort *)ptr10 == *(ushort *)ptr8 && ptr10[2] == ptr8[2])
                    {
                        flag2 = true;
                    }
                    flag = false;
                    if (!flag2)
                    {
                        *(IntPtr *)(ptr4 + (ulong)num4 * (ulong)((long)sizeof(byte *)) / (ulong)sizeof(byte *)) = ptr8;
                        ptr8++;
                        if (ptr8 >= ptr6)
                        {
                            break;
                        }
                    }
                    else
                    {
                        flag2 = false;
                        *(IntPtr *)(ptr4 + (ulong)num4 * (ulong)((long)sizeof(byte *)) / (ulong)sizeof(byte *)) = ptr8;
                        if ((long)(ptr8 - ptr7) > 0L)
                        {
                            uint num5 = (uint)((long)(ptr8 - ptr7));
                            if (num5 <= 3U)
                            {
                                byte *ptr11  = ptr9 + -2;
                                *     ptr11 |= (byte)num5;
                            }
                            else if (num5 <= 18U)
                            {
                                *(ptr9++) = (byte)(num5 - 3U);
                            }
                            else
                            {
                                uint num6 = num5 - 18U;
                                *(ptr9++) = 0;
                                while (num6 > 255U)
                                {
                                    num6     -= 255U;
                                    *(ptr9++) = 0;
                                }
                                *(ptr9++) = (byte)num6;
                            }
                            do
                            {
                                *(ptr9++) = *(ptr7++);
                            }while ((num5 -= 1U) > 0U);
                        }
                        ptr8 += 3;
                        if (ptr10[3] != *(ptr8++) || ptr10[4] != *(ptr8++) || ptr10[5] != *(ptr8++) || ptr10[6] != *(ptr8++) || ptr10[7] != *(ptr8++))
                        {
                            goto IL_38F;
                        }
                        if (ptr10[8] != *(ptr8++))
                        {
                            goto IL_38F;
                        }
                        byte *ptr12 = ptr10 + 8 + 1;
                        while (ptr8 < ptr5)
                        {
                            if (*ptr12 != *ptr8)
                            {
                                break;
                            }
                            ptr12++;
                            ptr8++;
                        }
                        uint num7 = (uint)((long)(ptr8 - ptr7));
                        if (num3 <= 16384U)
                        {
                            num3 -= 1U;
                            if (num7 <= 33U)
                            {
                                *(ptr9++) = (byte)(32U | num7 - 2U);
                            }
                            else
                            {
                                num7     -= 33U;
                                *(ptr9++) = 32;
                                while (num7 > 255U)
                                {
                                    num7     -= 255U;
                                    *(ptr9++) = 0;
                                }
                                *(ptr9++) = (byte)num7;
                            }
                        }
                        else
                        {
                            num3 -= 16384U;
                            if (num7 <= 9U)
                            {
                                *(ptr9++) = (byte)(16U | (num3 & 16384U) >> 11 | num7 - 2U);
                            }
                            else
                            {
                                num7     -= 9U;
                                *(ptr9++) = (byte)(16U | (num3 & 16384U) >> 11);
                                while (num7 > 255U)
                                {
                                    num7     -= 255U;
                                    *(ptr9++) = 0;
                                }
                                *(ptr9++) = (byte)num7;
                            }
                        }
                        *(ptr9++) = (byte)((num3 & 63U) << 2);
                        *(ptr9++) = (byte)(num3 >> 6);
IL_461:
                        ptr7 = ptr8;
                        if (ptr8 >= ptr6)
                        {
                            break;
                        }
                        continue;
IL_38F:
                        ptr8--;
                        num7 = (uint)((long)(ptr8 - ptr7));
                        if (num3 <= 2048U)
                        {
                            num3     -= 1U;
                            *(ptr9++) = (byte)(num7 - 1U << 5 | (num3 & 7U) << 2);
                            *(ptr9++) = (byte)(num3 >> 3);
                            goto IL_461;
                        }
                        if (num3 <= 16384U)
                        {
                            num3     -= 1U;
                            *(ptr9++) = (byte)(32U | num7 - 2U);
                            *(ptr9++) = (byte)((num3 & 63U) << 2);
                            *(ptr9++) = (byte)(num3 >> 6);
                            goto IL_461;
                        }
                        num3     -= 16384U;
                        *(ptr9++) = (byte)(16U | (num3 & 16384U) >> 11 | num7 - 2U);
                        *(ptr9++) = (byte)((num3 & 63U) << 2);
                        *(ptr9++) = (byte)(num3 >> 6);
                        goto IL_461;
                    }
                }
                num  = (uint)((long)(ptr9 - ptr3));
                num2 = (uint)((long)(ptr5 - ptr7));
                ptr  = null;
                ptr2 = null;
                ptr3 = null;
            }
            if (num2 > 0U)
            {
                uint num8 = (uint)(src.Length - (int)num2);
                if (num == 0U && num2 <= 238U)
                {
                    dst[(int)((UIntPtr)(num++))] = (byte)(17U + num2);
                }
                else if (num2 <= 3U)
                {
                    byte[]  array4  = dst;
                    UIntPtr uintPtr = (UIntPtr)(num - 2U);
                    array4[(int)uintPtr] = (array4[(int)uintPtr] | (byte)num2);
                }
                else if (num2 <= 18U)
                {
                    dst[(int)((UIntPtr)(num++))] = (byte)(num2 - 3U);
                }
                else
                {
                    uint num9 = num2 - 18U;
                    dst[(int)((UIntPtr)(num++))] = 0;
                    while (num9 > 255U)
                    {
                        num9 -= 255U;
                        dst[(int)((UIntPtr)(num++))] = 0;
                    }
                    dst[(int)((UIntPtr)(num++))] = (byte)num9;
                }
                do
                {
                    dst[(int)((UIntPtr)(num++))] = src[(int)((UIntPtr)(num8++))];
                }while ((num2 -= 1U) > 0U);
            }
            dst[(int)((UIntPtr)(num++))] = 17;
            dst[(int)((UIntPtr)(num++))] = 0;
            dst[(int)((UIntPtr)(num++))] = 0;
            if ((long)dst.Length != (long)((ulong)num))
            {
                byte[] array5 = new byte[num];
                Buffer.BlockCopy(dst, 0, array5, 0, (int)num);
                dst = array5;
            }
        }
Exemple #29
0
		static extern void load_collation_resource (string path, int resource_index, byte** data, int* size);
Exemple #30
0
 internal extern static unsafe bool RhpEHEnumInitFromStackFrameIterator(ref StackFrameIterator pFrameIter, byte **pMethodStartAddress, void *pEHEnum);
Exemple #31
0
        /// <summary>
        /// Transmits the given audio frame to an auto allocated buffer. Returns whether the operation is success, and the buffer when it succeeds.
        /// </summary>
        /// <param name="context">The <see cref="DecodeContext"/> containing decoding information.</param>
        /// <param name="frame">The <see cref="AVFrame"/> containing decoded audio data.</param>
        /// <param name="buffer">An auto allocated buffer. If the function succeeds, it contains audio data of required format. The data is NOT planar.</param>
        /// <returns><see langword="true"/> if all operation succeeds, otherwise <see langword="false"/>.</returns>
        /// <seealso cref="RequiredChannels"/>
        /// <seealso cref="RequiredSampleFormat"/>
        /// <seealso cref="RequiredSampleRate"/>
        internal static bool TransmitAudioFrame([NotNull] DecodeContext context, [NotNull] AVFrame *frame, [CanBeNull] out byte[] buffer)
        {
            buffer = null;

            var audioContext = context.AudioContext;

            if (audioContext == null)
            {
                return(false);
            }

            if (frame->nb_samples == 0 || frame->channels == 0)
            {
                return(true);
            }

            const int            dstChannels     = RequiredChannels;
            const AVSampleFormat dstSampleFormat = RequiredSampleFormat;
            const int            dstSampleRate   = RequiredSampleRate;

            var resampleContext = audioContext.GetSuitableResampleContext(dstSampleFormat, dstChannels, dstSampleRate);

            // First roughly estimates the number of samples in the output data.
            var roughDstSampleCount = (int)ffmpeg.av_rescale_rnd(frame->nb_samples, dstSampleRate, audioContext.SampleRate, AVRounding.AV_ROUND_UP);

            if (roughDstSampleCount < 0)
            {
                throw new FFmpegException("Failed to calculate simple rescaled sample count.");
            }

            var dstSampleCount = roughDstSampleCount;

            // About dstData and being continuous:
            // We only care about 16-bit stereo audio, so the audio output always has 1 plane (not planar).
            // For more complicated situations: http://blog.csdn.net/dancing_night/article/details/45642107
            byte **   dstData     = null;
            var       dstLineSize = 0;
            const int planeCount  = 1;

            try {
                // Allocate channel array and sample buffers.
                Verify(ffmpeg.av_samples_alloc_array_and_samples(&dstData, &dstLineSize, dstChannels, dstSampleCount, dstSampleFormat, 0));

                Debug.Assert(dstData != null);

                // Then consider the possible resample delay and calculate the correct number of samples.
                // TODO: Isn't this redundant? We may use this value in the first place.
                dstSampleCount = (int)ffmpeg.av_rescale_rnd(ffmpeg.swr_get_delay(resampleContext, audioContext.SampleRate) + frame->nb_samples, dstSampleRate, audioContext.SampleRate, AVRounding.AV_ROUND_UP);

                if (dstSampleCount <= 0)
                {
                    throw new FFmpegException("Failed to calculate rescaled sample count (with possible delays).");
                }

                // If there is a delay, we have to adjust the buffers allocated. (Yeah actually one buffer.)
                if (dstSampleCount > roughDstSampleCount)
                {
                    for (var i = 0; i < planeCount; ++i)
                    {
                        ffmpeg.av_freep(&dstData[i]);
                    }

                    Verify(ffmpeg.av_samples_alloc(dstData, &dstLineSize, dstChannels, dstSampleCount, dstSampleFormat, 1));
                }

                var ptrs = frame->data.ToArray();
                int convertRet;

                // Next, resample.
                fixed(byte **data = ptrs)
                {
                    convertRet = ffmpeg.swr_convert(resampleContext, dstData, dstSampleCount, data, frame->nb_samples);

                    Verify(convertRet);
                }

                // Get resampled data size...
                var resampledDataSize = ffmpeg.av_samples_get_buffer_size(&dstLineSize, dstChannels, convertRet, dstSampleFormat, 1);

                // ... allocate the buffer...
                buffer = new byte[resampledDataSize];

                // .. and write to it.
                // TODO: sometimes dstData[0] is null?
                if (dstData[0] != null)
                {
                    Marshal.Copy((IntPtr)dstData[0], buffer, 0, resampledDataSize);
                }
            } finally {
                // Finally, clean up the native buffers.
                if (dstData != null)
                {
                    for (var i = 0; i < planeCount; ++i)
                    {
                        if (dstData[i] != null)
                        {
                            ffmpeg.av_freep(&dstData[i]);
                        }
                    }

                    ffmpeg.av_freep(&dstData);
                }
            }

            return(true);
        }
 public HRESULT Lock2DSize(MF2DBuffer_LockFlags lockFlags, byte **ppbScanline0, [NativeTypeName("LONG *")] int *plPitch, byte **ppbBufferStart, [NativeTypeName("DWORD *")] uint *pcbBufferLength)
 {
     return(((delegate * unmanaged <IMF2DBuffer2 *, MF2DBuffer_LockFlags, byte **, int *, byte **, uint *, int>)(lpVtbl[10]))((IMF2DBuffer2 *)Unsafe.AsPointer(ref this), lockFlags, ppbScanline0, plPitch, ppbBufferStart, pcbBufferLength));
 }
Exemple #33
0
 int IMetadataImport.GetTypeSpecFromToken(int typeSpec, byte **signature, int *signatureLength) => throw new NotImplementedException();
        /// <summary>
        /// Creates a new instance of the <see cref="NJImage"/> class
        /// </summary>
        public NJImage()
        {
            comp = (Component*)Marshal.AllocHGlobal(3 * Marshal.SizeOf(typeof(Component)));
            block = (int*)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(int)));

            FillMem(comp, new Component(), 3);

            qtab = (byte**)Marshal.AllocHGlobal(4 * IntPtr.Size);
            vlctab = (VLCCode**)Marshal.AllocHGlobal(4 * IntPtr.Size);
            for (int i = 0; i < 4; i++)
            {
                qtab[i] = (byte*)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(byte)));
                vlctab[i] = (VLCCode*)Marshal.AllocHGlobal(65536 * Marshal.SizeOf(typeof(VLCCode)));

                FillMem((long*)qtab[i], 0, 64 / 8);//use long instead of byte
                FillMem((long*)vlctab[i], 0, 65536 / 4);//use long instead of VLCCode (length=2)
            }
        }
Exemple #35
0
 int IMetadataImport.GetCustomAttributeProps(int customAttribute, int *parent, int *constructor, byte **value, int *valueLength) => throw new NotImplementedException();
Exemple #36
0
 static XmlCharType()
 {
     s_PageIndexes = new IntPtr[256];
     s_CharProperties = InitializeCharProperties();
 }