Commit 10f5556a authored by fbarchard@google.com's avatar fbarchard@google.com

I444 fourcc and ConvertToI420 support

BUG=none
TEST=untested
Review URL: http://webrtc-codereview.appspot.com/290001

git-svn-id: http://libyuv.googlecode.com/svn/trunk@92 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 1c5136d0
......@@ -1132,10 +1132,9 @@ int ConvertToI420(const uint8* sample, size_t sample_size,
dst_width, inv_dst_height, rotation);
break;
}
// Triplanar formats
case FOURCC_I422:
case FOURCC_YV16: {
const uint8* src_y = sample + (src_width * crop_y + crop_x);
const uint8* src_y = sample + src_width * crop_y + crop_x;
const uint8* src_u;
const uint8* src_v;
int halfwidth = (src_width + 1) / 2;
......@@ -1159,6 +1158,27 @@ int ConvertToI420(const uint8* sample, size_t sample_size,
dst_width, inv_dst_height);
break;
}
case FOURCC_I444:
case FOURCC_YV24: {
const uint8* src_y = sample + src_width * crop_y + crop_x;
const uint8* src_u;
const uint8* src_v;
if (format == FOURCC_I444) {
src_u = sample + src_width * (abs_src_height + crop_y) + crop_x;
src_v = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
} else {
src_v = sample + src_width * (abs_src_height + crop_y) + crop_x;
src_u = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
}
I444ToI420(src_y, src_width,
src_u, halfwidth,
src_v, halfwidth,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
}
// Formats not supported
case FOURCC_MJPG:
default:
......
......@@ -25,6 +25,8 @@ struct FourCCAliasEntry {
static const FourCCAliasEntry kFourCCAliases[] = {
{FOURCC_IYUV, FOURCC_I420},
{FOURCC_YU12, FOURCC_I420},
{FOURCC_YU16, FOURCC_I422},
{FOURCC_YU24, FOURCC_I444},
{FOURCC_YUYV, FOURCC_YUY2},
{FOURCC_YUVS, FOURCC_YUY2},
{FOURCC_HDYC, FOURCC_UYVY},
......
......@@ -39,8 +39,10 @@ enum FourCC {
// Canonical fourcc codes used in our code.
FOURCC_I420 = FOURCC('I', '4', '2', '0'),
FOURCC_I422 = FOURCC('I', '4', '2', '2'),
FOURCC_I444 = FOURCC('I', '4', '4', '4'),
FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
......@@ -65,6 +67,7 @@ enum FourCC {
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420
FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Alias for I420
FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422
FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444
FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2
FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac
FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY
......
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