-
Notifications
You must be signed in to change notification settings - Fork 273
Open
Labels
Description
Q_MODEL_MUL
and Q_MODEL_ADD
is used only for 8-bit depth. This seems odd, because perceptual effects of chroma's spatial resolution are not dependent on the bit depth.
The adjustment is not used for intra frames either. I'm not sure why. It would be nice to have appropriate chroma quality for still AVIF images.
Lines 534 to 538 in c247d53
if !is_intra && bit_depth == 8 { | |
log_q_y = log_target_q | |
+ (log_target_q >> 32) * Q_MODEL_MUL[chroma_sampling as usize] | |
+ Q_MODEL_ADD[chroma_sampling as usize]; | |
} |
I suspect that the slopes and bases for 4:4:4 may be overfitting something, or lack clamping before the calculation:
Lines 510 to 523 in c247d53
fn chroma_offset( | |
log_target_q: i64, chroma_sampling: ChromaSampling, | |
) -> (i64, i64) { | |
let x = log_target_q.max(0); | |
// Gradient optimized for CIEDE2000+PSNR on subset3 | |
let y = match chroma_sampling { | |
ChromaSampling::Cs400 => 0, | |
ChromaSampling::Cs420 => (x >> 2) + (x >> 6), // 0.266 | |
ChromaSampling::Cs422 => (x >> 3) + (x >> 4) - (x >> 7), // 0.180 | |
ChromaSampling::Cs444 => (x >> 4) + (x >> 5) + (x >> 8), // 0.098 | |
}; | |
// blog64(7) - blog64(4); blog64(5) - blog64(4) | |
(0x19D_5D9F_D501_0B37 - y, 0xA4_D3C2_5E68_DC58 - y) | |
} |
That's because in dc_qi
and ac_qi
, u
can end up having higher qi
than y
:
QuantizerParameters {
log_base_q: 596939234966375734,
log_target_q: 540310075640714472,
x | 10 bit 444 | 8 bit 444 | 10 bit 420 | 8 bit 420 |
---|---|---|---|---|
dc_qi | [110, 131, 108] | [110, 132, 108] | [110, 101, 75] | [110, 101, 73] |
ac_qi | [99, 118, 97] | [98, 118, 97] | [99, 90, 65] | [98, 88, 61] |
lambda | 20.83157578250051 | 21.039473974368523 | 20.83157578250051 | 21.039473974368523 |
dist_scale | [1.0, 0.54229736328125, 1.0629119873046875] | [1.0, 0.5428314208984375, 1.0639495849609375] | [1.0, 1.2977294921875, 2.5435638427734375] | [1.0, 1.3011627197265625, 2.5502777099609375] |
gitoss