Add support for HEVC in Annex B, fix HEVC codec string extraction logic

This commit is contained in:
Vanilagy
2025-05-12 14:56:34 +02:00
parent c3ffdb3054
commit b0a6cf8535
8 changed files with 730 additions and 109 deletions
+9
View File
@@ -104,6 +104,15 @@ export const readExpGolomb = (bitstream: Bitstream) => {
return result;
};
/** Reads a signed exponential-Golomb universal code from a Bitstream. */
export const readSignedExpGolomb = (bitstream: Bitstream) => {
const codeNum = readExpGolomb(bitstream);
return ((codeNum & 1) === 0)
? -(codeNum >> 1)
: ((codeNum + 1) >> 1);
};
export const writeBits = (bytes: Uint8Array, start: number, end: number, value: number) => {
for (let i = start; i < end; i++) {
const byteIndex = Math.floor(i / 8);