Commit 5ca144d2 authored by fbarchard@google.com's avatar fbarchard@google.com

NV12 to/from I420 coalesce rows for Y and UV independently.

BUG=197
TESTED=*NV12*_Opt
Review URL: https://webrtc-codereview.appspot.com/1201004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@607 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 7d25fe2d
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 606
Version: 607
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 606
#define LIBYUV_VERSION 607
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -381,8 +381,21 @@ static int X420ToI420(const uint8* src_y,
dst_stride_u = -dst_stride_u;
dst_stride_v = -dst_stride_v;
}
// Coalesce contiguous rows.
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
if (src_stride_y0 == width &&
src_stride_y1 == width &&
dst_stride_y == width) {
width = width * height;
height = 1;
}
if (src_stride_uv == width &&
dst_stride_u * 2 == width &&
dst_stride_v * 2 == width) {
halfwidth = halfwidth * halfheight;
halfheight = 1;
}
void (*SplitUVRow)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) =
SplitUVRow_C;
#if defined(HAS_SPLITUVROW_SSE2)
......@@ -437,7 +450,6 @@ static int X420ToI420(const uint8* src_y,
}
}
int halfheight = (height + 1) >> 1;
for (int y = 0; y < halfheight; ++y) {
// Copy a row of UV.
SplitUVRow(src_uv, dst_u, dst_v, halfwidth);
......
......@@ -465,12 +465,13 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
if (src_stride_y == width &&
src_stride_u * 2 == width &&
src_stride_v * 2 == width &&
dst_stride_y == width &&
dst_stride_uv == width) {
dst_stride_y == width) {
width = width * height;
height = 1;
}
if (src_stride_u * 2 == width &&
src_stride_v * 2 == width &&
dst_stride_uv == width) {
halfwidth = halfwidth * halfheight;
halfheight = 1;
}
......
......@@ -19,7 +19,6 @@ extern "C" {
// TODO(fbarchard): Consider 'any' functions handling any quantity of pixels.
// TODO(fbarchard): Consider 'any' functions handling odd alignment.
// YUV to RGB does multiple of 8 with SIMD and remainder with C.
#define YANY(NAMEANY, I420TORGB_SIMD, I420TORGB_C, UV_SHIFT, BPP, MASK) \
void NAMEANY(const uint8* y_buf, \
......
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