ReactOS 0.4.16-dev-852-gcfcc8d8
tiffformat.c File Reference
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "wincodec.h"
#include "wine/test.h"
#include "pshpack2.h"
#include "poppack.h"
Include dependency graph for tiffformat.c:

Go to the source code of this file.

Classes

struct  IFD_entry
 
struct  IFD_rational
 
struct  tiff_1bpp_data
 
struct  tiff_8bpp_alpha
 
struct  tiff_8bpp_data
 
struct  tiff_resolution_test_data
 
struct  tiff_resolution_image_data
 
struct  tiff_24bpp_data
 
struct  tiff_4bps_bgra
 
struct  tiff_1x1_data
 

Macros

#define COBJMACROS
 
#define EXPECT_REF(obj, ref)   _expect_ref((IUnknown*)obj, ref, __LINE__)
 
#define IFD_BYTE   1
 
#define IFD_ASCII   2
 
#define IFD_SHORT   3
 
#define IFD_LONG   4
 
#define IFD_RATIONAL   5
 
#define IFD_SBYTE   6
 
#define IFD_UNDEFINED   7
 
#define IFD_SSHORT   8
 
#define IFD_SLONG   9
 
#define IFD_SRATIONAL   10
 
#define IFD_FLOAT   11
 
#define IFD_DOUBLE   12
 

Functions

static void _expect_ref (IUnknown *obj, ULONG ref, int line)
 
static IStreamcreate_stream (const void *data, int data_size)
 
static HRESULT create_decoder (const void *image_data, UINT image_size, IWICBitmapDecoder **decoder)
 
static HRESULT get_pixelformat_info (const GUID *format, UINT *bpp, UINT *channels, BOOL *transparency)
 
static void dump_tiff (void *buf)
 
static void test_tiff_1bpp_palette (void)
 
static void test_QueryCapability (void)
 
static void test_tiff_8bpp_alpha (void)
 
static void generate_tiff_palette (void *buf, unsigned count)
 
static void test_tiff_8bpp_palette (void)
 
static void test_tiff_resolution (void)
 
static void test_tiff_24bpp (void)
 
static UINT width_bytes (UINT width, UINT bpp)
 
static void test_color_formats (void)
 
static void test_tiff_4bps_bgra (void)
 
 START_TEST (tiffformat)
 

Variables

static const struct tiff_1bpp_data tiff_1bpp_data
 
static const struct tiff_8bpp_alpha tiff_8bpp_alpha
 
static const struct tiff_8bpp_data tiff_8bpp_data
 
static const struct tiff_resolution_test_data tiff_resolution_test_data []
 
static struct tiff_resolution_image_data tiff_resolution_image_data
 
static const struct tiff_24bpp_data tiff_24bpp_data
 
static const struct tiff_4bps_bgra tiff_4bps_bgra
 
static IWICImagingFactoryfactory
 
static const struct tiff_1x1_data tiff_1x1_data
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file tiffformat.c.

◆ EXPECT_REF

#define EXPECT_REF (   obj,
  ref 
)    _expect_ref((IUnknown*)obj, ref, __LINE__)

Definition at line 29 of file tiffformat.c.

◆ IFD_ASCII

#define IFD_ASCII   2

Definition at line 39 of file tiffformat.c.

◆ IFD_BYTE

#define IFD_BYTE   1

Definition at line 38 of file tiffformat.c.

◆ IFD_DOUBLE

#define IFD_DOUBLE   12

Definition at line 49 of file tiffformat.c.

◆ IFD_FLOAT

#define IFD_FLOAT   11

Definition at line 48 of file tiffformat.c.

◆ IFD_LONG

#define IFD_LONG   4

Definition at line 41 of file tiffformat.c.

◆ IFD_RATIONAL

#define IFD_RATIONAL   5

Definition at line 42 of file tiffformat.c.

◆ IFD_SBYTE

#define IFD_SBYTE   6

Definition at line 43 of file tiffformat.c.

◆ IFD_SHORT

#define IFD_SHORT   3

Definition at line 40 of file tiffformat.c.

◆ IFD_SLONG

#define IFD_SLONG   9

Definition at line 46 of file tiffformat.c.

◆ IFD_SRATIONAL

#define IFD_SRATIONAL   10

Definition at line 47 of file tiffformat.c.

◆ IFD_SSHORT

#define IFD_SSHORT   8

Definition at line 45 of file tiffformat.c.

◆ IFD_UNDEFINED

#define IFD_UNDEFINED   7

Definition at line 44 of file tiffformat.c.

Function Documentation

◆ _expect_ref()

static void _expect_ref ( IUnknown obj,
ULONG  ref,
int  line 
)
static

Definition at line 30 of file tiffformat.c.

