Commit d239b83e authored by Baptiste Coudurier's avatar Baptiste Coudurier Committed by Anton Khirnov

v210enc: switch to PIX_FMT_422P10

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 08fa23d6
...@@ -31,8 +31,8 @@ static av_cold int encode_init(AVCodecContext *avctx) ...@@ -31,8 +31,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
return -1; return -1;
} }
if (avctx->pix_fmt != PIX_FMT_YUV422P16) { if (avctx->pix_fmt != PIX_FMT_YUV422P10) {
av_log(avctx, AV_LOG_ERROR, "v210 needs YUV422P16\n"); av_log(avctx, AV_LOG_ERROR, "v210 needs YUV422P10\n");
return -1; return -1;
} }
...@@ -68,9 +68,9 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, ...@@ -68,9 +68,9 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
#define WRITE_PIXELS(a, b, c) \ #define WRITE_PIXELS(a, b, c) \
do { \ do { \
val = (*a++ >> 6) | \ val = *a++; \
((*b++ & 0xFFC0) << 4); \ val |= (*b++ << 10) | \
val|= (*c++ & 0xFFC0) << 14; \ (*c++ << 20); \
bytestream_put_le32(&p, val); \ bytestream_put_le32(&p, val); \
} while (0) } while (0)
...@@ -85,17 +85,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, ...@@ -85,17 +85,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
if (w < avctx->width - 1) { if (w < avctx->width - 1) {
WRITE_PIXELS(u, y, v); WRITE_PIXELS(u, y, v);
val = *y++ >> 6; val = *y++;
if (w == avctx->width - 2) if (w == avctx->width - 2)
bytestream_put_le32(&p, val); bytestream_put_le32(&p, val);
} }
if (w < avctx->width - 3) { if (w < avctx->width - 3) {
val |=((*u++ & 0xFFC0) << 4) | val |= (*u++ << 10) | (*y++ << 20);
((*y++ & 0xFFC0) << 14);
bytestream_put_le32(&p, val); bytestream_put_le32(&p, val);
val = (*v++ >> 6) | val = *v++ | (*y++ << 10);
(*y++ & 0xFFC0) << 4;
bytestream_put_le32(&p, val); bytestream_put_le32(&p, val);
} }
...@@ -124,6 +122,6 @@ AVCodec ff_v210_encoder = { ...@@ -124,6 +122,6 @@ AVCodec ff_v210_encoder = {
.init = encode_init, .init = encode_init,
.encode = encode_frame, .encode = encode_frame,
.close = encode_close, .close = encode_close,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P16, PIX_FMT_NONE}, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P10, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment