mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Fix for ARGBColorTable x86 assembly. Sav
BUG=51 TEST=TestARGBColorTable Review URL: https://webrtc-codereview.appspot.com/667011 git-svn-id: http://libyuv.googlecode.com/svn/trunk@307 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
452472dfc4
commit
c0d6dee4f3
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 306
|
Version: 307
|
||||||
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 306
|
#define LIBYUV_VERSION 307
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||||
|
|||||||
@ -59,10 +59,11 @@ enum FourCC {
|
|||||||
FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // bgr565.
|
FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // bgr565.
|
||||||
FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // abgr1555.
|
FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // abgr1555.
|
||||||
FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444.
|
FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444.
|
||||||
FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
|
|
||||||
FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
|
FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
|
||||||
FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
|
FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
|
||||||
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
||||||
|
FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
|
||||||
|
FOURCC_H264 = FOURCC('H', '2', '6', '4'),
|
||||||
// Next four are Bayer RGB formats. The four characters define the order of
|
// Next four are Bayer RGB formats. The four characters define the order of
|
||||||
// the colours in each 2x2 pixel grid, going left-to-right and top-to-bottom.
|
// the colours in each 2x2 pixel grid, going left-to-right and top-to-bottom.
|
||||||
FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
|
FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
|
||||||
@ -112,10 +113,11 @@ enum FourCCBpp {
|
|||||||
FOURCC_BPP_RGBP = 16,
|
FOURCC_BPP_RGBP = 16,
|
||||||
FOURCC_BPP_RGBO = 16,
|
FOURCC_BPP_RGBO = 16,
|
||||||
FOURCC_BPP_R444 = 16,
|
FOURCC_BPP_R444 = 16,
|
||||||
FOURCC_BPP_MJPG = 0, // 0 means unknown.
|
|
||||||
FOURCC_BPP_RAW = 24,
|
FOURCC_BPP_RAW = 24,
|
||||||
FOURCC_BPP_NV21 = 12,
|
FOURCC_BPP_NV21 = 12,
|
||||||
FOURCC_BPP_NV12 = 12,
|
FOURCC_BPP_NV12 = 12,
|
||||||
|
FOURCC_BPP_MJPG = 0, // 0 means unknown.
|
||||||
|
FOURCC_BPP_H264 = 0,
|
||||||
// Next four are Bayer RGB formats. The four characters define the order of
|
// Next four are Bayer RGB formats. The four characters define the order of
|
||||||
// the colours in each 2x2 pixel grid, going left-to-right and top-to-bottom.
|
// the colours in each 2x2 pixel grid, going left-to-right and top-to-bottom.
|
||||||
FOURCC_BPP_RGGB = 8,
|
FOURCC_BPP_RGGB = 8,
|
||||||
|
|||||||
@ -86,7 +86,7 @@ extern "C" {
|
|||||||
// The following are Windows only:
|
// The following are Windows only:
|
||||||
#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86)
|
#if !defined(YUV_DISABLE_ASM) && defined(_M_IX86)
|
||||||
// TODO(fbarchard): Investigate possible issue in this function and reenable.
|
// TODO(fbarchard): Investigate possible issue in this function and reenable.
|
||||||
#define HAS_ARGBCOLORTABLEROW_X86_DISABLED
|
#define HAS_ARGBCOLORTABLEROW_X86
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The following are disabled when SSSE3 is available:
|
// The following are disabled when SSSE3 is available:
|
||||||
|
|||||||
@ -3031,11 +3031,12 @@ void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb,
|
|||||||
int width) {
|
int width) {
|
||||||
__asm {
|
__asm {
|
||||||
push ebx
|
push ebx
|
||||||
|
push esi
|
||||||
push edi
|
push edi
|
||||||
push ebp
|
push ebp
|
||||||
mov eax, [esp + 12 + 4] /* dst_argb */
|
mov eax, [esp + 16 + 4] /* dst_argb */
|
||||||
mov edi, [esp + 12 + 8] /* table_argb */
|
mov edi, [esp + 16 + 8] /* table_argb */
|
||||||
mov ecx, [esp + 12 + 12] /* width */
|
mov ecx, [esp + 16 + 12] /* width */
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
|
||||||
@ -3064,6 +3065,7 @@ void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb,
|
|||||||
jg convertloop
|
jg convertloop
|
||||||
pop ebp
|
pop ebp
|
||||||
pop edi
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|||||||
@ -601,6 +601,65 @@ TEST_F(libyuvTest, TestARGBColorMatrix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(libyuvTest, TestARGBColorTable) {
|
||||||
|
SIMD_ALIGNED(uint8 orig_pixels[256][4]);
|
||||||
|
|
||||||
|
// Matrix for Sepia.
|
||||||
|
static const uint8 kARGBTable[256 * 4] = {
|
||||||
|
1u, 2u, 3u, 4u,
|
||||||
|
5u, 6u, 7u, 8u,
|
||||||
|
9u, 10u, 11u, 12u,
|
||||||
|
13u, 14u, 15u, 16u,
|
||||||
|
};
|
||||||
|
|
||||||
|
orig_pixels[0][0] = 0u;
|
||||||
|
orig_pixels[0][1] = 0u;
|
||||||
|
orig_pixels[0][2] = 0u;
|
||||||
|
orig_pixels[0][3] = 0u;
|
||||||
|
orig_pixels[1][0] = 1u;
|
||||||
|
orig_pixels[1][1] = 1u;
|
||||||
|
orig_pixels[1][2] = 1u;
|
||||||
|
orig_pixels[1][3] = 1u;
|
||||||
|
orig_pixels[2][0] = 2u;
|
||||||
|
orig_pixels[2][1] = 2u;
|
||||||
|
orig_pixels[2][2] = 2u;
|
||||||
|
orig_pixels[2][3] = 2u;
|
||||||
|
orig_pixels[3][0] = 0u;
|
||||||
|
orig_pixels[3][1] = 1u;
|
||||||
|
orig_pixels[3][2] = 2u;
|
||||||
|
orig_pixels[3][3] = 3u;
|
||||||
|
// Do 16 to test asm version.
|
||||||
|
ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 16, 1);
|
||||||
|
EXPECT_EQ(1u, orig_pixels[0][0]);
|
||||||
|
EXPECT_EQ(2u, orig_pixels[0][1]);
|
||||||
|
EXPECT_EQ(3u, orig_pixels[0][2]);
|
||||||
|
EXPECT_EQ(4u, orig_pixels[0][3]);
|
||||||
|
EXPECT_EQ(5u, orig_pixels[1][0]);
|
||||||
|
EXPECT_EQ(6u, orig_pixels[1][1]);
|
||||||
|
EXPECT_EQ(7u, orig_pixels[1][2]);
|
||||||
|
EXPECT_EQ(8u, orig_pixels[1][3]);
|
||||||
|
EXPECT_EQ(9u, orig_pixels[2][0]);
|
||||||
|
EXPECT_EQ(10u, orig_pixels[2][1]);
|
||||||
|
EXPECT_EQ(11u, orig_pixels[2][2]);
|
||||||
|
EXPECT_EQ(12u, orig_pixels[2][3]);
|
||||||
|
EXPECT_EQ(1u, orig_pixels[3][0]);
|
||||||
|
EXPECT_EQ(6u, orig_pixels[3][1]);
|
||||||
|
EXPECT_EQ(11u, orig_pixels[3][2]);
|
||||||
|
EXPECT_EQ(16u, orig_pixels[3][3]);
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i) {
|
||||||
|
orig_pixels[i][0] = i;
|
||||||
|
orig_pixels[i][1] = i / 2;
|
||||||
|
orig_pixels[i][2] = i / 3;
|
||||||
|
orig_pixels[i][3] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 1000 * 1280 * 720 / 256; ++i) {
|
||||||
|
ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 256, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(libyuvTest, TestARGBQuantize) {
|
TEST_F(libyuvTest, TestARGBQuantize) {
|
||||||
SIMD_ALIGNED(uint8 orig_pixels[256][4]);
|
SIMD_ALIGNED(uint8 orig_pixels[256][4]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user