Commit 201a511b authored by James Almer's avatar James Almer

lavc/tiff: add support for YUV deflate

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent b4231b4f
...@@ -333,9 +333,9 @@ static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, ...@@ -333,9 +333,9 @@ static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
return zret == Z_STREAM_END ? Z_OK : zret; return zret == Z_STREAM_END ? Z_OK : zret;
} }
static int tiff_unpack_zlib(TiffContext *s, uint8_t *dst, int stride, static int tiff_unpack_zlib(TiffContext *s, AVFrame *p, uint8_t *dst, int stride,
const uint8_t *src, int size, const uint8_t *src, int size, int width, int lines,
int width, int lines) int strip_start, int is_yuv)
{ {
uint8_t *zbuf; uint8_t *zbuf;
unsigned long outlen; unsigned long outlen;
...@@ -366,6 +366,10 @@ static int tiff_unpack_zlib(TiffContext *s, uint8_t *dst, int stride, ...@@ -366,6 +366,10 @@ static int tiff_unpack_zlib(TiffContext *s, uint8_t *dst, int stride,
} else { } else {
memcpy(dst, src, width); memcpy(dst, src, width);
} }
if (is_yuv) {
unpack_yuv(s, p, dst, strip_start + line);
line += s->subsampling[1] - 1;
}
dst += stride; dst += stride;
src += width; src += width;
} }
...@@ -443,12 +447,9 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid ...@@ -443,12 +447,9 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
} }
if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) { if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
if (is_yuv) {
av_log(s->avctx, AV_LOG_ERROR, "YUV deflate is unsupported");
return AVERROR_PATCHWELCOME;
}
#if CONFIG_ZLIB #if CONFIG_ZLIB
return tiff_unpack_zlib(s, dst, stride, src, size, width, lines); return tiff_unpack_zlib(s, p, dst, stride, src, size, width, lines,
strip_start, is_yuv);
#else #else
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"zlib support not enabled, " "zlib support not enabled, "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment