865{
867 {
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 };
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 };
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 };
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 };
891 {
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 };
896 {
897 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_1bpsBGRA
898 };
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 };
905 {
906 32, 5, 2, &GUID_WICPixelFormat32bppBGRA, bits_4bpsBGRA
907 };
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 };
914 {
915 32, 4, 1, &GUID_WICPixelFormat32bppBGRA, bits_8bpsBGRA
916 };
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 };
923 {
925 };
927 {
929 };
930 static const BYTE bits_BlackWhite[] = { 85,195,184,85 };
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 };
942 {
944 };
947 {
949 };
952 {
954 };
955 static const BYTE bits_16bppGray[] = { 1,0,2,3,4,5 };
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 {
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 };
981 {
982 1, 32, 1, &GUID_WICPixelFormat1bppIndexed, bits_1bppIndexed
983 };
984 static const BYTE bits_4bppIndexed[] = { 85,195,184,85 };
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 };
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 };
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 };
1006 {
1007 64, 2, 1, &GUID_WICPixelFormat64bppCMYK, bits_64bppCMYK
1008 };
1009 static const struct
1010 {
1011 int photometric;
1013 int bps;
1014 int extra_samples;
1017 } td[] =
1018 {
1019
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
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
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
1049 { 3, 1, 16, 0, &data_8bppIndexed },
1050 { 3, 1, 24, 0, &data_8bppIndexed },
1051 { 3, 1, 32, 0, &data_8bppIndexed },
1052#endif
1053
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 };
1071 short *bps;
1072
1075
1078
1079
1081 {
1082 if (
tag[
i].
id == 0x100)
1083 tag_width = &
tag[
i];
1084 else if (
tag[
i].
id == 0x101)
1085 tag_height = &
tag[
i];
1086 else if (
tag[
i].
id == 0x102)
1088 else if (
tag[
i].
id == 0x106)
1089 tag_photo = &
tag[
i];
1090 else if (
tag[
i].
id == 0x115)
1091 tag_samples = &
tag[
i];
1092 else if (
tag[
i].
id == 0x140)
1093 tag_colormap = &
tag[
i];
1094 else if (
tag[
i].
id == 0x152)
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
1107 {
1109 {
1110 bpp = td[
i].samples * td[
i].bps;
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,
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
1127 {
1132 }
1133 else
1134 {
1139 }
1140
1141 tag_photo->
value = td[
i].photometric;
1142 tag_bps->count = td[
i].samples;
1143 tag_samples->value = td[
i].samples;
1144
1146 tag_bps->value = td[
i].bps;
1148 tag_bps->value =
MAKELONG(td[
i].bps, td[
i].bps);
1150 {
1151 tag_bps->value = (
BYTE *)bps -
buf;
1152 bps[0] = bps[1] = bps[2] = td[
i].bps;
1153 }
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;
1168 tag_extra_samples->value = td[
i].extra_samples;
1169 }
1170 else
1171 {
1172 tag_extra_samples->id = 0x14e;
1173 tag_extra_samples->value = td[
i].samples;
1174 }
1175
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);
1182 {
1183 IWICBitmapDecoder_Release(
decoder);
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);
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 }
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);
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);
1216 ok(transparency == (td[
i].photometric == 2 && td[
i].
samples == 4),
"%u: got %u\n",
i, transparency);
1217
1220 ok(
hr ==
S_OK,
"%u: CopyPixels error %#lx\n",
i,
hr);
1222 if (
ret && td[
i].alt_data)
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);
1226 {
1228 for (
j = 0;
j <
n;
j++)
1230 }
1231
1232 IWICBitmapFrameDecode_Release(frame);
1233 IWICBitmapDecoder_Release(
decoder);
1234 }
1235}
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 BYTE bits_4bppGray_xp[]
static const float bits_32bppGrayFloat[]
static const BYTE bits_8bppGray[]
static const BYTE bits_64bppRGBA[]
static const BYTE bits_4bppGray[]
static const WORD bits_48bppRGB[]
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