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

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

Issue 1837383011: Merge to M49: Reland "Fix sycc{420,422}_to_rgb issues." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@2623
Patch Set: fix paths Created 4 years, 8 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 | « core/src/fxcodec/codec/fx_codec_jpx_opj.cpp ('k') | 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 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "codec_int.h" 9 #include "core/src/fxcodec/codec/codec_int.h"
10 #include "testing/fx_string_testhelpers.h" 10 #include "testing/fx_string_testhelpers.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1); 13 static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1);
14 static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1); 14 static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1);
15 static const OPJ_SIZE_T kWriteError = static_cast<OPJ_SIZE_T>(-1); 15 static const OPJ_SIZE_T kWriteError = static_cast<OPJ_SIZE_T>(-1);
16 16
17 static unsigned char stream_data[] = { 17 static unsigned char stream_data[] = {
18 0x00, 0x01, 0x02, 0x03, 18 0x00, 0x01, 0x02, 0x03,
19 0x84, 0x85, 0x86, 0x87, // Include some hi-bytes, too. 19 0x84, 0x85, 0x86, 0x87, // Include some hi-bytes, too.
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 y.prec = 8; 489 y.prec = 8;
490 y.bpp = 8; 490 y.bpp = 8;
491 opj_image_t img; 491 opj_image_t img;
492 memset(&img, 0, sizeof(img)); 492 memset(&img, 0, sizeof(img));
493 img.numcomps = 3; 493 img.numcomps = 3;
494 img.color_space = OPJ_CLRSPC_SYCC; 494 img.color_space = OPJ_CLRSPC_SYCC;
495 img.comps = FX_Alloc(opj_image_comp_t, 3); 495 img.comps = FX_Alloc(opj_image_comp_t, 3);
496 const struct { 496 const struct {
497 OPJ_UINT32 w; 497 OPJ_UINT32 w;
498 bool expected; 498 bool expected;
499 } cases[] = {{0, false}, 499 } cases[] = {{0, false}, {1, false}, {30, false}, {31, true},
500 {1, false}, 500 {32, true}, {33, false}, {34, false}, {UINT_MAX, false}};
501 {30, false},
502 {31, true},
503 {32, true},
504 {33, true},
505 {34, false},
506 {UINT_MAX, false}};
507 for (int i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i) { 501 for (int i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i) {
508 y.w = cases[i].w; 502 y.w = cases[i].w;
509 y.h = y.w; 503 y.h = y.w;
510 img.x1 = y.w; 504 img.x1 = y.w;
511 img.y1 = y.h; 505 img.y1 = y.h;
512 y.data = FX_Alloc(OPJ_INT32, y.w * y.h); 506 y.data = FX_Alloc(OPJ_INT32, y.w * y.h);
513 memset(y.data, 1, y.w * y.h * sizeof(OPJ_INT32)); 507 memset(y.data, 1, y.w * y.h * sizeof(OPJ_INT32));
514 u.data = FX_Alloc(OPJ_INT32, u.w * u.h); 508 u.data = FX_Alloc(OPJ_INT32, u.w * u.h);
515 memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32)); 509 memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32));
516 v.data = FX_Alloc(OPJ_INT32, v.w * v.h); 510 v.data = FX_Alloc(OPJ_INT32, v.w * v.h);
(...skipping 12 matching lines...) Expand all
529 EXPECT_NE(img.comps[0].h, img.comps[1].h); 523 EXPECT_NE(img.comps[0].h, img.comps[1].h);
530 EXPECT_NE(img.comps[0].w, img.comps[2].w); 524 EXPECT_NE(img.comps[0].w, img.comps[2].w);
531 EXPECT_NE(img.comps[0].h, img.comps[2].h); 525 EXPECT_NE(img.comps[0].h, img.comps[2].h);
532 } 526 }
533 FX_Free(img.comps[0].data); 527 FX_Free(img.comps[0].data);
534 FX_Free(img.comps[1].data); 528 FX_Free(img.comps[1].data);
535 FX_Free(img.comps[2].data); 529 FX_Free(img.comps[2].data);
536 } 530 }
537 FX_Free(img.comps); 531 FX_Free(img.comps);
538 } 532 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jpx_opj.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698