Skip to content

Commit 5afbd5c

Browse files
committed
added fallback yuv444p12le_to_uyvy
1 parent dabcc0c commit 5afbd5c

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/libavcodec/from_lavc_vid_conv.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,12 @@ static void yuv422p10le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restri
13901390
}
13911391
}
13921392

1393-
static void yuv444p10le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1393+
#if defined __GNUC__
1394+
static inline void yuv444p1Xle_to_uyvy(unsigned in_depth, char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1395+
int width, int height, int pitch, const int * __restrict rgb_shift)
1396+
__attribute__((always_inline));
1397+
#endif
1398+
static inline void yuv444p1Xle_to_uyvy(unsigned in_depth, char * __restrict dst_buffer, AVFrame * __restrict in_frame,
13941399
int width, int height, int pitch, const int * __restrict rgb_shift)
13951400
{
13961401
UNUSED(rgb_shift);
@@ -1401,16 +1406,28 @@ static void yuv444p10le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restri
14011406
uint8_t *dst = (uint8_t *)(void *)(dst_buffer + y * pitch);
14021407

14031408
OPTIMIZED_FOR (int x = 0; x < width / 2; ++x) {
1404-
*dst++ = (src_cb[0] + src_cb[1]) / 2 >> 2;
1405-
*dst++ = *src_y++ >> 2;
1406-
*dst++ = (src_cr[0] + src_cr[1]) / 2 >> 2;
1407-
*dst++ = *src_y++ >> 2;
1409+
*dst++ = (src_cb[0] + src_cb[1]) / 2 >> (in_depth - 2U);
1410+
*dst++ = *src_y++ >> (in_depth - 2U);
1411+
*dst++ = (src_cr[0] + src_cr[1]) / 2 >> (in_depth - 2U);
1412+
*dst++ = *src_y++ >> (in_depth - 2U);
14081413
src_cb += 2;
14091414
src_cr += 2;
14101415
}
14111416
}
14121417
}
14131418

1419+
static void yuv444p10le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1420+
int width, int height, int pitch, const int * __restrict rgb_shift)
1421+
{
1422+
yuv444p1Xle_to_uyvy(10, dst_buffer, in_frame, width, height, pitch, rgb_shift);
1423+
}
1424+
1425+
static void yuv444p12le_to_uyvy(char * __restrict dst_buffer, AVFrame * __restrict in_frame,
1426+
int width, int height, int pitch, const int * __restrict rgb_shift)
1427+
{
1428+
yuv444p1Xle_to_uyvy(12, dst_buffer, in_frame, width, height, pitch, rgb_shift);
1429+
}
1430+
14141431
#if defined __GNUC__
14151432
static inline void yuv444p1Xle_to_y416(unsigned in_depth, char * __restrict dst_buffer, AVFrame * __restrict in_frame,
14161433
int width, int height, int pitch, const int * __restrict rgb_shift)
@@ -1948,6 +1965,7 @@ const struct av_to_uv_conversion *get_av_to_uv_conversions() {
19481965
{AV_PIX_FMT_YUV444P12LE, R10k, yuv444p12le_to_r10k, false},
19491966
{AV_PIX_FMT_YUV444P12LE, R12L, yuv444p12le_to_r12l, false},
19501967
{AV_PIX_FMT_YUV444P12LE, RG48, yuv444p12le_to_rg48, false},
1968+
{AV_PIX_FMT_YUV444P12LE, UYVY, yuv444p12le_to_uyvy, false},
19511969
{AV_PIX_FMT_YUV444P12LE, v210, yuv444p12le_to_v210, false},
19521970
{AV_PIX_FMT_YUV444P12LE, Y416, yuv444p12le_to_y416, true},
19531971
// 16-bit YUV

0 commit comments

Comments
 (0)