31{
32 ULONG rc;
33 IUnknown_AddRef(obj);
34 rc = IUnknown_Release(obj);
35 ok_(__FILE__,line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
36}
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: parser.c:49
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ create_decoder()

static HRESULT create_decoder ( const void image_data,
UINT  image_size,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 347 of file tiffformat.c.

348{
349 HGLOBAL hmem;
350 BYTE *data;
351 HRESULT hr;
353 GUID format;
354 LONG refcount;
355
356 *decoder = NULL;
357
358 hmem = GlobalAlloc(0, image_size);
359 data = GlobalLock(hmem);
360 memcpy(data, image_data, image_size);
361 GlobalUnlock(hmem);
362
364 ok(hr == S_OK, "CreateStreamOnHGlobal error %#lx\n", hr);
365
366 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, decoder);
367 if (hr == S_OK)
368 {
369 hr = IWICBitmapDecoder_GetContainerFormat(*decoder, &format);
370 ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
371 ok(IsEqualGUID(&format, &GUID_ContainerFormatTiff),
372 "wrong container format %s\n", wine_dbgstr_guid(&format));
373
374 refcount = IStream_Release(stream);
375 ok(refcount > 0, "expected stream refcount > 0\n");
376 }
377
378 return hr;
379}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define S_OK
Definition: intsafe.h:52
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
HRESULT hr
Definition: shlfolder.c:183
Definition: main.c:439
Definition: format.c:58
Definition: parse.h:23
unsigned char BYTE
Definition: xxhash.c:193

◆ create_stream()

static IStream * create_stream ( const void data,
int  data_size 
)
static

Definition at line 326 of file tiffformat.c.

327{
328 HRESULT hr;
330 HGLOBAL hdata;
331 void *locked_data;
332
333 hdata = GlobalAlloc(GMEM_MOVEABLE, data_size);
334 ok(hdata != 0, "GlobalAlloc failed\n");
335 if (!hdata) return NULL;
336
337 locked_data = GlobalLock(hdata);
338 memcpy(locked_data, data, data_size);
339 GlobalUnlock(hdata);
340
342 ok(hr == S_OK, "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
343
344 return stream;
345}
#define GMEM_MOVEABLE
Definition: winbase.h:320

Referenced by test_QueryCapability().

◆ dump_tiff()

static void dump_tiff ( void buf)
static

Definition at line 412 of file tiffformat.c.

413{
414 UINT count, i;
415 struct tiff_1bpp_data *tiff;
416 struct IFD_entry *tag;
417
418 tiff = buf;
419 count = *(short *)((char *)tiff + tiff->dir_offset);
420 tag = (struct IFD_entry *)((char *)tiff + tiff->dir_offset + sizeof(short));
421
422 for (i = 0; i < count; i++)
423 {
424 printf("tag %u: id %04x, type %04x, count %lu, value %ld",
425 i, tag[i].id, tag[i].type, tag[i].count, tag[i].value);
426 if (tag[i].id == 0x102 && tag[i].count > 2)
427 {
428 short *bps = (short *)((char *)tiff + tag[i].value);
429 printf(" (%d,%d,%d,%d)\n", bps[0], bps[1], bps[2], bps[3]);
430 }
431 else
432 printf("\n");
433 }
434}
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define printf
Definition: freeldr.h:97
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
Definition: ecma_167.h:138
Definition: tiffiop.h:115
Definition: pdh_main.c:96

Referenced by test_color_formats().

◆ generate_tiff_palette()

static void generate_tiff_palette ( void buf,
unsigned  count 
)
static

Definition at line 625 of file tiffformat.c.

626{
627 unsigned short *r, *g, *b;
628 unsigned i;
629
630 r = buf;
631 g = r + count;
632 b = g + count;
633
634 r[0] = 0x11 * 257;
635 g[0] = 0x22 * 257;
636 b[0] = 0x33 * 257;
637 r[1] = 0x44 * 257;
638 g[1] = 0x55 * 257;
639 b[1] = 0x66 * 257;
640 r[2] = 0x77 * 257;
641 g[2] = 0x88 * 257;
642 b[2] = 0x99 * 257;
643 r[3] = 0xa1 * 257;
644 g[3] = 0xb5 * 257;
645 b[3] = 0xff * 257;
646
647 for (i = 4; i < count; i++)
648 {
649 r[i] = i * 257;
650 g[i] = (i | 0x40) * 257;
651 b[i] = (i | 0x80) * 257;
652 }
653}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

Referenced by test_color_formats(), and test_tiff_8bpp_palette().

◆ get_pixelformat_info()

static HRESULT get_pixelformat_info ( const GUID format,
UINT bpp,
UINT channels,
BOOL transparency 
)
static

Definition at line 381 of file tiffformat.c.

382{
383 HRESULT hr;
385 IWICPixelFormatInfo2 *formatinfo;
386
387 hr = IWICImagingFactory_CreateComponentInfo(factory, format, &info);
388 ok(hr == S_OK, "CreateComponentInfo(%s) error %#lx\n", wine_dbgstr_guid(format), hr);
389 if (hr == S_OK)
390 {
391 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void **)&formatinfo);
392 if (hr == S_OK)
393 {
394 hr = IWICPixelFormatInfo2_SupportsTransparency(formatinfo, transparency);
395 ok(hr == S_OK, "SupportsTransparency error %#lx\n", hr);
396 IWICPixelFormatInfo2_Release(formatinfo);
397 }
398 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void **)&formatinfo);
399 if (hr == S_OK)
400 {
401 hr = IWICPixelFormatInfo2_GetBitsPerPixel(formatinfo, bpp);
402 ok(hr == S_OK, "GetBitsPerPixel error %#lx\n", hr);
403 hr = IWICPixelFormatInfo2_GetChannelCount(formatinfo, channels);
404 ok(hr == S_OK, "GetChannelCount error %#lx\n", hr);
405 IWICPixelFormatInfo2_Release(formatinfo);
406 }
407 IWICComponentInfo_Release(info);
408 }
409 return hr;
410}
DWORD bpp
Definition: surface.c:185
int This channels
Definition: rdpsnd_libao.c:37

Referenced by test_color_formats().

◆ START_TEST()

START_TEST ( tiffformat  )

Definition at line 1299 of file tiffformat.c.

1300{
1301 HRESULT hr;
1302
1304
1305 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
1306 &IID_IWICImagingFactory, (void **)&factory);
1307 ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
1308 if (FAILED(hr)) return;
1309
1318
1319 IWICImagingFactory_Release(factory);
1321}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define FAILED(hr)
Definition: intsafe.h:51
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
static void test_tiff_24bpp(void)
Definition: tiffformat.c:755
static void test_color_formats(void)
Definition: tiffformat.c:864
static void test_tiff_4bps_bgra(void)
Definition: tiffformat.c:1237
static void test_QueryCapability(void)
Definition: tiffformat.c:467
static void test_tiff_1bpp_palette(void)
Definition: tiffformat.c:436
static void test_tiff_8bpp_alpha(void)
Definition: tiffformat.c:562
static void test_tiff_resolution(void)
Definition: tiffformat.c:703
static void test_tiff_8bpp_palette(void)
Definition: tiffformat.c:655

◆ test_color_formats()

static void test_color_formats ( void  )
static

Definition at line 864 of file tiffformat.c.

