+ return 0;
+}
+
+static int v410_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ ThreadData td;
+ ThreadFrame frame = { .f = data };
+ AVFrame *pic = data;
+ uint8_t *src = avpkt->data;
+ int ret;
+ int thread_count = av_clip(avctx->thread_count, 1, avctx->height/4);
+
+ td.stride = avctx->width * 4;
+ if (avpkt->size < 4 * avctx->height * avctx->width) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
+ return AVERROR(EINVAL);
+ }
+
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
+ return ret;
+
+ pic->key_frame = 1;
+ pic->pict_type = AV_PICTURE_TYPE_I;
+
+ td.buf = src;
+ td.frame = pic;
+ avctx->execute2(avctx, v410_decode_slice, &td, NULL, thread_count);
+