36 int i,
ret, buf_size = avpkt->
size;
37 uint32_t
version, header_size, vclass, ncolors;
38 uint32_t xoffset, be, bpp, lsize, rsize;
39 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
48 header_size = bytestream2_get_be32u(&gb);
50 version = bytestream2_get_be32u(&gb);
61 pixformat = bytestream2_get_be32u(&gb);
62 pixdepth = bytestream2_get_be32u(&gb);
63 avctx->
width = bytestream2_get_be32u(&gb);
64 avctx->
height = bytestream2_get_be32u(&gb);
65 xoffset = bytestream2_get_be32u(&gb);
66 be = bytestream2_get_be32u(&gb);
67 bunit = bytestream2_get_be32u(&gb);
68 bitorder = bytestream2_get_be32u(&gb);
69 bpad = bytestream2_get_be32u(&gb);
70 bpp = bytestream2_get_be32u(&gb);
71 lsize = bytestream2_get_be32u(&gb);
72 vclass = bytestream2_get_be32u(&gb);
73 rgb[0] = bytestream2_get_be32u(&gb);
74 rgb[1] = bytestream2_get_be32u(&gb);
75 rgb[2] = bytestream2_get_be32u(&gb);
77 ncolors = bytestream2_get_be32u(&gb);
81 "pixformat %"PRIu32
", pixdepth %"PRIu32
", bunit %"PRIu32
", bitorder %"PRIu32
", bpad %"PRIu32
"\n",
82 pixformat, pixdepth, bunit, bitorder, bpad);
84 "vclass %"PRIu32
", ncolors %"PRIu32
", bpp %"PRIu32
", be %"PRIu32
", lsize %"PRIu32
", xoffset %"PRIu32
"\n",
85 vclass, ncolors, bpp, be, lsize, xoffset);
87 "red %0"PRIx32
", green %0"PRIx32
", blue %0"PRIx32
"\n",
88 rgb[0], rgb[1], rgb[2]);
95 if (pixdepth == 0 || pixdepth > 32) {
115 if (bunit != 8 && bunit != 16 && bunit != 32) {
120 if (bpad != 8 && bpad != 16 && bpad != 32) {
125 if (bpp == 0 || bpp > 32) {
158 if (bpp != 1 && bpp != 8)
162 }
else if (pixdepth == 8) {
173 if (bpp != 16 && bpp != 24 && bpp != 32)
175 if (bpp == 16 && pixdepth == 15) {
176 if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
178 else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
180 }
else if (bpp == 16 && pixdepth == 16) {
181 if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
183 else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
185 }
else if (bpp == 24) {
186 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
188 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
190 }
else if (bpp == 32) {
191 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
193 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
205 "Unknown file: bpp %"PRIu32
", pixdepth %"PRIu32
", vclass %"PRIu32
"",
206 bpp, pixdepth, vclass);
217 uint32_t *dst = (uint32_t *)p->
data[1];
220 for (i = 0; i < ncolors; i++) {
223 red = bytestream2_get_byteu(&gb);
225 green = bytestream2_get_byteu(&gb);
227 blue = bytestream2_get_byteu(&gb);
230 dst[i] = red << 16 | green << 8 | blue;
235 for (i = 0; i < avctx->
height; i++) {