43 #define TIFF_MAX_ENTRY 32
101 flip ^= ((
int[]) { 0, 0, 0, 1, 3, 3 })[type];
104 *(*p)++ = val[i ^
flip];
116 enum TiffTypes type,
int count,
const void *ptr_val)
122 bytestream_put_le16(&entries_ptr, tag);
123 bytestream_put_le16(&entries_ptr, type);
124 bytestream_put_le32(&entries_ptr, count);
127 tnput(&entries_ptr, count, ptr_val, type, 0);
129 bytestream_put_le32(&entries_ptr, *s->
buf - s->
buf_start);
131 tnput(s->
buf, count, ptr_val, type, 0);
156 uint8_t *dst,
int n,
int compr)
164 if (compress(dst, &zlen, src, n) != Z_OK) {
178 src, 1, n, 2, 0xff, -1, 0);
193 for (i = 0; i < w; i++) {
204 const AVFrame *pict,
int *got_packet)
212 uint32_t *strip_sizes =
NULL;
213 uint32_t *strip_offsets =
NULL;
215 uint32_t res[2] = { 72, 1 };
216 uint16_t bpp_tab[] = { 8, 8, 8, 8 };
220 int shift_h, shift_v;
265 s->
bpp = 8 + (16 >> (shift_h + shift_v));
273 "This colors format is not supported\n");
306 bytestream_put_le16(&ptr, 0x4949);
307 bytestream_put_le16(&ptr, 42);
310 bytestream_put_le32(&ptr, 0);
312 strip_sizes =
av_mallocz(
sizeof(*strip_sizes) * strips);
313 strip_offsets =
av_mallocz(
sizeof(*strip_offsets) * strips);
314 if (!strip_sizes || !strip_offsets) {
323 if (yuv_line ==
NULL) {
336 zlen = bytes_per_row * s->
rps;
342 strip_offsets[0] = ptr - pkt->
data;
344 for (j = 0; j < s->
rps; j++) {
347 memcpy(zbuf + zn, yuv_line, bytes_per_row);
350 memcpy(zbuf + j * bytes_per_row,
361 strip_sizes[0] = ptr - pkt->
data - strip_offsets[0];
371 for (i = 0; i < s->
height; i++) {
372 if (strip_sizes[i / s->
rps] == 0) {
378 strip_offsets[i / s->
rps] = ptr - pkt->
data;
386 ptr, bytes_per_row, s->
compr);
391 strip_sizes[i / s->
rps] += ret;
396 strip_sizes[(i / s->
rps)] += ret;
430 uint16_t pal[256 * 3];
431 for (i = 0; i < 256; i++) {
432 uint32_t rgb = *(uint32_t *) (p->
data[1] + i * 4);
433 pal[i] = ((rgb >> 16) & 0xff) * 257;
434 pal[i + 256] = ((rgb >> 8) & 0xff) * 257;
435 pal[i + 512] = (rgb & 0xff) * 257;
441 uint32_t refbw[12] = { 15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1 };
446 bytestream_put_le32(&offset, ptr - pkt->
data);
454 bytestream_put_le32(&ptr, 0);
485 #define OFFSET(x) offsetof(TiffEncoderContext, x)
486 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM