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
This commit is contained in:
fbarchard@google.com 2013-12-30 21:11:21 +00:00
parent a12284b906
commit 9fd689e5bf
4 changed files with 33 additions and 46 deletions

View File

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

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 931
#define LIBYUV_VERSION 932
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT

View File

@ -325,9 +325,9 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
}
#endif
// Allocate a row of uv.
align_buffer_64(row_u, halfwidth);
align_buffer_64(row_v, halfwidth);
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (int y = 0; y < height - 1; y += 2) {
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,
ARGBToYRow(src_argb, dst_y, width);
}
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0;
}
@ -429,9 +428,9 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
}
#endif
// Allocate a row of uv.
align_buffer_64(row_u, halfwidth);
align_buffer_64(row_v, halfwidth);
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (int y = 0; y < height - 1; y += 2) {
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,
ARGBToYRow(src_argb, dst_y, width);
}
free_aligned_buffer_64(row_u);
free_aligned_buffer_64(row_v);
return 0;
}
@ -533,10 +531,10 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
}
#endif
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 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) {
ARGBToUV422Row(src_argb, row_u, row_v, width);
@ -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_u);
free_aligned_buffer_64(row_v);
return 0;
}
@ -632,10 +628,11 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
}
}
#endif
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 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) {
ARGBToUV422Row(src_argb, row_u, row_v, width);
@ -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_u);
free_aligned_buffer_64(row_v);
return 0;
}

View File

@ -2009,61 +2009,53 @@ void NV21ToRGB565Row_SSSE3(const uint8* src_y,
void YUY2ToARGBRow_SSSE3(const uint8* src_yuy2,
uint8* dst_argb,
int width) {
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
uint8* row_u = row_y + ((width + 63) & ~63);
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
YUY2ToUV422Row_SSE2(src_yuy2, row_u, row_v, width);
YUY2ToYRow_SSE2(src_yuy2, row_y, width);
I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width);
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,
uint8* dst_argb,
int width) {
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
uint8* row_u = row_y + ((width + 63) & ~63);
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
YUY2ToUV422Row_Unaligned_SSE2(src_yuy2, row_u, row_v, width);
YUY2ToYRow_Unaligned_SSE2(src_yuy2, row_y, width);
I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width);
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,
uint8* dst_argb,
int width) {
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
uint8* row_u = row_y + ((width + 63) & ~63);
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
UYVYToUV422Row_SSE2(src_uyvy, row_u, row_v, width);
UYVYToYRow_SSE2(src_uyvy, row_y, width);
I422ToARGBRow_SSSE3(row_y, row_u, row_v, dst_argb, width);
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,
uint8* dst_argb,
int width) {
// Allocate a row of yuv.
align_buffer_64(row_y, width);
align_buffer_64(row_u, (width + 1) / 2);
align_buffer_64(row_v, (width + 1) / 2);
// Allocate a rows of yuv.
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
uint8* row_u = row_y + ((width + 63) & ~63);
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
UYVYToUV422Row_Unaligned_SSE2(src_uyvy, row_u, row_v, width);
UYVYToYRow_Unaligned_SSE2(src_uyvy, row_y, width);
I422ToARGBRow_Unaligned_SSSE3(row_y, row_u, row_v, dst_argb, width);
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__)