comparison src/stb_image.c @ 2414:69a5af2eb1ea

Remove useless dmMemset().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 23:27:01 +0200
parents 40797bfd35bf
children 9807ae37ad69
comparison
equal deleted inserted replaced
2413:902cc22018a1 2414:69a5af2eb1ea
1369 code <<= 1; 1369 code <<= 1;
1370 } 1370 }
1371 h->maxcode[j] = 0xffffffff; 1371 h->maxcode[j] = 0xffffffff;
1372 1372
1373 // build non-spec acceleration table; 255 is flag for not-accelerated 1373 // build non-spec acceleration table; 255 is flag for not-accelerated
1374 dmMemset(h->fast, 255, 1 << FAST_BITS); 1374 memset(h->fast, 255, 1 << FAST_BITS);
1375 for (i=0; i < k; ++i) { 1375 for (i=0; i < k; ++i) {
1376 int s = h->size[i]; 1376 int s = h->size[i];
1377 if (s <= FAST_BITS) { 1377 if (s <= FAST_BITS) {
1378 int c = h->code[i] << (FAST_BITS-s); 1378 int c = h->code[i] << (FAST_BITS-s);
1379 int m = 1 << (FAST_BITS-s); 1379 int m = 1 << (FAST_BITS-s);
1549 if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); 1549 if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
1550 t = stbi__jpeg_huff_decode(j, hdc); 1550 t = stbi__jpeg_huff_decode(j, hdc);
1551 if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); 1551 if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG");
1552 1552
1553 // 0 all the ac values now so we can do it 32-bits at a time 1553 // 0 all the ac values now so we can do it 32-bits at a time
1554 dmMemset(data,0,64*sizeof(data[0])); 1554 memset(data,0,64*sizeof(data[0]));
1555 1555
1556 diff = t ? stbi__extend_receive(j, t) : 0; 1556 diff = t ? stbi__extend_receive(j, t) : 0;
1557 dc = j->img_comp[b].dc_pred + diff; 1557 dc = j->img_comp[b].dc_pred + diff;
1558 j->img_comp[b].dc_pred = dc; 1558 j->img_comp[b].dc_pred = dc;
1559 data[0] = (short) (dc * dequant[0]); 1559 data[0] = (short) (dc * dequant[0]);
1601 1601
1602 if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); 1602 if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
1603 1603
1604 if (j->succ_high == 0) { 1604 if (j->succ_high == 0) {
1605 // first scan for DC coefficient, must be first 1605 // first scan for DC coefficient, must be first
1606 dmMemset(data,0,64*sizeof(data[0])); // 0 all the ac values now 1606 memset(data,0,64*sizeof(data[0])); // 0 all the ac values now
1607 t = stbi__jpeg_huff_decode(j, hdc); 1607 t = stbi__jpeg_huff_decode(j, hdc);
1608 diff = t ? stbi__extend_receive(j, t) : 0; 1608 diff = t ? stbi__extend_receive(j, t) : 0;
1609 1609
1610 dc = j->img_comp[b].dc_pred + diff; 1610 dc = j->img_comp[b].dc_pred + diff;
1611 j->img_comp[b].dc_pred = dc; 1611 j->img_comp[b].dc_pred = dc;
4558 out = (Uint8 *) dmMalloc(4 * w*h); 4558 out = (Uint8 *) dmMalloc(4 * w*h);
4559 if (!out) return stbi__errpuc("outofmem", "Out of memory"); 4559 if (!out) return stbi__errpuc("outofmem", "Out of memory");
4560 pixelCount = w*h; 4560 pixelCount = w*h;
4561 4561
4562 // Initialize the data to zero. 4562 // Initialize the data to zero.
4563 //dmMemset( out, 0, pixelCount * 4 ); 4563 //memset( out, 0, pixelCount * 4 );
4564 4564
4565 // Finally, the image data. 4565 // Finally, the image data.
4566 if (compression) { 4566 if (compression) {
4567 // RLE as used by .PSD and .TIFF 4567 // RLE as used by .PSD and .TIFF
4568 // Loop until you get the number of unpacked bytes you are expecting: 4568 // Loop until you get the number of unpacked bytes you are expecting:
4841 stbi__get16be(s); //skip `fields' 4841 stbi__get16be(s); //skip `fields'
4842 stbi__get16be(s); //skip `pad' 4842 stbi__get16be(s); //skip `pad'
4843 4843
4844 // intermediate buffer is RGBA 4844 // intermediate buffer is RGBA
4845 result = (Uint8 *) dmMalloc(x*y*4); 4845 result = (Uint8 *) dmMalloc(x*y*4);
4846 dmMemset(result, 0xff, x*y*4); 4846 memset(result, 0xff, x*y*4);
4847 4847
4848 if (!stbi__pic_load_core(s,x,y,comp, result)) { 4848 if (!stbi__pic_load_core(s,x,y,comp, result)) {
4849 dmFree(result); 4849 dmFree(result);
4850 result=0; 4850 result=0;
4851 } 4851 }
5191 5191
5192 static Uint8 *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp) 5192 static Uint8 *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
5193 { 5193 {
5194 Uint8 *u = 0; 5194 Uint8 *u = 0;
5195 stbi__gif g; 5195 stbi__gif g;
5196 dmMemset(&g, 0, sizeof(g)); 5196 memset(&g, 0, sizeof(g));
5197 5197
5198 u = stbi__gif_load_next(s, &g, comp, req_comp); 5198 u = stbi__gif_load_next(s, &g, comp, req_comp);
5199 if (u == (Uint8 *) s) u = 0; // end of animated gif marker 5199 if (u == (Uint8 *) s) u = 0; // end of animated gif marker
5200 if (u) { 5200 if (u) {
5201 *x = g.w; 5201 *x = g.w;