Commit aab73bbe authored by fbarchard@google.com's avatar fbarchard@google.com

format conversion use malloc

BUG=296
TESTED=convert_test
R=tpsiaki@google.com

Review URL: https://webrtc-codereview.appspot.com/6339004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@924 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 4752dc59
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 923
Version: 924
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 923
#define LIBYUV_VERSION 924
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -287,9 +287,6 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer,
uint8* dst_v, int dst_stride_v,
int width, int height,
uint32 src_fourcc_bayer) {
if (width * 4 > kMaxStride) {
return -1; // Size too large for row buffer
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
......@@ -358,14 +355,16 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer,
return -1; // Bad FourCC
}
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
// Allocate 2 rows of ARGB.
const int kRowSize = (width * 4 + 15) & ~15;
align_buffer_64(row, kRowSize * 2);
for (int y = 0; y < height - 1; y += 2) {
BayerRow0(src_bayer, src_stride_bayer, row, width);
BayerRow1(src_bayer + src_stride_bayer, -src_stride_bayer,
row + kMaxStride, width);
ARGBToUVRow(row, kMaxStride, dst_u, dst_v, width);
row + kRowSize, width);
ARGBToUVRow(row, kRowSize, dst_u, dst_v, width);
ARGBToYRow(row, dst_y, width);
ARGBToYRow(row + kMaxStride, dst_y + dst_stride_y, width);
ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width);
src_bayer += src_stride_bayer * 2;
dst_y += dst_stride_y * 2;
dst_u += dst_stride_u;
......@@ -376,6 +375,7 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer,
ARGBToUVRow(row, 0, dst_u, dst_v, width);
ARGBToYRow(row, dst_y, width);
}
free_aligned_buffer_64(row);
return 0;
}
......@@ -387,9 +387,6 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
uint8* dst_bayer, int dst_stride_bayer,
int width, int height,
uint32 dst_fourcc_bayer) {
if (width * 4 > kMaxStride) {
return -1; // Size too large for row buffer
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
......@@ -439,7 +436,6 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
}
#endif
SIMD_ALIGNED(uint8 row[kMaxStride]);
void (*ARGBToBayerRow)(const uint8* src_argb, uint8* dst_bayer,
uint32 selector, int pix) = ARGBToBayerRow_C;
#if defined(HAS_ARGBTOBAYERROW_SSSE3)
......@@ -466,7 +462,8 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
dst_fourcc_bayer, index_map)) {
return -1; // Bad FourCC
}
// Allocate a row of ARGB.
align_buffer_64(row, width * 4);
for (int y = 0; y < height; ++y) {
I422ToARGBRow(src_y, src_u, src_v, row, width);
ARGBToBayerRow(row, dst_bayer, index_map[y & 1], width);
......@@ -477,6 +474,7 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
src_v += src_stride_v;
}
}
free_aligned_buffer_64(row);
return 0;
}
......
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