Simplify nie.decoder.decode_image_config

This commit is contained in:
Nigel Tao committed 2020-12-23 21:28:31 +11:00
1 parent 332fb46b5c
commit 47a231f679
2 files changed
+8 -17

No files matched your search

+4 -9
View File
@@ -28406,19 +28406,14 @@ wuffs_nie__decoder__decode_image_config(
}
v_a = t_1;
}
if ((v_a & 255) != 255) {
status = wuffs_base__make_status(wuffs_nie__error__bad_header);
goto exit;
}
v_a >>= 8;
if (v_a == 3436130) {
if (v_a == 879649535) {
self->private_impl.f_pixfmt = 2164295816;
} else if (v_a == 3698274) {
} else if (v_a == 946758399) {
self->private_impl.f_pixfmt = 2164308923;
} else if (v_a == 3436642) {
} else if (v_a == 879780607) {
status = wuffs_base__make_status(wuffs_nie__error__unsupported_nie_file);
goto exit;
} else if (v_a == 3698786) {
} else if (v_a == 946889471) {
status = wuffs_base__make_status(wuffs_nie__error__unsupported_nie_file);
goto exit;
} else {
+4 -8
View File
@@ -75,17 +75,13 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
}
a = args.src.read_u32le?()
if (a & 0xFF) <> 0xFF {
return "#bad header"
}
a >>= 8
if a == 'bn4'le {
if a == '\xFFbn4'le {
this.pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
} else if a == 'bn8'le {
} else if a == '\xFFbn8'le {
this.pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
} else if a == 'bp4'le {
} else if a == '\xFFbp4'le {
return "#unsupported NIE file"
} else if a == 'bp8'le {
} else if a == '\xFFbp8'le {
return "#unsupported NIE file"
} else {
return "#bad header"