TAV decoding minor changes

This commit is contained in:
minjaesong
2025-10-13 01:42:44 +09:00
parent 222b9866a8
commit e705d274de
3 changed files with 7 additions and 16 deletions

View File

@@ -53,7 +53,6 @@ let subtitlePosition = 0 // 0=bottom center (default)
// Parse command line options
let interactive = false
let userDefinedFilmGrain = false
let filmGrainLevel = null
if (exec_args.length > 2) {
@@ -69,7 +68,6 @@ if (exec_args.length > 2) {
const level = parseInt(parts[1])
if (!isNaN(level) && level >= 1 && level <= 32767) {
filmGrainLevel = level
userDefinedFilmGrain = true
}
}
// Try next argument if no '=' found
@@ -77,7 +75,6 @@ if (exec_args.length > 2) {
const level = parseInt(exec_args[i + 1])
if (!isNaN(level) && level >= 1 && level <= 32767) {
filmGrainLevel = level
userDefinedFilmGrain = true
i++ // Skip next arg
}
}
@@ -298,13 +295,6 @@ if (header.version < 1 || header.version > 8) {
return
}
function setFilmGrainLevel(header) {
// decide film grain strength by quality level
filmGrainLevel = [9,6,-4,3,-2,-2,-2][header.qualityLevel - 1]
}
setFilmGrainLevel(header)
// Helper function to decode channel layout name
function getChannelLayoutName(layout) {
switch (layout) {
@@ -846,7 +836,6 @@ try {
currentCueIndex++
}
totalFilesProcessed++
setFilmGrainLevel(header)
console.log(`\nStarting file ${currentFileIndex}:`)
console.log(`Resolution: ${header.width}x${header.height}`)
@@ -908,8 +897,8 @@ try {
serial.println(` FIELD_SIZE: ${FIELD_SIZE}`)
}
//let thisFrameNoiseLevel = (filmGrainLevel >= 0) ? filmGrainLevel : -(filmGrainLevel - (trueFrameCount % 2))
// grain synthesis is now part of the spec
// TODO if filmGrainLevel != null, user requested custom film grain level
// Call new TAV hardware decoder that handles Zstd decompression internally
// Note: No longer using JS gzip.decompFromTo - Kotlin handles Zstd natively

View File

@@ -943,6 +943,7 @@ transmission capability, and region-of-interest coding.
* Payload
## Packet Types
<video packets>
0x10: I-frame (intra-coded frame)
0x11: P-frame (delta/skip frame)
0x1F: (prohibited)
@@ -965,7 +966,8 @@ transmission capability, and region-of-interest coding.
0xE2: ID3v2 packet
0xE3: Vorbis Comment packet
0xE4: CD-text packet
<End of Standard metadata>
<Special packets>
0x00: No-op
0xF0: Loop point start
0xF1: Loop point end
0xFE: NTSC sync packet (used by player to calculate exact framerate-wise performance)

View File

@@ -4504,11 +4504,11 @@ class GraphicsJSR223Delegate(private val vm: VM) {
getPerceptualWeight(qIndex, qYGlobal, subband.level, subband.subbandType, false, decompLevels)
} else {
1.0f
}
}*/
// Noise amplitude for this subband
val noiseAmplitude = (quantiser * perceptualWeight) * 0.5f*/
val noiseAmplitude = quantiser.coerceAtMost(32f) * 0.5f
// val noiseAmplitude = quantiser.coerceAtMost(32f) * 0.5f
val noiseAmplitude = qYGlobal.coerceAtMost(32) * 0.5f // using qYGlobal because quantiser is variable on bitrate-control mode and varying grain amp annoys viewer
// Remove noise from each coefficient in this subband
for (i in 0 until subband.coeffCount) {