#undef WRITE_FRAME
-static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
- AVFrame *picture)
+static int jpeg2000_decode_tile(AVCodecContext *avctx, void *td,
+ int jobnr, int threadnr)
{
+ Jpeg2000DecoderContext *s = avctx->priv_data;
+ AVFrame *picture = td;
+ Jpeg2000Tile *tile = s->tile + jobnr;
int x;
tile_codeblocks(s, tile);
Jpeg2000DecoderContext *s = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *picture = data;
- int tileno, ret;
+ int ret;
s->avctx = avctx;
bytestream2_init(&s->g, avpkt->data, avpkt->size);
if (ret = jpeg2000_read_bitstream_packets(s))
goto end;
- for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
- if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
- goto end;
+ avctx->execute2(avctx, jpeg2000_decode_tile, picture, NULL, s->numXtiles * s->numYtiles);
jpeg2000_dec_cleanup(s);
.long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_JPEG2000,
- .capabilities = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_DR1,
.priv_data_size = sizeof(Jpeg2000DecoderContext),
.init_static_data = jpeg2000_init_static_data,
.init = jpeg2000_decode_init,