comparison lcldec.c @ 9751:705efd6ddaab libavcodec

lcldec.c: change #if CONFIG_ZLIB to #if CONFIG_ZLIB_DECODER. The zlib related code should not be compiled in when the decoder is disabled and it thus will never be used, even if we have zlib available.
author reimar
date Sun, 31 May 2009 09:16:06 +0000
parents a87706453840
children f52c5d54ede5
comparison
equal deleted inserted replaced
9750:a87706453840 9751:705efd6ddaab
43 43
44 #include "avcodec.h" 44 #include "avcodec.h"
45 #include "get_bits.h" 45 #include "get_bits.h"
46 #include "lcl.h" 46 #include "lcl.h"
47 47
48 #if CONFIG_ZLIB 48 #if CONFIG_ZLIB_DECODER
49 #include <zlib.h> 49 #include <zlib.h>
50 #endif 50 #endif
51 51
52 /* 52 /*
53 * Decoder context 53 * Decoder context
63 int flags; 63 int flags;
64 // Decompressed data size 64 // Decompressed data size
65 unsigned int decomp_size; 65 unsigned int decomp_size;
66 // Decompression buffer 66 // Decompression buffer
67 unsigned char* decomp_buf; 67 unsigned char* decomp_buf;
68 #if CONFIG_ZLIB 68 #if CONFIG_ZLIB_DECODER
69 z_stream zstream; 69 z_stream zstream;
70 #endif 70 #endif
71 } LclDecContext; 71 } LclDecContext;
72 72
73 73
135 unsigned int height = avctx->height; // Real image height 135 unsigned int height = avctx->height; // Real image height
136 unsigned int mszh_dlen; 136 unsigned int mszh_dlen;
137 unsigned char yq, y1q, uq, vq; 137 unsigned char yq, y1q, uq, vq;
138 int uqvq; 138 int uqvq;
139 unsigned int mthread_inlen, mthread_outlen; 139 unsigned int mthread_inlen, mthread_outlen;
140 #if CONFIG_ZLIB 140 #if CONFIG_ZLIB_DECODER
141 int zret; // Zlib return code 141 int zret; // Zlib return code
142 #endif 142 #endif
143 unsigned int len = buf_size; 143 unsigned int len = buf_size;
144 144
145 if(c->pic.data[0]) 145 if(c->pic.data[0])
196 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n"); 196 av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n");
197 return -1; 197 return -1;
198 } 198 }
199 break; 199 break;
200 case CODEC_ID_ZLIB: 200 case CODEC_ID_ZLIB:
201 #if CONFIG_ZLIB 201 #if CONFIG_ZLIB_DECODER
202 /* Using the original dll with normal compression (-1) and RGB format 202 /* Using the original dll with normal compression (-1) and RGB format
203 * gives a file with ZLIB fourcc, but frame is really uncompressed. 203 * gives a file with ZLIB fourcc, but frame is really uncompressed.
204 * To be sure that's true check also frame size */ 204 * To be sure that's true check also frame size */
205 if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 && 205 if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
206 len == width * height * 3) 206 len == width * height * 3)
468 unsigned int max_decomp_size; 468 unsigned int max_decomp_size;
469 int zret; // Zlib return code 469 int zret; // Zlib return code
470 470
471 c->pic.data[0] = NULL; 471 c->pic.data[0] = NULL;
472 472
473 #if CONFIG_ZLIB 473 #if CONFIG_ZLIB_DECODER
474 // Needed if zlib unused or init aborted before inflateInit 474 // Needed if zlib unused or init aborted before inflateInit
475 memset(&c->zstream, 0, sizeof(z_stream)); 475 memset(&c->zstream, 0, sizeof(z_stream));
476 #endif 476 #endif
477 477
478 if (avctx->extradata_size < 8) { 478 if (avctx->extradata_size < 8) {
549 av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression); 549 av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression);
550 return 1; 550 return 1;
551 } 551 }
552 break; 552 break;
553 case CODEC_ID_ZLIB: 553 case CODEC_ID_ZLIB:
554 #if CONFIG_ZLIB 554 #if CONFIG_ZLIB_DECODER
555 switch (c->compression) { 555 switch (c->compression) {
556 case COMP_ZLIB_HISPEED: 556 case COMP_ZLIB_HISPEED:
557 av_log(avctx, AV_LOG_INFO, "High speed compression.\n"); 557 av_log(avctx, AV_LOG_INFO, "High speed compression.\n");
558 break; 558 break;
559 case COMP_ZLIB_HICOMP: 559 case COMP_ZLIB_HICOMP:
598 if (c->flags & FLAGMASK_UNUSED) 598 if (c->flags & FLAGMASK_UNUSED)
599 av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags); 599 av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags);
600 600
601 /* If needed init zlib */ 601 /* If needed init zlib */
602 if (avctx->codec_id == CODEC_ID_ZLIB) { 602 if (avctx->codec_id == CODEC_ID_ZLIB) {
603 #if CONFIG_ZLIB 603 #if CONFIG_ZLIB_DECODER
604 c->zstream.zalloc = Z_NULL; 604 c->zstream.zalloc = Z_NULL;
605 c->zstream.zfree = Z_NULL; 605 c->zstream.zfree = Z_NULL;
606 c->zstream.opaque = Z_NULL; 606 c->zstream.opaque = Z_NULL;
607 zret = inflateInit(&c->zstream); 607 zret = inflateInit(&c->zstream);
608 if (zret != Z_OK) { 608 if (zret != Z_OK) {
627 { 627 {
628 LclDecContext * const c = avctx->priv_data; 628 LclDecContext * const c = avctx->priv_data;
629 629
630 if (c->pic.data[0]) 630 if (c->pic.data[0])
631 avctx->release_buffer(avctx, &c->pic); 631 avctx->release_buffer(avctx, &c->pic);
632 #if CONFIG_ZLIB 632 #if CONFIG_ZLIB_DECODER
633 inflateEnd(&c->zstream); 633 inflateEnd(&c->zstream);
634 #endif 634 #endif
635 635
636 return 0; 636 return 0;
637 } 637 }