43 int i, ret, buf_size = avpkt->
size;
44 uint32_t
version, header_size, vclass, ncolors;
45 uint32_t xoffset, be, bpp, lsize, rsize;
46 uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
55 header_size = bytestream2_get_be32u(&gb);
57 version = bytestream2_get_be32u(&gb);
68 pixformat = bytestream2_get_be32u(&gb);
69 pixdepth = bytestream2_get_be32u(&gb);
70 avctx->
width = bytestream2_get_be32u(&gb);
71 avctx->
height = bytestream2_get_be32u(&gb);
72 xoffset = bytestream2_get_be32u(&gb);
73 be = bytestream2_get_be32u(&gb);
74 bunit = bytestream2_get_be32u(&gb);
75 bitorder = bytestream2_get_be32u(&gb);
76 bpad = bytestream2_get_be32u(&gb);
77 bpp = bytestream2_get_be32u(&gb);
78 lsize = bytestream2_get_be32u(&gb);
79 vclass = bytestream2_get_be32u(&gb);
80 rgb[0] = bytestream2_get_be32u(&gb);
81 rgb[1] = bytestream2_get_be32u(&gb);
82 rgb[2] = bytestream2_get_be32u(&gb);
84 ncolors = bytestream2_get_be32u(&gb);
87 av_log(avctx,
AV_LOG_DEBUG,
"pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
88 pixformat, pixdepth, bunit, bitorder, bpad);
89 av_log(avctx,
AV_LOG_DEBUG,
"vclass %d, ncolors %d, bpp %d, be %d, lsize %d, xoffset %d\n",
90 vclass, ncolors, bpp, be, lsize, xoffset);
98 if (pixdepth == 0 || pixdepth > 32) {
118 if (bunit != 8 && bunit != 16 && bunit != 32) {
123 if (bpad != 8 && bpad != 16 && bpad != 32) {
128 if (bpp == 0 || bpp > 32) {
161 if (bpp != 1 && bpp != 8)
165 }
else if (pixdepth == 8) {
176 if (bpp != 16 && bpp != 24 && bpp != 32)
178 if (bpp == 16 && pixdepth == 15) {
179 if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
181 else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
183 }
else if (bpp == 16 && pixdepth == 16) {
184 if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
186 else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
188 }
else if (bpp == 24) {
189 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
191 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
193 }
else if (bpp == 32) {
194 if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
196 else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
207 av_log_ask_for_sample(avctx,
"unknown file: bpp %d, pixdepth %d, vclass %d\n", bpp, pixdepth, vclass);
224 uint32_t *
dst = (uint32_t *)p->
data[1];
227 for (i = 0; i < ncolors; i++) {
230 red = bytestream2_get_byteu(&gb);
232 green = bytestream2_get_byteu(&gb);
234 blue = bytestream2_get_byteu(&gb);
237 dst[i] = red << 16 | green << 8 | blue;
242 for (i = 0; i < avctx->
height; i++) {