Home | History | Annotate | Download | only in libtests

Lines Matching full:sbit

1877    /* Lowest sbit to test (libpng fails for sbit < 8) */
2901 png_byte sbit;
2907 png_byte sbit = ((sbit_modification*)me)->sbit;
2908 if (pm->bit_depth > sbit)
2932 "unexpected colour type in sBIT modification");
2939 (pm->buffer+8)[--cb] = sbit;
2945 /* Remove the sBIT chunk */
2954 sbit_modification_init(sbit_modification *me, png_modifier *pm, png_byte sbit)
2960 me->sbit = sbit;
2984 * Files are stored with no gAMA or sBIT chunks, with a PLTE only when needed
3960 /* Now we know the bit depth we can easily generate an invalid sBIT entry */
3974 { sBIT0_error_fn, "sBIT(0): failed to detect error", 1 },
3975 { sBIT_error_fn, "sBIT(too big): failed to detect error", 1 },
4245 png_byte red_sBIT; /* Input data sBIT values. */
4506 /* Record (but don't check at present) the input sBIT according to the colour
4510 png_color_8p sBIT = 0;
4512 if (png_get_sBIT(pp, pi, &sBIT) & PNG_INFO_sBIT)
4516 if (sBIT == 0)
4521 if (sBIT->red == 0 || sBIT->red > dp->bit_depth)
4524 dp->red_sBIT = sBIT->red;
4526 if (sBIT->green == 0 || sBIT->green > dp->bit_depth)
4529 dp->green_sBIT = sBIT->green;
4531 if (sBIT->blue == 0 || sBIT->blue > dp->bit_depth)
4534 dp->blue_sBIT = sBIT->blue;
4539 if (sBIT->gray == 0 || sBIT->gray > dp->bit_depth)
4542 dp->blue_sBIT = dp->green_sBIT = dp->red_sBIT = sBIT->gray;
4550 if (sBIT->alpha == 0 || sBIT->alpha > dp->bit_depth)
4553 dp->alpha_sBIT = sBIT->alpha;
4557 png_error(pp, "validate: sBIT value out of range");
5284 * sBIT setting allows larger error bounds (indeed, by the spec, apparently
5285 * up to just less than +/-1 in the scaled value) the *lowest* sBIT for each
5286 * channel is stored. This sBIT value is folded in to the stored error value
5469 /* The error in the alpha is zero and the sBIT value comes from the
5470 * original sBIT data (actually it will always be the original bit depth).
5635 /* The error value is increased, at the end, according to the lowest sBIT
5638 * the sBIT allows the implementation to be worse than this. In addition the
5783 /* Don't need sBIT here, but it must be set to non-zero to avoid
5996 * use the error field here, so no need to update sBIT.
7210 /* The sBIT is the minium of the three colour channel sBITs. */
7697 png_byte sbit;
7715 double file_gamma, double screen_gamma, png_byte sbit, int threshold_test,
7729 dp->sbit = sbit;
7752 * are interactions with sBIT but, internally, libpng makes sbit at most
7878 png_byte sbit;
7914 if (dp->sbit > 0 && dp->sbit < in_depth)
7916 vi->sbit = dp->sbit;
7917 vi->isbit_shift = in_depth - dp->sbit;
7922 vi->sbit = (png_byte)in_depth;
7926 vi->sbit_max = (1U << vi->sbit)-1;
8330 if (pass == 0 && vi->use_input_precision && vi->dp->sbit)
8334 * for sbit) can be anywhere between value-.5 and value+.5 - quite a
8335 * large range if sbit is low.
8339 * calculations the precise sbit calculation (a shift) has been
8341 * an sbit less than the bit depth.
8410 if (pass == 0 && alpha < 0 && vi->scale16 && vi->sbit > 8 &&
8411 vi->sbit + vi->isbit_shift == 16)
8502 /* sBIT has reduced the precision of the input: */
8503 pos = safecat(msg, sizeof msg, pos, ", sbit(");
8504 pos = safecatn(msg, sizeof msg, pos, vi->sbit);
8509 /* The output is either "id/max" or "id sbit(sbit): isbit/max" */
8651 * file encoding, determined by sbit and/or the file depth, secondly
8667 * The behavior of the 'sbit' paramter is defined by section 12.5
8669 * decoder to assume that the PNG values have been scaled if sBIT is
8679 * Nevertheless the spec requires that the upper 'sBIT' bits of the
8681 * Consequently the code below simply scales the top sbit bits by
8682 * (1<<sbit)-1 to obtain an original sample value.
8879 * given gamma value and the sBIT chunk to the given precision.
8884 if (d.sbit > 0)
8885 sbit_modification_init(&sbit_mod, d.pm, d.sbit);
9012 file_gamma, screen_gamma, 0/*sBIT*/, 1/*threshold test*/, name,
9056 PNG_CONST double screen_gamma, PNG_CONST png_byte sbit,
9062 if (sbit != bit_depth && sbit != 0)
9064 pos = safecat(name, sizeof name, pos, "sbit(");
9065 pos = safecatn(name, sizeof name, pos, sbit);
9080 file_gamma, screen_gamma, sbit, 0, name, use_input_precision,
9098 pm->interlace_type, 1/pm->gammas[i], pm->gammas[j], 0/*sBIT*/,
9109 png_byte sbit;
9112 * for overall speed. Only bit depths where sbit is less than the bit depth
9115 for (sbit=pm->sbitlow; sbit<(1<<READ_BDHI); ++sbit)
9122 ((colour_type == 3 && sbit < 8) ||
9123 (colour_type != 3 && sbit < bit_depth)))
9135 sbit, pm->use_input_precision_sbit, 0 /*scale16*/);
9156 /* Include the alpha cases here. Note that sbit matches the internal value
9158 * internal sbit style approximation.
9346 file_gamma, screen_gamma, 0/*sBIT*/, 0, name, use_input_precision,
9463 printf("increases when the image file includes an sBIT chunk.\n");
9484 /* The sbit tests produce much larger errors: */
9491 summarize_gamma_errors(pm, "sBIT", pm->sbitlow < 8U, 1/*indexed*/);
10099 pm.sbitlow = 8U; /* because libpng doesn't do sBIT below 8! */
10109 pm.use_input_precision_sbit = 1U; /* because libpng now rounds sBIT */
10226 else if (strcmp(*argv, "--gamma-sbit") == 0)
10229 else if (strcmp(*argv, "--nogamma-sbit") == 0)