diff --git a/VERSION b/VERSION index f64402b..30f8347 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.115 +0.0.116 diff --git a/frontend/static/vendor/hevcjs/hevc-core.js b/frontend/static/vendor/hevcjs/hevc-core.js index 0101a2b..1508f0f 100644 --- a/frontend/static/vendor/hevcjs/hevc-core.js +++ b/frontend/static/vendor/hevcjs/hevc-core.js @@ -286,7 +286,11 @@ var FrameRenderer = class _FrameRenderer { format: "I420", codedWidth: w, codedHeight: h, - timestamp + timestamp, + // Hikvision H.265 — BT.709, TV/limited range. Без явного colorSpace браузер для + // I420 по умолчанию берёт BT.601 (зелёно-красный сдвиг) и неверный диапазон + // (белёсость). Задаём явно, чтобы YUV→RGB шёл по правильной матрице и диапазону. + colorSpace: { primaries: "bt709", transfer: "bt709", matrix: "bt709", fullRange: false } }); await this._writer.write(videoFrame); videoFrame.close(); @@ -394,12 +398,13 @@ var FRAGMENT_SRC = ` uniform sampler2D u_texCb; uniform sampler2D u_texCr; void main() { - float y = texture2D(u_texY, v_tex).r; - float cb = texture2D(u_texCb, v_tex).r - 0.5; - float cr = texture2D(u_texCr, v_tex).r - 0.5; - float r = y + 1.5748 * cr; - float g = y - 0.1873 * cb - 0.4681 * cr; - float b = y + 1.8556 * cb; + // BT.709 limited range (TV): Y∈[16,235]/255 → (Y-16)*255/219; Cb/Cr∈[16,240]/255 центр 128/255. + float y = (texture2D(u_texY, v_tex).r - 0.0627451) * 1.1643836; + float cb = texture2D(u_texCb, v_tex).r - 0.5019608; + float cr = texture2D(u_texCr, v_tex).r - 0.5019608; + float r = y + 1.7927411 * cr; + float g = y - 0.2132486 * cb - 0.5329093 * cr; + float b = y + 2.1124018 * cb; gl_FragColor = vec4(clamp(r, 0.0, 1.0), clamp(g, 0.0, 1.0), clamp(b, 0.0, 1.0), 1.0); } `;