Decodificatore HEVC scritto in casa, prima parte: le immagini intra coincidono coi flussi di conformità (#58)
Per leggere i video HEVC senza ffmpeg serve un decodificatore nostro, scritto dalla norma ITU-T H.265. Questa prima parte copre tutto ciò che serve alle immagini intra: unità NAL Annex B e hvcC, VPS/SPS/PPS (liste di scala, VUI, indicatori RExt), intestazione di slice, POC, RPS, DPB con uscita e bumping (C.5.2), CABAC con tutte le tabelle d'inizio, albero di codifica, unità di predizione, residui con sign data hiding e transform skip, predizione intra, DCT/DST e dequantizzazione, PCM, deblocking e SAO, tile, WPP e segmenti dipendenti. I 12 flussi di sole slice I dei profili Main, Main 10 e Main Still Picture coincidono col YUV ufficiale. Nei 136 flussi Main e Main 10 ogni immagine di sole slice I coincide con l'MD5 SEI del codificatore, dove il flusso lo porta. Le slice P e B si rifiutano finché manca la predizione inter (tappa successiva). Le prove ne leggono comunque la sintassi fino alla fine di ogni slice, con le unità di predizione grigie. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6274c4ee03
commit
f77b5e4db6
17 files changed
+5708
-9
No files matched your search
@@ -1,18 +1,23 @@
|
||||
using System.Security.Cryptography;
|
||||
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). There is no HEVC
|
||||
/// decoder yet: every stream is inconclusive until it exists, 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 reference data and the
|
||||
/// reader of the decoded picture hashes are checked now.
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class H265ConformanceTests
|
||||
{
|
||||
/// <summary>Streams the decoder is expected to reproduce exactly; empty while the decoder is not written.</summary>
|
||||
private static readonly HashSet<string> s_supported = [];
|
||||
/// <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 });
|
||||
|
||||
@@ -28,11 +33,15 @@ public sealed class H265ConformanceTests
|
||||
|
||||
if (!s_supported.Contains(name))
|
||||
{
|
||||
Assert.Inconclusive($"{name}: il decodificatore HEVC non è ancora scritto.");
|
||||
Assert.Inconclusive($"{name}: ha slice P o B, e la predizione inter HEVC non è ancora scritta.");
|
||||
}
|
||||
|
||||
// The decoder goes here: frames in output order, in the layout of the official YUV file.
|
||||
Assert.Fail($"{name}: manca la decodifica.");
|
||||
var frames = new List<byte[]>();
|
||||
var decoder = new H265Decoder();
|
||||
decoder.FrameOutput += frame => frames.Add(frame.ToYuvFile());
|
||||
decoder.DecodeAnnexB(File.ReadAllBytes(stream.BitstreamPath));
|
||||
decoder.Flush();
|
||||
Assert.IsNull(stream.Compare(frames));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in new issue
Block a user