865{
866 struct bitmap_data
867 {
868 UINT bpp;
869 UINT width;
870 UINT height;
872 const BYTE *bits;
873 };
874 static const BYTE bits_1bpsBGR[] = { 0,255,0,255,0,255,255,255,0,0,0,255,255,0,0,0,255,255,255,255,255,0,0,0,0,255,0,255,0,255 };
875 static const struct bitmap_data data_1bpsBGR =
876 {
877 24, 10, 2, &GUID_WICPixelFormat24bppBGR, bits_1bpsBGR
878 };
879 static const BYTE bits_4bpsBGR[] = { 204,85,85,136,187,51,0,85,85,85,0,68,0,102,0,136,0,119,0,153,0 };
880 static const struct bitmap_data data_4bpsBGR =
881 {
882 24, 5, 2, &GUID_WICPixelFormat24bppBGR, bits_4bpsBGR
883 };
884 static const BYTE bits_8bpsBGR[] = { 2,0,1,5,4,3,8,7,6 };
885 static const struct bitmap_data data_8bpsBGR =
886 {
887 24, 3, 1, &GUID_WICPixelFormat24bppBGR, bits_8bpsBGR
888 };
889 static const BYTE bits_48bppRGB[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
890 static const struct bitmap_data data_48bppRGB =
891 {
892 48, 2, 1, &GUID_WICPixelFormat48bppRGB, bits_48bppRGB
893 };
894 static const BYTE bits_1bpsBGRA[] = { 0,255,0,255,0,255,0,255,0,255,255,0,255,0,0,255,255,0,255,255,0,0,255,0,0,255,0,255,0,255,0,255,0,0,0,0,0,255,0,0 };
895 static const struct bitmap_data data_1bpsBGRA =
896 {
897 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_1bpsBGRA
898 };
899 static const struct bitmap_data data_1bpsPBGRA =
900 {
901 32, 5, 2, &GUID_WICPixelFormat32bppPBGRA, bits_1bpsBGRA
902 };
903 static const BYTE bits_4bpsBGRA[] = { 204,85,85,51,85,136,187,85,0,68,0,85,0,102,0,119,0,136,0,153,0,0,0,17,0,34,0,51 };
904 static const struct bitmap_data data_4bpsBGRA =
905 {
906 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_4bpsBGRA
907 };
908 static const struct bitmap_data data_4bpsPBGRA =
909 {
910 32, 5, 2, &GUID_WICPixelFormat32bppPBGRA, bits_4bpsBGRA
911 };
912 static const BYTE bits_8bpsBGRA[] = { 2,0,1,3,6,5,4,7,0,9,8,1,4,3,2,5 };
913 static const struct bitmap_data data_8bpsBGRA =
914 {
915 32, 4, 1, &GUID_WICPixelFormat32bppBGRA, bits_8bpsBGRA
916 };
917 static const struct bitmap_data data_8bpsPBGRA =
918 {
919 32, 4, 1, &GUID_WICPixelFormat32bppPBGRA, bits_8bpsBGRA
920 };
921 static const BYTE bits_64bppRGBA[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
922 static const struct bitmap_data data_64bppRGBA =
923 {
924 64, 2, 1, &GUID_WICPixelFormat64bppRGBA, bits_64bppRGBA
925 };
926 static const struct bitmap_data data_64bppPRGBA =
927 {
928 64, 2, 1, &GUID_WICPixelFormat64bppPRGBA, bits_64bppRGBA
929 };
930 static const BYTE bits_BlackWhite[] = { 85,195,184,85 };
931 static const struct bitmap_data data_BlackWhite =
932 {
933 1, 30, 1, &GUID_WICPixelFormatBlackWhite, bits_BlackWhite
934 };
935 static const BYTE bits_BlackWhite_xp[] = { 85,195,184,84 };
936 static const struct bitmap_data data_BlackWhite_xp =
937 {
938 1, 30, 1, &GUID_WICPixelFormatBlackWhite, bits_BlackWhite_xp
939 };
940 static const BYTE bits_4bppGray[] = { 85,195,184,85 };
941 static const struct bitmap_data data_4bppGray =
942 {
943 4, 7, 1, &GUID_WICPixelFormat4bppGray, bits_4bppGray
944 };
945 static const BYTE bits_4bppGray_xp[] = { 85,195,184,80 };
946 static const struct bitmap_data data_4bppGray_xp =
947 {
948 4, 7, 1, &GUID_WICPixelFormat4bppGray, bits_4bppGray_xp
949 };
950 static const BYTE bits_8bppGray[] = { 1,0,2,3,4,5,6,7,8,9 };
951 static const struct bitmap_data data_8bppGray =
952 {
953 8, 10, 1, &GUID_WICPixelFormat8bppGray, bits_8bppGray
954 };
955 static const BYTE bits_16bppGray[] = { 1,0,2,3,4,5 };
956 static const struct bitmap_data data_16bppGray =
957 {
958 16, 3, 1, &GUID_WICPixelFormat16bppGray, bits_16bppGray
959 };
960 static const BYTE bits_32bppGrayFloat[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
961 static const struct bitmap_data data_32bppGrayFloat =
962 {
963 32, 3, 1, &GUID_WICPixelFormat32bppGrayFloat, bits_32bppGrayFloat
964 };
965 static const BYTE bits_96bppRGBFloat[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
966 static const struct bitmap_data data_96bppRGBFloat =
967 {
968 96, 1, 1, &GUID_WICPixelFormat96bppRGBFloat, bits_96bppRGBFloat
969 };
970 static const BYTE bits_128bppRGBAFloat[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
971 static const struct bitmap_data data_128bppRGBAFloat =
972 {
973 128, 1, 1, &GUID_WICPixelFormat128bppRGBAFloat, bits_128bppRGBAFloat
974 };
975 static const struct bitmap_data data_128bppPRGBAFloat =
976 {
977 128, 1, 1, &GUID_WICPixelFormat128bppPRGBAFloat, bits_128bppRGBAFloat
978 };
979 static const BYTE bits_1bppIndexed[] = { 85,195,184,85 };
980 static const struct bitmap_data data_1bppIndexed =
981 {
982 1, 32, 1, &GUID_WICPixelFormat1bppIndexed, bits_1bppIndexed
983 };
984 static const BYTE bits_4bppIndexed[] = { 85,195,184,85 };
985 static const struct bitmap_data data_4bppIndexed =
986 {
987 4, 7, 1, &GUID_WICPixelFormat4bppIndexed, bits_4bppIndexed
988 };
989 static const BYTE bits_4bppIndexed_xp[] = { 85,195,184,80 };
990 static const struct bitmap_data data_4bppIndexed_xp =
991 {
992 4, 7, 1, &GUID_WICPixelFormat4bppIndexed, bits_4bppIndexed_xp
993 };
994 static const BYTE bits_8bppIndexed[] = { 1,0,2,3,4,5,6,7,8,9 };
995 static const struct bitmap_data data_8bppIndexed =
996 {
997 8, 3, 1, &GUID_WICPixelFormat8bppIndexed, bits_8bppIndexed
998 };
999 static const BYTE bits_32bppCMYK[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
1000 static const struct bitmap_data data_32bppCMYK =
1001 {
1002 32, 3, 1, &GUID_WICPixelFormat32bppCMYK, bits_32bppCMYK
1003 };
1004 static const BYTE bits_64bppCMYK[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
1005 static const struct bitmap_data data_64bppCMYK =
1006 {
1007 64, 2, 1, &GUID_WICPixelFormat64bppCMYK, bits_64bppCMYK
1008 };
1009 static const struct
1010 {
1011 int photometric; /* PhotometricInterpretation */
1012 int samples; /* SamplesPerPixel */
1013 int bps; /* BitsPerSample */
1014 int extra_samples; /* ExtraSamples */
1015 const struct bitmap_data *data;
1016 const struct bitmap_data *alt_data;
1017 } td[] =
1018 {
1019 /* 2 - RGB */
1020 { 2, 3, 1, 0, &data_1bpsBGR },
1021 { 2, 3, 4, 0, &data_4bpsBGR },
1022 { 2, 3, 8, 0, &data_8bpsBGR },
1023 { 2, 3, 16, 0, &data_48bppRGB },
1024 { 2, 3, 24, 0, NULL },
1025 { 2, 3, 32, 0, &data_96bppRGBFloat },
1026 { 2, 4, 1, 0, &data_1bpsBGRA },
1027 { 2, 4, 1, 1, &data_1bpsPBGRA },
1028 { 2, 4, 4, 0, &data_4bpsBGRA },
1029 { 2, 4, 4, 1, &data_4bpsPBGRA },
1030 { 2, 4, 8, 0, &data_8bpsBGRA },
1031 { 2, 4, 8, 1, &data_8bpsPBGRA },
1032 { 2, 4, 16, 0, &data_64bppRGBA },
1033 { 2, 4, 16, 1, &data_64bppPRGBA },
1034 { 2, 4, 24, 0, NULL },
1035 { 2, 4, 32, 0, &data_128bppRGBAFloat },
1036 { 2, 4, 32, 1, &data_128bppPRGBAFloat },
1037 /* 1 - BlackIsZero (Bilevel) */
1038 { 1, 1, 1, 0, &data_BlackWhite, &data_BlackWhite_xp },
1039 { 1, 1, 4, 0, &data_4bppGray, &data_4bppGray_xp },
1040 { 1, 1, 8, 0, &data_8bppGray },
1041 { 1, 1, 16, 0, &data_16bppGray },
1042 { 1, 1, 24, 0, NULL },
1043 { 1, 1, 32, 0, &data_32bppGrayFloat },
1044 /* 3 - Palette Color */
1045 { 3, 1, 1, 0, &data_1bppIndexed },
1046 { 3, 1, 4, 0, &data_4bppIndexed, &data_4bppIndexed_xp },
1047 { 3, 1, 8, 0, &data_8bppIndexed },
1048#if 0 /* FIXME: for some reason libtiff replaces photometric 3 by 1 for bps > 8 */
1049 { 3, 1, 16, 0, &data_8bppIndexed },
1050 { 3, 1, 24, 0, &data_8bppIndexed },
1051 { 3, 1, 32, 0, &data_8bppIndexed },
1052#endif
1053 /* 5 - Separated */
1054 { 5, 4, 1, 0, NULL },
1055 { 5, 4, 4, 0, NULL },
1056 { 5, 4, 8, 0, &data_32bppCMYK },
1057 { 5, 4, 16, 0, &data_64bppCMYK },
1058 { 5, 4, 24, 0, NULL },
1059 { 5, 4, 32, 0, NULL },
1060 };
1061 BYTE buf[sizeof(tiff_1x1_data)];
1062 BYTE pixels[256];
1063 HRESULT hr;
1065 IWICBitmapFrameDecode *frame;
1066 GUID format;
1067 UINT count, i, bpp, channels, ret;
1068 BOOL transparency;
1069 struct IFD_entry *tag, *tag_photo = NULL, *tag_bps = NULL, *tag_samples = NULL, *tag_colormap = NULL;
1070 struct IFD_entry *tag_width = NULL, *tag_height = NULL, *tag_extra_samples = NULL;
1071 short *bps;
1072
1074 generate_tiff_palette(buf + FIELD_OFFSET(struct tiff_1x1_data, palette_data), 256);
1075
1076 count = *(short *)(buf + tiff_1x1_data.dir_offset);
1077 tag = (struct IFD_entry *)(buf + tiff_1x1_data.dir_offset + sizeof(short));
1078
1079 /* verify the TIFF structure */
1080 for (i = 0; i < count; i++)
1081 {
1082 if (tag[i].id == 0x100) /* ImageWidth */
1083 tag_width = &tag[i];
1084 else if (tag[i].id == 0x101) /* ImageLength */
1085 tag_height = &tag[i];
1086 else if (tag[i].id == 0x102) /* BitsPerSample */
1087 tag_bps = &tag[i];
1088 else if (tag[i].id == 0x106) /* PhotometricInterpretation */
1089 tag_photo = &tag[i];
1090 else if (tag[i].id == 0x115) /* SamplesPerPixel */
1091 tag_samples = &tag[i];
1092 else if (tag[i].id == 0x140) /* ColorMap */
1093 tag_colormap = &tag[i];
1094 else if (tag[i].id == 0x152) /* ExtraSamples */
1095 tag_extra_samples = &tag[i];
1096 }
1097
1098 ok(tag_bps && tag_photo && tag_samples && tag_colormap && tag_extra_samples, "tag 0x102,0x106,0x115,0x140 or 0x152 is missing\n");
1099 if (!tag_bps || !tag_photo || !tag_samples || !tag_colormap || !tag_extra_samples) return;
1100
1101 ok(tag_bps->type == IFD_SHORT, "tag 0x102 should have type IFD_SHORT\n");
1102 bps = (short *)(buf + tag_bps->value);
1103 ok(bps[0] == 8 && bps[1] == 8 && bps[2] == 8 && bps[3] == 0,
1104 "expected bps 8,8,8,0 got %d,%d,%d,%d\n", bps[0], bps[1], bps[2], bps[3]);
1105
1106 for (i = 0; i < ARRAY_SIZE(td); i++)
1107 {
1108 if (td[i].data)
1109 {
1110 bpp = td[i].samples * td[i].bps;
1111 if (winetest_debug > 1)
1112 trace("photometric %d, samples %d, extra samples %d, bps %d, bpp %u, width %u => width_bytes %u\n",
1113 td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, bpp,
1114 td[i].data->width, width_bytes(td[i].data->width, bpp));
1115 tag_width->value = td[i].data->width;
1116 tag_height->value = td[i].data->height;
1117 }
1118 else
1119 {
1120 tag_width->value = 1;
1121 tag_height->value = 1;
1122 }
1123
1124 tag_colormap->count = (1 << td[i].bps) * 3;
1125
1126 if (td[i].bps < 8)
1127 {
1128 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data)] = 0x55;
1129 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 1] = 0xc3;
1130 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 2] = 0xb8;
1131 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 3] = 0x55;
1132 }
1133 else
1134 {
1135 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data)] = 1;
1136 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 1] = 0;
1137 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 2] = 2;
1138 buf[FIELD_OFFSET(struct tiff_1x1_data, pixel_data) + 3] = 3;
1139 }
1140
1141 tag_photo->value = td[i].photometric;
1142 tag_bps->count = td[i].samples;
1143 tag_samples->value = td[i].samples;
1144
1145 if (td[i].samples == 1)
1146 tag_bps->value = td[i].bps;
1147 else if (td[i].samples == 2)
1148 tag_bps->value = MAKELONG(td[i].bps, td[i].bps);
1149 else if (td[i].samples == 3)
1150 {
1151 tag_bps->value = (BYTE *)bps - buf;
1152 bps[0] = bps[1] = bps[2] = td[i].bps;
1153 }
1154 else if (td[i].samples == 4)
1155 {
1156 tag_bps->value = (BYTE *)bps - buf;
1157 bps[0] = bps[1] = bps[2] = bps[3] = td[i].bps;
1158 }
1159 else
1160 {
1161 ok(0, "%u: unsupported samples count %d\n", i, td[i].samples);
1162 continue;
1163 }
1164
1165 if (td[i].extra_samples)
1166 {
1167 tag_extra_samples->id = 0x152; /* ExtraSamples */
1168 tag_extra_samples->value = td[i].extra_samples;
1169 }
1170 else /* remove ExtraSamples tag */
1171 {
1172 tag_extra_samples->id = 0x14e; /* NumberOfInks */
1173 tag_extra_samples->value = td[i].samples;
1174 }
1175
1176 hr = create_decoder(buf, sizeof(buf), &decoder);
1177 if (!td[i].data)
1178 {
1180 "%u: (%d,%d,%d,%d) wrong error %#lx\n", i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, hr);
1181 if (hr == S_OK)
1182 {
1183 IWICBitmapDecoder_Release(decoder);
1184 dump_tiff(buf);
1185 }
1186 continue;
1187 }
1188 else
1190 "%u: failed to load TIFF image data (%d,%d,%d,%d) %#lx\n",
1191 i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, hr);
1192 if (hr != S_OK) continue;
1193
1194 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
1195 ok(hr == S_OK, "%u: GetFrame error %#lx\n", i, hr);
1196
1197 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
1198 ok(hr == S_OK, "%u: GetPixelFormat error %#lx\n", i, hr);
1199 if (IsEqualGUID(td[i].data->format, &GUID_WICPixelFormat96bppRGBFloat) && IsEqualGUID(&format, &GUID_WICPixelFormat128bppRGBFloat))
1200 {
1201 win_skip("Windows Server 2008 misinterprets 96bppRGBFloat as 128bppRGBFloat, skipping the tests\n");
1202 IWICBitmapFrameDecode_Release(frame);
1203 IWICBitmapDecoder_Release(decoder);
1204 continue;
1205 }
1206 ok(IsEqualGUID(&format, td[i].data->format),
1207 "%u (%d,%d,%d,%d): expected %s, got %s\n",
1208 i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps,
1210
1211 transparency = (td[i].photometric == 2 && td[i].samples == 4); /* for XP */
1212 hr = get_pixelformat_info(&format, &bpp, &channels, &transparency);
1213 ok(hr == S_OK, "%u: get_pixelformat_bpp error %#lx\n", i, hr);
1214 ok(bpp == td[i].data->bpp, "%u: expected %u, got %u\n", i, td[i].data->bpp, bpp);
1215 ok(channels == td[i].samples, "%u: expected %u, got %u\n", i, td[i].samples, channels);
1216 ok(transparency == (td[i].photometric == 2 && td[i].samples == 4), "%u: got %u\n", i, transparency);
1217
1218 memset(pixels, 0, sizeof(pixels));
1219 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, width_bytes(td[i].data->width, bpp), sizeof(pixels), pixels);
1220 ok(hr == S_OK, "%u: CopyPixels error %#lx\n", i, hr);
1221 ret = memcmp(pixels, td[i].data->bits, width_bytes(td[i].data->width, bpp));
1222 if (ret && td[i].alt_data)
1223 ret = memcmp(pixels, td[i].alt_data->bits, width_bytes(td[i].data->width, bpp));
1224 ok(ret == 0, "%u: (%d,%d,%d,%d) wrong pixel data\n", i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps);
1225 if (ret)
1226 {
1227 UINT j, n = width_bytes(td[i].data->width, bpp);
1228 for (j = 0; j < n; j++)
1229 printf("%u%s", pixels[j], (j + 1) < n ? "," : "\n");
1230 }
1231
1232 IWICBitmapFrameDecode_Release(frame);
1233 IWICBitmapDecoder_Release(decoder);
1234 }
1235}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define trace
Definition: atltest.h:70
#define broken(x)
Definition: atltest.h:178
#define ARRAY_SIZE(A)
Definition: main.h:20
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLsizei samples
Definition: glext.h:7006
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static const BYTE bits_4bppGray_xp[]
Definition: converter.c:565
static const float bits_32bppGrayFloat[]
Definition: converter.c:553
static const BYTE bits_8bppGray[]
Definition: converter.c:585
static const BYTE bits_64bppRGBA[]
Definition: converter.c:528
static const BYTE bits_4bppGray[]
Definition: converter.c:571
static const WORD bits_48bppRGB[]
Definition: converter.c:625
static IWICBitmapDecoder * create_decoder(void)
Definition: ddsformat.c:485
int winetest_debug
#define win_skip
Definition: test.h:164
#define memset(x, y, z)
Definition: compat.h:39
LONG value
UINT bpp
Definition: converter.c:37
const BYTE * bits
Definition: converter.c:38
UINT width
Definition: converter.c:39
UINT height
Definition: converter.c:40
const WICPixelFormatGUID * format
Definition: converter.c:36
const struct bitmap_data * alt_data
Definition: converter.c:43
ULONG dir_offset
Definition: image.c:5507
static HRESULT get_pixelformat_info(const GUID *format, UINT *bpp, UINT *channels, BOOL *transparency)
Definition: tiffformat.c:381
static UINT width_bytes(UINT width, UINT bpp)
Definition: tiffformat.c:859
#define IFD_SHORT
Definition: tiffformat.c:40
static void generate_tiff_palette(void *buf, unsigned count)
Definition: tiffformat.c:625
static void dump_tiff(void *buf)
Definition: tiffformat.c:412
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define MAKELONG(a, b)
Definition: typedefs.h:249
int ret
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3296
#define WINCODEC_ERR_BADIMAGE
Definition: winerror.h:3299
#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT
Definition: winerror.h:3307

