summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-08 11:46:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-08 11:46:41 +0200
commit1bad40ef27237dcccf12a106ed870aa303ed4d44 (patch)
tree40ee7738a962299eec357f6d9b9a3eec10129530 /libavcodec/jpeg2000dec.c
parentaecb3421f641d56d3b3419c28da5cf98b0eadd7c (diff)
parent70f9661542a581dfe93b636b1c55b5558e4a4e3c (diff)
Merge commit '70f9661542a581dfe93b636b1c55b5558e4a4e3c'
* commit '70f9661542a581dfe93b636b1c55b5558e4a4e3c': jpeg2000dec: initialize static data just once Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 89a1527219..2a71d1dc19 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1265,8 +1265,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
// reduction factor, i.e number of resolution levels to skip
s->reduction_factor = s->lowres;
- ff_jpeg2000_init_tier1_luts();
-
if (s->buf_end - s->buf < 2)
return AVERROR(EINVAL);
@@ -1313,6 +1311,11 @@ end:
return ret;
}
+static void jpeg2000_init_static_data(AVCodec *codec)
+{
+ ff_jpeg2000_init_tier1_luts();
+}
+
#define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
@@ -1339,16 +1342,17 @@ static const AVClass class = {
};
AVCodec ff_jpeg2000_decoder = {
- .name = "jpeg2000",
- .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
- .type = AVMEDIA_TYPE_VIDEO,
- .id = AV_CODEC_ID_JPEG2000,
- .capabilities = CODEC_CAP_FRAME_THREADS,
- .priv_data_size = sizeof(Jpeg2000DecoderContext),
- .decode = jpeg2000_decode_frame,
- .priv_class = &class,
- .pix_fmts = (enum PixelFormat[]) { AV_PIX_FMT_XYZ12,
- AV_PIX_FMT_GRAY8,
- -1 },
- .profiles = NULL_IF_CONFIG_SMALL(profiles)
+ .name = "jpeg2000",
+ .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_JPEG2000,
+ .capabilities = CODEC_CAP_FRAME_THREADS,
+ .priv_data_size = sizeof(Jpeg2000DecoderContext),
+ .init_static_data = jpeg2000_init_static_data,
+ .decode = jpeg2000_decode_frame,
+ .priv_class = &class,
+ .pix_fmts = (enum PixelFormat[]) { AV_PIX_FMT_XYZ12,
+ AV_PIX_FMT_GRAY8,
+ -1 },
+ .profiles = NULL_IF_CONFIG_SMALL(profiles)
};