Skip to content

Commit 4a3b5ce

Browse files
committed
Regression fix: Apply weight equally to line weight
The faulty code slightly improved quality at higher rates, but dramatically reduced it at lower rates.
1 parent 5cafceb commit 4a3b5ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libulc/ulcEncoder_Psycho.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static inline void Block_Transform_CalculatePsychoacoustics(
9595
//! become way too low, and brightness degrades.
9696
v = BufferAmp2[n] * Norm;
9797
float ve = v * (1.0f - 0x1.6B5434p-2f*ThisFreqWeightTable[n]); //! 0x1.6B5434p-2 = 10^(-9/20)
98-
float vw = 0x1.0p16f * sqrtf(v) * (1.0f - ThisFreqWeightTable[n]);
98+
float vw = 0x1.0p16f * sqrtf(ve);
9999
EnergyNp[n] = (ve <= 1.0f) ? 0 : (uint32_t)(logf(ve) * LogScale);
100100
Weight [n] = (vw <= 1.0f) ? 1 : (uint32_t)vw;
101101
}

0 commit comments

Comments
 (0)