1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

swscale: support converting YVYU422 pixel format

This commit is contained in:
Vittorio Giovara 2014-04-07 17:19:53 +02:00
parent 8b17243d17
commit 92b099daf4
3 changed files with 28 additions and 1 deletions

View File

@ -385,6 +385,17 @@ static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
assert(src1 == src2); assert(src1 == src2);
} }
static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
const uint8_t *src2, int width, uint32_t *unused)
{
int i;
for (i = 0; i < width; i++) {
dstV[i] = src1[4 * i + 1];
dstU[i] = src1[4 * i + 3];
}
assert(src1 == src2);
}
static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, int width, static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, int width,
uint32_t *unused) uint32_t *unused)
{ {
@ -677,6 +688,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YUYV422:
c->chrToYV12 = yuy2ToUV_c; c->chrToYV12 = yuy2ToUV_c;
break; break;
case AV_PIX_FMT_YVYU422:
c->chrToYV12 = yvy2ToUV_c;
break;
case AV_PIX_FMT_UYVY422: case AV_PIX_FMT_UYVY422:
c->chrToYV12 = uyvyToUV_c; c->chrToYV12 = uyvyToUV_c;
break; break;
@ -974,6 +988,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
break; break;
#endif #endif
case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YUYV422:
case AV_PIX_FMT_YVYU422:
case AV_PIX_FMT_Y400A: case AV_PIX_FMT_Y400A:
c->lumToYV12 = yuy2ToY_c; c->lumToYV12 = yuy2ToY_c;
break; break;

View File

@ -450,7 +450,12 @@ YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK)
dest[pos + 1] = U; \ dest[pos + 1] = U; \
dest[pos + 2] = Y2; \ dest[pos + 2] = Y2; \
dest[pos + 3] = V; \ dest[pos + 3] = V; \
} else { \ } else if (target == AV_PIX_FMT_YVYU422) { \
dest[pos + 0] = Y1; \
dest[pos + 1] = V; \
dest[pos + 2] = Y2; \
dest[pos + 3] = U; \
} else { /* AV_PIX_FMT_UYVY422 */ \
dest[pos + 0] = U; \ dest[pos + 0] = U; \
dest[pos + 1] = Y1; \ dest[pos + 1] = Y1; \
dest[pos + 2] = V; \ dest[pos + 2] = V; \
@ -569,6 +574,7 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
#undef output_pixels #undef output_pixels
YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422) YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422)
YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? R : B) #define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? R : B)
@ -1576,6 +1582,11 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
*yuv2packed2 = yuv2yuyv422_2_c; *yuv2packed2 = yuv2yuyv422_2_c;
*yuv2packedX = yuv2yuyv422_X_c; *yuv2packedX = yuv2yuyv422_X_c;
break; break;
case AV_PIX_FMT_YVYU422:
*yuv2packed1 = yuv2yvyu422_1_c;
*yuv2packed2 = yuv2yvyu422_2_c;
*yuv2packedX = yuv2yvyu422_X_c;
break;
case AV_PIX_FMT_UYVY422: case AV_PIX_FMT_UYVY422:
*yuv2packed1 = yuv2uyvy422_1_c; *yuv2packed1 = yuv2uyvy422_1_c;
*yuv2packed2 = yuv2uyvy422_2_c; *yuv2packed2 = yuv2uyvy422_2_c;

View File

@ -92,6 +92,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_YUVJ420P] = { 1, 1 }, [AV_PIX_FMT_YUVJ420P] = { 1, 1 },
[AV_PIX_FMT_YUVJ422P] = { 1, 1 }, [AV_PIX_FMT_YUVJ422P] = { 1, 1 },
[AV_PIX_FMT_YUVJ444P] = { 1, 1 }, [AV_PIX_FMT_YUVJ444P] = { 1, 1 },
[AV_PIX_FMT_YVYU422] = { 1, 1 },
[AV_PIX_FMT_UYVY422] = { 1, 1 }, [AV_PIX_FMT_UYVY422] = { 1, 1 },
[AV_PIX_FMT_UYYVYY411] = { 0, 0 }, [AV_PIX_FMT_UYYVYY411] = { 0, 0 },
[AV_PIX_FMT_BGR8] = { 1, 1 }, [AV_PIX_FMT_BGR8] = { 1, 1 },