Lines Matching refs:data

40 static inline int8_t read_int8(uint8_t *data, unsigned int o) {  in read_int8()  argument
41 return (int8_t) data[o]; in read_int8()
45 static inline uint8_t read_uint8(uint8_t *data, unsigned int o) { in read_uint8() argument
46 return (uint8_t) data[o]; in read_uint8()
49 static inline int16_t read_int16(uint8_t *data, unsigned int o) { in read_int16() argument
50 return (int16_t) (data[o] | (data[o+1] << 8)); in read_int16()
53 static inline uint16_t read_uint16(uint8_t *data, unsigned int o) { in read_uint16() argument
54 return (uint16_t) (data[o] | (data[o+1] << 8)); in read_uint16()
57 static inline int32_t read_int32(uint8_t *data, unsigned int o) { in read_int32() argument
58 return (int32_t) ((unsigned)data[o] | in read_int32()
59 ((unsigned)data[o+1] << 8) | in read_int32()
60 ((unsigned)data[o+2] << 16) | in read_int32()
61 ((unsigned)data[o+3] << 24)); in read_int32()
64 static inline uint32_t read_uint32(uint8_t *data, unsigned int o) { in read_uint32() argument
65 return (uint32_t) ((unsigned)data[o] | in read_uint32()
66 ((unsigned)data[o+1] << 8) | in read_uint32()
67 ((unsigned)data[o+2] << 16) | in read_uint32()
68 ((unsigned)data[o+3] << 24)); in read_uint32()
75 static bmp_result bmp_info_header_parse(bmp_image *bmp, uint8_t *data) in bmp_info_header_parse() argument
89 header_size = read_uint32(data, 0); in bmp_info_header_parse()
108 width = read_int16(data, 4); in bmp_info_header_parse()
109 height = read_int16(data, 6); in bmp_info_header_parse()
133 if (read_uint16(data, 8) != 1) in bmp_info_header_parse()
135 bmp->bpp = read_uint16(data, 10); in bmp_info_header_parse()
185 width = read_int32(data, 4); in bmp_info_header_parse()
186 height = read_int32(data, 8); in bmp_info_header_parse()
214 if (read_uint16(data, 12) != 1) in bmp_info_header_parse()
216 bmp->bpp = read_uint16(data, 14); in bmp_info_header_parse()
219 bmp->encoding = read_uint32(data, 16); in bmp_info_header_parse()
264 bmp->mask[i] = read_uint32(data, 40 + (i << 2)); in bmp_info_header_parse()
269 bmp->mask[i] = read_uint32(data, 40 + (i << 2)); in bmp_info_header_parse()
285 bmp->colours = read_uint32(data, 32); in bmp_info_header_parse()
290 data += header_size; in bmp_info_header_parse()
319 uint32_t colour = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_info_header_parse()
322 data += palette_size; in bmp_info_header_parse()
331 if ((bmp->bitmap_offset < (uint32_t)(data - bmp->bmp_data)) && in bmp_info_header_parse()
332 ((bmp->buffer_size - (data - bmp->bmp_data)) > 0)) { in bmp_info_header_parse()
333 bmp->bitmap_offset = data - bmp->bmp_data; in bmp_info_header_parse()
350 bmp->bitmap_offset = (uintptr_t)data - (uintptr_t)bmp->bmp_data; in bmp_info_header_parse()
362 static bmp_result bmp_file_header_parse(bmp_image *bmp, uint8_t *data) in bmp_file_header_parse() argument
375 if ((data[0] != (uint8_t)'B') || (data[1] != (uint8_t)'M')) in bmp_file_header_parse()
378 bmp->bitmap_offset = read_uint32(data, 10); in bmp_file_header_parse()
412 static bmp_result ico_header_parse(ico_collection *ico, uint8_t *data) in ico_header_parse() argument
428 if (read_uint16(data, 2) != 0x0001) in ico_header_parse()
430 count = read_uint16(data, 4); in ico_header_parse()
433 data += ICO_FILE_HEADER_SIZE; in ico_header_parse()
460 image->bmp.width = read_uint8(data, 0); in ico_header_parse()
463 image->bmp.height = read_uint8(data, 1); in ico_header_parse()
466 image->bmp.buffer_size = read_uint32(data, 8); in ico_header_parse()
467 image->bmp.bmp_data = ico->ico_data + read_uint32(data, 12); in ico_header_parse()
472 data += ICO_DIR_ENTRY_SIZE; in ico_header_parse()
482 ico->buffer_size - (ico->ico_data - data)) in ico_header_parse()
514 uint8_t *top, *bottom, *end, *data; in bmp_decode_rgb32() local
521 data = *start; in bmp_decode_rgb32()
527 end = data + bytes; in bmp_decode_rgb32()
532 if ((data + 4) > end) in bmp_decode_rgb32()
535 bmp->transparent_index = read_uint32(data, 0); in bmp_decode_rgb32()
537 bmp->transparent_index = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb32()
541 if ((data + (4 * bmp->width)) > end) in bmp_decode_rgb32()
549 word = read_uint32(data, 0); in bmp_decode_rgb32()
558 data += 4; in bmp_decode_rgb32()
563 scanline[x] = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb32()
570 scanline[x] |= (unsigned)data[3] << 24; in bmp_decode_rgb32()
572 data += 4; in bmp_decode_rgb32()
577 *start = data; in bmp_decode_rgb32()
594 uint8_t *top, *bottom, *end, *data; in bmp_decode_rgb24() local
600 data = *start; in bmp_decode_rgb24()
608 end = data + bytes; in bmp_decode_rgb24()
609 addr = ((uintptr_t)data) & 3; in bmp_decode_rgb24()
614 if ((data + 3) > end) { in bmp_decode_rgb24()
618 bmp->transparent_index = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb24()
622 if ((data + (3 * bmp->width)) > end) { in bmp_decode_rgb24()
633 scanline[x] = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb24()
639 data += 3; in bmp_decode_rgb24()
643 while (addr != (((uintptr_t)data) & 3)) { in bmp_decode_rgb24()
644 data++; in bmp_decode_rgb24()
647 *start = data; in bmp_decode_rgb24()
664 uint8_t *top, *bottom, *end, *data; in bmp_decode_rgb16() local
671 data = *start; in bmp_decode_rgb16()
677 end = data + bytes; in bmp_decode_rgb16()
678 addr = ((uintptr_t)data) & 3; in bmp_decode_rgb16()
683 if ((data + 2) > end) in bmp_decode_rgb16()
685 bmp->transparent_index = read_uint16(data, 0); in bmp_decode_rgb16()
689 if ((data + (2 * bmp->width)) > end) in bmp_decode_rgb16()
697 word = read_uint16(data, 0); in bmp_decode_rgb16()
710 data += 2; in bmp_decode_rgb16()
715 word = read_uint16(data, 0); in bmp_decode_rgb16()
726 data += 2; in bmp_decode_rgb16()
730 while (addr != (((uintptr_t)data) & 3)) in bmp_decode_rgb16()
731 data += 2; in bmp_decode_rgb16()
733 *start = data; in bmp_decode_rgb16()
750 uint8_t *top, *bottom, *end, *data; in bmp_decode_rgb() local
762 data = *start; in bmp_decode_rgb()
768 end = data + bytes; in bmp_decode_rgb()
769 addr = ((uintptr_t)data) & 3; in bmp_decode_rgb()
774 uint32_t idx = (*data >> bit_shifts[0]) & bit_mask; in bmp_decode_rgb()
782 if ((data + ((bmp->width + ppb - 1) / ppb)) > end) in bmp_decode_rgb()
792 cur_byte = *data++; in bmp_decode_rgb()
804 while (addr != (((uintptr_t)data) & 3)) in bmp_decode_rgb()
805 data++; in bmp_decode_rgb()
807 *start = data; in bmp_decode_rgb()
820 static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t *data, int bytes) in bmp_decode_mask() argument
833 end = data + bytes; in bmp_decode_mask()
835 addr = ((uintptr_t)data) & 3; in bmp_decode_mask()
838 if ((data + (bmp->width >> 3)) > end) in bmp_decode_mask()
843 cur_byte = *data++; in bmp_decode_mask()
853 while (addr != (((uintptr_t)data) & 3)) in bmp_decode_mask()
854 data++; in bmp_decode_mask()
871 bmp_decode_rle8(bmp_image *bmp, uint8_t *data, int bytes) in bmp_decode_rle8() argument
888 end = data + bytes; in bmp_decode_rle8()
892 if (data + 2 > end) in bmp_decode_rle8()
894 length = *data++; in bmp_decode_rle8()
896 length = *data++; in bmp_decode_rle8()
915 if (data + 2 > end) in bmp_decode_rle8()
917 x += *data++; in bmp_decode_rle8()
920 y += *data++; in bmp_decode_rle8()
936 if (data + length > end) in bmp_decode_rle8()
944 uint32_t idx = (uint32_t) *data++; in bmp_decode_rle8()
961 if ((length & 1) && (*data++ != 0x00)) in bmp_decode_rle8()
981 if (data + 1 > end) in bmp_decode_rle8()
988 idx = (uint32_t) *data++; in bmp_decode_rle8()
1008 } while (data < end); in bmp_decode_rle8()
1025 bmp_decode_rle4(bmp_image *bmp, uint8_t *data, int bytes) in bmp_decode_rle4() argument
1042 end = data + bytes; in bmp_decode_rle4()
1046 if (data + 2 > end) in bmp_decode_rle4()
1048 length = *data++; in bmp_decode_rle4()
1050 length = *data++; in bmp_decode_rle4()
1069 if (data + 2 > end) in bmp_decode_rle4()
1071 x += *data++; in bmp_decode_rle4()
1074 y += *data++; in bmp_decode_rle4()
1090 if (data + ((length + 1) / 2) > end) in bmp_decode_rle4()
1112 pixel = *data++; in bmp_decode_rle4()
1126 if ((length & 1) && (*data++ != 0x00)) in bmp_decode_rle4()
1144 if (data + 1 > end) in bmp_decode_rle4()
1152 pixel2 = *data++; in bmp_decode_rle4()
1177 } while (data < end); in bmp_decode_rle4()
1209 bmp_result bmp_analyse(bmp_image *bmp, size_t size, uint8_t *data) in bmp_analyse() argument
1220 bmp->bmp_data = data; in bmp_analyse()
1222 res = bmp_file_header_parse(bmp, data); in bmp_analyse()
1224 res = bmp_info_header_parse(bmp, data + BMP_FILE_HEADER_SIZE); in bmp_analyse()
1231 bmp_result ico_analyse(ico_collection *ico, size_t size, uint8_t *data) in ico_analyse() argument
1239 ico->ico_data = data; in ico_analyse()
1241 return ico_header_parse(ico, data); in ico_analyse()
1248 uint8_t *data; in bmp_decode() local
1252 data = bmp->bmp_data + bmp->bitmap_offset; in bmp_decode()
1259 result = bmp_decode_rgb32(bmp, &data, bytes); in bmp_decode()
1263 result = bmp_decode_rgb24(bmp, &data, bytes); in bmp_decode()
1267 result = bmp_decode_rgb16(bmp, &data, bytes); in bmp_decode()
1271 result = bmp_decode_rgb(bmp, &data, bytes); in bmp_decode()
1277 result = bmp_decode_rle8(bmp, data, bytes); in bmp_decode()
1281 result = bmp_decode_rle4(bmp, data, bytes); in bmp_decode()
1287 result = bmp_decode_rgb32(bmp, &data, bytes); in bmp_decode()
1291 result = bmp_decode_rgb16(bmp, &data, bytes); in bmp_decode()
1303 bytes = (uintptr_t)bmp->bmp_data + bmp->buffer_size - (uintptr_t)data; in bmp_decode()
1304 result = bmp_decode_mask(bmp, data, bytes); in bmp_decode()