Commit 9fd689e5 authored by fbarchard@google.com's avatar fbarchard@google.com

Combines multiple allocs into one call.

BUG=300
TESTED=libyuv_unitests pass
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@932 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent a12284b9
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 931 Version: 932
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 931 #define LIBYUV_VERSION 932
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -325,9 +325,9 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb, ...@@ -325,9 +325,9 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
} }
#endif #endif
// Allocate a row of uv. // Allocate a rows of uv.
align_buffer_64(row_u, halfwidth); align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
align_buffer_64(row_v, halfwidth); uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (int y = 0; y < height - 1; y += 2) { for (int y = 0; y < height - 1; y += 2) {
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width); ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
...@@ -344,7 +344,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb, ...@@ -344,7 +344,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
ARGBToYRow(src_argb, dst_y, width); ARGBToYRow(src_argb, dst_y, width);
} }
free_aligned_buffer_64(row_u); free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0; return 0;
} }
...@@ -429,9 +428,9 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb, ...@@ -429,9 +428,9 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
} }
#endif #endif
// Allocate a row of uv. // Allocate a rows of uv.
align_buffer_64(row_u, halfwidth); align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
align_buffer_64(row_v, halfwidth); uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (int y = 0; y < height - 1; y += 2) { for (int y = 0; y < height - 1; y += 2) {
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width); ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
...@@ -448,7 +447,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb, ...@@ -448,7 +447,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
ARGBToYRow(src_argb, dst_y, width); ARGBToYRow(src_argb, dst_y, width);
} }
free_aligned_buffer_64(row_u); free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0; return 0;
} }
...@@ -533,10 +531,10 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb, ...@@ -533,10 +531,10 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
} }
#endif #endif
// Allocate a row of yuv. // Allocate a rows of yuv.
align_buffer_64(row_y, width); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_u, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_v = row_u + ((width + 63) & ~63) / 2;
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
ARGBToUV422Row(src_argb, row_u, row_v, width); ARGBToUV422Row(src_argb, row_u, row_v, width);
...@@ -547,8 +545,6 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb, ...@@ -547,8 +545,6 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
} }
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0; return 0;
} }
...@@ -632,10 +628,11 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb, ...@@ -632,10 +628,11 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
} }
} }
#endif #endif
// Allocate a row of yuv.
align_buffer_64(row_y, width); // Allocate a rows of yuv.
align_buffer_64(row_u, (width + 1) / 2); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
ARGBToUV422Row(src_argb, row_u, row_v, width); ARGBToUV422Row(src_argb, row_u, row_v, width);
...@@ -646,8 +643,6 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb, ...@@ -646,8 +643,6 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
} }
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0; return 0;
} }
......
...@@ -2009,61 +2009,53 @@ void NV21ToRGB565Row_SSSE3(const uint8* src_y, ...@@ -2009,61 +2009,53 @@ void NV21ToRGB565Row_SSSE3(const uint8* src_y,
void YUY2ToARGBRow_SSSE3(const uint8* src_yuy2, void YUY2ToARGBRow_SSSE3(const uint8* src_yuy2,
uint8* dst_argb, uint8* dst_argb,
int width) { int width) {
// Allocate a row of yuv. // Allocate a rows of yuv.
align_buffer_64(row_y, width); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_u, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_v = row_u + ((width + 63) & ~63) / 2;
YUY2ToUV422Row_SSE2(src_yuy2, row_u, row_v, width); YUY2ToUV422Row_SSE2(src_yuy2, row_u, row_v, width);
YUY2ToYRow_SSE2(src_yuy2, row_y, width); YUY2ToYRow_SSE2(src_yuy2, row_y, width);
I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width); I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width);
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
} }
void YUY2ToARGBRow_Unaligned_SSSE3(const uint8* src_yuy2, void YUY2ToARGBRow_Unaligned_SSSE3(const uint8* src_yuy2,
uint8* dst_argb, uint8* dst_argb,
int width) { int width) {
// Allocate a row of yuv. // Allocate a rows of yuv.
align_buffer_64(row_y, width); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_u, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_v = row_u + ((width + 63) & ~63) / 2;
YUY2ToUV422Row_Unaligned_SSE2(src_yuy2, row_u, row_v, width); YUY2ToUV422Row_Unaligned_SSE2(src_yuy2, row_u, row_v, width);
YUY2ToYRow_Unaligned_SSE2(src_yuy2, row_y, width); YUY2ToYRow_Unaligned_SSE2(src_yuy2, row_y, width);
I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width); I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width);
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
} }
void UYVYToARGBRow_SSSE3(const uint8* src_uyvy, void UYVYToARGBRow_SSSE3(const uint8* src_uyvy,
uint8* dst_argb, uint8* dst_argb,
int width) { int width) {
// Allocate a row of yuv. // Allocate a rows of yuv.
align_buffer_64(row_y, width); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_u, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_v = row_u + ((width + 63) & ~63) / 2;
UYVYToUV422Row_SSE2(src_uyvy, row_u, row_v, width); UYVYToUV422Row_SSE2(src_uyvy, row_u, row_v, width);
UYVYToYRow_SSE2(src_uyvy, row_y, width); UYVYToYRow_SSE2(src_uyvy, row_y, width);
I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width); I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width);
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
} }
void UYVYToARGBRow_Unaligned_SSSE3(const uint8* src_uyvy, void UYVYToARGBRow_Unaligned_SSSE3(const uint8* src_uyvy,
uint8* dst_argb, uint8* dst_argb,
int width) { int width) {
// Allocate a row of yuv. // Allocate a rows of yuv.
align_buffer_64(row_y, width); align_buffer_64(row_y, ((width + 63) & ~63) * 2);
align_buffer_64(row_u, (width + 1) / 2); uint8* row_u = row_y + ((width + 63) & ~63);
align_buffer_64(row_v, (width + 1) / 2); uint8* row_v = row_u + ((width + 63) & ~63) / 2;
UYVYToUV422Row_Unaligned_SSE2(src_uyvy, row_u, row_v, width); UYVYToUV422Row_Unaligned_SSE2(src_uyvy, row_u, row_v, width);
UYVYToYRow_Unaligned_SSE2(src_uyvy, row_y, width); UYVYToYRow_Unaligned_SSE2(src_uyvy, row_y, width);
I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width); I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width);
free_aligned_buffer_64(row_y); free_aligned_buffer_64(row_y);
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
} }
#endif // defined(_M_IX86) || defined(__x86_64__) || defined(__i386__) #endif // defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)
......
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