Added y216_to_yuv422p10le

yuv422p10le is eligible intermediate format for Y216 to libx264/libx265.
This commit is contained in:
Martin Pulec
2021-06-14 14:51:08 +02:00
parent 34c8055dc8
commit 703208432c

View File

@@ -891,6 +891,24 @@ static void rg48_to_yuv444p16le(AVFrame * __restrict out_frame, unsigned char *
rg48_to_yuv444pXXle(16, out_frame, in_data, width, height);
}
static void y216_to_yuv422p10le(AVFrame * __restrict out_frame, unsigned char * __restrict in_data, int width, int height)
{
const int src_linesize = vc_get_linesize(width, Y216);
for(int y = 0; y < height; y++) {
uint16_t *dst_y = (uint16_t *) (out_frame->data[0] + out_frame->linesize[0] * y);
uint16_t *dst_cb = (uint16_t *) (out_frame->data[1] + out_frame->linesize[1] * y);
uint16_t *dst_cr = (uint16_t *) (out_frame->data[2] + out_frame->linesize[2] * y);
uint16_t *src = (uint16_t *) (in_data + y * src_linesize);
OPTIMIZED_FOR(int x = 0; x < (width + 1) / 2; x++){
*dst_y++ = *src++ >> 6U;
*dst_cb++ = *src++ >> 6U;
*dst_y++ = *src++ >> 6U;
*dst_cr++ = *src++ >> 6U;
}
}
}
static void y216_to_yuv444p16le(AVFrame * __restrict out_frame, unsigned char * __restrict in_data, int width, int height)
{
const int src_linesize = vc_get_linesize(width, Y216);
@@ -2536,6 +2554,7 @@ const struct uv_to_av_conversion *get_uv_to_av_conversions() {
{ UYVY, AV_PIX_FMT_NV12, AVCOL_SPC_BT709, AVCOL_RANGE_MPEG, uyvy_to_nv12 },
{ UYVY, AV_PIX_FMT_YUV444P, AVCOL_SPC_BT709, AVCOL_RANGE_MPEG, uyvy_to_yuv444p },
{ UYVY, AV_PIX_FMT_YUVJ444P, AVCOL_SPC_BT709, AVCOL_RANGE_MPEG, uyvy_to_yuv444p },
{ Y216, AV_PIX_FMT_YUV422P10LE, AVCOL_SPC_BT709, AVCOL_RANGE_MPEG, y216_to_yuv422p10le },
{ Y216, AV_PIX_FMT_YUV444P16LE, AVCOL_SPC_BT709, AVCOL_RANGE_MPEG, y216_to_yuv444p16le },
{ RGB, AV_PIX_FMT_BGR0, AVCOL_SPC_RGB, AVCOL_RANGE_JPEG, rgb_to_bgr0 },
{ RGB, AV_PIX_FMT_GBRP, AVCOL_SPC_RGB, AVCOL_RANGE_JPEG, rgb_to_gbrp },