34 int i,
ret, buf_size = avpkt->
size;
35 uint32_t
version, header_size, vclass, ncolors;
36 uint32_t xoffset, be, bpp, lsize, rsize;
37 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
46 header_size = bytestream2_get_be32u(&gb);
48 version = bytestream2_get_be32u(&gb);
59 pixformat = bytestream2_get_be32u(&gb);
60 pixdepth = bytestream2_get_be32u(&gb);
61 avctx->
width = bytestream2_get_be32u(&gb);
62 avctx->
height = bytestream2_get_be32u(&gb);
63 xoffset = bytestream2_get_be32u(&gb);
64 be = bytestream2_get_be32u(&gb);
65 bunit = bytestream2_get_be32u(&gb);
66 bitorder = bytestream2_get_be32u(&gb);
67 bpad = bytestream2_get_be32u(&gb);
68 bpp = bytestream2_get_be32u(&gb);
69 lsize = bytestream2_get_be32u(&gb);
70 vclass = bytestream2_get_be32u(&gb);
71 rgb[0] = bytestream2_get_be32u(&gb);
72 rgb[1] = bytestream2_get_be32u(&gb);
73 rgb[2] = bytestream2_get_be32u(&gb);
75 ncolors = bytestream2_get_be32u(&gb);
78 av_log(avctx,
AV_LOG_DEBUG,
"pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
79 pixformat, pixdepth, bunit, bitorder, bpad);
80 av_log(avctx,
AV_LOG_DEBUG,
"vclass %d, ncolors %d, bpp %d, be %d, lsize %d, xoffset %d\n",
81 vclass, ncolors, bpp, be, lsize, xoffset);
89 if (pixdepth == 0 || pixdepth > 32) {
109 if (bunit != 8 && bunit != 16 && bunit != 32) {
114 if (bpad != 8 && bpad != 16 && bpad != 32) {
119 if (bpp == 0 || bpp > 32) {
152 if (bpp != 1 && bpp != 8)
156 }
else if (pixdepth == 8) {
167 if (bpp != 16 && bpp != 24 && bpp != 32)
169 if (bpp == 16 && pixdepth == 15) {
170 if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
172 else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
174 }
else if (bpp == 16 && pixdepth == 16) {
175 if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
177 else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
179 }
else if (bpp == 24) {
180 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
182 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
184 }
else if (bpp == 32) {
185 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
187 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
199 "Unknown file: bpp %d, pixdepth %d, vclass %d",
200 bpp, pixdepth, vclass);
211 uint32_t *dst = (uint32_t *)p->
data[1];
214 for (i = 0; i < ncolors; i++) {
217 red = bytestream2_get_byteu(&gb);
219 green = bytestream2_get_byteu(&gb);
221 blue = bytestream2_get_byteu(&gb);
224 dst[i] = red << 16 | green << 8 | blue;
229 for (i = 0; i < avctx->
height; i++) {