Commit 8b6d7d72 authored by fbarchard@google.com's avatar fbarchard@google.com

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
parent 45b9ef0f
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 112 Version: 113
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -63,6 +63,13 @@ int I444ToI420(const uint8* src_y, int src_stride_y, ...@@ -63,6 +63,13 @@ int I444ToI420(const uint8* src_y, int src_stride_y,
uint8* dst_v, int dst_stride_v, uint8* dst_v, int dst_stride_v,
int width, int height); 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. // Convert NV12 to I420. Also used for NV21.
int NV12ToI420(const uint8* src_y, int src_stride_y, int NV12ToI420(const uint8* src_y, int src_stride_y,
const uint8* src_uv, int src_stride_uv, const uint8* src_uv, int src_stride_uv,
......
...@@ -2069,6 +2069,26 @@ int ARGBRect(uint8* dst_argb, int dst_stride_argb, ...@@ -2069,6 +2069,26 @@ int ARGBRect(uint8* dst_argb, int dst_stride_argb,
return 0; 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 #ifdef __cplusplus
} // extern "C" } // extern "C"
} // namespace libyuv } // namespace libyuv
......
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