comparison png.c @ 5089:bff60ecc02f9 libavcodec

Use AV_xx throughout libavcodec
author ramiro
date Sat, 02 Jun 2007 01:41:07 +0000
parents 6166fbf375cc
children e9a0c447dc73
comparison
equal deleted inserted replaced
5088:8e206208db1f 5089:bff60ecc02f9
691 uint32_t crc; 691 uint32_t crc;
692 uint8_t tagbuf[4]; 692 uint8_t tagbuf[4];
693 693
694 bytestream_put_be32(f, length); 694 bytestream_put_be32(f, length);
695 crc = crc32(0, Z_NULL, 0); 695 crc = crc32(0, Z_NULL, 0);
696 tagbuf[0] = tag; 696 AV_WL32(tagbuf, tag);
697 tagbuf[1] = tag >> 8;
698 tagbuf[2] = tag >> 16;
699 tagbuf[3] = tag >> 24;
700 crc = crc32(crc, tagbuf, 4); 697 crc = crc32(crc, tagbuf, 4);
701 bytestream_put_be32(f, bswap_32(tag)); 698 bytestream_put_be32(f, bswap_32(tag));
702 if (length > 0) { 699 if (length > 0) {
703 crc = crc32(crc, buf, length); 700 crc = crc32(crc, buf, length);
704 memcpy(*f, buf, length); 701 memcpy(*f, buf, length);
831 v = palette[i]; 828 v = palette[i];
832 alpha = v >> 24; 829 alpha = v >> 24;
833 if (alpha && alpha != 0xff) 830 if (alpha && alpha != 0xff)
834 has_alpha = 1; 831 has_alpha = 1;
835 *alpha_ptr++ = alpha; 832 *alpha_ptr++ = alpha;
836 ptr[0] = v >> 16; 833 bytestream_put_be24(&ptr, v);
837 ptr[1] = v >> 8;
838 ptr[2] = v;
839 ptr += 3;
840 } 834 }
841 png_write_chunk(&s->bytestream, MKTAG('P', 'L', 'T', 'E'), s->buf, 256 * 3); 835 png_write_chunk(&s->bytestream, MKTAG('P', 'L', 'T', 'E'), s->buf, 256 * 3);
842 if (has_alpha) { 836 if (has_alpha) {
843 png_write_chunk(&s->bytestream, MKTAG('t', 'R', 'N', 'S'), s->buf + 256 * 3, 256); 837 png_write_chunk(&s->bytestream, MKTAG('t', 'R', 'N', 'S'), s->buf + 256 * 3, 256);
844 } 838 }