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

Underflow sub fix

BUG=none
TEST=ARGBSubtract_Unaligned

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@667 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 75a5403e
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 666 Version: 667
License File: LICENSE License File: LICENSE
Description: Description:
......
...@@ -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 666 #define LIBYUV_VERSION 667
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -737,14 +737,14 @@ void ARGBMultiplyRow_C(const uint8* src_argb0, const uint8* src_argb1, ...@@ -737,14 +737,14 @@ void ARGBMultiplyRow_C(const uint8* src_argb0, const uint8* src_argb1,
void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1, void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) { uint8* dst_argb, int width) {
for (int i = 0; i < width; ++i) { for (int i = 0; i < width; ++i) {
const uint32 b = src_argb0[0]; const int b = src_argb0[0];
const uint32 g = src_argb0[1]; const int g = src_argb0[1];
const uint32 r = src_argb0[2]; const int r = src_argb0[2];
const uint32 a = src_argb0[3]; const int a = src_argb0[3];
const uint32 b_add = src_argb1[0]; const int b_add = src_argb1[0];
const uint32 g_add = src_argb1[1]; const int g_add = src_argb1[1];
const uint32 r_add = src_argb1[2]; const int r_add = src_argb1[2];
const uint32 a_add = src_argb1[3]; const int a_add = src_argb1[3];
dst_argb[0] = SHADE(b, b_add); dst_argb[0] = SHADE(b, b_add);
dst_argb[1] = SHADE(g, g_add); dst_argb[1] = SHADE(g, g_add);
dst_argb[2] = SHADE(r, r_add); dst_argb[2] = SHADE(r, r_add);
...@@ -756,19 +756,19 @@ void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1, ...@@ -756,19 +756,19 @@ void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1,
} }
#undef SHADE #undef SHADE
#define SHADE(f, v) ((f - v) > f) ? 0 : (f - v) #define SHADE(f, v) ((f - v) < 0) ? 0 : (f - v)
void ARGBSubtractRow_C(const uint8* src_argb0, const uint8* src_argb1, void ARGBSubtractRow_C(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) { uint8* dst_argb, int width) {
for (int i = 0; i < width; ++i) { for (int i = 0; i < width; ++i) {
const uint32 b = src_argb0[0]; const int b = src_argb0[0];
const uint32 g = src_argb0[1]; const int g = src_argb0[1];
const uint32 r = src_argb0[2]; const int r = src_argb0[2];
const uint32 a = src_argb0[3]; const int a = src_argb0[3];
const uint32 b_sub = src_argb1[0]; const int b_sub = src_argb1[0];
const uint32 g_sub = src_argb1[1]; const int g_sub = src_argb1[1];
const uint32 r_sub = src_argb1[2]; const int r_sub = src_argb1[2];
const uint32 a_sub = src_argb1[3]; const int a_sub = src_argb1[3];
dst_argb[0] = SHADE(b, b_sub); dst_argb[0] = SHADE(b, b_sub);
dst_argb[1] = SHADE(g, g_sub); dst_argb[1] = SHADE(g, g_sub);
dst_argb[2] = SHADE(r, r_sub); dst_argb[2] = SHADE(r, r_sub);
......
...@@ -5350,9 +5350,9 @@ void ARGBMultiplyRow_AVX2(const uint8* src_argb0, const uint8* src_argb1, ...@@ -5350,9 +5350,9 @@ void ARGBMultiplyRow_AVX2(const uint8* src_argb0, const uint8* src_argb1,
vpmulhuw ymm0, ymm0, ymm2 // src_argb0 * src_argb1 low 4 vpmulhuw ymm0, ymm0, ymm2 // src_argb0 * src_argb1 low 4
vpmulhuw ymm1, ymm1, ymm3 // src_argb0 * src_argb1 high 4 vpmulhuw ymm1, ymm1, ymm3 // src_argb0 * src_argb1 high 4
vpackuswb ymm0, ymm0, ymm1 vpackuswb ymm0, ymm0, ymm1
sub ecx, 8
vmovdqu [eax + edx], ymm0 vmovdqu [eax + edx], ymm0
lea eax, [eax + 32] lea eax, [eax + 32]
sub ecx, 8
jg convertloop jg convertloop
pop esi pop esi
...@@ -5381,9 +5381,9 @@ void ARGBAddRow_AVX2(const uint8* src_argb0, const uint8* src_argb1, ...@@ -5381,9 +5381,9 @@ void ARGBAddRow_AVX2(const uint8* src_argb0, const uint8* src_argb1,
convertloop: convertloop:
vmovdqu ymm0, [eax] // read 8 pixels from src_argb0 vmovdqu ymm0, [eax] // read 8 pixels from src_argb0
vpaddusb ymm0, ymm0, [eax + esi] // add 8 pixels from src_argb1 vpaddusb ymm0, ymm0, [eax + esi] // add 8 pixels from src_argb1
sub ecx, 8
vmovdqu [eax + edx], ymm0 vmovdqu [eax + edx], ymm0
lea eax, [eax + 32] lea eax, [eax + 32]
sub ecx, 8
jg convertloop jg convertloop
pop esi pop esi
...@@ -5411,9 +5411,9 @@ void ARGBSubtractRow_AVX2(const uint8* src_argb0, const uint8* src_argb1, ...@@ -5411,9 +5411,9 @@ void ARGBSubtractRow_AVX2(const uint8* src_argb0, const uint8* src_argb1,
convertloop: convertloop:
vmovdqu ymm0, [eax] // read 8 pixels from src_argb0 vmovdqu ymm0, [eax] // read 8 pixels from src_argb0
vpsubusb ymm0, ymm0, [eax + esi] // src_argb0 - src_argb1 vpsubusb ymm0, ymm0, [eax + esi] // src_argb0 - src_argb1
sub ecx, 8
vmovdqu [eax + edx], ymm0 vmovdqu [eax + edx], ymm0
lea eax, [eax + 32] lea eax, [eax + 32]
sub ecx, 8
jg convertloop jg convertloop
pop esi pop esi
......
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