Browse Source

PlaneCount calculation inside ObuColorConfig

pull/2633/head
Ynse Hoornenborg 2 years ago
parent
commit
68be92331b
  1. 16
      src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuColorConfig.cs
  2. 1
      src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuReader.cs
  3. 1
      src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuWriter.cs

16
src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuColorConfig.cs

@ -5,18 +5,28 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.OpenBitstreamUnit;
internal class ObuColorConfig
{
private bool isMonochrome;
public bool IsColorDescriptionPresent { get; set; }
/// <summary>
/// Gets or sets the number of color channels in this image.
/// Gets the number of color channels in this image. Can have the value 1 or 3.
/// </summary>
public int PlaneCount { get; set; }
public int PlaneCount { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether the image has a single greyscale plane, will have
/// <see cref="Av1Constants.MaxPlanes"/> color planes otherwise.
/// </summary>
public bool IsMonochrome { get; set; }
public bool IsMonochrome
{
get => this.isMonochrome;
set
{
this.PlaneCount = value ? 1 : Av1Constants.MaxPlanes;
this.isMonochrome = value;
}
}
public ObuColorPrimaries ColorPrimaries { get; set; }

1
src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuReader.cs

@ -465,7 +465,6 @@ internal class ObuReader
colorConfig.IsMonochrome = reader.ReadBoolean();
}
colorConfig.PlaneCount = colorConfig.IsMonochrome ? 1 : Av1Constants.MaxPlanes;
colorConfig.IsColorDescriptionPresent = reader.ReadBoolean();
colorConfig.ColorPrimaries = ObuColorPrimaries.Unspecified;
colorConfig.TransferCharacteristics = ObuTransferCharacteristics.Unspecified;

1
src/ImageSharp/Formats/Heif/Av1/OpenBitstreamUnit/ObuWriter.cs

@ -112,7 +112,6 @@ internal class ObuWriter
writer.WriteBoolean(colorConfig.IsMonochrome);
}
colorConfig.PlaneCount = colorConfig.IsMonochrome ? 1 : Av1Constants.MaxPlanes;
writer.WriteBoolean(false); // colorConfig.IsColorDescriptionPresent
if (colorConfig.IsMonochrome)
{

Loading…
Cancel
Save