- if (!p_j2k->dump_state) {
- switch (p_j2k->enumcs) { /* AFL tests */
- int ok, sycc;
-
- case 12: /* CMYK */
- if (l_image->numcomps == 4 /* cnf. color.c, line 879 */
- && l_image->comps[0].dx == l_image->comps[1].dx
- && l_image->comps[0].dx == l_image->comps[2].dx
- && l_image->comps[0].dx == l_image->comps[3].dx
- && l_image->comps[0].dy == l_image->comps[1].dy
- && l_image->comps[0].dy == l_image->comps[2].dy
- && l_image->comps[0].dy == l_image->comps[3].dy) {
- break;
- }
- opj_event_msg(p_manager, EVT_ERROR, "wrong values for enumcs 12(i.e. CMYK)\n");
- return OPJ_FALSE;
-
- case 16: /* sRGB */
- if (l_image->numcomps < 3) {
- break; /* GRAY, GRAYA */
- }
-
- if (l_image->numcomps == 3 /* RGB */
- && l_image->comps[0].dx == l_image->comps[1].dx
- && l_image->comps[0].dx == l_image->comps[2].dx
- && l_image->comps[0].dy == l_image->comps[1].dy
- && l_image->comps[0].dy == l_image->comps[2].dy
- && l_image->comps[0].prec == l_image->comps[1].prec
- && l_image->comps[0].prec == l_image->comps[2].prec
- && l_image->comps[0].sgnd == l_image->comps[1].sgnd
- && l_image->comps[0].sgnd == l_image->comps[2].sgnd) {
- break;
- }
- if (l_image->numcomps == 4 /* RGBA */
- && l_image->comps[0].dx == l_image->comps[3].dx
- && l_image->comps[0].dy == l_image->comps[3].dy
- && l_image->comps[0].prec == l_image->comps[3].prec
- && l_image->comps[0].sgnd == l_image->comps[3].sgnd) {
- break;
- }
- opj_event_msg(p_manager, EVT_ERROR, "wrong values for enumcs 16(i.e. sRGB)\n");
- return OPJ_FALSE;
-
- case 18: /* sYCC */
- sycc = 0;
- ok = (l_image->numcomps > 2); /* cnf. color.c, line 319 */
-
- if (ok) {
- sycc = /* sycc420 */
- ((l_image->comps[0].dx == 1)
- && (l_image->comps[1].dx == 2)
- && (l_image->comps[2].dx == 2)
- && (l_image->comps[0].dy == 1)
- && (l_image->comps[1].dy == 2)
- && (l_image->comps[2].dy == 2))
- || /* sycc422 */
- ((l_image->comps[0].dx == 1)
- && (l_image->comps[1].dx == 2)
- && (l_image->comps[2].dx == 2)
- && (l_image->comps[0].dy == 1)
- && (l_image->comps[1].dy == 1)
- && (l_image->comps[2].dy == 1))
- || /* sycc444 */
- ((l_image->comps[0].dx == 1)
- && (l_image->comps[1].dx == 1)
- && (l_image->comps[2].dx == 1)
- && (l_image->comps[0].dy == 1)
- && (l_image->comps[1].dy == 1)
- && (l_image->comps[2].dy == 1));
- }
- if (ok && sycc) {
- break;
- }
-
- opj_event_msg(p_manager, EVT_ERROR, "wrong values for enumcs 18(i.e. sYCC)\n");
- return OPJ_FALSE;
-
- case 24: /* e-sYCC */
- if (l_image->numcomps > 2 /* cnf. color.c, line 938 */
- && l_image->comps[0].dx == l_image->comps[1].dx
- && l_image->comps[0].dx == l_image->comps[2].dx
- && l_image->comps[0].dy == l_image->comps[1].dy
- && l_image->comps[0].dy == l_image->comps[2].dy) {
- break;
- }
-
- opj_event_msg(p_manager, EVT_ERROR,
- "wrong values for enumcs 24(i.e. e-sYCC)\n");
- return OPJ_FALSE;
-
- case 14: /* CIELAB */
- if (l_image->numcomps != 3) {
- opj_event_msg(p_manager, EVT_ERROR,
- "wrong values for enumcs 14(i.e. CIElab)\n");
- return OPJ_FALSE;
- }
- break;
-
- case 17: /* GRAY */
- if (l_image->comps[0].dx == 1
- && l_image->comps[0].dy == 1) {
- break;
- }
- opj_event_msg(p_manager, EVT_ERROR, "wrong values for enumcs %u\n",
- p_j2k->enumcs);
- return OPJ_FALSE;
-
- default:
- break;
-
- }/* switch() */
- } /* p_j2k->dump */