mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-02 06:23:23 +02:00
Support LZW and ZLIB compressed 4bpp tiff samples.
Fixes ticket #439 and ticket #440.
This commit is contained in:
parent
baad01d8b4
commit
ef8756dab2
@ -129,6 +129,16 @@ static void av_always_inline horizontal_fill(unsigned int bpp, uint8_t* dst,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void av_always_inline split_nibbles(uint8_t *dst, const uint8_t *src,
|
||||||
|
int width)
|
||||||
|
{
|
||||||
|
while (--width >= 0) {
|
||||||
|
// src == dst for LZW
|
||||||
|
dst[width * 2 + 1] = src[width] & 0xF;
|
||||||
|
dst[width * 2 + 0] = src[width] >> 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
|
static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
|
||||||
int c, line, pixels, code;
|
int c, line, pixels, code;
|
||||||
const uint8_t *ssrc = src;
|
const uint8_t *ssrc = src;
|
||||||
@ -148,7 +158,11 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
|
|||||||
}
|
}
|
||||||
src = zbuf;
|
src = zbuf;
|
||||||
for(line = 0; line < lines; line++){
|
for(line = 0; line < lines; line++){
|
||||||
memcpy(dst, src, width);
|
if(s->bpp == 4){
|
||||||
|
split_nibbles(dst, src, width);
|
||||||
|
}else{
|
||||||
|
memcpy(dst, src, width);
|
||||||
|
}
|
||||||
dst += stride;
|
dst += stride;
|
||||||
src += width;
|
src += width;
|
||||||
}
|
}
|
||||||
@ -238,6 +252,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
|
av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if(s->bpp == 4)
|
||||||
|
split_nibbles(dst, dst, width);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dst += stride;
|
dst += stride;
|
||||||
|
Loading…
Reference in New Issue
Block a user