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

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

Issue 818363006: fix a few linux compilation warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore origina cmslut.c Created 5 years, 11 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 sycc444_to_rgb(img); 307 sycc444_to_rgb(img);
308 } else { 308 } else {
309 return; 309 return;
310 } 310 }
311 img->color_space = OPJ_CLRSPC_SRGB; 311 img->color_space = OPJ_CLRSPC_SRGB;
312 } 312 }
313 void color_apply_icc_profile(opj_image_t *image) 313 void color_apply_icc_profile(opj_image_t *image)
314 { 314 {
315 cmsHPROFILE in_prof, out_prof; 315 cmsHPROFILE in_prof, out_prof;
316 cmsHTRANSFORM transform; 316 cmsHTRANSFORM transform;
317 // TODO(tsepez): unused in_space seems suspicious.
317 cmsColorSpaceSignature in_space, out_space; 318 cmsColorSpaceSignature in_space, out_space;
318 cmsUInt32Number intent, in_type, out_type, nr_samples; 319 cmsUInt32Number intent, in_type, out_type, nr_samples;
319 int *r, *g, *b; 320 int *r, *g, *b;
320 int prec, i, max, max_w, max_h; 321 int prec, i, max, max_w, max_h;
321 OPJ_COLOR_SPACE oldspace; 322 OPJ_COLOR_SPACE oldspace;
322 in_prof = 323 in_prof =
323 cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len); 324 cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
324 if(in_prof == NULL) { 325 if(in_prof == NULL) {
325 return; 326 return;
326 } 327 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 numcomps = image->numcomps; 463 numcomps = image->numcomps;
463 if(numcomps < 3) { 464 if(numcomps < 3) {
464 return; 465 return;
465 } 466 }
466 row = (int*)image->icc_profile_buf; 467 row = (int*)image->icc_profile_buf;
467 enumcs = row[0]; 468 enumcs = row[0];
468 if(enumcs == 14) { 469 if(enumcs == 14) {
469 int *L, *a, *b, *red, *green, *blue, *src0, *src1, *src2; 470 int *L, *a, *b, *red, *green, *blue, *src0, *src1, *src2;
470 double rl, ol, ra, oa, rb, ob, prec0, prec1, prec2; 471 double rl, ol, ra, oa, rb, ob, prec0, prec1, prec2;
471 double minL, maxL, mina, maxa, minb, maxb; 472 double minL, maxL, mina, maxa, minb, maxb;
472 unsigned int default_type, il; 473 unsigned int default_type;
473 unsigned int i, max, illu; 474 unsigned int i, max;
474 cmsHPROFILE in, out; 475 cmsHPROFILE in, out;
475 cmsHTRANSFORM transform; 476 cmsHTRANSFORM transform;
476 cmsUInt16Number RGB[3]; 477 cmsUInt16Number RGB[3];
477 cmsCIELab Lab; 478 cmsCIELab Lab;
478 illu = 0;
479 il = 0;
480 in = cmsCreateLab4Profile(NULL); 479 in = cmsCreateLab4Profile(NULL);
481 out = cmsCreate_sRGBProfile(); 480 out = cmsCreate_sRGBProfile();
482 transform = 481 transform =
483 cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, 482 cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16,
484 INTENT_PERCEPTUAL, 0); 483 INTENT_PERCEPTUAL, 0);
485 cmsCloseProfile(in); 484 cmsCloseProfile(in);
486 cmsCloseProfile(out); 485 cmsCloseProfile(out);
487 if(transform == NULL) { 486 if(transform == NULL) {
488 return; 487 return;
489 } 488 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 { 665 {
667 width = (FX_DWORD)image->x1; 666 width = (FX_DWORD)image->x1;
668 height = (FX_DWORD)image->y1; 667 height = (FX_DWORD)image->y1;
669 output_nComps = codestream_nComps = (FX_DWORD)image->numcomps; 668 output_nComps = codestream_nComps = (FX_DWORD)image->numcomps;
670 } 669 }
671 FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo lor, FX_LPBYTE offsets) 670 FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo lor, FX_LPBYTE offsets)
672 { 671 {
673 FX_BYTE** channel_bufs; 672 FX_BYTE** channel_bufs;
674 int* adjust_comps; 673 int* adjust_comps;
675 int i, wid, hei, row, col, channel, src; 674 int i, wid, hei, row, col, channel, src;
676 FX_BOOL flag;
677 FX_LPBYTE pChannel, pScanline, pPixel; 675 FX_LPBYTE pChannel, pScanline, pPixel;
678 676
679 if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) { 677 if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) {
680 return FALSE; 678 return FALSE;
681 } 679 }
682 if(pitch < (int)(image->comps[0].w * 8 * image->numcomps + 31) >> 5 << 2) { 680 if(pitch < (int)(image->comps[0].w * 8 * image->numcomps + 31) >> 5 << 2) {
683 return FALSE; 681 return FALSE;
684 } 682 }
685 FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch); 683 FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch);
686 channel_bufs = FX_Alloc(FX_BYTE*, image->numcomps); 684 channel_bufs = FX_Alloc(FX_BYTE*, image->numcomps);
687 if (channel_bufs == NULL) { 685 if (channel_bufs == NULL) {
688 return FALSE; 686 return FALSE;
689 } 687 }
690 adjust_comps = FX_Alloc(int, image->numcomps); 688 adjust_comps = FX_Alloc(int, image->numcomps);
691 if (adjust_comps == NULL) { 689 if (adjust_comps == NULL) {
692 FX_Free(channel_bufs); 690 FX_Free(channel_bufs);
693 return FALSE; 691 return FALSE;
694 } 692 }
695 flag = TRUE;
696 for (i = 0; i < (int)image->numcomps; i ++) { 693 for (i = 0; i < (int)image->numcomps; i ++) {
697 channel_bufs[i] = dest_buf + offsets[i]; 694 channel_bufs[i] = dest_buf + offsets[i];
698 adjust_comps[i] = image->comps[i].prec - 8; 695 adjust_comps[i] = image->comps[i].prec - 8;
699 if(i > 0) { 696 if(i > 0) {
700 if(image->comps[i].dx != image->comps[i - 1].dx 697 if(image->comps[i].dx != image->comps[i - 1].dx
701 || image->comps[i].dy != image->comps[i - 1].dy 698 || image->comps[i].dy != image->comps[i - 1].dy
702 || image->comps[i].prec != image->comps[i - 1].prec) { 699 || image->comps[i].prec != image->comps[i - 1].prec) {
703 flag = FALSE;
704 goto failed; 700 goto failed;
705 } 701 }
706 } 702 }
707 } 703 }
708 wid = image->comps[0].w; 704 wid = image->comps[0].w;
709 hei = image->comps[0].h; 705 hei = image->comps[0].h;
710 for (channel = 0; channel < (int)image->numcomps; channel++) { 706 for (channel = 0; channel < (int)image->numcomps; channel++) {
711 pChannel = channel_bufs[channel]; 707 pChannel = channel_bufs[channel];
712 if(adjust_comps[channel] < 0) { 708 if(adjust_comps[channel] < 0) {
713 for(row = 0; row < hei; row++) { 709 for(row = 0; row < hei; row++) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets) 781 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B OOL bTranslateColor, FX_LPBYTE offsets)
786 { 782 {
787 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; 783 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
788 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); 784 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets);
789 } 785 }
790 void CCodec_JpxModule::DestroyDecoder(void* ctx) 786 void CCodec_JpxModule::DestroyDecoder(void* ctx)
791 { 787 {
792 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; 788 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
793 delete pDecoder; 789 delete pDecoder;
794 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698