894{
896 {
902 };
903 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 };
905 {
906 24, 10, 2, &GUID_WICPixelFormat24bppBGR, bits_1bpsBGR
907 };
908 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 };
910 {
911 24, 5, 2, &GUID_WICPixelFormat24bppBGR, bits_4bpsBGR
912 };
913 static const BYTE bits_8bpsBGR[] = { 2,0,1,5,4,3,8,7,6 };
915 {
916 24, 3, 1, &GUID_WICPixelFormat24bppBGR, bits_8bpsBGR
917 };
918 static const BYTE bits_48bppRGB[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
920 {
921 48, 2, 1, &GUID_WICPixelFormat48bppRGB, bits_48bppRGB
922 };
923 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 };
925 {
926 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_1bpsBGRA
927 };
928 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 };
930 {
931 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_4bpsBGRA
932 };
933 static const BYTE bits_8bpsBGRA[] = { 2,0,1,3,6,5,4,7,0,9,8,1,4,3,2,5 };
935 {
936 32, 4, 1, &GUID_WICPixelFormat32bppBGRA, bits_8bpsBGRA
937 };
938 static const BYTE bits_64bppRGBA[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
940 {
942 };
943 static const BYTE bits_BlackWhite[] = { 85,195,184,85 };
945 {
946 1, 30, 1, &GUID_WICPixelFormatBlackWhite, bits_BlackWhite
947 };
948 static const BYTE bits_BlackWhite_xp[] = { 85,195,184,84 };
949 static const struct bitmap_data data_BlackWhite_xp =
950 {
951 1, 30, 1, &GUID_WICPixelFormatBlackWhite, bits_BlackWhite_xp
952 };
953 static const BYTE bits_4bppGray[] = { 85,195,184,85 };
955 {
956 4, 7, 1, &GUID_WICPixelFormat4bppGray, bits_4bppGray
957 };
958 static const BYTE bits_4bppGray_xp[] = { 85,195,184,80 };
960 {
961 4, 7, 1, &GUID_WICPixelFormat4bppGray, bits_4bppGray_xp
962 };
965 {
967 };
968 static const BYTE bits_16bppGray[] = { 1,0,2,3,4,5 };
970 {
971 16, 3, 1, &GUID_WICPixelFormat16bppGray, bits_16bppGray
972 };
973 static const BYTE bits_32bppGrayFloat[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
974 static const struct bitmap_data data_32bppGrayFloat =
975 {
977 };
978#if 0
979 static const BYTE bits_96bpp3Channels[] = { 0 };
980 static const struct bitmap_data data_96bpp3Channels =
981 {
982 64, 1, 1, &GUID_WICPixelFormat96bpp3Channels, bits_96bpp3Channels
983 };
984#endif
985 static const BYTE bits_128bppRGBAFloat[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
986 static const struct bitmap_data data_128bppRGBAFloat =
987 {
988 128, 1, 1, &GUID_WICPixelFormat128bppRGBAFloat, bits_128bppRGBAFloat
989 };
990 static const BYTE bits_1bppIndexed[] = { 85,195,184,85 };
992 {
993 1, 32, 1, &GUID_WICPixelFormat1bppIndexed, bits_1bppIndexed
994 };
995 static const BYTE bits_4bppIndexed[] = { 85,195,184,85 };
997 {
998 4, 7, 1, &GUID_WICPixelFormat4bppIndexed, bits_4bppIndexed
999 };
1000 static const BYTE bits_4bppIndexed_xp[] = { 85,195,184,80 };
1001 static const struct bitmap_data data_4bppIndexed_xp =
1002 {
1003 4, 7, 1, &GUID_WICPixelFormat4bppIndexed, bits_4bppIndexed_xp
1004 };
1005 static const BYTE bits_8bppIndexed[] = { 1,0,2,3,4,5,6,7,8,9 };
1006 static const struct bitmap_data data_8bppIndexed =
1007 {
1008 8, 3, 1, &GUID_WICPixelFormat8bppIndexed, bits_8bppIndexed
1009 };
1010 static const BYTE bits_32bppCMYK[] = { 1,0,2,3,4,5,6,7,8,9,0,1 };
1012 {
1013 32, 3, 1, &GUID_WICPixelFormat32bppCMYK, bits_32bppCMYK
1014 };
1015 static const BYTE bits_64bppCMYK[] = { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
1017 {
1018 64, 2, 1, &GUID_WICPixelFormat64bppCMYK, bits_64bppCMYK
1019 };
1020 static const struct
1021 {
1022 int photometric;
1024 int bps;
1027 } td[] =
1028 {
1029
1030 { 2, 3, 1, &data_1bpsBGR },
1031 { 2, 3, 4, &data_4bpsBGR },
1032 { 2, 3, 8, &data_8bpsBGR },
1033 { 2, 3, 16, &data_48bppRGB },
1035#if 0
1036 { 2, 3, 32, &data_96bpp3Channels },
1037#endif
1038 { 2, 4, 1, &data_1bpsBGRA },
1039 { 2, 4, 4, &data_4bpsBGRA },
1040 { 2, 4, 8, &data_8bpsBGRA },
1041 { 2, 4, 16, &data_64bppRGBA },
1043 { 2, 4, 32, &data_128bppRGBAFloat },
1044
1045 { 1, 1, 1, &data_BlackWhite, &data_BlackWhite_xp },
1046 { 1, 1, 4, &data_4bppGray, &data_4bppGray_xp },
1047 { 1, 1, 8, &data_8bppGray },
1048 { 1, 1, 16, &data_16bppGray },
1050 { 1, 1, 32, &data_32bppGrayFloat },
1051
1052 { 3, 1, 1, &data_1bppIndexed },
1053 { 3, 1, 4, &data_4bppIndexed, &data_4bppIndexed_xp },
1054 { 3, 1, 8, &data_8bppIndexed },
1055#if 0
1056 { 3, 1, 16, &data_8bppIndexed },
1057 { 3, 1, 24, &data_8bppIndexed },
1058 { 3, 1, 32, &data_8bppIndexed },
1059#endif
1060
1063 { 5, 4, 8, &data_32bppCMYK },
1064 { 5, 4, 16, &data_64bppCMYK },
1067 };
1078 short *bps;
1079
1082
1085
1086
1088 {
1089 if (
tag[
i].
id == 0x100)
1090 tag_width = &
tag[
i];
1091 else if (
tag[
i].
id == 0x101)
1092 tag_height = &
tag[
i];
1093 else if (
tag[
i].
id == 0x102)
1095 else if (
tag[
i].
id == 0x106)
1096 tag_photo = &
tag[
i];
1097 else if (
tag[
i].
id == 0x115)
1098 tag_samples = &
tag[
i];
1099 else if (
tag[
i].
id == 0x140)
1100 tag_colormap = &
tag[
i];
1101 }
1102
1103 ok(tag_bps && tag_photo && tag_samples && tag_colormap,
"tag 0x102,0x106,0x115 or 0x140 is missing\n");
1104 if (!tag_bps || !tag_photo || !tag_samples || !tag_colormap) return;
1105
1106 ok(tag_bps->type ==
IFD_SHORT,
"tag 0x102 should have type IFD_SHORT\n");
1107 bps = (
short *)(
buf + tag_bps->value);
1108 ok(bps[0] == 8 && bps[1] == 8 && bps[2] == 8 && bps[3] == 0,
1109 "expected bps 8,8,8,0 got %d,%d,%d,%d\n", bps[0], bps[1], bps[2], bps[3]);
1110
1111 for (
i = 0;
i <
sizeof(td)/
sizeof(td[0]);
i++)
1112 {
1114 {
1115 bpp = td[
i].samples * td[
i].bps;
1117 trace(
"samples %u, bps %u, bpp %u, width %u => width_bytes %u\n", td[
i].
samples, td[
i].bps,
bpp,
1119 tag_width->
value = td[
i].data->width;
1120 tag_height->value = td[
i].data->height;
1121 }
1122 else
1123 {
1124 tag_width->
value = 1;
1125 tag_height->value = 1;
1126 }
1127
1128 tag_colormap->count = (1 << td[
i].bps) * 3;
1129
1131 {
1136 }
1137 else
1138 {
1143 }
1144
1145 tag_photo->
value = td[
i].photometric;
1146 tag_bps->count = td[
i].samples;
1147 tag_samples->value = td[
i].samples;
1148
1150 tag_bps->value = td[
i].bps;
1152 tag_bps->value =
MAKELONG(td[
i].bps, td[
i].bps);
1154 {
1155 tag_bps->value = (
BYTE *)bps -
buf;
1156 bps[0] = bps[1] = bps[2] = td[
i].bps;
1157 }
1159 {
1160 tag_bps->value = (
BYTE *)bps -
buf;
1161 bps[0] = bps[1] = bps[2] = bps[3] = td[
i].bps;
1162 }
1163 else
1164 {
1165 ok(0,
"%u: unsupported samples count %d\n",
i, td[
i].
samples);
1166 continue;
1167 }
1168
1171 {
1173 "%u: (%d,%d,%d) wrong error %#x\n",
i, td[
i].photometric, td[
i].
samples, td[
i].bps,
hr);
1175 {
1176 IWICBitmapDecoder_Release(decoder);
1178 }
1179 continue;
1180 }
1181 else
1183 "%u: failed to load TIFF image data (%d,%d,%d) %#x\n",
1185 if (
hr !=
S_OK)
continue;
1186
1187 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
1188 ok(
hr ==
S_OK,
"%u: GetFrame error %#x\n",
i,
hr);
1189
1190 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &
format);
1191 ok(
hr ==
S_OK,
"%u: GetPixelFormat error %#x\n",
i,
hr);
1193 "%u (%d,%d,%d): expected %s, got %s\n",
1194 i, td[
i].photometric, td[
i].samples, td[
i].bps,
1196
1197 trasparency = (td[
i].photometric == 2 && td[
i].samples == 4);
1199 ok(
hr ==
S_OK,
"%u: get_pixelformat_bpp error %#x\n",
i,
hr);
1200 ok(
bpp == td[
i].
data->bpp,
"%u: expected %u, got %u\n",
i, td[
i].data->bpp,
bpp);
1202 ok(trasparency == (td[
i].photometric == 2 && td[
i].
samples == 4),
"%u: got %u\n",
i, trasparency);
1203
1206 ok(
hr ==
S_OK,
"%u: CopyPixels error %#x\n",
i,
hr);
1208 if (
ret && td[
i].alt_data)
1210 ok(
ret == 0,
"%u: (%d,%d,%d) wrong pixel data\n",
i, td[
i].photometric, td[
i].
samples, td[
i].bps);
1212 {
1214 for (
j = 0;
j <
n;
j++)
1216 }
1217
1218 IWICBitmapFrameDecode_Release(frame);
1219 IWICBitmapDecoder_Release(decoder);
1220 }
1221}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
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
static const float bits_32bppGrayFloat[]
static const BYTE bits_8bppGray[]
static const BYTE bits_64bppRGBA[]
const WICPixelFormatGUID * format
const struct bitmap_data * alt_data
#define FIELD_OFFSET(t, f)
#define WINCODEC_ERR_COMPONENTNOTFOUND
#define WINCODEC_ERR_BADIMAGE
#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT