Go to the documentation of this file.
32 #define LZMA_API_STATIC
102 if (
s->tiff_type < tiff_type)
103 s->tiff_type = tiff_type;
109 for (
i = 0;
i <
s->geotag_count;
i++) {
110 if (
s->geotags[
i].val)
117 #define RET_GEOKEY(TYPE, array, element)\
118 if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\
119 key - TIFF_##TYPE##_KEY_ID_OFFSET < FF_ARRAY_ELEMS(ff_tiff_##array##_name_type_map))\
120 return ff_tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].element;
165 #define RET_GEOKEY_VAL(TYPE, array)\
166 if (val >= TIFF_##TYPE##_OFFSET &&\
167 val - TIFF_##TYPE##_OFFSET < FF_ARRAY_ELEMS(ff_tiff_##array##_codes))\
168 return av_strdup(ff_tiff_##array##_codes[val - TIFF_##TYPE##_OFFSET]);
228 uint64_t component_len;
229 if (!sep) sep =
", ";
230 component_len = 24LL + strlen(sep);
231 if (
count >= (INT_MAX - 1)/component_len)
239 unsigned l =
snprintf(ap, component_len,
"%.15g%s", dp[
i], sep);
240 if(l >= component_len) {
246 ap0[strlen(ap0) - strlen(sep)] =
'\0';
262 unsigned int bpp,
uint8_t* dst,
268 while (--
width >= 0) {
280 while (--
width >= 0) {
288 while (--
width >= 0) {
294 uint16_t *dst16 = (uint16_t *)dst;
297 for (
int i = 0;
i <
s->width;
i++) {
316 if (!
s->deinvert_buf)
328 uint16_t *dst = (uint16_t *)(p->
data[0] + lnum * p->
linesize[0]);
332 for (
int i = 0;
i <
s->width;
i++) {
341 int w = (
s->width - 1) /
s->subsampling[0] + 1;
344 if (
s->width %
s->subsampling[0] ||
s->height %
s->subsampling[1]) {
345 for (
i = 0;
i <
w;
i++) {
346 for (j = 0; j <
s->subsampling[1]; j++)
347 for (k = 0; k <
s->subsampling[0]; k++)
349 FFMIN(
i *
s->subsampling[0] + k,
s->width-1)] = *
src++;
354 for (
i = 0;
i <
w;
i++) {
355 for (j = 0; j <
s->subsampling[1]; j++)
356 for (k = 0; k <
s->subsampling[0]; k++)
358 i *
s->subsampling[0] + k] = *
src++;
369 z_stream zstream = { 0 };
373 zstream.avail_in =
size;
374 zstream.next_out = dst;
375 zstream.avail_out = *
len;
376 zret = inflateInit(&zstream);
381 zret =
inflate(&zstream, Z_SYNC_FLUSH);
382 inflateEnd(&zstream);
383 *
len = zstream.total_out;
384 return zret == Z_STREAM_END ? Z_OK : zret;
389 int strip_start,
int is_yuv)
392 unsigned long outlen;
394 outlen =
width * lines;
403 src =
s->deinvert_buf;
405 ret = tiff_uncompress(zbuf, &outlen,
src,
size);
408 "Uncompressing failed (%lu of %lu) with error %d\n", outlen,
422 line +=
s->subsampling[1] - 1;
436 lzma_stream stream = LZMA_STREAM_INIT;
440 stream.avail_in =
size;
441 stream.next_out = dst;
442 stream.avail_out = *
len;
443 ret = lzma_stream_decoder(&stream, UINT64_MAX, 0);
444 if (
ret != LZMA_OK) {
448 ret = lzma_code(&stream, LZMA_RUN);
450 *
len = stream.total_out;
451 return ret == LZMA_STREAM_END ? LZMA_OK :
ret;
456 int strip_start,
int is_yuv)
458 uint64_t outlen =
width * (uint64_t)lines;
468 src =
s->deinvert_buf;
471 if (
ret != LZMA_OK) {
473 "Uncompressing failed (%"PRIu64
" of %"PRIu64
") with error %d\n", outlen,
487 line +=
s->subsampling[1] - 1;
505 src2 =
s->fax_buffer;
509 "Error allocating temporary buffer\n");
513 if (!
s->fill_order) {
521 s->compr,
s->fax_opts);
536 int width = ((
s->width *
s->bpp) + 7) >> 3;
540 desc->nb_components >= 3;
549 int bytes_per_row = (((
s->width - 1) /
s->subsampling[0] + 1) *
s->bpp *
550 s->subsampling[0] *
s->subsampling[1] + 7) >> 3;
552 if (
s->yuv_line ==
NULL) {
559 width = (
s->width - 1) /
s->subsampling[0] + 1;
565 width = (
s->bpp *
s->width + 7) >> 3;
569 if (
s->yuv_line ==
NULL) {
580 strip_start, is_yuv);
583 "zlib support not enabled, "
584 "deflate compression not supported\n");
591 strip_start, is_yuv);
594 "LZMA support not enabled\n");
602 ssrc =
src =
s->deinvert_buf;
622 line +=
s->subsampling[1] - 1;
656 if (!
s->fill_order) {
678 "Copy went out of bounds\n");
685 }
else if (
code != -128) {
689 "Run went out of bounds\n");
707 line +=
s->subsampling[1] - 1;
719 int create_gray_palette = 0;
722 if (
s->bpp >= 100 ||
s->bppcount >= 10) {
724 "Unsupported image parameters: bpp=%d, bppcount=%d\n",
725 s->bpp,
s->bppcount);
729 switch (
s->planar * 1000 +
s->bpp * 10 +
s->bppcount +
s->is_bayer * 10000) {
731 if (!
s->palette_is_set) {
738 if (!
s->palette_is_set) {
739 create_gray_palette = 1;
810 if (
s->subsampling[0] == 1 &&
s->subsampling[1] == 1) {
812 }
else if (
s->subsampling[0] == 2 &&
s->subsampling[1] == 1) {
814 }
else if (
s->subsampling[0] == 4 &&
s->subsampling[1] == 1) {
816 }
else if (
s->subsampling[0] == 1 &&
s->subsampling[1] == 2) {
818 }
else if (
s->subsampling[0] == 2 &&
s->subsampling[1] == 2) {
820 }
else if (
s->subsampling[0] == 4 &&
s->subsampling[1] == 4) {
846 "bpp=40 without PHOTOMETRIC_SEPARATED is unsupported\n");
870 "This format is not supported (bpp=%d, bppcount=%d)\n",
871 s->bpp,
s->bppcount);
879 desc->nb_components < 3) {
885 if (
s->width !=
s->avctx->width ||
s->height !=
s->avctx->height) {
893 if (!create_gray_palette)
894 memcpy(
frame->f->data[1],
s->palette,
sizeof(
s->palette));
898 uint32_t *pal = (uint32_t *)
frame->f->data[1];
899 for (
i = 0;
i < 1<<
s->bpp;
i++)
900 pal[
i] = 0xFFU << 24 |
i * 255 / ((1<<
s->bpp) - 1) * 0x010101;
911 if (
s->res[0] &&
s->res[1] &&
s->res[2] &&
s->res[3]) {
912 uint64_t num =
s->res[2] * (uint64_t)
s->res[1];
913 uint64_t den =
s->res[0] * (uint64_t)
s->res[3];
914 if (num > INT64_MAX || den > INT64_MAX) {
918 av_reduce(&
s->avctx->sample_aspect_ratio.num, &
s->avctx->sample_aspect_ratio.den,
919 num, den, INT32_MAX);
920 if (!
s->avctx->sample_aspect_ratio.den)
921 s->avctx->sample_aspect_ratio = (
AVRational) {0, 1};
937 if (tag <= s->last_tag)
967 s->is_thumbnail = (
value != 0);
977 "This format is not supported (bpp=%d, %d components)\n",
1003 "Samples per pixel requires a single value, many provided\n");
1008 "Invalid samples per pixel %d\n",
value);
1011 if (
s->bppcount == 1)
1061 if (
value > INT_MAX) {
1063 "strippos %u too large\n",
value);
1077 if (
value > INT_MAX) {
1079 "stripsize %u too large\n",
value);
1082 s->stripsizesoff = 0;
1086 s->stripsizesoff = off;
1147 "PhotometricInterpretation 0x%04X",
1152 "unknown\n",
value);
1157 if (value < 1 || value > 2) {
1159 "Unknown FillOrder value %d, trying default one\n",
value);
1162 s->fill_order =
value - 1;
1167 if (
count / 3 > 256 ||
1171 pal_gb[0] = pal_gb[1] = pal_gb[2] =
s->gb;
1182 uint32_t p = 0xFF000000;
1188 s->palette_is_set = 1;
1201 if (
s->subsampling[
i] <= 0) {
1203 s->subsampling[
i] = 1;
1216 #define ADD_METADATA(count, name, sep)\
1217 if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
1218 av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\
1231 if (
s->geotag_count) {
1238 if (
s->geotag_count >
count / 4 - 1) {
1239 s->geotag_count =
count / 4 - 1;
1243 ||
s->geotag_count == 0) {
1244 s->geotag_count = 0;
1250 s->geotag_count = 0;
1253 for (
i = 0;
i <
s->geotag_count;
i++) {
1258 if (!
s->geotags[
i].type)
1265 if (
count >= INT_MAX /
sizeof(int64_t))
1276 for (
i = 0;
i <
s->geotag_count;
i++) {
1278 if (
s->geotags[
i].count == 0
1279 ||
s->geotags[
i].offset +
s->geotags[
i].count >
count) {
1281 }
else if (
s->geotags[
i].val) {
1284 char *ap =
doubles2str(&dp[
s->geotags[
i].offset],
s->geotags[
i].count,
", ");
1290 s->geotags[
i].val = ap;
1298 for (
i = 0;
i <
s->geotag_count;
i++) {
1300 if (
s->geotags[
i].count == 0
1301 ||
s->geotags[
i].offset +
s->geotags[
i].count >
count) {
1309 if (
s->geotags[
i].val)
1317 ap[
s->geotags[
i].count - 1] =
'\0';
1318 s->geotags[
i].val = ap;
1364 unsigned int ver[4];
1371 ver[0], ver[1], ver[2], ver[3]);
1386 "Unknown or unsupported tag %d/0x%0X\n",
1394 "This format is not supported (bpp=%d, %d components)\n",
1409 unsigned off, last_off;
1412 unsigned soff, ssize;
1416 int retry_for_subifd, retry_for_page;
1424 }
else if (off >= UINT_MAX - 14 || avpkt->
size < off + 14) {
1431 s->is_thumbnail = 0;
1432 s->bppcount =
s->bpp = 1;
1444 s->stripsizesoff =
s->strippos = 0;
1450 for (
i = 0;
i < entries;
i++) {
1455 if (
s->get_thumbnail && !
s->is_thumbnail) {
1461 retry_for_subifd =
s->sub_ifd && (
s->get_subimage || (!
s->get_thumbnail &&
s->is_thumbnail));
1463 retry_for_page =
s->get_page &&
s->cur_page + 1 <
s->get_page;
1466 if (retry_for_page) {
1469 }
else if (retry_for_subifd) {
1474 if (retry_for_subifd || retry_for_page) {
1479 if (off <= last_off) {
1483 if (off >= UINT_MAX - 14 || avpkt->
size < off + 14) {
1491 for (
i = 0;
i<
s->geotag_count;
i++) {
1508 if (!
s->strippos && !
s->stripoff) {
1516 if (
s->strips == 1 && !
s->stripsize) {
1518 s->stripsize = avpkt->
size -
s->stripoff;
1521 if (
s->stripsizesoff) {
1522 if (
s->stripsizesoff >= (
unsigned)avpkt->
size)
1525 avpkt->
size -
s->stripsizesoff);
1528 if (
s->strippos >= (
unsigned)avpkt->
size)
1531 avpkt->
size -
s->strippos);
1534 if (
s->rps <= 0 ||
s->rps %
s->subsampling[1]) {
1539 planes =
s->planar ?
s->bppcount : 1;
1542 int remaining = avpkt->
size;
1554 for (
i = 0;
i <
s->height;
i +=
s->rps) {
1557 if (
s->stripsizesoff)
1558 ssize =
ff_tget(&stripsizes,
s->sstype, le);
1560 ssize =
s->stripsize;
1563 soff =
ff_tget(&stripdata,
s->sot, le);
1567 if (soff > avpkt->
size || ssize > avpkt->
size - soff || ssize > remaining) {
1574 FFMIN(
s->rps,
s->height -
i))) < 0) {
1582 decoded_height =
FFMIN(
i,
s->height);
1584 if (
s->predictor == 2) {
1589 dst = five_planes ? five_planes : p->
data[
plane];
1592 soff =
FFMAX(soff /
s->bppcount, 1);
1593 ssize =
s->width * soff;
1600 for (
i = 0;
i < decoded_height;
i++) {
1601 for (j = soff; j < ssize; j += 2)
1611 for (
i = 0;
i < decoded_height;
i++) {
1612 for (j = soff; j < ssize; j += 2)
1617 for (
i = 0;
i < decoded_height;
i++) {
1618 for (j = soff; j < ssize; j++)
1619 dst[j] += dst[j - soff];
1628 for (
i = 0;
i <
s->height;
i++) {
1629 for (j = 0; j <
stride; j++)
1630 dst[j] =
c - dst[j];
1640 for (
i = 0;
i <
s->height;
i++) {
1641 for (j = 0; j <
s->width; j++) {
1642 int k = 255 -
src[x * j + 3];
1643 int r = (255 -
src[x * j ]) * k;
1644 int g = (255 -
src[x * j + 1]) * k;
1645 int b = (255 -
src[x * j + 2]) * k;
1646 dst[4 * j ] =
r * 257 >> 16;
1647 dst[4 * j + 1] =
g * 257 >> 16;
1648 dst[4 * j + 2] =
b * 257 >> 16;
1658 for (
i = 0;
i <
s->height;
i++) {
1659 for (j = 0; j <
s->width; j++) {
1660 uint64_t k = 65535 -
AV_RB16(dst + 8 * j + 6);
1661 uint64_t
r = (65535 -
AV_RB16(dst + 8 * j )) * k;
1662 uint64_t
g = (65535 -
AV_RB16(dst + 8 * j + 2)) * k;
1663 uint64_t
b = (65535 -
AV_RB16(dst + 8 * j + 4)) * k;
1664 AV_WB16(dst + 8 * j ,
r * 65537 >> 32);
1665 AV_WB16(dst + 8 * j + 2,
g * 65537 >> 32);
1666 AV_WB16(dst + 8 * j + 4,
b * 65537 >> 32);
1667 AV_WB16(dst + 8 * j + 6, 65535);
1674 if (
s->planar &&
s->bppcount > 2) {
1681 if (
s->is_bayer &&
s->white_level &&
s->bpp == 16) {
1682 uint16_t *dst = (uint16_t *)p->
data[0];
1683 for (
i = 0;
i <
s->height;
i++) {
1684 for (j = 0; j <
s->width; j++)
1685 dst[j] =
FFMIN((dst[j] / (
float)
s->white_level) * 65535, 65535);
1702 s->subsampling[1] = 1;
1720 s->deinvert_buf_size = 0;
1722 s->yuv_line_size = 0;
1724 s->fax_buffer_size = 0;
1728 #define OFFSET(x) offsetof(TiffContext, x)
int ff_tadd_string_metadata(int count, const char *name, GetByteContext *gb, int le, AVDictionary **metadata)
Adds a string of count characters into the metadata dictionary.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ TIFF_GEOG_LINEAR_UNITS_GEOKEY
@ AV_PIX_FMT_BAYER_GBRG16LE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
static av_always_inline unsigned int bytestream2_get_eof(PutByteContext *p)
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
static int get_geokey_type(int key)
#define AV_OPT_FLAG_VIDEO_PARAM
static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
@ TIFF_PHOTOMETRIC_ICC_LAB
#define FFSWAP(type, a, b)
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
static char * get_geokey_val(int key, int val)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
static int init_image(TiffContext *s, ThreadFrame *frame)
@ TIFF_PROJ_COORD_TRANS_GEOKEY
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static char * doubles2str(double *dp, int count, const char *sep)
unsigned int fax_buffer_size
@ TIFF_GEOG_AZIMUTH_UNITS_GEOKEY
static av_cold int end(AVCodecContext *avctx)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure describes decoded (raw) audio or video data.
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
static av_cold int tiff_end(AVCodecContext *avctx)
@ TIFF_PHOTOMETRIC_ITU_LAB
const uint8_t ff_reverse[256]
#define RET_GEOKEY_VAL(TYPE, array)
void * av_mallocz_array(size_t nmemb, size_t size)
static int deinvert_buffer(TiffContext *s, const uint8_t *src, int size)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
int ff_lzw_decode(LZWState *p, uint8_t *buf, int len)
Decode given number of bytes NOTE: the algorithm here is inspired from the LZW GIF decoder written by...
@ TIFF_GEOG_ELLIPSOID_GEOKEY
#define TIFF_GEO_KEY_USER_DEFINED
@ TIFF_PROJ_LINEAR_UNITS_GEOKEY
av_cold void ff_lzw_decode_close(LZWState **p)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
@ AV_PIX_FMT_BAYER_GRBG16BE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
@ TIFF_PHOTOMETRIC_WHITE_IS_ZERO
@ TIFF_GEOG_PRIME_MERIDIAN_GEOKEY
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
#define TIFF_GEO_KEY_UNDEFINED
static const AVOption tiff_options[]
@ TIFF_PHOTOMETRIC_LINEAR_RAW
@ AV_PIX_FMT_BAYER_GBRG16BE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
@ TIFF_PHOTOMETRIC_ALPHA_MASK
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_ccitt_unpack(AVCodecContext *avctx, const uint8_t *src, int srcsize, uint8_t *dst, int height, int stride, enum TiffCompr compr, int opts)
unpack data compressed with CCITT Group 3 1/2-D or Group 4 method
static void unpack_yuv(TiffContext *s, AVFrame *p, const uint8_t *src, int lnum)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
static void tiff_set_type(TiffContext *s, enum TiffType tiff_type)
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
@ TIFF_GEOG_GEODETIC_DATUM_GEOKEY
static void av_always_inline horizontal_fill(TiffContext *s, unsigned int bpp, uint8_t *dst, int usePtr, const uint8_t *src, uint8_t c, int width, int offset)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
@ TIFF_VERTICAL_CS_TYPE_GEOKEY
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PIX_FMT_BAYER_RGGB16BE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
@ AV_PIX_FMT_BAYER_RGGB16LE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
@ AV_PIX_FMT_BAYER_BGGR8
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
TiffType
TIFF types in ascenting priority (last in the list is highest)
av_cold void ff_lzw_decode_open(LZWState **p)
@ TIFF_GEOGRAPHIC_TYPE_GEOKEY
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, int is_signed, AVDictionary **metadata)
Adds count shorts converted to a string into the metadata dictionary.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
enum TiffPhotometric photometric
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
static const char * search_keyval(const TiffGeoTagKeyName *keys, int n, int id)
@ AV_PIX_FMT_BAYER_RGGB8
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
av_cold void ff_ccitt_unpack_init(void)
initialize unpacker code
@ AV_PIX_FMT_BAYER_GRBG16LE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
@ TIFF_VERTICAL_UNITS_GEOKEY
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
static av_cold int tiff_init(AVCodecContext *avctx)
#define LIBAVUTIL_VERSION_INT
unsigned ff_tget_short(GetByteContext *gb, int le)
Reads a short from the bytestream using given endianness.
Describe the class of an AVClass context structure.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Rational number (pair of numerator and denominator).
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ TIFF_PHOTOMETRIC_PALETTE
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ TIFF_PHOTOMETRIC_CIE_LAB
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define AV_EF_EXPLODE
abort decoding on minor error detection
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline int bytestream2_tell(GetByteContext *g)
int ff_tread_tag(GetByteContext *gb, int le, unsigned *tag, unsigned *type, unsigned *count, int *next)
Reads the first 3 fields of a TIFF tag, which are the tag id, the tag type and the count of values fo...
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
static const struct @314 planes[]
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ TIFF_TYPE_CINEMADNG
Digital Negative (DNG) image part of an CinemaDNG image sequence.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
@ AV_PIX_FMT_BAYER_BGGR16LE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have add an init_thread_copy() which re-allocates them for other threads. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
@ TIFF_GT_MODEL_TYPE_GEOKEY
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
const char const char void * val
@ TIFF_MODEL_TRANSFORMATION
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
static int cmp_id_key(const void *id, const void *k)
#define AV_LOG_INFO
Standard information.
static const AVClass tiff_decoder_class
#define RET_GEOKEY(TYPE, array, element)
@ TIFF_PHOTOMETRIC_LOG_LUV
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
unsigned ff_tget_long(GetByteContext *gb, int le)
Reads a long from the bytestream using given endianness.
@ TIFF_PHOTOMETRIC_BLACK_IS_ZERO
int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
Initialize LZW decoder.
static void unpack_gray(TiffContext *s, AVFrame *p, const uint8_t *src, int lnum, int width, int bpp)
#define av_malloc_array(a, b)
@ AV_PIX_FMT_BAYER_GBRG8
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
@ TIFF_TYPE_TIFF
TIFF image based on the TIFF 6.0 or TIFF/EP (ISO 12234-2) specifications.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
@ TIFF_TYPE_DNG
Digital Negative (DNG) image.
const char * name
Name of the codec implementation.
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
@ AV_PIX_FMT_BAYER_BGGR16BE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
static const char * get_geokey_name(int key)
#define AV_INPUT_BUFFER_PADDING_SIZE
#define FF_ARRAY_ELEMS(a)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
double ff_tget_double(GetByteContext *gb, int le)
Reads a double from the bytestream using given endianness.
TiffPhotometric
list of TIFF, TIFF/AP and DNG PhotometricInterpretation (TIFF_PHOTOMETRIC) values
const TiffGeoTagKeyName ff_tiff_proj_cs_type_codes[]
main external API structure.
#define ADD_METADATA(count, name, sep)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining again
static av_always_inline int bytestream2_seek_p(PutByteContext *p, int offset, int whence)
AVDictionary * metadata
metadata.
static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den)
static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int width, int lines)
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
int ff_tdecode_header(GetByteContext *gb, int *le, int *ifd_offset)
Decodes a TIFF header from the input bytestream and sets the endianness in *le and the offset to the ...
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
char * av_strdup(const char *s)
Duplicate a string.
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
#define avpriv_request_sample(...)
static void free_geotags(TiffContext *const s)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int stride, const uint8_t *src, int size, int strip_start, int lines)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
int ff_tadd_doubles_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata)
Adds count doubles converted to a string into the metadata dictionary.
static int add_metadata(int count, int type, const char *name, const char *sep, TiffContext *s, AVFrame *frame)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
TiffCompr
list of TIFF, TIFF/EP and DNG compression types
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ TIFF_GEOG_ANGULAR_UNITS_GEOKEY
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const uint8_t type_sizes[14]
sizes of various TIFF field types (string size = 100)
#define AV_PIX_FMT_GRAY12
const TiffGeoTagKeyName ff_tiff_projection_codes[]
unsigned ff_tget(GetByteContext *gb, int type, int le)
Reads a byte from the bytestream using given endianness.
@ TIFF_PHOTOMETRIC_SEPARATED
@ TIFF_PROJECTED_CS_TYPE_GEOKEY
@ AV_PIX_FMT_BAYER_GRBG8
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
unsigned int yuv_line_size
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
@ TIFF_GT_RASTER_TYPE_GEOKEY