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

ARGBToNV12 fix for memory leak on row_u_mem.

BUG=352
TESTED=libyuv_unittest
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1057 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c1155cb5
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1056 Version: 1057
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 1056 #define LIBYUV_VERSION 1057
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -269,9 +269,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb, ...@@ -269,9 +269,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
ARGBToYRow_C; ARGBToYRow_C;
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
int width) = MergeUVRow_C; int width) = MergeUVRow_C;
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
if (!src_argb || if (!src_argb ||
!dst_y || !dst_uv || !dst_y || !dst_uv ||
width <= 0 || height == 0) { width <= 0 || height == 0) {
...@@ -341,6 +338,10 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb, ...@@ -341,6 +338,10 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
} }
} }
#endif #endif
{
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (y = 0; y < height - 1; y += 2) { for (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);
...@@ -357,6 +358,7 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb, ...@@ -357,6 +358,7 @@ 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);
}
return 0; return 0;
} }
...@@ -374,9 +376,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb, ...@@ -374,9 +376,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
ARGBToYRow_C; ARGBToYRow_C;
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
int width) = MergeUVRow_C; int width) = MergeUVRow_C;
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
if (!src_argb || if (!src_argb ||
!dst_y || !dst_uv || !dst_y || !dst_uv ||
width <= 0 || height == 0) { width <= 0 || height == 0) {
...@@ -446,6 +445,10 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb, ...@@ -446,6 +445,10 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
} }
} }
#endif #endif
{
// Allocate a rows of uv.
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
for (y = 0; y < height - 1; y += 2) { for (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);
...@@ -462,6 +465,7 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb, ...@@ -462,6 +465,7 @@ 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);
}
return 0; 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