Referenced by START_TEST().

◆ test_QueryCapability()

static void test_QueryCapability ( void  )
static

Definition at line 467 of file tiffformat.c.

468{
469 HRESULT hr;
476 static const DWORD exp_caps_xp = WICBitmapDecoderCapabilityCanDecodeAllImages |
478 DWORD capability;
480 UINT frame_count;
481
483 if (!stream) return;
484
485 hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatTiff, NULL, &decoder);
486 ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
487 if (FAILED(hr)) return;
488
489 frame_count = 0xdeadbeef;
490 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
491 ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#lx\n", hr);
492 ok(frame_count == 0, "expected 0, got %u\n", frame_count);
493
494 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
495 ok(hr == WINCODEC_ERR_FRAMEMISSING || broken(hr == E_POINTER) /* XP */, "expected WINCODEC_ERR_FRAMEMISSING, got %#lx\n", hr);
496
497 pos.QuadPart = 4;
498 hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
499 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
500
501 capability = 0xdeadbeef;
502 hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
503 ok(hr == S_OK, "QueryCapability error %#lx\n", hr);
504 ok(capability == exp_caps || capability == exp_caps_xp,
505 "expected %#lx, got %#lx\n", exp_caps, capability);
506
507 frame_count = 0xdeadbeef;
508 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
509 ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
510 ok(frame_count == 1, "expected 1, got %u\n", frame_count);
511
512 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
513 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
514 IWICBitmapFrameDecode_Release(frame);
515
516 pos.QuadPart = 5;
517 hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
518 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
519
520 hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
521 ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
522
523 hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
524 ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
525
526 IWICBitmapDecoder_Release(decoder);
527
528 /* CreateDecoderFromStream fails if seeked past the start */
529 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
531 ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "expected WINCODEC_ERR_COMPONENTNOTFOUND, got %#lx\n", hr);
532
533 if (SUCCEEDED(hr))
534 IWICBitmapDecoder_Release(decoder);
535
536 pos.QuadPart = 0;
537 hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
538 ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
539
540 hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
541 ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
542
543 frame_count = 0xdeadbeef;
544 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
545 ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
546 ok(frame_count == 1, "expected 1, got %u\n", frame_count);
547
548 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
549 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
550 IWICBitmapFrameDecode_Release(frame);
551
552 hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
553 ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
554
555 hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
556 ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
557
558 IWICBitmapDecoder_Release(decoder);
559 IStream_Release(stream);
560}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define SEEK_SET
Definition: jmemansi.c:26
#define todo_wine
Definition: custom.c:89
static IStream * create_stream(const void *data, int data_size)
Definition: tiffformat.c:326
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:29
@ WICBitmapDecoderCapabilityCanDecodeSomeImages
Definition: wincodec.idl:51
@ WICBitmapDecoderCapabilityCanEnumerateMetadata
Definition: wincodec.idl:52
@ WICBitmapDecoderCapabilityCanDecodeAllImages
Definition: wincodec.idl:50
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281
#define E_POINTER
Definition: winerror.h:2365
#define WINCODEC_ERR_FRAMEMISSING
Definition: winerror.h:3301

