You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

690 lines
20KB

  1. /*
  2. * TIFF image decoder
  3. * Copyright (c) 2006 Konstantin Shishkov
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * TIFF image decoder
  24. * @author Konstantin Shishkov
  25. */
  26. #include "avcodec.h"
  27. #include "config.h"
  28. #if CONFIG_ZLIB
  29. #include <zlib.h>
  30. #endif
  31. #include "lzw.h"
  32. #include "tiff.h"
  33. #include "faxcompr.h"
  34. #include "internal.h"
  35. #include "mathops.h"
  36. #include "libavutil/attributes.h"
  37. #include "libavutil/intreadwrite.h"
  38. #include "libavutil/imgutils.h"
  39. typedef struct TiffContext {
  40. AVCodecContext *avctx;
  41. int width, height;
  42. unsigned int bpp, bppcount;
  43. uint32_t palette[256];
  44. int palette_is_set;
  45. int le;
  46. enum TiffCompr compr;
  47. int invert;
  48. int fax_opts;
  49. int predictor;
  50. int fill_order;
  51. int strips, rps, sstype;
  52. int sot;
  53. const uint8_t *stripdata;
  54. const uint8_t *stripsizes;
  55. int stripsize, stripoff;
  56. LZWState *lzw;
  57. } TiffContext;
  58. static unsigned tget_short(const uint8_t **p, int le)
  59. {
  60. unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
  61. *p += 2;
  62. return v;
  63. }
  64. static unsigned tget_long(const uint8_t **p, int le)
  65. {
  66. unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
  67. *p += 4;
  68. return v;
  69. }
  70. static unsigned tget(const uint8_t **p, int type, int le)
  71. {
  72. switch (type) {
  73. case TIFF_BYTE : return *(*p)++;
  74. case TIFF_SHORT: return tget_short(p, le);
  75. case TIFF_LONG : return tget_long(p, le);
  76. default : return UINT_MAX;
  77. }
  78. }
  79. #if CONFIG_ZLIB
  80. static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
  81. int size)
  82. {
  83. z_stream zstream = { 0 };
  84. int zret;
  85. zstream.next_in = src;
  86. zstream.avail_in = size;
  87. zstream.next_out = dst;
  88. zstream.avail_out = *len;
  89. zret = inflateInit(&zstream);
  90. if (zret != Z_OK) {
  91. av_log(NULL, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
  92. return zret;
  93. }
  94. zret = inflate(&zstream, Z_SYNC_FLUSH);
  95. inflateEnd(&zstream);
  96. *len = zstream.total_out;
  97. return zret == Z_STREAM_END ? Z_OK : zret;
  98. }
  99. #endif
  100. static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
  101. const uint8_t *src, int size, int lines)
  102. {
  103. int c, line, pixels, code, ret;
  104. const uint8_t *ssrc = src;
  105. int width = ((s->width * s->bpp) + 7) >> 3;
  106. if (size <= 0)
  107. return AVERROR_INVALIDDATA;
  108. #if CONFIG_ZLIB
  109. if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
  110. uint8_t *zbuf;
  111. unsigned long outlen;
  112. int ret;
  113. outlen = width * lines;
  114. zbuf = av_malloc(outlen);
  115. if (!zbuf)
  116. return AVERROR(ENOMEM);
  117. ret = tiff_uncompress(zbuf, &outlen, src, size);
  118. if (ret != Z_OK) {
  119. av_log(s->avctx, AV_LOG_ERROR,
  120. "Uncompressing failed (%lu of %lu) with error %d\n", outlen,
  121. (unsigned long)width * lines, ret);
  122. av_free(zbuf);
  123. return AVERROR_UNKNOWN;
  124. }
  125. src = zbuf;
  126. for (line = 0; line < lines; line++) {
  127. memcpy(dst, src, width);
  128. dst += stride;
  129. src += width;
  130. }
  131. av_free(zbuf);
  132. return 0;
  133. }
  134. #endif
  135. if (s->compr == TIFF_LZW) {
  136. if ((ret = ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF)) < 0) {
  137. av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n");
  138. return ret;
  139. }
  140. }
  141. if (s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3
  142. || s->compr == TIFF_G4) {
  143. int i, ret = 0;
  144. uint8_t *src2 = av_malloc((unsigned)size +
  145. FF_INPUT_BUFFER_PADDING_SIZE);
  146. if (!src2) {
  147. av_log(s->avctx, AV_LOG_ERROR,
  148. "Error allocating temporary buffer\n");
  149. return AVERROR(ENOMEM);
  150. }
  151. if (s->fax_opts & 2) {
  152. av_log(s->avctx, AV_LOG_ERROR,
  153. "Uncompressed fax mode is not supported (yet)\n");
  154. av_free(src2);
  155. return AVERROR_INVALIDDATA;
  156. }
  157. if (!s->fill_order) {
  158. memcpy(src2, src, size);
  159. } else {
  160. for (i = 0; i < size; i++)
  161. src2[i] = ff_reverse[src[i]];
  162. }
  163. memset(src2 + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  164. switch (s->compr) {
  165. case TIFF_CCITT_RLE:
  166. case TIFF_G3:
  167. case TIFF_G4:
  168. ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride,
  169. s->compr, s->fax_opts);
  170. break;
  171. }
  172. av_free(src2);
  173. return ret;
  174. }
  175. for (line = 0; line < lines; line++) {
  176. if (src - ssrc > size) {
  177. av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
  178. return AVERROR_INVALIDDATA;
  179. }
  180. switch (s->compr) {
  181. case TIFF_RAW:
  182. if (ssrc + size - src < width)
  183. return AVERROR_INVALIDDATA;
  184. if (!s->fill_order) {
  185. memcpy(dst, src, width);
  186. } else {
  187. int i;
  188. for (i = 0; i < width; i++)
  189. dst[i] = ff_reverse[src[i]];
  190. }
  191. src += width;
  192. break;
  193. case TIFF_PACKBITS:
  194. for (pixels = 0; pixels < width;) {
  195. code = (int8_t) * src++;
  196. if (code >= 0) {
  197. code++;
  198. if (pixels + code > width) {
  199. av_log(s->avctx, AV_LOG_ERROR,
  200. "Copy went out of bounds\n");
  201. return AVERROR_INVALIDDATA;
  202. }
  203. memcpy(dst + pixels, src, code);
  204. src += code;
  205. pixels += code;
  206. } else if (code != -128) { // -127..-1
  207. code = (-code) + 1;
  208. if (pixels + code > width) {
  209. av_log(s->avctx, AV_LOG_ERROR,
  210. "Run went out of bounds\n");
  211. return AVERROR_INVALIDDATA;
  212. }
  213. c = *src++;
  214. memset(dst + pixels, c, code);
  215. pixels += code;
  216. }
  217. }
  218. break;
  219. case TIFF_LZW:
  220. pixels = ff_lzw_decode(s->lzw, dst, width);
  221. if (pixels < width) {
  222. av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n",
  223. pixels, width);
  224. return AVERROR_INVALIDDATA;
  225. }
  226. break;
  227. }
  228. dst += stride;
  229. }
  230. return 0;
  231. }
  232. static int init_image(TiffContext *s, AVFrame *frame)
  233. {
  234. int i, ret;
  235. uint32_t *pal;
  236. switch (s->bpp * 10 + s->bppcount) {
  237. case 11:
  238. s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
  239. break;
  240. case 81:
  241. s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
  242. break;
  243. case 243:
  244. s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
  245. break;
  246. case 161:
  247. s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY16BE;
  248. break;
  249. case 324:
  250. s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
  251. break;
  252. case 483:
  253. s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE;
  254. break;
  255. default:
  256. av_log(s->avctx, AV_LOG_ERROR,
  257. "This format is not supported (bpp=%d, bppcount=%d)\n",
  258. s->bpp, s->bppcount);
  259. return AVERROR_INVALIDDATA;
  260. }
  261. if (s->width != s->avctx->width || s->height != s->avctx->height) {
  262. if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
  263. return ret;
  264. avcodec_set_dimensions(s->avctx, s->width, s->height);
  265. }
  266. if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) {
  267. av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  268. return ret;
  269. }
  270. if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
  271. if (s->palette_is_set) {
  272. memcpy(frame->data[1], s->palette, sizeof(s->palette));
  273. } else {
  274. /* make default grayscale pal */
  275. pal = (uint32_t *) frame->data[1];
  276. for (i = 0; i < 256; i++)
  277. pal[i] = i * 0x010101;
  278. }
  279. }
  280. return 0;
  281. }
  282. static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
  283. const uint8_t *buf, const uint8_t *end_buf)
  284. {
  285. unsigned tag, type, count, off, value = 0;
  286. int i, j;
  287. uint32_t *pal;
  288. const uint8_t *rp, *gp, *bp;
  289. if (end_buf - buf < 12)
  290. return AVERROR_INVALIDDATA;
  291. tag = tget_short(&buf, s->le);
  292. type = tget_short(&buf, s->le);
  293. count = tget_long(&buf, s->le);
  294. off = tget_long(&buf, s->le);
  295. if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) {
  296. av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n",
  297. type);
  298. return 0;
  299. }
  300. if (count == 1) {
  301. switch (type) {
  302. case TIFF_BYTE:
  303. case TIFF_SHORT:
  304. buf -= 4;
  305. value = tget(&buf, type, s->le);
  306. buf = NULL;
  307. break;
  308. case TIFF_LONG:
  309. value = off;
  310. buf = NULL;
  311. break;
  312. case TIFF_STRING:
  313. if (count <= 4) {
  314. buf -= 4;
  315. break;
  316. }
  317. default:
  318. value = UINT_MAX;
  319. buf = start + off;
  320. }
  321. } else {
  322. if (count <= 4 && type_sizes[type] * count <= 4) {
  323. buf -= 4;
  324. } else {
  325. buf = start + off;
  326. }
  327. }
  328. if (buf && (buf < start || buf > end_buf)) {
  329. av_log(s->avctx, AV_LOG_ERROR,
  330. "Tag referencing position outside the image\n");
  331. return AVERROR_INVALIDDATA;
  332. }
  333. switch (tag) {
  334. case TIFF_WIDTH:
  335. s->width = value;
  336. break;
  337. case TIFF_HEIGHT:
  338. s->height = value;
  339. break;
  340. case TIFF_BPP:
  341. s->bppcount = count;
  342. if (count > 4) {
  343. av_log(s->avctx, AV_LOG_ERROR,
  344. "This format is not supported (bpp=%d, %d components)\n",
  345. s->bpp, count);
  346. return AVERROR_INVALIDDATA;
  347. }
  348. if (count == 1)
  349. s->bpp = value;
  350. else {
  351. switch (type) {
  352. case TIFF_BYTE:
  353. s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) +
  354. ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
  355. break;
  356. case TIFF_SHORT:
  357. case TIFF_LONG:
  358. s->bpp = 0;
  359. for (i = 0; i < count && buf < end_buf; i++)
  360. s->bpp += tget(&buf, type, s->le);
  361. break;
  362. default:
  363. s->bpp = -1;
  364. }
  365. }
  366. break;
  367. case TIFF_SAMPLES_PER_PIXEL:
  368. if (count != 1) {
  369. av_log(s->avctx, AV_LOG_ERROR,
  370. "Samples per pixel requires a single value, many provided\n");
  371. return AVERROR_INVALIDDATA;
  372. }
  373. if (s->bppcount == 1)
  374. s->bpp *= value;
  375. s->bppcount = value;
  376. break;
  377. case TIFF_COMPR:
  378. s->compr = value;
  379. s->predictor = 0;
  380. switch (s->compr) {
  381. case TIFF_RAW:
  382. case TIFF_PACKBITS:
  383. case TIFF_LZW:
  384. case TIFF_CCITT_RLE:
  385. break;
  386. case TIFF_G3:
  387. case TIFF_G4:
  388. s->fax_opts = 0;
  389. break;
  390. case TIFF_DEFLATE:
  391. case TIFF_ADOBE_DEFLATE:
  392. #if CONFIG_ZLIB
  393. break;
  394. #else
  395. av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n");
  396. return AVERROR(ENOSYS);
  397. #endif
  398. case TIFF_JPEG:
  399. case TIFF_NEWJPEG:
  400. av_log(s->avctx, AV_LOG_ERROR,
  401. "JPEG compression is not supported\n");
  402. return AVERROR_PATCHWELCOME;
  403. default:
  404. av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n",
  405. s->compr);
  406. return AVERROR_INVALIDDATA;
  407. }
  408. break;
  409. case TIFF_ROWSPERSTRIP:
  410. if (type == TIFF_LONG && value == UINT_MAX)
  411. value = s->avctx->height;
  412. if (value < 1) {
  413. av_log(s->avctx, AV_LOG_ERROR,
  414. "Incorrect value of rows per strip\n");
  415. return AVERROR_INVALIDDATA;
  416. }
  417. s->rps = value;
  418. break;
  419. case TIFF_STRIP_OFFS:
  420. if (count == 1) {
  421. s->stripdata = NULL;
  422. s->stripoff = value;
  423. } else
  424. s->stripdata = start + off;
  425. s->strips = count;
  426. if (s->strips == 1)
  427. s->rps = s->height;
  428. s->sot = type;
  429. if (s->stripdata > end_buf) {
  430. av_log(s->avctx, AV_LOG_ERROR,
  431. "Tag referencing position outside the image\n");
  432. return AVERROR_INVALIDDATA;
  433. }
  434. break;
  435. case TIFF_STRIP_SIZE:
  436. if (count == 1) {
  437. s->stripsizes = NULL;
  438. s->stripsize = value;
  439. s->strips = 1;
  440. } else {
  441. s->stripsizes = start + off;
  442. }
  443. s->strips = count;
  444. s->sstype = type;
  445. if (s->stripsizes > end_buf) {
  446. av_log(s->avctx, AV_LOG_ERROR,
  447. "Tag referencing position outside the image\n");
  448. return AVERROR_INVALIDDATA;
  449. }
  450. break;
  451. case TIFF_PREDICTOR:
  452. s->predictor = value;
  453. break;
  454. case TIFF_INVERT:
  455. switch (value) {
  456. case 0:
  457. s->invert = 1;
  458. break;
  459. case 1:
  460. s->invert = 0;
  461. break;
  462. case 2:
  463. case 3:
  464. break;
  465. default:
  466. av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n",
  467. value);
  468. return AVERROR_INVALIDDATA;
  469. }
  470. break;
  471. case TIFF_FILL_ORDER:
  472. if (value < 1 || value > 2) {
  473. av_log(s->avctx, AV_LOG_ERROR,
  474. "Unknown FillOrder value %d, trying default one\n", value);
  475. value = 1;
  476. }
  477. s->fill_order = value - 1;
  478. break;
  479. case TIFF_PAL:
  480. pal = (uint32_t *) s->palette;
  481. off = type_sizes[type];
  482. if (count / 3 > 256 || end_buf - buf < count / 3 * off * 3)
  483. return AVERROR_INVALIDDATA;
  484. rp = buf;
  485. gp = buf + count / 3 * off;
  486. bp = buf + count / 3 * off * 2;
  487. off = (type_sizes[type] - 1) << 3;
  488. for (i = 0; i < count / 3; i++) {
  489. j = (tget(&rp, type, s->le) >> off) << 16;
  490. j |= (tget(&gp, type, s->le) >> off) << 8;
  491. j |= tget(&bp, type, s->le) >> off;
  492. pal[i] = j;
  493. }
  494. s->palette_is_set = 1;
  495. break;
  496. case TIFF_PLANAR:
  497. if (value == 2) {
  498. av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n");
  499. return AVERROR_PATCHWELCOME;
  500. }
  501. break;
  502. case TIFF_T4OPTIONS:
  503. if (s->compr == TIFF_G3)
  504. s->fax_opts = value;
  505. break;
  506. case TIFF_T6OPTIONS:
  507. if (s->compr == TIFF_G4)
  508. s->fax_opts = value;
  509. break;
  510. default:
  511. av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n",
  512. tag, tag);
  513. }
  514. return 0;
  515. }
  516. static int decode_frame(AVCodecContext *avctx,
  517. void *data, int *got_frame, AVPacket *avpkt)
  518. {
  519. const uint8_t *buf = avpkt->data;
  520. int buf_size = avpkt->size;
  521. TiffContext *const s = avctx->priv_data;
  522. AVFrame *const p = data;
  523. const uint8_t *orig_buf = buf, *end_buf = buf + buf_size;
  524. unsigned off;
  525. int id, le, ret;
  526. int i, j, entries;
  527. int stride;
  528. unsigned soff, ssize;
  529. uint8_t *dst;
  530. //parse image header
  531. if (end_buf - buf < 8)
  532. return AVERROR_INVALIDDATA;
  533. id = AV_RL16(buf);
  534. buf += 2;
  535. if (id == 0x4949)
  536. le = 1;
  537. else if (id == 0x4D4D)
  538. le = 0;
  539. else {
  540. av_log(avctx, AV_LOG_ERROR, "TIFF header not found\n");
  541. return AVERROR_INVALIDDATA;
  542. }
  543. s->le = le;
  544. s->invert = 0;
  545. s->compr = TIFF_RAW;
  546. s->fill_order = 0;
  547. // As TIFF 6.0 specification puts it "An arbitrary but carefully chosen number
  548. // that further identifies the file as a TIFF file"
  549. if (tget_short(&buf, le) != 42) {
  550. av_log(avctx, AV_LOG_ERROR,
  551. "The answer to life, universe and everything is not correct!\n");
  552. return AVERROR_INVALIDDATA;
  553. }
  554. // Reset these pointers so we can tell if they were set this frame
  555. s->stripsizes = s->stripdata = NULL;
  556. /* parse image file directory */
  557. off = tget_long(&buf, le);
  558. if (off >= UINT_MAX - 14 || end_buf - orig_buf < off + 14) {
  559. av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
  560. return AVERROR_INVALIDDATA;
  561. }
  562. buf = orig_buf + off;
  563. entries = tget_short(&buf, le);
  564. for (i = 0; i < entries; i++) {
  565. if ((ret = tiff_decode_tag(s, orig_buf, buf, end_buf)) < 0)
  566. return ret;
  567. buf += 12;
  568. }
  569. if (!s->stripdata && !s->stripoff) {
  570. av_log(avctx, AV_LOG_ERROR, "Image data is missing\n");
  571. return AVERROR_INVALIDDATA;
  572. }
  573. /* now we have the data and may start decoding */
  574. if ((ret = init_image(s, p)) < 0)
  575. return ret;
  576. if (s->strips == 1 && !s->stripsize) {
  577. av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");
  578. s->stripsize = buf_size - s->stripoff;
  579. }
  580. stride = p->linesize[0];
  581. dst = p->data[0];
  582. for (i = 0; i < s->height; i += s->rps) {
  583. if (s->stripsizes) {
  584. if (s->stripsizes >= end_buf)
  585. return AVERROR_INVALIDDATA;
  586. ssize = tget(&s->stripsizes, s->sstype, s->le);
  587. } else
  588. ssize = s->stripsize;
  589. if (s->stripdata) {
  590. if (s->stripdata >= end_buf)
  591. return AVERROR_INVALIDDATA;
  592. soff = tget(&s->stripdata, s->sot, s->le);
  593. } else
  594. soff = s->stripoff;
  595. if (soff > buf_size || ssize > buf_size - soff) {
  596. av_log(avctx, AV_LOG_ERROR, "Invalid strip size/offset\n");
  597. return AVERROR_INVALIDDATA;
  598. }
  599. if (tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize,
  600. FFMIN(s->rps, s->height - i)) < 0)
  601. break;
  602. dst += s->rps * stride;
  603. }
  604. if (s->predictor == 2) {
  605. dst = p->data[0];
  606. soff = s->bpp >> 3;
  607. ssize = s->width * soff;
  608. for (i = 0; i < s->height; i++) {
  609. for (j = soff; j < ssize; j++)
  610. dst[j] += dst[j - soff];
  611. dst += stride;
  612. }
  613. }
  614. if (s->invert) {
  615. uint8_t *src;
  616. int j;
  617. src = p->data[0];
  618. for (j = 0; j < s->height; j++) {
  619. for (i = 0; i < p->linesize[0]; i++)
  620. src[i] = 255 - src[i];
  621. src += p->linesize[0];
  622. }
  623. }
  624. *got_frame = 1;
  625. return buf_size;
  626. }
  627. static av_cold int tiff_init(AVCodecContext *avctx)
  628. {
  629. TiffContext *s = avctx->priv_data;
  630. s->width = 0;
  631. s->height = 0;
  632. s->avctx = avctx;
  633. ff_lzw_decode_open(&s->lzw);
  634. ff_ccitt_unpack_init();
  635. return 0;
  636. }
  637. static av_cold int tiff_end(AVCodecContext *avctx)
  638. {
  639. TiffContext *const s = avctx->priv_data;
  640. ff_lzw_decode_close(&s->lzw);
  641. return 0;
  642. }
  643. AVCodec ff_tiff_decoder = {
  644. .name = "tiff",
  645. .type = AVMEDIA_TYPE_VIDEO,
  646. .id = AV_CODEC_ID_TIFF,
  647. .priv_data_size = sizeof(TiffContext),
  648. .init = tiff_init,
  649. .close = tiff_end,
  650. .decode = decode_frame,
  651. .capabilities = CODEC_CAP_DR1,
  652. .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
  653. };