I400 to 420 for MJPG internals

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@113 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
fbarchard@google.com 2011-12-16 19:43:29 +00:00
parent 45b9ef0f6a
commit 8b6d7d72f9
3 changed files with 28 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 112
Version: 113
License: BSD
License File: LICENSE

View File

@ -63,6 +63,13 @@ int I444ToI420(const uint8* src_y, int src_stride_y,
uint8* dst_v, int dst_stride_v,
int width, int height);
// Convert I400 (grey) to I420.
int I400ToI420(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height);
// Convert NV12 to I420. Also used for NV21.
int NV12ToI420(const uint8* src_y, int src_stride_y,
const uint8* src_uv, int src_stride_uv,

View File

@ -2069,6 +2069,26 @@ int ARGBRect(uint8* dst_argb, int dst_stride_argb,
return 0;
}
// I400 is greyscale typically used in MJPG
int I400ToI420(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height) {
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_y = src_y + (height - 1) * src_stride_y;
src_stride_y = -src_stride_y;
}
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
SetPlane(dst_u, dst_stride_u, halfwidth, halfheight, 128);
SetPlane(dst_v, dst_stride_v, halfwidth, halfheight, 128);
return 0;
}
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv