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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jpx_opj.cpp

Issue 648823002: Fix a bug when image width is odd in sycc422_to_rgb (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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; ++j, ++y, ++r, ++g, ++b) {
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 if (j % 2){
173 ++r; 173 ++cb;
174 ++g; 174 ++cr;
175 ++b; 175 }
176 sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
177 ++y;
178 ++r;
179 ++g;
180 ++b;
181 ++cb;
182 ++cr;
183 } 176 }
184 } 177 }
185 FX_Free(img->comps[0].data); 178 FX_Free(img->comps[0].data);
186 img->comps[0].data = d0; 179 img->comps[0].data = d0;
187 FX_Free(img->comps[1].data); 180 FX_Free(img->comps[1].data);
188 img->comps[1].data = d1; 181 img->comps[1].data = d1;
189 FX_Free(img->comps[2].data); 182 FX_Free(img->comps[2].data);
190 img->comps[2].data = d2; 183 img->comps[2].data = d2;
191 img->comps[1].w = maxw; 184 img->comps[1].w = maxw;
192 img->comps[1].h = maxh; 185 img->comps[1].h = maxh;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets) 772 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets)
780 { 773 {
781 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; 774 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
782 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); 775 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets);
783 } 776 }
784 void CCodec_JpxModule::DestroyDecoder(void* ctx) 777 void CCodec_JpxModule::DestroyDecoder(void* ctx)
785 { 778 {
786 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; 779 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
787 delete pDecoder; 780 delete pDecoder;
788 } 781 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698