43 #define TIFF_MAX_ENTRY 32
103 flip ^= ((
int[]) {0, 0, 0, 1, 3, 3})[type];
106 *(*p)++ = val[i ^
flip];
125 bytestream_put_le16(&entries_ptr, tag);
126 bytestream_put_le16(&entries_ptr, type);
127 bytestream_put_le32(&entries_ptr, count);
130 tnput(&entries_ptr, count, ptr_val, type, 0);
132 bytestream_put_le32(&entries_ptr, *s->
buf - s->
buf_start);
134 tnput(s->
buf, count, ptr_val, type, 0);
158 uint8_t * dst,
int n,
int compr)
167 if (compress(dst, &zlen, src, n) != Z_OK) {
195 for (i = 0; i < w; i++){
206 const AVFrame *pict,
int *got_packet)
214 uint32_t *strip_sizes =
NULL;
215 uint32_t *strip_offsets =
NULL;
217 uint32_t res[2] = { 72, 1 };
218 uint16_t bpp_tab[] = { 8, 8, 8, 8 };
222 int shift_h, shift_v;
275 s->
bpp = 8 + (16 >> (shift_h + shift_v));
283 "This colors format is not supported\n");
311 bytestream_put_le16(&ptr, 0x4949);
312 bytestream_put_le16(&ptr, 42);
315 bytestream_put_le32(&ptr, 0);
317 strip_sizes =
av_mallocz(
sizeof(*strip_sizes) * strips);
318 strip_offsets =
av_mallocz(
sizeof(*strip_offsets) * strips);
319 if (!strip_sizes || !strip_offsets) {
328 if (yuv_line ==
NULL){
341 zlen = bytes_per_row * s->
rps;
347 strip_offsets[0] = ptr - pkt->
data;
349 for (j = 0; j < s->
rps; j++) {
352 memcpy(zbuf + zn, yuv_line, bytes_per_row);
356 memcpy(zbuf + j * bytes_per_row,
367 strip_sizes[0] = ptr - pkt->
data - strip_offsets[0];
378 for (i = 0; i < s->
height; i++) {
379 if (strip_sizes[i / s->
rps] == 0) {
384 strip_offsets[i / s->
rps] = ptr - pkt->
data;
393 ptr, bytes_per_row, s->
compr);
398 strip_sizes[i / s->
rps] += ret;
402 strip_sizes[(i / s->
rps )] += ret ;
437 uint16_t pal[256 * 3];
438 for (i = 0; i < 256; i++) {
439 uint32_t rgb = *(uint32_t *) (p->
data[1] + i * 4);
440 pal[i] = ((rgb >> 16) & 0xff) * 257;
441 pal[i + 256] = ((rgb >> 8 ) & 0xff) * 257;
442 pal[i + 512] = ( rgb & 0xff) * 257;
448 uint32_t refbw[12] = {15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1};
452 bytestream_put_le32(&offset, ptr - pkt->
data);
460 bytestream_put_le32(&ptr, 0);
473 #define OFFSET(x) offsetof(TiffEncoderContext, x)
474 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM