Exemple #1
0
 public static ImageFormat ARGB(int bitsPerComponent, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed, bool premultipliedAlpha = false)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(premultipliedAlpha ? PreMultipliedAlphaChannelId :AlphaChannelId, bitsPerComponent),
         new Codec.MediaComponent(RedChannelId, bitsPerComponent),
         new Codec.MediaComponent(GreenChannelId, bitsPerComponent),
         new Codec.MediaComponent(BlueChannelId, bitsPerComponent)
     }));
 }
Exemple #2
0
 public ImageFormat(Common.Binary.ByteOrder byteOrder, Codec.DataLayout dataLayout, params Codec.MediaComponent[] components)
     : base(Codec.MediaType.Image, byteOrder, dataLayout, components)
 {
     //No sub sampling
     Heights = Widths = new int[Components.Length];
 }
Exemple #3
0
 public static ImageFormat RGB(int bitsPerComponent, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(RedChannelId, bitsPerComponent),
         new Codec.MediaComponent(GreenChannelId, bitsPerComponent),
         new Codec.MediaComponent(BlueChannelId, bitsPerComponent)
     }));
 }
Exemple #4
0
 public ImageFormat(Common.Binary.ByteOrder byteOrder, Codec.DataLayout dataLayout, int components, int[] componentSizes, byte[] componentIds)
     : base(Codec.MediaType.Image, byteOrder, dataLayout, components, componentSizes, componentIds)
 {
     //No sub sampling
     Heights = Widths = new int[components];
 }
Exemple #5
0
 public ImageFormat(Common.Binary.ByteOrder byteOrder, Codec.DataLayout dataLayout, System.Collections.Generic.IEnumerable <Codec.MediaComponent> components)
     : base(Codec.MediaType.Image, byteOrder, dataLayout, components)
 {
     //No sub sampling
     Heights = Widths = new int[Components.Length];
 }
Exemple #6
0
 //32 bit -> 2 bit alpha 10 bit r, g, b
 public static ImageFormat ARGB_230(Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent((byte)'a', 2),
         new Codec.MediaComponent(RedChannelId, 10),
         new Codec.MediaComponent(GreenChannelId, 10),
         new Codec.MediaComponent(BlueChannelId, 10)
     }));
 }
Exemple #7
0
 public static ImageFormat YUV_565(Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(LumaChannelId, 5),
         new Codec.MediaComponent(ChromaMajorChannelId, 6),
         new Codec.MediaComponent(ChromaMinorChannelId, 5)
     }));
 }
Exemple #8
0
        //Supports 565 formats... etc.

        public static ImageFormat VariableYUV(int[] sizes, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
        {
            return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
            {
                new Codec.MediaComponent(LumaChannelId, sizes[0]),
                new Codec.MediaComponent(ChromaMajorChannelId, sizes[1]),
                new Codec.MediaComponent(ChromaMinorChannelId, sizes[2])
            }));
        }
Exemple #9
0
 public static ImageFormat VariableRGB(int[] sizes, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(RedChannelId, sizes[0]),
         new Codec.MediaComponent(GreenChannelId, sizes[1]),
         new Codec.MediaComponent(BlueChannelId, sizes[2])
     }));
 }
Exemple #10
0
 public static ImageFormat AVUY(int bitsPerComponent, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed, bool premultipliedAlpha = false)
 {
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(AlphaChannelId, bitsPerComponent),
         new Codec.MediaComponent(ChromaMinorChannelId, bitsPerComponent),
         new Codec.MediaComponent(ChromaMajorChannelId, bitsPerComponent),
         new Codec.MediaComponent(premultipliedAlpha ? PreMultipliedAlphaChannelId : LumaChannelId, bitsPerComponent)
     }));
 }
Exemple #11
0
 public static ImageFormat YUV(int bitsPerComponent, Common.Binary.ByteOrder byteOrder = Common.Binary.ByteOrder.Little, Codec.DataLayout dataLayout = Codec.DataLayout.Packed)
 {
     //Uglier version of the constructor
     //public static readonly ImageFormat YUV = new ImageFormat(Common.Binary.ByteOrder.Little, Codec.DataLayout.Packed, 3, 8, new byte[] { LumaChannelId, ChromaMajorChannelId, ChromaMinorChannelId });
     return(new ImageFormat(byteOrder, dataLayout, new Codec.MediaComponent[]
     {
         new Codec.MediaComponent(LumaChannelId, bitsPerComponent),
         new Codec.MediaComponent(ChromaMajorChannelId, bitsPerComponent),
         new Codec.MediaComponent(ChromaMinorChannelId, bitsPerComponent)
     }));
 }
Exemple #12
0
 /// <summary>
 /// Constructs a new AudioFormat with the given configuration
 /// </summary>
 /// <param name="sampleRate">The sample rate</param>
 /// <param name="sampleSizeInBits">The size in bits of a single sample</param>
 /// <param name="channelCount">The amount of channels</param>
 /// <param name="signed">True if the data is signed, otherwise false</param>
 /// <param name="bigEndian">True to specify <see cref="Common.Binary.ByteOrder.BigEndian"/> or false to specify <see cref="Common.Binary.ByteOrder.Little"/> </param>
 public AudioFormat(int sampleRate, bool signed, bool bigEndian, Codec.DataLayout dataLayout)
     : this(sampleRate, signed, bigEndian ? Common.Binary.ByteOrder.Big : Common.Binary.ByteOrder.Little, dataLayout)
 {
 }
Exemple #13
0
        public AudioFormat(int sampleRate, bool signed, Common.Binary.ByteOrder byteOrder, Codec.DataLayout dataLayout, System.Collections.Generic.IEnumerable <Codec.MediaComponent> components)
            : base(Codec.MediaType.Audio, byteOrder, dataLayout, components)
        {
            SampleRate = sampleRate;

            IsSigned = signed;
        }
Exemple #14
0
        /// <summary>
        /// Gets the amount of channels.
        /// </summary>
        //public int Channels { get { return m_Channels; } }

        /// <summary>
        /// Gets the size in bits of a single sample.
        /// </summary>
        //public int SampleSize { get { return m_SampleSize; } }

        /// <summary>
        /// Gets the sample rate.
        /// </summary>
        //public int SampleRate { get { return m_SampleRate; } }

        /// <summary>
        /// Gets the <see cref="Media.Common.Binary.ByteOrder"/> of the format.
        /// </summary>
        //public Common.Binary.ByteOrder ByteOrder { get { return m_ByteOrder; } }

        /// <summary>
        /// Indicates if the sample data is signed, useful for determining the mid point.
        /// </summary>
        //public bool IsSigned { get { return m_Signed; } }

        #endregion

        #endregion

        #region Constructor

        /// <summary>
        /// Constructs a new AudioFormat with the given configuration
        /// </summary>
        /// <param name="sampleRate">The sample rate</param>
        /// <param name="sampleSizeInBits">The size in bits of a single sample</param>
        /// <param name="channelCount">The amount of channels</param>
        /// <param name="signed">True if the data is signed, otherwise false</param>
        /// <param name="byteOrder">The <see cref="Common.Binary.ByteOrder"/> of the format</param>
        public AudioFormat(int sampleRate, bool signed, Common.Binary.ByteOrder byteOrder, Codec.DataLayout dataLayout, params Codec.MediaComponent[] components)
            : base(Codec.MediaType.Audio, byteOrder, dataLayout, components)
        {
            SampleRate = sampleRate;

            IsSigned = signed;
        }