Skip to content

Commit

Permalink
j2kdec: frame multithreading support
Browse files Browse the repository at this point in the history
This allows comparing the 2 decoders with threads

Based on:commit 2e2d246
By: Nicolas Bertrand <[email protected]>

Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed May 6, 2013
1 parent b02f073 commit d2bf8ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libavcodec/j2kdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "thread.h"
#include "j2k.h"
#include "libavutil/common.h"

Expand Down Expand Up @@ -205,6 +206,7 @@ static int tag_tree_decode(J2kDecoderContext *s, J2kTgtNode *node, int threshold
static int get_siz(J2kDecoderContext *s)
{
int i, ret;
ThreadFrame frame = { .f = s->picture };

if (bytestream2_get_bytes_left(&s->g) < 36)
return AVERROR(EINVAL);
Expand Down Expand Up @@ -282,7 +284,7 @@ static int get_siz(J2kDecoderContext *s)
}


if ((ret = ff_get_buffer(s->avctx, s->picture, 0)) < 0)
if ((ret = ff_thread_get_buffer(s->avctx, &frame, 0)) < 0)
return ret;

s->picture->pict_type = AV_PICTURE_TYPE_I;
Expand Down Expand Up @@ -1088,6 +1090,6 @@ AVCodec ff_j2k_decoder = {
.priv_data_size = sizeof(J2kDecoderContext),
.init = j2kdec_init,
.decode = decode_frame,
.capabilities = CODEC_CAP_EXPERIMENTAL,
.capabilities = CODEC_CAP_EXPERIMENTAL | CODEC_CAP_FRAME_THREADS,
.long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
};

0 comments on commit d2bf8ae

Please sign in to comment.