summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 8c49ea9307..f7e6b6e8ab 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -3,20 +3,20 @@
* Copyright (c) 2007 Kamil Nowosad
* Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -862,6 +862,7 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
for (y = 0; y < height; y++)
memset(t1->data[y], 0, width * sizeof(width));
+
/* If code-block contains no compressed data: nothing to do. */
if (!cblk->length)
return 0;
@@ -1276,6 +1277,8 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
"couldn't find jpeg2k codestream atom\n");
return -1;
}
+ } else if (AV_RB16(s->buf) != JPEG2000_SOC && AV_RB32(s->buf + 4) == JP2_CODESTREAM) {
+ s->buf += 8;
}
if (bytestream_get_be16(&s->buf) != JPEG2000_SOC) {
@@ -1298,12 +1301,14 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
goto end;
+ jpeg2000_dec_cleanup(s);
*got_frame = 1;
+ return s->buf - s->buf_start;
end:
jpeg2000_dec_cleanup(s);
- return ret ? ret : s->buf - s->buf_start;
+ return ret;
}
static void jpeg2000_init_static_data(AVCodec *codec)