tweak RGB-to-Y conversion
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parent 64e1799 · Browse files · 1 file·+11 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+11 added−6 removed
- other:+11 added−6 removed
Provenance
- Commit
786ac92- Tree
3c7f6f0- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent
64e1799
1 file changed+11 added−6 removed
modified:stb_image.h+11 added-6 removed
46 unmodified lines47 See end of file for license information.48 49 RECENT REVISION HISTORY:50 51- 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD51+ 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs52 2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes53 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes54 2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x6455 RGB-format JPEG; remove white matting in PSD;21 unmodified lines77 Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD)78 github:urraka (animated gif) Junggon Kim (PNM comments)79 Daniel Gibson (16-bit TGA)80 socks-the-fox (16-bit TGA)81+ Jeremy Sawicki (handle all ImageNet JPGs)82 Optimizations & bugfixes83 Fabian "ryg" Giesen84 Arseny Kapoulkine85 9 unmodified lines95 Aruelien Pocheville Thibault Reuille Cass Everitt Matthew Gregan96 Ryamond Barbiero Paul Du Bois Engin Manap github:snagar97 Michaelangel007@github Oriol Ferrer Mesia Dale Weiler github:Zelex98 Philipp Wiesemann Josh Tobin github:rlyeh github:grim210@github98- Blazej Dariusz Roszkowski github:sammyhw Jeremy Sawicki99+ Blazej Dariusz Roszkowski github:sammyhw100 101 */102 103 #ifndef STBI_INCLUDE_STB_IMAGE_H3461 unmodified lines3565 out += n;3566 }3567 } else {3568 if (z->rgb == 3) {3569+ if (n == 1)3570+ for (i=0; i < z->s->img_x; ++i)3571+ *out++ = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]);3572+ else {3568- for (i=0; i < z->s->img_x; ++i) {3569- out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]);3570- out[1] = 255;3571- out += n;3573+ for (i=0; i < z->s->img_x; ++i, out += 2) {3574+ out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]);3575+ out[1] = 255;3576+ }3577 }3578 } else {3579 stbi_uc *y = coutput[0];3580 if (n == 1)3469 unmodified lines