mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-08 01:36:47 +08:00
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
This commit is contained in:
parent
75a5403e9e
commit
fc264019de
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 666
|
||||
Version: 667
|
||||
License File: LICENSE
|
||||
|
||||
Description:
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 666
|
||||
#define LIBYUV_VERSION 667
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -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,
|
||||
uint8* dst_argb, int width) {
|
||||
for (int i = 0; i < width; ++i) {
|
||||
const uint32 b = src_argb0[0];
|
||||
const uint32 g = src_argb0[1];
|
||||
const uint32 r = src_argb0[2];
|
||||
const uint32 a = src_argb0[3];
|
||||
const uint32 b_add = src_argb1[0];
|
||||
const uint32 g_add = src_argb1[1];
|
||||
const uint32 r_add = src_argb1[2];
|
||||
const uint32 a_add = src_argb1[3];
|
||||
const int b = src_argb0[0];
|
||||
const int g = src_argb0[1];
|
||||
const int r = src_argb0[2];
|
||||
const int a = src_argb0[3];
|
||||
const int b_add = src_argb1[0];
|
||||
const int g_add = src_argb1[1];
|
||||
const int r_add = src_argb1[2];
|
||||
const int a_add = src_argb1[3];
|
||||
dst_argb[0] = SHADE(b, b_add);
|
||||
dst_argb[1] = SHADE(g, g_add);
|
||||
dst_argb[2] = SHADE(r, r_add);
|
||||
@ -756,19 +756,19 @@ void ARGBAddRow_C(const uint8* src_argb0, const uint8* src_argb1,
|
||||
}
|
||||
#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,
|
||||
uint8* dst_argb, int width) {
|
||||
for (int i = 0; i < width; ++i) {
|
||||
const uint32 b = src_argb0[0];
|
||||
const uint32 g = src_argb0[1];
|
||||
const uint32 r = src_argb0[2];
|
||||
const uint32 a = src_argb0[3];
|
||||
const uint32 b_sub = src_argb1[0];
|
||||
const uint32 g_sub = src_argb1[1];
|
||||
const uint32 r_sub = src_argb1[2];
|
||||
const uint32 a_sub = src_argb1[3];
|
||||
const int b = src_argb0[0];
|
||||
const int g = src_argb0[1];
|
||||
const int r = src_argb0[2];
|
||||
const int a = src_argb0[3];
|
||||
const int b_sub = src_argb1[0];
|
||||
const int g_sub = src_argb1[1];
|
||||
const int r_sub = src_argb1[2];
|
||||
const int a_sub = src_argb1[3];
|
||||
dst_argb[0] = SHADE(b, b_sub);
|
||||
dst_argb[1] = SHADE(g, g_sub);
|
||||
dst_argb[2] = SHADE(r, r_sub);
|
||||
|
||||
@ -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 ymm1, ymm1, ymm3 // src_argb0 * src_argb1 high 4
|
||||
vpackuswb ymm0, ymm0, ymm1
|
||||
sub ecx, 8
|
||||
vmovdqu [eax + edx], ymm0
|
||||
lea eax, [eax + 32]
|
||||
sub ecx, 8
|
||||
jg convertloop
|
||||
|
||||
pop esi
|
||||
@ -5381,9 +5381,9 @@ void ARGBAddRow_AVX2(const uint8* src_argb0, const uint8* src_argb1,
|
||||
convertloop:
|
||||
vmovdqu ymm0, [eax] // read 8 pixels from src_argb0
|
||||
vpaddusb ymm0, ymm0, [eax + esi] // add 8 pixels from src_argb1
|
||||
sub ecx, 8
|
||||
vmovdqu [eax + edx], ymm0
|
||||
lea eax, [eax + 32]
|
||||
sub ecx, 8
|
||||
jg convertloop
|
||||
|
||||
pop esi
|
||||
@ -5411,9 +5411,9 @@ void ARGBSubtractRow_AVX2(const uint8* src_argb0, const uint8* src_argb1,
|
||||
convertloop:
|
||||
vmovdqu ymm0, [eax] // read 8 pixels from src_argb0
|
||||
vpsubusb ymm0, ymm0, [eax + esi] // src_argb0 - src_argb1
|
||||
sub ecx, 8
|
||||
vmovdqu [eax + edx], ymm0
|
||||
lea eax, [eax + 32]
|
||||
sub ecx, 8
|
||||
jg convertloop
|
||||
|
||||
pop esi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user