lib/lowleveljpeg: add Abs method, nil checks

This commit is contained in:
Nigel Tao committed 2025-02-23 12:24:43 +11:00
1 parent 12b404f58d
commit f483ef0849
4 files changed
+42 -2

No files matched your search

+6
View File
@@ -236,6 +236,12 @@ func downsample4x4(dst []uint8, src *BlockU8) {
// DownsampleFrom reduces one 16×16 quad-block to one 8×8 block.
func (dst *BlockU8) DownsampleFrom(src *QuadBlockU8) {
if dst == nil {
return
} else if src == nil {
dst.SetToNeutral()
return
}
for y := 0; y < 8; y++ {
for x := 0; x < 8; x++ {
d := (y << 3) | (x << 0)