+ return 0;
+}
+
+static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
+{
+ V210DecContext *s = avctx->priv_data;
+ int h, w;
+ ThreadData *td = arg;
+ AVFrame *frame = td->frame;
+ int stride = td->stride;
+ int slice_start = (avctx->height * jobnr) / s->thread_count;
+ int slice_end = (avctx->height * (jobnr+1)) / s->thread_count;
+ uint8_t *psrc = td->buf + stride * slice_start;
+ uint16_t *y, *u, *v;
+
+ y = (uint16_t*)frame->data[0] + slice_start * frame->linesize[0] / 2;
+ u = (uint16_t*)frame->data[1] + slice_start * frame->linesize[1] / 2;
+ v = (uint16_t*)frame->data[2] + slice_start * frame->linesize[2] / 2;
+ for (h = slice_start; h < slice_end; h++) {
+ const uint32_t *src = (const uint32_t*)psrc;
+ uint32_t val;
+
+ w = (avctx->width / 12) * 12;
+ s->unpack_frame(src, y, u, v, w);
+
+ y += w;
+ u += w >> 1;
+ v += w >> 1;
+ src += (w << 1) / 3;
+
+ if (w < avctx->width - 5) {
+ READ_PIXELS(u, y, v);
+ READ_PIXELS(y, u, y);
+ READ_PIXELS(v, y, u);
+ READ_PIXELS(y, v, y);
+ w += 6;
+ }
+
+ if (w < avctx->width - 1) {
+ READ_PIXELS(u, y, v);
+
+ val = av_le2ne32(*src++);
+ *y++ = val & 0x3FF;
+ if (w < avctx->width - 3) {
+ *u++ = (val >> 10) & 0x3FF;
+ *y++ = (val >> 20) & 0x3FF;
+
+ val = av_le2ne32(*src++);
+ *v++ = val & 0x3FF;
+ *y++ = (val >> 10) & 0x3FF;
+ }
+ }
+
+ psrc += stride;
+ y += frame->linesize[0] / 2 - avctx->width + (avctx->width & 1);
+ u += frame->linesize[1] / 2 - avctx->width / 2;
+ v += frame->linesize[2] / 2 - avctx->width / 2;
+ }