[FFmpeg-cvslog] exr: simplify decompression path
Michael Niedermayer
michaelni at gmx.at
Wed Feb 27 22:23:45 CET 2013
On Wed, Feb 27, 2013 at 05:33:55PM +0100, Paul B Mahol wrote:
> ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb 27 16:22:14 2013 +0000| [9774145fe5ae9d463511eb63ad49017a271f2e20] | committer: Paul B Mahol
>
> exr: simplify decompression path
>
[...]
> @@ -251,7 +275,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
> const uint8_t *src;
> int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components;
> int bxmin = s->xmin * 2 * s->desc->nb_components;
> - int i, x, buf_size = s->buf_size;
> + int ret, i, x, buf_size = s->buf_size;
>
> line_offset = AV_RL64(s->table + jobnr * 8);
> // Check if the buffer has the required bytes needed from the offset
> @@ -280,25 +304,16 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
> av_fast_padded_malloc(&td->tmp, &td->tmp_size, uncompressed_size);
> if (!td->uncompressed_data || !td->tmp)
> return AVERROR(ENOMEM);
> - }
> - if ((s->compr == EXR_ZIP1 || s->compr == EXR_ZIP16) && data_size < uncompressed_size) {
> - unsigned long dest_len = uncompressed_size;
>
> - if (uncompress(td->tmp, &dest_len, src, data_size) != Z_OK ||
> - dest_len != uncompressed_size) {
> - av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
> - return AVERROR(EINVAL);
> - }
> - } else if (s->compr == EXR_RLE && data_size < uncompressed_size) {
> - if (rle_uncompress(src, data_size, td->tmp, uncompressed_size)) {
> - av_log(avctx, AV_LOG_ERROR, "error during rle decompression\n");
> - return AVERROR(EINVAL);
> + switch (s->compr) {
> + case EXR_ZIP1:
> + case EXR_ZIP16:
> + ret = zip_uncompress(src, data_size, uncompressed_size, td);
> + break;
> + case EXR_RLE:
> + ret = rle_uncompress(src, data_size, uncompressed_size, td);
> }
libavcodec/exr.c: In function ‘decode_block’:
libavcodec/exr.c:278:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20130227/592ea931/attachment.asc>
More information about the ffmpeg-cvslog
mailing list