mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-08-29 20:56:12 +02:00
Remove useless () from lcldec for more consistency with "normal" FFmpeg coding style.
Originally committed as revision 18995 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
b157e3e56b
commit
c40f366372
@ -115,9 +115,9 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
|
|||||||
unsigned char maskbit = 0;
|
unsigned char maskbit = 0;
|
||||||
unsigned int ofs, cnt;
|
unsigned int ofs, cnt;
|
||||||
|
|
||||||
while ((srclen > 0) && (destptr < destptr_end)) {
|
while (srclen > 0 && destptr < destptr_end) {
|
||||||
if (maskbit == 0) {
|
if (maskbit == 0) {
|
||||||
mask = *(srcptr++);
|
mask = *srcptr++;
|
||||||
maskbit = 8;
|
maskbit = 8;
|
||||||
srclen--;
|
srclen--;
|
||||||
continue;
|
continue;
|
||||||
@ -130,8 +130,8 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
|
|||||||
destptr += 4;
|
destptr += 4;
|
||||||
srcptr += 4;
|
srcptr += 4;
|
||||||
} else {
|
} else {
|
||||||
ofs = *(srcptr++);
|
ofs = *srcptr++;
|
||||||
cnt = *(srcptr++);
|
cnt = *srcptr++;
|
||||||
ofs += cnt * 256;
|
ofs += cnt * 256;
|
||||||
cnt = ((cnt >> 3) & 0x1f) + 1;
|
cnt = ((cnt >> 3) & 0x1f) + 1;
|
||||||
ofs &= 0x7ff;
|
ofs &= 0x7ff;
|
||||||
@ -141,13 +141,13 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
|
|||||||
cnt = destptr_end - destptr;
|
cnt = destptr_end - destptr;
|
||||||
}
|
}
|
||||||
for (; cnt > 0; cnt--) {
|
for (; cnt > 0; cnt--) {
|
||||||
*(destptr) = *(destptr - ofs);
|
*destptr = *(destptr - ofs);
|
||||||
destptr++;
|
destptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (destptr - destptr_bak);
|
return destptr - destptr_bak;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,8 +195,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
switch (c->compression) {
|
switch (c->compression) {
|
||||||
case COMP_MSZH:
|
case COMP_MSZH:
|
||||||
if (c->flags & FLAG_MULTITHREAD) {
|
if (c->flags & FLAG_MULTITHREAD) {
|
||||||
mthread_inlen = *((unsigned int*)encoded);
|
mthread_inlen = *(unsigned int*)encoded;
|
||||||
mthread_outlen = *((unsigned int*)(encoded+4));
|
mthread_outlen = *(unsigned int*)(encoded+4);
|
||||||
if (mthread_outlen > c->decomp_size) // this should not happen
|
if (mthread_outlen > c->decomp_size) // this should not happen
|
||||||
mthread_outlen = c->decomp_size;
|
mthread_outlen = c->decomp_size;
|
||||||
mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
|
mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
|
||||||
@ -237,34 +237,34 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
/* Using the original dll with normal compression (-1) and RGB format
|
/* Using the original dll with normal compression (-1) and RGB format
|
||||||
* gives a file with ZLIB fourcc, but frame is really uncompressed.
|
* gives a file with ZLIB fourcc, but frame is really uncompressed.
|
||||||
* To be sure that's true check also frame size */
|
* To be sure that's true check also frame size */
|
||||||
if ((c->compression == COMP_ZLIB_NORMAL) && (c->imgtype == IMGTYPE_RGB24) &&
|
if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
|
||||||
(len == width * height * 3))
|
len == width * height * 3)
|
||||||
break;
|
break;
|
||||||
zret = inflateReset(&(c->zstream));
|
zret = inflateReset(&c->zstream);
|
||||||
if (zret != Z_OK) {
|
if (zret != Z_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (c->flags & FLAG_MULTITHREAD) {
|
if (c->flags & FLAG_MULTITHREAD) {
|
||||||
mthread_inlen = *((unsigned int*)encoded);
|
mthread_inlen = *(unsigned int*)encoded;
|
||||||
mthread_outlen = *((unsigned int*)(encoded+4));
|
mthread_outlen = *(unsigned int*)(encoded+4);
|
||||||
if (mthread_outlen > c->decomp_size)
|
if (mthread_outlen > c->decomp_size)
|
||||||
mthread_outlen = c->decomp_size;
|
mthread_outlen = c->decomp_size;
|
||||||
c->zstream.next_in = encoded + 8;
|
c->zstream.next_in = encoded + 8;
|
||||||
c->zstream.avail_in = mthread_inlen;
|
c->zstream.avail_in = mthread_inlen;
|
||||||
c->zstream.next_out = c->decomp_buf;
|
c->zstream.next_out = c->decomp_buf;
|
||||||
c->zstream.avail_out = c->decomp_size;
|
c->zstream.avail_out = c->decomp_size;
|
||||||
zret = inflate(&(c->zstream), Z_FINISH);
|
zret = inflate(&c->zstream, Z_FINISH);
|
||||||
if ((zret != Z_OK) && (zret != Z_STREAM_END)) {
|
if (zret != Z_OK && zret != Z_STREAM_END) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Mthread1 inflate error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Mthread1 inflate error: %d\n", zret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (mthread_outlen != (unsigned int)(c->zstream.total_out)) {
|
if (mthread_outlen != (unsigned int)c->zstream.total_out) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%u != %lu)\n",
|
av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%u != %lu)\n",
|
||||||
mthread_outlen, c->zstream.total_out);
|
mthread_outlen, c->zstream.total_out);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
zret = inflateReset(&(c->zstream));
|
zret = inflateReset(&c->zstream);
|
||||||
if (zret != Z_OK) {
|
if (zret != Z_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate reset error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate reset error: %d\n", zret);
|
||||||
return -1;
|
return -1;
|
||||||
@ -273,12 +273,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
c->zstream.avail_in = len - mthread_inlen;
|
c->zstream.avail_in = len - mthread_inlen;
|
||||||
c->zstream.next_out = c->decomp_buf + mthread_outlen;
|
c->zstream.next_out = c->decomp_buf + mthread_outlen;
|
||||||
c->zstream.avail_out = c->decomp_size - mthread_outlen;
|
c->zstream.avail_out = c->decomp_size - mthread_outlen;
|
||||||
zret = inflate(&(c->zstream), Z_FINISH);
|
zret = inflate(&c->zstream, Z_FINISH);
|
||||||
if ((zret != Z_OK) && (zret != Z_STREAM_END)) {
|
if (zret != Z_OK && zret != Z_STREAM_END) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate error: %d\n", zret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (mthread_outlen != (unsigned int)(c->zstream.total_out)) {
|
if (mthread_outlen != (unsigned int)c->zstream.total_out) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %lu)\n",
|
av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %lu)\n",
|
||||||
mthread_outlen, c->zstream.total_out);
|
mthread_outlen, c->zstream.total_out);
|
||||||
return -1;
|
return -1;
|
||||||
@ -288,12 +288,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
c->zstream.avail_in = len;
|
c->zstream.avail_in = len;
|
||||||
c->zstream.next_out = c->decomp_buf;
|
c->zstream.next_out = c->decomp_buf;
|
||||||
c->zstream.avail_out = c->decomp_size;
|
c->zstream.avail_out = c->decomp_size;
|
||||||
zret = inflate(&(c->zstream), Z_FINISH);
|
zret = inflate(&c->zstream, Z_FINISH);
|
||||||
if ((zret != Z_OK) && (zret != Z_STREAM_END)) {
|
if (zret != Z_OK && zret != Z_STREAM_END) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (c->decomp_size != (unsigned int)(c->zstream.total_out)) {
|
if (c->decomp_size != (unsigned int)c->zstream.total_out) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
||||||
c->decomp_size, c->zstream.total_out);
|
c->decomp_size, c->zstream.total_out);
|
||||||
return -1;
|
return -1;
|
||||||
@ -313,7 +313,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
|
|
||||||
|
|
||||||
/* Apply PNG filter */
|
/* Apply PNG filter */
|
||||||
if ((avctx->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) {
|
if (avctx->codec_id == CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) {
|
||||||
switch (c->imgtype) {
|
switch (c->imgtype) {
|
||||||
case IMGTYPE_YUV111:
|
case IMGTYPE_YUV111:
|
||||||
case IMGTYPE_RGB24:
|
case IMGTYPE_RGB24:
|
||||||
@ -524,7 +524,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
// Needed if zlib unused or init aborted before inflateInit
|
// Needed if zlib unused or init aborted before inflateInit
|
||||||
memset(&(c->zstream), 0, sizeof(z_stream));
|
memset(&c->zstream, 0, sizeof(z_stream));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (avctx->extradata_size < 8) {
|
if (avctx->extradata_size < 8) {
|
||||||
@ -537,8 +537,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check codec type */
|
/* Check codec type */
|
||||||
if (((avctx->codec_id == CODEC_ID_MSZH) && (*((char *)avctx->extradata + 7) != CODEC_MSZH)) ||
|
if ((avctx->codec_id == CODEC_ID_MSZH && *((char *)avctx->extradata + 7) != CODEC_MSZH) ||
|
||||||
((avctx->codec_id == CODEC_ID_ZLIB) && (*((char *)avctx->extradata + 7) != CODEC_ZLIB))) {
|
(avctx->codec_id == CODEC_ID_ZLIB && *((char *)avctx->extradata + 7) != CODEC_ZLIB)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n");
|
av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
av_log(avctx, AV_LOG_INFO, "Normal compression.\n");
|
av_log(avctx, AV_LOG_INFO, "Normal compression.\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((c->compression < Z_NO_COMPRESSION) || (c->compression > Z_BEST_COMPRESSION)) {
|
if (c->compression < Z_NO_COMPRESSION || c->compression > Z_BEST_COMPRESSION) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unsupported compression level for ZLIB: (%d).\n", c->compression);
|
av_log(avctx, AV_LOG_ERROR, "Unsupported compression level for ZLIB: (%d).\n", c->compression);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
c->zstream.zalloc = Z_NULL;
|
c->zstream.zalloc = Z_NULL;
|
||||||
c->zstream.zfree = Z_NULL;
|
c->zstream.zfree = Z_NULL;
|
||||||
c->zstream.opaque = Z_NULL;
|
c->zstream.opaque = Z_NULL;
|
||||||
zret = inflateInit(&(c->zstream));
|
zret = inflateInit(&c->zstream);
|
||||||
if (zret != Z_OK) {
|
if (zret != Z_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
|
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
|
||||||
return 1;
|
return 1;
|
||||||
@ -678,7 +678,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
|||||||
if (c->pic.data[0])
|
if (c->pic.data[0])
|
||||||
avctx->release_buffer(avctx, &c->pic);
|
avctx->release_buffer(avctx, &c->pic);
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
inflateEnd(&(c->zstream));
|
inflateEnd(&c->zstream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user