*/
/**
- * @file lcl.c
+ * @file libavcodec/lcldec.c
* LCL (LossLess Codec Library) Video Codec
* Decoder for MSZH and ZLIB codecs
* Experimental encoder for ZLIB RGB24
#include <stdlib.h>
#include "avcodec.h"
-#include "bitstream.h"
+#include "get_bits.h"
#include "lcl.h"
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
#include <zlib.h>
#endif
unsigned int decomp_size;
// Decompression buffer
unsigned char* decomp_buf;
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
z_stream zstream;
#endif
} LclDecContext;
* Decode a frame
*
*/
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
LclDecContext * const c = avctx->priv_data;
unsigned char *encoded = (unsigned char *)buf;
unsigned int pixel_ptr;
unsigned char yq, y1q, uq, vq;
int uqvq;
unsigned int mthread_inlen, mthread_outlen;
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
int zret; // Zlib return code
#endif
unsigned int len = buf_size;
}
break;
case CODEC_ID_ZLIB:
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
/* Using the original dll with normal compression (-1) and RGB format
* gives a file with ZLIB fourcc, but frame is really uncompressed.
* To be sure that's true check also frame size */
c->pic.data[0] = NULL;
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
// Needed if zlib unused or init aborted before inflateInit
memset(&(c->zstream), 0, sizeof(z_stream));
#endif
}
break;
case CODEC_ID_ZLIB:
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
switch (c->compression) {
case COMP_ZLIB_HISPEED:
av_log(avctx, AV_LOG_INFO, "High speed compression.\n");
/* If needed init zlib */
if (avctx->codec_id == CODEC_ID_ZLIB) {
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
c->zstream.zalloc = Z_NULL;
c->zstream.zfree = Z_NULL;
c->zstream.opaque = Z_NULL;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
-#ifdef CONFIG_ZLIB
+#if CONFIG_ZLIB
inflateEnd(&(c->zstream));
#endif
return 0;
}
-#ifdef CONFIG_MSZH_DECODER
+#if CONFIG_MSZH_DECODER
AVCodec mszh_decoder = {
"mszh",
CODEC_TYPE_VIDEO,
decode_end,
decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"),
};
#endif
-#ifdef CONFIG_ZLIB_DECODER
+#if CONFIG_ZLIB_DECODER
AVCodec zlib_decoder = {
"zlib",
CODEC_TYPE_VIDEO,
decode_end,
decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
};
#endif