Referenced by START_TEST().

◆ test_tiff_1bpp_palette()

static void test_tiff_1bpp_palette ( void  )
static

Definition at line 436 of file tiffformat.c.

437{
438 HRESULT hr;
442 GUID format;
443
445 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
446 if (hr != S_OK) return;
447
448 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
449 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
450
451 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
452 ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
453 ok(IsEqualGUID(&format, &GUID_WICPixelFormatBlackWhite),
454 "got wrong format %s\n", wine_dbgstr_guid(&format));
455
456 hr = IWICImagingFactory_CreatePalette(factory, &palette);
457 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
458 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
460 "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
461
462 IWICPalette_Release(palette);
463 IWICBitmapFrameDecode_Release(frame);
464 IWICBitmapDecoder_Release(decoder);
465}
static HPALETTE palette
Definition: clipboard.c:1345
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292

Referenced by START_TEST().

◆ test_tiff_24bpp()

static void test_tiff_24bpp ( void  )
static

Definition at line 755 of file tiffformat.c.

756{
757 HRESULT hr;
761 double dpi_x, dpi_y;
762 GUID format;
763 WICRect rc;
764 BYTE data[3];
765 static const BYTE expected_data[] = { 0x33,0x22,0x11 };
766
768 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
769 if (hr != S_OK) return;
770 ok(decoder != NULL, "Failed to load TIFF image data\n");
771
772 hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
773 ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
774 ok(count == 1, "got %u\n", count);
775
776 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
777 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
778
779 hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
780 ok(hr == S_OK, "GetSize error %#lx\n", hr);
781 ok(width == 1, "got %u\n", width);
782 ok(height == 1, "got %u\n", height);
783
784 hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
785 ok(hr == S_OK, "GetResolution error %#lx\n", hr);
786 ok(dpi_x == 300.0, "got %f\n", dpi_x);
787 ok(dpi_y == 300.0, "got %f\n", dpi_y);
788
789 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
790 ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
791 ok(IsEqualGUID(&format, &GUID_WICPixelFormat24bppBGR),
792 "got wrong format %s\n", wine_dbgstr_guid(&format));
793
794 for (stride = 0; stride <= 32; stride++)
795 {
796 memset(data, 0, sizeof(data));
797 rc.X = 0;
798 rc.Y = 0;
799 rc.Width = 1;
800 rc.Height = 1;
801 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, stride, sizeof(data), data);
802 if (stride < 3)
803 ok(hr == E_INVALIDARG, "CopyPixels(%u) should fail: %#lx\n", stride, hr);
804 else
805 {
806 ok(hr == S_OK, "CopyPixels(%u) error %#lx\n", stride, hr);
807
808 for (i = 0; i < sizeof(data); i++)
809 ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
810 }
811 }
812
813 IWICBitmapFrameDecode_Release(frame);
814 IWICBitmapDecoder_Release(decoder);
815}
#define E_INVALIDARG
Definition: ddrawi.h:101
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
INT Height
Definition: wincodec.idl:335
INT Width
Definition: wincodec.idl:334

