Lettore e scrittore JPEG di casa (C1, passo 3)
Febe deve leggere e scrivere JPEG senza SkiaSharp né altri componenti esterni (decisione del 18 novembre 2026), quindi il codec è scritto dalla specifica ITU-T T.81. Lettore (JpegDecoder): sequenziale di base ed esteso, progressivo (selezione spettrale e approssimazioni successive), senza perdita (predittori 1-7), ognuno con Huffman e con codifica aritmetica; 8 e 12 bit (senza perdita da 2 a 16); qualunque campionamento, ripristino, DNL; grigio, YCbCr, RGB, CMYK e YCCK con il segmento Adobe. IDCT esatta e crominanza con il filtro triangolare. EXIF, ICC a pezzi, XMP e commenti; l'orientamento EXIF va in ImageMetadata.Orientation (anche per PNG) e non si applica ai pixel. I file gerarchici e quelli a 2 componenti si rifiutano come formato non letto; i dati troncati dentro una scansione sono un file danneggiato. Scrittore (JpegEncoder): sequenziale di base, qualità 1-100 sulle tabelle dell'allegato K, 4:2:0, 4:4:4 e grigio, intervallo di ripristino, EXIF, ICC, XMP e commenti. Prove: contro le letture di SkiaSharp i JPEG dell'insieme di riferimento stanno fra 59 e 67 dB di PSNR per canale, scarto massimo 3 (soglia 40 dB e 0,1% di pixel oltre 16). Un codificatore di prova scrive gli stessi coefficienti in progressivo, aritmetico, 12 bit, con ripristino, scansioni separate e DNL, e il lettore deve ridarli identici; senza perdita si confronta campione per campione. Più andata e ritorno dello scrittore, file danneggiati e mutazioni casuali con seme fisso. La facciata ImageDecoder ora legge i JPEG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bf76f18ff
commit
36196526bb
25 files changed
+6411
-14
No files matched your search
@@ -1,7 +1,7 @@
|
||||
namespace Febe.Core.Codecs.Images;
|
||||
|
||||
/// <summary>A text an image carries (PNG tEXt, zTXt, iTXt; GIF comment).</summary>
|
||||
/// <param name="Keyword">The keyword («Title», «Comment», «XML:com.adobe.xmp»...); empty for a GIF comment.</param>
|
||||
/// <summary>A text an image carries (PNG tEXt, zTXt, iTXt; GIF comment; JPEG COM).</summary>
|
||||
/// <param name="Keyword">The keyword («Title», «Comment», «XML:com.adobe.xmp»...); empty for a GIF or JPEG comment.</param>
|
||||
/// <param name="Text">The text.</param>
|
||||
/// <param name="Language">The language tag of an iTXt chunk, empty otherwise.</param>
|
||||
/// <param name="TranslatedKeyword">The translated keyword of an iTXt chunk, empty otherwise.</param>
|
||||
@@ -16,13 +16,19 @@ public sealed class ImageMetadata
|
||||
/// <summary>The EXIF block as a TIFF structure (starts with «II*\0» or «MM\0*»), or null.</summary>
|
||||
public byte[]? Exif { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The EXIF orientation, 1-8 (T.81 has none of its own: it is the Orientation tag of <see cref="Exif"/>); 1 when the
|
||||
/// image has no EXIF block, no such tag or an invalid value. The decoders never apply it to the pixels.
|
||||
/// </summary>
|
||||
public int Orientation { get; init; } = 1;
|
||||
|
||||
/// <summary>The ICC colour profile, decompressed, or null.</summary>
|
||||
public byte[]? IccProfile { get; init; }
|
||||
|
||||
/// <summary>The name of the ICC profile as the file gives it, or null.</summary>
|
||||
public string? IccProfileName { get; init; }
|
||||
|
||||
/// <summary>The XMP packet (from the iTXt chunk «XML:com.adobe.xmp» of a PNG), or null.</summary>
|
||||
/// <summary>The XMP packet (from the iTXt chunk «XML:com.adobe.xmp» of a PNG, the APP1 segment of a JPEG), or null.</summary>
|
||||
public string? Xmp { get; init; }
|
||||
|
||||
/// <summary>The texts, in file order (the XMP packet is in <see cref="Xmp"/>, not here).</summary>
|
||||
|
||||
Reference in new issue
Block a user