OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
8 #include "codec_int.h" | 8 #include "codec_int.h" |
9 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" | 9 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" |
10 #include "../lcms2/include/fx_lcms2.h" | 10 #include "../lcms2/include/fx_lcms2.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 maxw = (int)img->comps[0].w; | 160 maxw = (int)img->comps[0].w; |
161 maxh = (int)img->comps[0].h; | 161 maxh = (int)img->comps[0].h; |
162 max = maxw * maxh; | 162 max = maxw * maxh; |
163 y = img->comps[0].data; | 163 y = img->comps[0].data; |
164 cb = img->comps[1].data; | 164 cb = img->comps[1].data; |
165 cr = img->comps[2].data; | 165 cr = img->comps[2].data; |
166 d0 = r = FX_Alloc(int, (size_t)max); | 166 d0 = r = FX_Alloc(int, (size_t)max); |
167 d1 = g = FX_Alloc(int, (size_t)max); | 167 d1 = g = FX_Alloc(int, (size_t)max); |
168 d2 = b = FX_Alloc(int, (size_t)max); | 168 d2 = b = FX_Alloc(int, (size_t)max); |
169 for(i = 0; i < maxh; ++i) { | 169 for(i = 0; i < maxh; ++i) { |
170 for(j = 0; j < maxw; j += 2) { | 170 for(j = 0; j < (maxw & ~(OPJ_UINT32)1); j += 2) { |
jun_fang
2014/10/10 21:06:08
shall keep & ~(OPJ_UINT32)1 here.
| |
171 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); | 171 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); |
172 ++y; | 172 ++y; |
173 ++r; | 173 ++r; |
174 ++g; | 174 ++g; |
175 ++b; | 175 ++b; |
176 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); | 176 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); |
177 ++y; | 177 ++y; |
178 ++r; | 178 ++r; |
179 ++g; | 179 ++g; |
180 ++b; | 180 ++b; |
181 ++cb; | 181 ++cb; |
182 ++cr; | 182 ++cr; |
183 } | 183 } |
184 if (j < maxw) { | |
Tom Sepez
2014/10/10 21:03:41
nit: alternatively, you could run though this loop
| |
185 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); | |
186 ++y; | |
187 ++r; | |
188 ++g; | |
189 ++b; | |
190 } | |
184 } | 191 } |
185 FX_Free(img->comps[0].data); | 192 FX_Free(img->comps[0].data); |
186 img->comps[0].data = d0; | 193 img->comps[0].data = d0; |
187 FX_Free(img->comps[1].data); | 194 FX_Free(img->comps[1].data); |
188 img->comps[1].data = d1; | 195 img->comps[1].data = d1; |
189 FX_Free(img->comps[2].data); | 196 FX_Free(img->comps[2].data); |
190 img->comps[2].data = d2; | 197 img->comps[2].data = d2; |
191 img->comps[1].w = maxw; | 198 img->comps[1].w = maxw; |
192 img->comps[1].h = maxh; | 199 img->comps[1].h = maxh; |
193 img->comps[2].w = maxw; | 200 img->comps[2].w = maxw; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets) | 786 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets) |
780 { | 787 { |
781 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 788 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
782 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); | 789 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); |
783 } | 790 } |
784 void CCodec_JpxModule::DestroyDecoder(void* ctx) | 791 void CCodec_JpxModule::DestroyDecoder(void* ctx) |
785 { | 792 { |
786 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 793 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
787 delete pDecoder; | 794 delete pDecoder; |
788 } | 795 } |
OLD | NEW |