Referenced by START_TEST().

◆ test_tiff_4bps_bgra()

static void test_tiff_4bps_bgra ( void  )
static

Definition at line 1237 of file tiffformat.c.

1238{
1239 HRESULT hr;
1241 IWICBitmapFrameDecode *frame;
1242 UINT frame_count, width, height, i;
1243 double dpi_x, dpi_y;
1245 GUID format;
1246 WICRect rc;
1247 BYTE data[24];
1248 static const BYTE expected_data[24] = { 0,0,0,0xff, 0xff,0,0,0, 0xff,0,0,0xff,
1249 0,0xff,0,0, 0xff,0xff,0,0xff, 0xff,0xff,0xff,0 };
1250
1252 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
1253 if (hr != S_OK) return;
1254
1255 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
1256 ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
1257 ok(frame_count == 1, "expected 1, got %u\n", frame_count);
1258
1259 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
1260 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
1261
1262 hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
1263 ok(hr == S_OK, "GetSize error %#lx\n", hr);
1264 ok(width == 3, "got %u\n", width);
1265 ok(height == 2, "got %u\n", height);
1266
1267 hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
1268 ok(hr == S_OK, "GetResolution error %#lx\n", hr);
1269 ok(dpi_x == 96.0, "expected 96.0, got %f\n", dpi_x);
1270 ok(dpi_y == 96.0, "expected 96.0, got %f\n", dpi_y);
1271
1272 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
1273 ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
1274 ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
1275 "got wrong format %s\n", wine_dbgstr_guid(&format));
1276
1277 hr = IWICImagingFactory_CreatePalette(factory, &palette);
1278 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
1279 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
1281 "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
1282 IWICPalette_Release(palette);
1283
1284 memset(data, 0xaa, sizeof(data));
1285 rc.X = 0;
1286 rc.Y = 0;
1287 rc.Width = 3;
1288 rc.Height = 2;
1289 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 12, sizeof(data), data);
1290 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
1291
1292 for (i = 0; i < sizeof(data); i++)
1293 ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
1294
1295 IWICBitmapFrameDecode_Release(frame);
1296 IWICBitmapDecoder_Release(decoder);
1297}

