summaryrefslogtreecommitdiff
path: root/libavcodec/faxcompr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-12-26 15:05:12 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-12-26 15:05:12 +0000
commit66909bc4f166d99db352a262191c8135ae15e127 (patch)
tree348b417ca407f7055d5cfe755cb080c407d43da1 /libavcodec/faxcompr.c
parentd68542f019c89e7938297a18da282e3a892718aa (diff)
Merge ff_ccitt_unpack_1d and 2d.
Originally committed as revision 16332 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/faxcompr.c')
-rw-r--r--libavcodec/faxcompr.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index f8a8b93841..ec6b9e00ab 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -258,36 +258,9 @@ static int find_group3_syncmarker(GetBitContext *gb, int srcsize)
return -1;
}
-int ff_ccitt_unpack_1d(AVCodecContext *avctx,
+int ff_ccitt_unpack(AVCodecContext *avctx,
const uint8_t *src, int srcsize,
- uint8_t *dst, int height, int stride)
-{
- int j;
- GetBitContext gb;
- int *runs, *last;
-
- runs = av_malloc(avctx->width * sizeof(runs[0]));
- last = av_malloc(avctx->width * sizeof(last[0]));
- init_get_bits(&gb, src, srcsize*8);
- for(j = 0; j < height; j++){
- if(find_group3_syncmarker(&gb, srcsize*8) < 0)
- break;
- if(decode_group3_1d_line(avctx, &gb, avctx->width, runs) < 0){
- put_line(dst, stride, avctx->width, last);
- }else{
- put_line(dst, stride, avctx->width, runs);
- FFSWAP(int*, last, runs);
- }
- dst += stride;
- }
- av_free(runs);
- av_free(last);
- return 0;
-}
-
-int ff_ccitt_unpack_2d(AVCodecContext *avctx,
- const uint8_t *src, int srcsize,
- uint8_t *dst, int height, int stride, int g4)
+ uint8_t *dst, int height, int stride, enum TiffCompr compr)
{
int j;
GetBitContext gb;
@@ -301,7 +274,7 @@ int ff_ccitt_unpack_2d(AVCodecContext *avctx,
ref[2] = 0;
init_get_bits(&gb, src, srcsize*8);
for(j = 0; j < height; j++){
- if(g4){
+ if(compr == TIFF_G4){
ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, ref);
if(ret < 0){
av_free(runs);
@@ -311,7 +284,7 @@ int ff_ccitt_unpack_2d(AVCodecContext *avctx,
}else{
if(find_group3_syncmarker(&gb, srcsize*8) < 0)
break;
- if(get_bits1(&gb))
+ if(compr==TIFF_CCITT_RLE || get_bits1(&gb))
ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs);
else
ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, ref);