mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-14 14:19:52 +08:00
Sobel use malloc for row buffers
BUG=296 TESTED=Sobel* R=tpsiaki@google.com Review URL: https://webrtc-codereview.appspot.com/6389004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@927 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
05d025df22
commit
b2a51d042d
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 926
|
Version: 927
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -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 926
|
#define LIBYUV_VERSION 927
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||||
|
|||||||
@ -927,7 +927,7 @@ int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
|||||||
uint8* rgb_buf,
|
uint8* rgb_buf,
|
||||||
int width) = NV12ToRGB565Row_C;
|
int width) = NV12ToRGB565Row_C;
|
||||||
#if defined(HAS_NV12TORGB565ROW_SSSE3)
|
#if defined(HAS_NV12TORGB565ROW_SSSE3)
|
||||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8 && width * 4 <= kMaxStride) {
|
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||||
NV12ToRGB565Row = NV12ToRGB565Row_Any_SSSE3;
|
NV12ToRGB565Row = NV12ToRGB565Row_Any_SSSE3;
|
||||||
if (IS_ALIGNED(width, 8)) {
|
if (IS_ALIGNED(width, 8)) {
|
||||||
NV12ToRGB565Row = NV12ToRGB565Row_SSSE3;
|
NV12ToRGB565Row = NV12ToRGB565Row_SSSE3;
|
||||||
@ -974,7 +974,7 @@ int NV21ToRGB565(const uint8* src_y, int src_stride_y,
|
|||||||
uint8* rgb_buf,
|
uint8* rgb_buf,
|
||||||
int width) = NV21ToRGB565Row_C;
|
int width) = NV21ToRGB565Row_C;
|
||||||
#if defined(HAS_NV21TORGB565ROW_SSSE3)
|
#if defined(HAS_NV21TORGB565ROW_SSSE3)
|
||||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8 && width * 4 <= kMaxStride) {
|
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||||
NV21ToRGB565Row = NV21ToRGB565Row_Any_SSSE3;
|
NV21ToRGB565Row = NV21ToRGB565Row_Any_SSSE3;
|
||||||
if (IS_ALIGNED(width, 8)) {
|
if (IS_ALIGNED(width, 8)) {
|
||||||
NV21ToRGB565Row = NV21ToRGB565Row_SSSE3;
|
NV21ToRGB565Row = NV21ToRGB565Row_SSSE3;
|
||||||
@ -1844,10 +1844,8 @@ int ARGBSobelize(const uint8* src_argb, int src_stride_argb,
|
|||||||
void (*SobelRow)(const uint8* src_sobelx,
|
void (*SobelRow)(const uint8* src_sobelx,
|
||||||
const uint8* src_sobely,
|
const uint8* src_sobely,
|
||||||
uint8* dst, int width)) {
|
uint8* dst, int width)) {
|
||||||
const int kMaxRow = kMaxStride / 4;
|
|
||||||
const int kEdge = 16; // Extra pixels at start of row for extrude/align.
|
const int kEdge = 16; // Extra pixels at start of row for extrude/align.
|
||||||
if (!src_argb || !dst_argb ||
|
if (!src_argb || !dst_argb || width <= 0 || height == 0) {
|
||||||
width <= 0 || height == 0 || width > (kMaxRow - kEdge)) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Negative height means invert the image.
|
// Negative height means invert the image.
|
||||||
@ -1911,14 +1909,15 @@ int ARGBSobelize(const uint8* src_argb, int src_stride_argb,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// 3 rows with edges before/after.
|
// 3 rows with edges before/after.
|
||||||
SIMD_ALIGNED(uint8 row_y[kEdge + kMaxRow * 3]);
|
const int kRowSize = (width + 15) & ~15;
|
||||||
SIMD_ALIGNED(uint8 row_sobelx[kMaxRow]);
|
align_buffer_64(row_y, kEdge + kRowSize * 3);
|
||||||
SIMD_ALIGNED(uint8 row_sobely[kMaxRow]);
|
align_buffer_64(row_sobelx, width);
|
||||||
|
align_buffer_64(row_sobely, width);
|
||||||
|
|
||||||
// Convert first row.
|
// Convert first row.
|
||||||
uint8* row_y0 = row_y + kEdge;
|
uint8* row_y0 = row_y + kEdge;
|
||||||
uint8* row_y1 = row_y0 + kMaxRow;
|
uint8* row_y1 = row_y0 + kRowSize;
|
||||||
uint8* row_y2 = row_y1 + kMaxRow;
|
uint8* row_y2 = row_y1 + kRowSize;
|
||||||
ARGBToBayerRow(src_argb, row_y0, 0x0d090501, width);
|
ARGBToBayerRow(src_argb, row_y0, 0x0d090501, width);
|
||||||
row_y0[-1] = row_y0[0];
|
row_y0[-1] = row_y0[0];
|
||||||
memset(row_y0 + width, row_y0[width - 1], 16); // extrude 16 pixels.
|
memset(row_y0 + width, row_y0[width - 1], 16); // extrude 16 pixels.
|
||||||
@ -1948,6 +1947,9 @@ int ARGBSobelize(const uint8* src_argb, int src_stride_argb,
|
|||||||
|
|
||||||
dst_argb += dst_stride_argb;
|
dst_argb += dst_stride_argb;
|
||||||
}
|
}
|
||||||
|
free_aligned_buffer_64(row_y);
|
||||||
|
free_aligned_buffer_64(row_sobelx);
|
||||||
|
free_aligned_buffer_64(row_sobely);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user