Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: src/codec/SkJpegCodec.h

Issue 2195523002: Revert of Add color space xform support to SkJpegCodec (includes F16!) (Closed) Base URL: https://skia.googlesource.com/skia.git@drop
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkJpegCodec_DEFINED 8 #ifndef SkJpegCodec_DEFINED
9 #define SkJpegCodec_DEFINED 9 #define SkJpegCodec_DEFINED
10 10
11 #include "SkCodec.h" 11 #include "SkCodec.h"
12 #include "SkColorSpace.h" 12 #include "SkColorSpace.h"
13 #include "SkColorSpaceXform.h"
14 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
15 #include "SkSwizzler.h" 14 #include "SkSwizzler.h"
16 #include "SkStream.h" 15 #include "SkStream.h"
17 #include "SkTemplates.h" 16 #include "SkTemplates.h"
18 17
19 class JpegDecoderMgr; 18 class JpegDecoderMgr;
20 19
21 /* 20 /*
22 * 21 *
23 * This class implements the decoding for jpeg images 22 * This class implements the decoding for jpeg images
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 * @param stream the encoded image data 92 * @param stream the encoded image data
94 * @param decoderMgr holds decompress struct, src manager, and error manager 93 * @param decoderMgr holds decompress struct, src manager, and error manager
95 * takes ownership 94 * takes ownership
96 */ 95 */
97 SkJpegCodec(int width, int height, const SkEncodedInfo& info, SkStream* stre am, 96 SkJpegCodec(int width, int height, const SkEncodedInfo& info, SkStream* stre am,
98 JpegDecoderMgr* decoderMgr, sk_sp<SkColorSpace> colorSpace, Origin o rigin, 97 JpegDecoderMgr* decoderMgr, sk_sp<SkColorSpace> colorSpace, Origin o rigin,
99 sk_sp<SkData> iccData); 98 sk_sp<SkData> iccData);
100 99
101 /* 100 /*
102 * Checks if the conversion between the input image and the requested output 101 * Checks if the conversion between the input image and the requested output
103 * image has been implemented. 102 * image has been implemented
104 * 103 * Sets the output color space
105 * Sets the output color space.
106 */ 104 */
107 bool setOutputColorSpace(const SkImageInfo& dst, bool needsColorXform); 105 bool setOutputColorSpace(const SkImageInfo& dst);
108 106
107 // scanline decoding
109 void initializeSwizzler(const SkImageInfo& dstInfo, const Options& options); 108 void initializeSwizzler(const SkImageInfo& dstInfo, const Options& options);
110 bool initializeColorXform(const SkImageInfo& dstInfo, bool needsColorXform);
111 void allocateStorage(const SkImageInfo& dstInfo);
112 int readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int cou nt);
113
114 /*
115 * Scanline decoding.
116 */
117 SkSampler* getSampler(bool createIfNecessary) override; 109 SkSampler* getSampler(bool createIfNecessary) override;
118 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti ons, 110 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti ons,
119 SkPMColor ctable[], int* ctableCount) override; 111 SkPMColor ctable[], int* ctableCount) override;
120 int onGetScanlines(void* dst, int count, size_t rowBytes) override; 112 int onGetScanlines(void* dst, int count, size_t rowBytes) override;
121 bool onSkipScanlines(int count) override; 113 bool onSkipScanlines(int count) override;
122 114
123 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; 115 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr;
124
125 // We will save the state of the decompress struct after reading the header. 116 // We will save the state of the decompress struct after reading the header.
126 // This allows us to safely call onGetScaledDimensions() at any time. 117 // This allows us to safely call onGetScaledDimensions() at any time.
127 const int fReadyState; 118 const int fReadyState;
128 119
129 120 // scanline decoding
130 SkAutoTMalloc<uint8_t> fStorage; 121 SkAutoTMalloc<uint8_t> fStorage; // Only used if sampling is needed
131 uint8_t* fSwizzleSrcRow; 122 uint8_t* fSrcRow; // Only used if sampling is needed
132 uint32_t* fColorXformSrcRow;
133
134 // libjpeg-turbo provides some subsetting. In the case that libjpeg-turbo 123 // libjpeg-turbo provides some subsetting. In the case that libjpeg-turbo
135 // cannot take the exact the subset that we need, we will use the swizzler 124 // cannot take the exact the subset that we need, we will use the swizzler
136 // to further subset the output from libjpeg-turbo. 125 // to further subset the output from libjpeg-turbo.
137 SkIRect fSwizzlerSubset; 126 SkIRect fSwizzlerSubset;
138 127 SkAutoTDelete<SkSwizzler> fSwizzler;
139 SkAutoTDelete<SkSwizzler> fSwizzler;
140 std::unique_ptr<SkColorSpaceXform> fColorXform;
141 128
142 sk_sp<SkData> fICCData; 129 sk_sp<SkData> fICCData;
143 130
144 typedef SkCodec INHERITED; 131 typedef SkCodec INHERITED;
145 }; 132 };
146 133
147 #endif 134 #endif
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698