Commit 928483f3 authored by fbarchard@google.com's avatar fbarchard@google.com

Add I420ToNV12 and NV21 to convert from

BUG=178
TEST=none
Review URL: https://webrtc-codereview.appspot.com/1127007

git-svn-id: http://libyuv.googlecode.com/svn/trunk@581 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c22cd5b2
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 579
Version: 581
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 579
#define LIBYUV_VERSION 581
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -1866,6 +1866,30 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_RGBP:
src = sample + (src_width * crop_y + crop_x) * 2;
r = RGB565ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_RGBO:
src = sample + (src_width * crop_y + crop_x) * 2;
r = ARGB1555ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_R444:
src = sample + (src_width * crop_y + crop_x) * 2;
r = ARGB4444ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_24BG:
src = sample + (src_width * crop_y + crop_x) * 3;
r = RGB24ToI420(src, src_width * 3,
......@@ -1914,30 +1938,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_RGBP:
src = sample + (src_width * crop_y + crop_x) * 2;
r = RGB565ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_RGBO:
src = sample + (src_width * crop_y + crop_x) * 2;
r = ARGB1555ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_R444:
src = sample + (src_width * crop_y + crop_x) * 2;
r = ARGB4444ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
// TODO(fbarchard): Support cropping Bayer by odd numbers
// by adjusting fourcc.
case FOURCC_BGGR:
......@@ -1948,7 +1948,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_GBRG:
src = sample + (src_width * crop_y + crop_x);
r = BayerGBRGToI420(src, src_width,
......@@ -1957,7 +1956,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_GRBG:
src = sample + (src_width * crop_y + crop_x);
r = BayerGRBGToI420(src, src_width,
......@@ -1966,7 +1964,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_RGGB:
src = sample + (src_width * crop_y + crop_x);
r = BayerRGGBToI420(src, src_width,
......@@ -1975,7 +1972,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_I400:
src = sample + src_width * crop_y + crop_x;
r = I400ToI420(src, src_width,
......@@ -1984,7 +1980,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
// Biplanar formats
case FOURCC_NV12:
src = sample + (src_width * crop_y + crop_x);
......
......@@ -1127,6 +1127,31 @@ int ConvertFromI420(const uint8* y, int y_stride,
dst_sample_stride ? dst_sample_stride : width,
width, height);
break;
case FOURCC_NV12: {
uint8* dst_uv = dst_sample + width * height;
r = I420ToNV12(y, y_stride,
u, u_stride,
v, v_stride,
dst_sample,
dst_sample_stride ? dst_sample_stride : width,
dst_uv,
dst_sample_stride ? dst_sample_stride : width,
width, height);
break;
}
case FOURCC_NV21: {
uint8* dst_vu = dst_sample + width * height;
r = I420ToNV21(y, y_stride,
u, u_stride,
v, v_stride,
dst_sample,
dst_sample_stride ? dst_sample_stride : width,
dst_vu,
dst_sample_stride ? dst_sample_stride : width,
width, height);
break;
}
// TODO(fbarchard): Add M420 and Q420.
// Triplanar formats
// TODO(fbarchard): halfstride instead of halfwidth
case FOURCC_I420:
......
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