Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HeifNclxColorProfile"/> class.
 /// </summary>
 /// <param name="colorPrimaries">The color primaries.</param>
 /// <param name="transferCharacteristics">The transfer characteristics.</param>
 /// <param name="matrixCoefficients">The matrix coefficients.</param>
 /// <param name="fullRange"><see langword="true"/> if the full color range is used; otherwise, <see langword="false"/>.</param>
 public HeifNclxColorProfile(ColorPrimaries colorPrimaries,
                             TransferCharacteristics transferCharacteristics,
                             MatrixCoefficients matrixCoefficients,
                             bool fullRange) : base(ColorProfileType.Nclx)
 {
     this.ColorPrimaries          = colorPrimaries;
     this.TransferCharacteristics = transferCharacteristics;
     this.MatrixCoefficients      = matrixCoefficients;
     this.FullRange = fullRange;
 }
Пример #2
0
        public int Load(byte[] buffer, int startIndex, int bufferLength)
        {
            // If less than 14 bytes are available for processing then the header and following start code
            // can't be read.
            if ((bufferLength - startIndex) < 14)
            {
                return(0);
            }

            int index = startIndex;

            extensionStartCodeIdentifier = buffer[index + 4] >> 4;
            videoFormat       = (VideoFormat)((buffer[index + 4] & 0xE) >> 1);
            colourDescription = buffer[index + 4] & 0x01;

            index += 5;
            if (colourDescription == 1)
            {
                colourPrimaries         = (ColourPrimaries)(buffer[index++]);
                transferCharacteristics = (TransferCharacteristics)(buffer[index++]);
                matrixCoefficients      = (MatrixCoefficients)(buffer[index++]);
            }

            displayHorizontalSize = Read16(buffer, index++) >> 2;
            displayVerticalSize   = (Read16(buffer, index += 2) & 0x1FFE) >> 1;

            while (index < (bufferLength - 4))
            {
                if ((Read32(buffer, index) >> 8) == 1)
                {
                    return(index - startIndex);
                }

                index++;
            }

            return(0);
        }