#include "get_bits.h"
#include "internal.h"
#include "unary.h"
+#include "thread.h"
static int64_t get_raw_size(enum AVPixelFormat fmt, int width, int height)
{
case AV_PIX_FMT_YUV444P:
return width * height * 3LL;
case AV_PIX_FMT_YUV420P:
- return (int64_t)(width * height) + AV_CEIL_RSHIFT(width, 1) * AV_CEIL_RSHIFT(height, 1);
+ return (int64_t)(width * height) + 2 * AV_CEIL_RSHIFT(width, 1) * AV_CEIL_RSHIFT(height, 1);
case AV_PIX_FMT_YUV410P:
- return (int64_t)(width * height) + AV_CEIL_RSHIFT(width, 2) * AV_CEIL_RSHIFT(height, 2);
+ return (int64_t)(width * height) + 2 * AV_CEIL_RSHIFT(width, 2) * AV_CEIL_RSHIFT(height, 2);
}
return 0;
pic->linesize[1] = -pic->linesize[1];
pic->data[2] += (avctx->height - 1) * pic->linesize[2];
pic->linesize[2] = -pic->linesize[2];
+ case AV_PIX_FMT_RGB555LE:
+ case AV_PIX_FMT_RGB565LE:
case AV_PIX_FMT_BGR24:
case AV_PIX_FMT_RGB24:
pic->data[0] += (avctx->height - 1) * pic->linesize[0];
const uint8_t *src, int src_size,
int id, int bpp, uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h;
uint8_t *dst;
int ret;
}
avctx->pix_fmt = id;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
int height, width, hmargin, vmargin;
}
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
V[huvborder] = src[1] + 0x80;
src += 2;
}
- Y1 += pic->linesize[0] << 2;
- Y2 += pic->linesize[0] << 2;
- Y3 += pic->linesize[0] << 2;
- Y4 += pic->linesize[0] << 2;
+ Y1 += pic->linesize[0] * 4;
+ Y2 += pic->linesize[0] * 4;
+ Y3 += pic->linesize[0] * 4;
+ Y4 += pic->linesize[0] * 4;
U += pic->linesize[1];
V += pic->linesize[2];
}
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y1, *Y2, *U, *V;
int height, width, hmargin, vmargin;
}
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
V[huvborder] = src[3] + 0x80;
src += 4;
}
- Y1 += pic->linesize[0] << 1;
- Y2 += pic->linesize[0] << 1;
+ Y1 += pic->linesize[0] * 2;
+ Y2 += pic->linesize[0] * 2;
U += pic->linesize[1];
V += pic->linesize[2];
}
const uint8_t *src, int src_size,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
int h, w;
uint8_t *Y, *U, *V;
int ret;
}
avctx->pix_fmt = AV_PIX_FMT_YUV444P;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
enum AVPixelFormat fmt,
uint32_t vflipped)
{
+ ThreadFrame frame = { .f = pic };
GetByteContext gb, gb_check;
GetBitContext gb2;
int nslices, slice, line = 0;
return AVERROR_INVALIDDATA;
avctx->pix_fmt = fmt;
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret;
do_vflip(avctx, pic, vflipped);
V[huvborder] = decode_sym(gb, lru[2]) ^ 0x80;
}
- Y += ystride << 2;
+ Y += ystride * 4;
U += ustride;
V += vstride;
}
V[huvborder] = decode_sym(gb, lru[2]) ^ 0x80;
}
- Y += ystride << 1;
+ Y += ystride * 2;
U += ustride;
V += vstride;
}
return avpkt->size;
}
-AVCodec ff_dxtory_decoder = {
+const AVCodec ff_dxtory_decoder = {
.name = "dxtory",
.long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_DXTORY,
.decode = decode_frame,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
};