Skip to content

Commit f99e011

Browse files
committed
added yuv444p16le_to_y416
refers to GH-275
1 parent 9753112 commit f99e011

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/libavcodec/from_lavc_vid_conv.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,11 @@ static void yuv444p10le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restri
14341434
}
14351435
}
14361436

1437-
static void yuv444p10le_to_y416(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1437+
#if defined __GNUC__
1438+
static inline void yuv444p1Xle_to_y416(unsigned in_depth, char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1439+
int width, int height, int pitch, const int * __restrict rgb_shift);
1440+
#endif
1441+
static void yuv444p1Xle_to_y416(unsigned in_depth, char * __restrict dst_buffer, AVFrame * __restrict in_frame,
14381442
int width, int height, int pitch, const int * __restrict rgb_shift)
14391443
{
14401444
assert((uintptr_t) dst_buffer % 2 == 0);
@@ -1449,14 +1453,26 @@ static void yuv444p10le_to_y416(char * __restrict dst_buffer, AVFrame * __restri
14491453
uint16_t *dst = (uint16_t *)(void *)(dst_buffer + y * pitch);
14501454

14511455
OPTIMIZED_FOR (int x = 0; x < width; ++x) {
1452-
*dst++ = *src_cb++ << 6U; // U
1453-
*dst++ = *src_y++ << 6U; // Y
1454-
*dst++ = *src_cr++ << 6U; // V
1456+
*dst++ = *src_cb++ << (16U - in_depth); // U
1457+
*dst++ = *src_y++ << (16U - in_depth); // Y
1458+
*dst++ = *src_cr++ << (16U - in_depth); // V
14551459
*dst++ = 0xFFFFU; // A
14561460
}
14571461
}
14581462
}
14591463

1464+
static void yuv444p10le_to_y416(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1465+
int width, int height, int pitch, const int * __restrict rgb_shift)
1466+
{
1467+
yuv444p1Xle_to_y416(10, dst_buffer, in_frame, width, height, pitch, rgb_shift);
1468+
}
1469+
1470+
static void yuv444p16le_to_y416(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1471+
int width, int height, int pitch, const int * __restrict rgb_shift)
1472+
{
1473+
yuv444p1Xle_to_y416(16, dst_buffer, in_frame, width, height, pitch, rgb_shift);
1474+
}
1475+
14601476
#if defined __GNUC__
14611477
static inline void yuvp10le_to_rgb(int subsampling, char * __restrict dst_buffer, AVFrame * __restrict frame,
14621478
int width, int height, int pitch, const int * __restrict rgb_shift, int out_bit_depth) __attribute__((always_inline));
@@ -1954,6 +1970,7 @@ const struct av_to_uv_conversion *get_av_to_uv_conversions() {
19541970
{AV_PIX_FMT_YUV444P16LE, RG48, yuv444p16le_to_rg48, false},
19551971
{AV_PIX_FMT_YUV444P16LE, UYVY, yuv444p16le_to_uyvy, false},
19561972
{AV_PIX_FMT_YUV444P16LE, v210, yuv444p16le_to_v210, false},
1973+
{AV_PIX_FMT_YUV444P16LE, Y416, yuv444p16le_to_y416, true},
19571974
{AV_PIX_FMT_AYUV64, UYVY, ayuv64_to_uyvy, false },
19581975
{AV_PIX_FMT_AYUV64, v210, ayuv64_to_v210, false },
19591976
{AV_PIX_FMT_AYUV64, Y416, ayuv64_to_y416, true },

0 commit comments

Comments
 (0)