Referenced by START_TEST().

◆ test_tiff_8bpp_alpha()

static void test_tiff_8bpp_alpha ( void  )
static

Definition at line 562 of file tiffformat.c.

563{
564 HRESULT hr;
567 UINT frame_count, width, height, i;
568 double dpi_x, dpi_y;
570 GUID format;
571 WICRect rc;
572 BYTE data[16];
573 static const BYTE expected_data[16] = { 0x11,0x11,0x11,0x22,0x33,0x33,0x33,0x44,
574 0x55,0x55,0x55,0x66,0x77,0x77,0x77,0x88 };
575
577 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
578 if (hr != S_OK) return;
579
580 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
581 ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
582 ok(frame_count == 1, "expected 1, got %u\n", frame_count);
583
585 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
586 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
588 IWICBitmapDecoder_Release(decoder);
589
590 hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
591 ok(hr == S_OK, "GetSize error %#lx\n", hr);
592 ok(width == 2, "expected 2, got %u\n", width);
593 ok(height == 2, "expected 2, got %u\n", height);
594
595 hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
596 ok(hr == S_OK, "GetResolution error %#lx\n", hr);
597 ok(dpi_x == 96.0, "expected 96.0, got %f\n", dpi_x);
598 ok(dpi_y == 96.0, "expected 96.0, got %f\n", dpi_y);
599
600 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
601 ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
602 ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppPBGRA),
603 "got wrong format %s\n", wine_dbgstr_guid(&format));
604
605 hr = IWICImagingFactory_CreatePalette(factory, &palette);
606 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
607 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
609 "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
610 IWICPalette_Release(palette);
611
612 rc.X = 0;
613 rc.Y = 0;
614 rc.Width = 2;
615 rc.Height = 2;
616 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 8, sizeof(data), data);
617 ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
618
619 for (i = 0; i < sizeof(data); i++)
620 ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
621
622 IWICBitmapFrameDecode_Release(frame);
623}
#define EXPECT_REF(obj, ref)
Definition: tiffformat.c:29

Referenced by START_TEST().

◆ test_tiff_8bpp_palette()

static void test_tiff_8bpp_palette ( void  )
static

Definition at line 655 of file tiffformat.c.

656{
657 char buf[sizeof(tiff_8bpp_data)];
658 HRESULT hr;
662 GUID format;
663 UINT count, ret;
664 WICColor color[256];
665
667 generate_tiff_palette(buf + FIELD_OFFSET(struct tiff_8bpp_data, palette_data), 256);
668
669 hr = create_decoder(buf, sizeof(buf), &decoder);
670 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
671 if (hr != S_OK) return;
672
673 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
674 ok(hr == S_OK, "GetFrame error %#lx\n", hr);
675
676 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
677 ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
678 ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
679 "expected GUID_WICPixelFormat8bppIndexed, got %s\n", wine_dbgstr_guid(&format));
680
681 hr = IWICImagingFactory_CreatePalette(factory, &palette);
682 ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
683 hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
684 ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
685
686 hr = IWICPalette_GetColorCount(palette, &count);
687 ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
688 ok(count == 256, "expected 256, got %u\n", count);
689
690 hr = IWICPalette_GetColors(palette, 256, color, &ret);
691 ok(hr == S_OK, "GetColors error %#lx\n", hr);
692 ok(ret == count, "expected %u, got %u\n", count, ret);
693 ok(color[0] == 0xff112233, "got %#x\n", color[0]);
694 ok(color[1] == 0xff445566, "got %#x\n", color[1]);
695 ok(color[2] == 0xff778899, "got %#x\n", color[2]);
696 ok(color[3] == 0xffa1b5ff, "got %#x\n", color[3]);
697
698 IWICPalette_Release(palette);
699 IWICBitmapFrameDecode_Release(frame);
700 IWICBitmapDecoder_Release(decoder);
701}
GLuint color
Definition: glext.h:6243
UINT32 WICColor
Definition: wincodec.idl:364

Referenced by START_TEST().

◆ test_tiff_resolution()

static void test_tiff_resolution ( void  )
static

Definition at line 703 of file tiffformat.c.

704{
705 HRESULT hr;
708 double dpi_x, dpi_y;
709 int i;
710
711 for (i = 0; i < ARRAY_SIZE(tiff_resolution_test_data); i++)
712 {
716 tiff_resolution_image_data.entry[12].value = test_data->resolution_unit;
717
719 ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
720 if (hr != S_OK) return;
721
722 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
723 ok(hr == S_OK, "%d: GetFrame error %#lx\n", i, hr);
724
725 hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
726 ok(hr == S_OK, "%d: GetResolution error %#lx\n", i, hr);
727
728 if (test_data->broken_dpi_x != 0)
729 {
730 ok(fabs(dpi_x - test_data->expected_dpi_x) < 0.01 || broken(fabs(dpi_x - test_data->broken_dpi_x) < 0.01),
731 "%d: x: expected %f or %f, got %f\n", i, test_data->expected_dpi_x, test_data->broken_dpi_x, dpi_x);
732 }
733 else
734 {
735 ok(fabs(dpi_x - test_data->expected_dpi_x) < 0.01,
736 "%d: x: expected %f, got %f\n", i, test_data->expected_dpi_x, dpi_x);
737 }
738
739 if (test_data->broken_dpi_y != 0)
740 {
741 ok(fabs(dpi_y - test_data->expected_dpi_y) < 0.01 || broken(fabs(dpi_y - test_data->broken_dpi_y) < 0.01),
742 "%d: y: expected %f or %f, got %f\n", i, test_data->expected_dpi_y, test_data->broken_dpi_y, dpi_y);
743 }
744 else
745 {
746 ok(fabs(dpi_y - test_data->expected_dpi_y) < 0.01,
747 "%d: y: expected %f, got %f\n", i, test_data->expected_dpi_y, dpi_y);
748 }
749
750 IWICBitmapFrameDecode_Release(frame);
751 IWICBitmapDecoder_Release(decoder);
752 }
753}
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
struct IFD_rational resy
Definition: tiffformat.c:221
struct IFD_entry entry[13]
Definition: tiffformat.c:218
struct IFD_rational resx
Definition: tiffformat.c:220

Referenced by START_TEST().

◆ width_bytes()

