go.image/vp8: clamp the UV DC quantization factor to 132.
This fixes the lossy_extreme_probabilities.webp conformance test.
LGTM=pascal.massimino, r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/145600043
diff --git a/vp8/quant.go b/vp8/quant.go
index 8bf12a0..da43616 100644
--- a/vp8/quant.go
+++ b/vp8/quant.go
@@ -49,7 +49,10 @@
if d.quant[i].y2[1] < 8 {
d.quant[i].y2[1] = 8
}
- d.quant[i].uv[0] = dequantTableDC[clip(q+dquvDC, 0, 127)]
+ // The 117 is not a typo. The dequant_init function in the spec's Reference
+ // Decoder Source Code (http://tools.ietf.org/html/rfc6386#section-9.6 Page 145)
+ // says to clamp the LHS value at 132, which is equal to dequantTableDC[117].
+ d.quant[i].uv[0] = dequantTableDC[clip(q+dquvDC, 0, 117)]
d.quant[i].uv[1] = dequantTableAC[clip(q+dquvAC, 0, 127)]
}
}