Decodificatore HEVC, seconda parte: predizione inter, tutti i flussi Main e Main 10 coincidono (#58)

La predizione inter scritta dalla norma ITU-T H.265 (§8.3.4, §8.5.3): liste di
riferimento con le modifiche, merge con candidati spaziali, temporale,
bi-predittivi combinati e nulli e livello di merge parallelo, AMVP con la scala
per distanza di POC, TMVP sull'immagine co-locata, interpolazione a 8 prese per
la luma e 4 per il croma, predizione pesata di base ed esplicita. Il deblocking
prende l'intensità 1 anche dal moto; ogni immagine conserva il moto dei blocchi
4x4, la slice di ogni CTB e le liste delle sue slice per chi la usa come
co-locata. Un riferimento mancante diventa un'immagine grigia fuori dal DPB.
I filtri d'interpolazione usano i vettori della BCL (Vector128).

Perché: senza inter nessun video HEVC reale si decodifica. Ora i 136 flussi
Main, Main 10 e Main Still Picture della serie ITU-T H.265.1 danno esattamente
il YUV ufficiale e ogni immagine il suo hash SEI; questo conferma anche il
numero di fotogrammi e gli MD5 scelti per i flussi senza YUV. Restano
inconcludenti solo i 10 flussi RExt, in attesa della decisione di Alberto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-18 16:18:32 +01:00
1 parent f77b5e4db6
commit d5e1282261
10 files changed
+1219 -125

No files matched your search

@@ -4,21 +4,14 @@ using Febe.Core.Codecs.H265;
namespace Febe.Tests.Codecs.H265;
/// <summary>
/// The streams of the ITU-T H.265.1 conformance set in Media/H265/Conformita (see LEGGIMI.md there). The decoder has no
/// inter prediction yet: the streams with only I slices must match their YUV exactly, the others are inconclusive (their
/// intra pictures are checked in <see cref="H265DecoderTests"/>), and the range extension streams (4:0:0, 4:2:2,
/// 4:4:4, 12 bits, RExt tools) stay inconclusive until Alberto says whether «HEVC» covers them.
/// The streams of the ITU-T H.265.1 conformance set in Media/H265/Conformita (see LEGGIMI.md there). Every Main, Main 10
/// and Main Still Picture stream must give exactly the frames of its official YUV (the MD5 of each frame where the YUV
/// came with the stream, of the whole YUV for all); the range extension streams (4:0:0, 4:2:2, 4:4:4, 12 bits, RExt
/// tools) stay inconclusive until Alberto says whether «HEVC» covers them.
/// </summary>
[TestClass]
public sealed class H265ConformanceTests
{
/// <summary>Streams the decoder is expected to reproduce exactly: those of Main, Main 10 and Main Still Picture made only of I slices.</summary>
private static readonly HashSet<string> s_supported =
[
"IPRED_A_docomo_2", "IPRED_B_Nokia_3", "IPRED_C_Mitsubishi_3", "ipcm_A_NEC_3", "ipcm_B_NEC_3", "ipcm_C_NEC_3",
"ipcm_D_NEC_3", "ipcm_E_NEC_2", "MAXBINS_A_TI_5", "POC_A_Bossen_3", "SAO_H_Parabola_1", "VPSSPSPPS_A_MainConcept_1",
];
public static IEnumerable<object[]> Streams => H265ConformanceStream.Names().Select(n => new object[] { n });
[TestMethod]
@@ -31,11 +24,6 @@ public sealed class H265ConformanceTests
Assert.Inconclusive($"{name}: estensione di formato (RExt, {stream.Chroma} a {stream.LumaBitDepth} bit), da decodificare solo se Alberto la vuole.");
}
if (!s_supported.Contains(name))
{
Assert.Inconclusive($"{name}: ha slice P o B, e la predizione inter HEVC non è ancora scritta.");
}
var frames = new List<byte[]>();
var decoder = new H265Decoder();
decoder.FrameOutput += frame => frames.Add(frame.ToYuvFile());