static UINT width_bytes ( UINT  width,
UINT  bpp 
)
static

Variable Documentation

◆ factory

Definition at line 324 of file tiffformat.c.

Referenced by test_CreateMetadataWriterFromReader().

◆ tiff_1bpp_data

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_1bpp_data, number_of_entries),
13,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 1 },
{ 0x101, IFD_LONG, 1, 1 },
{ 0x102, IFD_SHORT, 1, 1 },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 1 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_1bpp_data, pixel_data) },
{ 0x115, IFD_SHORT, 1, 1 },
{ 0x116, IFD_LONG, 1, 1 },
{ 0x117, IFD_LONG, 1, 1 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1bpp_data, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1bpp_data, res) },
{ 0x128, IFD_SHORT, 1, 2 },
},
0,
{ 900, 3 },
{ 0x11, 0x22, 0x33, 0 }
}
GLuint res
Definition: glext.h:9613
#define IFD_RATIONAL
Definition: tiffformat.c:42
#define IFD_LONG
Definition: tiffformat.c:41

◆ tiff_1x1_data

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_1x1_data, number_of_entries),
13,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 1 },
{ 0x101, IFD_LONG, 1, 1 },
{ 0x102, IFD_SHORT, 3, FIELD_OFFSET(struct tiff_1x1_data, bps_data) },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 2 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_1x1_data, pixel_data) },
{ 0x115, IFD_SHORT, 1, 3 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) },
{ 0x128, IFD_SHORT, 1, 2 },
{ 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_1x1_data, palette_data) },
{ 0x152, IFD_SHORT, 1, 1 }
},
0,
{ 96, 1 },
{ { 0 } },
{ 8,8,8,0 },
{ 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 }
}

◆ tiff_24bpp_data

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_1bpp_data, number_of_entries),
13,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 1 },
{ 0x101, IFD_LONG, 1, 1 },
{ 0x102, IFD_SHORT, 1, 8 },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 2 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_24bpp_data, pixel_data) },
{ 0x115, IFD_SHORT, 1, 3 },
{ 0x116, IFD_LONG, 1, 1 },
{ 0x117, IFD_LONG, 1, 3 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_24bpp_data, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_24bpp_data, res) },
{ 0x128, IFD_SHORT, 1, 2 },
},
0,
{ 900, 3 },
{ 0x11, 0x22, 0x33 }
}

◆ tiff_4bps_bgra

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_4bps_bgra, number_of_entries),
14,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 3 },
{ 0x101, IFD_LONG, 1, 2 },
{ 0x102, IFD_SHORT, 1, 1 },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 2 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_4bps_bgra, pixel_data) },
{ 0x115, IFD_SHORT, 1, 4 },
{ 0x116, IFD_LONG, 1, 2 },
{ 0x117, IFD_LONG, 1, 4 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_4bps_bgra, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_4bps_bgra, res) },
{ 0x11c, IFD_SHORT, 1, 1 },
{ 0x128, IFD_SHORT, 1, 2 }
},
0,
{ 96, 1 },
{ 0x12,0x30, 0x47,0xe0 }
}

◆ tiff_8bpp_alpha

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_8bpp_alpha, number_of_entries),
15,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 2 },
{ 0x101, IFD_LONG, 1, 2 },
{ 0x102, IFD_SHORT, 2, MAKELONG(8, 8) },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 1 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, pixel_data) },
{ 0x115, IFD_SHORT, 1, 2 },
{ 0x116, IFD_LONG, 1, 2 },
{ 0x117, IFD_LONG, 1, 8 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, res) },
{ 0x11c, IFD_SHORT, 1, 1 },
{ 0x128, IFD_SHORT, 1, 2 },
{ 0x152, IFD_SHORT, 1, 1 }
},
0,
{ 96, 1 },
{ 0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88 }
}

◆ tiff_8bpp_data

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_8bpp_data, number_of_entries),
14,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 4 },
{ 0x101, IFD_LONG, 1, 1 },
{ 0x102, IFD_SHORT, 1, 8 },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 3 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_8bpp_data, pixel_data) },
{ 0x115, IFD_SHORT, 1, 1 },
{ 0x116, IFD_LONG, 1, 1 },
{ 0x117, IFD_LONG, 1, 1 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_data, res) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_data, res) },
{ 0x128, IFD_SHORT, 1, 2 },
{ 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_8bpp_data, palette_data) }
},
0,
{ 96, 1 },
{ { 0 } },
{ 0,1,2,3 }
}

◆ tiff_resolution_image_data

Initial value:
=
{
'I' | 'I' << 8,
42,
FIELD_OFFSET(struct tiff_resolution_image_data, number_of_entries),
13,
{
{ 0xff, IFD_SHORT, 1, 0 },
{ 0x100, IFD_LONG, 1, 1 },
{ 0x101, IFD_LONG, 1, 1 },
{ 0x102, IFD_SHORT, 1, 1 },
{ 0x103, IFD_SHORT, 1, 1 },
{ 0x106, IFD_SHORT, 1, 1 },
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_resolution_image_data, pixel_data) },
{ 0x115, IFD_SHORT, 1, 1 },
{ 0x116, IFD_LONG, 1, 1 },
{ 0x117, IFD_LONG, 1, 1 },
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_resolution_image_data, resx) },
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_resolution_image_data, resy) },
{ 0x128, IFD_SHORT, 1, 1 },
},
0,
{ 72, 1 },
{ 72, 1 },
{ 0x11, 0x22, 0x33, 0 }
}

◆ tiff_resolution_test_data

Initial value:
=
{
{ { 100, 1 }, { 50, 1 }, 0, 100.0, 50.0, 0, 0 },
{ { 50, 1 }, { 100, 1 }, 0, 50.0, 100.0, 0, 0 },
{ { 100, 1 }, { 50, 1 }, 1, 100.0, 50.0, 0, 0 },
{ { 50, 1 }, { 100, 1 }, 1, 50.0, 100.0, 0, 0 },
{ { 49, 1 }, { 49, 1 }, 2, 49.0, 49.0, 0, 0 },
{ { 33, 1 }, { 55, 1 }, 2, 33.0, 55.0, 0, 0 },
{ { 50, 2 }, { 66, 3 }, 2, 25.0, 22.0, 0, 0 },
{ { 100, 1 }, { 200, 1 }, 3, 254.0, 508.0, 0, 0 },
{ { 0, 1 }, { 29, 1 }, 2, 96.0, 96.0, 0, 29.0 },
{ { 58, 1 }, { 29, 0 }, 2, 96.0, 96.0, 58.0, 0 },
{ { 0, 1 }, { 100, 1 }, 3, 96.0, 96.0, 243.84, 254.0 },
{ { 50, 1 }, { 72, 0 }, 3, 96.0, 96.0, 127.0, 243.84 }
}