xref: /aosp_15_r20/external/libaom/third_party/libyuv/README.libaom (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard WorkerName: libyuv
2*77c1e3ccSAndroid Build Coastguard WorkerURL: https://chromium.googlesource.com/libyuv/libyuv/
3*77c1e3ccSAndroid Build Coastguard WorkerVersion: dfaf7534e0e536f7e5ef8ddd7326797bd09b8622
4*77c1e3ccSAndroid Build Coastguard WorkerLicense: BSD
5*77c1e3ccSAndroid Build Coastguard WorkerLicense File: LICENSE
6*77c1e3ccSAndroid Build Coastguard Worker
7*77c1e3ccSAndroid Build Coastguard WorkerDescription:
8*77c1e3ccSAndroid Build Coastguard Workerlibyuv is an open source project that includes YUV conversion and scaling
9*77c1e3ccSAndroid Build Coastguard Workerfunctionality.
10*77c1e3ccSAndroid Build Coastguard Worker
11*77c1e3ccSAndroid Build Coastguard WorkerThe optimized scaler in libyuv is used in multiple resolution encoder example,
12*77c1e3ccSAndroid Build Coastguard Workerwhich down-samples the original input video (f.g. 1280x720) a number of times
13*77c1e3ccSAndroid Build Coastguard Workerin order to encode multiple resolution bit streams.
14*77c1e3ccSAndroid Build Coastguard Worker
15*77c1e3ccSAndroid Build Coastguard WorkerLocal Modifications:
16*77c1e3ccSAndroid Build Coastguard Worker
17*77c1e3ccSAndroid Build Coastguard Workerdiff --git a/third_party/libyuv/source/cpu_id.cc b/third_party/libyuv/source/cpu_id.cc
18*77c1e3ccSAndroid Build Coastguard Workerindex fe89452b7..72a7fb82f 100644
19*77c1e3ccSAndroid Build Coastguard Worker--- a/third_party/libyuv/source/cpu_id.cc
20*77c1e3ccSAndroid Build Coastguard Worker+++ b/third_party/libyuv/source/cpu_id.cc
21*77c1e3ccSAndroid Build Coastguard Worker@@ -108,7 +108,7 @@ void CpuId(int eax, int ecx, int* cpu_info) {
22*77c1e3ccSAndroid Build Coastguard Worker //  }
23*77c1e3ccSAndroid Build Coastguard Worker // For VS2013 and earlier 32 bit, the _xgetbv(0) optimizer produces bad code.
24*77c1e3ccSAndroid Build Coastguard Worker // https://code.google.com/p/libyuv/issues/detail?id=529
25*77c1e3ccSAndroid Build Coastguard Worker-#if defined(_M_IX86) && (_MSC_VER < 1900)
26*77c1e3ccSAndroid Build Coastguard Worker+#if defined(_M_IX86) && defined(_MSC_VER) && (_MSC_VER < 1900)
27*77c1e3ccSAndroid Build Coastguard Worker #pragma optimize("g", off)
28*77c1e3ccSAndroid Build Coastguard Worker #endif
29*77c1e3ccSAndroid Build Coastguard Worker #if (defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \
30*77c1e3ccSAndroid Build Coastguard Worker@@ -129,7 +129,7 @@ int GetXCR0() {
31*77c1e3ccSAndroid Build Coastguard Worker #define GetXCR0() 0
32*77c1e3ccSAndroid Build Coastguard Worker #endif  // defined(_M_IX86) || defined(_M_X64) ..
33*77c1e3ccSAndroid Build Coastguard Worker // Return optimization to previous setting.
34*77c1e3ccSAndroid Build Coastguard Worker-#if defined(_M_IX86) && (_MSC_VER < 1900)
35*77c1e3ccSAndroid Build Coastguard Worker+#if defined(_M_IX86) && defined(_MSC_VER) && (_MSC_VER < 1900)
36*77c1e3ccSAndroid Build Coastguard Worker #pragma optimize("g", on)
37*77c1e3ccSAndroid Build Coastguard Worker #endif
38*77c1e3ccSAndroid Build Coastguard Workerdiff --git a/third_party/libyuv/source/row_common.cc b/third_party/libyuv/source/row_common.cc
39*77c1e3ccSAndroid Build Coastguard Workerindex 79aed5c787..b0add63a6e 100644
40*77c1e3ccSAndroid Build Coastguard Worker--- a/third_party/libyuv/source/row_common.cc
41*77c1e3ccSAndroid Build Coastguard Worker+++ b/third_party/libyuv/source/row_common.cc
42*77c1e3ccSAndroid Build Coastguard Worker@@ -37,7 +37,7 @@ extern "C" {
43*77c1e3ccSAndroid Build Coastguard Worker // llvm x86 is poor at ternary operator, so use branchless min/max.
44*77c1e3ccSAndroid Build Coastguard Worker
45*77c1e3ccSAndroid Build Coastguard Worker #define USE_BRANCHLESS 1
46*77c1e3ccSAndroid Build Coastguard Worker-#if USE_BRANCHLESS
47*77c1e3ccSAndroid Build Coastguard Worker+#if defined(USE_BRANCHLESS)
48*77c1e3ccSAndroid Build Coastguard Worker static __inline int32_t clamp0(int32_t v) {
49*77c1e3ccSAndroid Build Coastguard Worker   return -(v >= 0) & v;
50*77c1e3ccSAndroid Build Coastguard Worker }
51*77c1e3ccSAndroid Build Coastguard Worker@@ -460,7 +460,7 @@ static __inline int RGB2xToV(uint16_t r, uint16_t g, uint16_t b) {
52*77c1e3ccSAndroid Build Coastguard Worker
53*77c1e3ccSAndroid Build Coastguard Worker // ARGBToY_C and ARGBToUV_C
54*77c1e3ccSAndroid Build Coastguard Worker // Intel version mimic SSE/AVX which does 2 pavgb
55*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
56*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
57*77c1e3ccSAndroid Build Coastguard Worker
58*77c1e3ccSAndroid Build Coastguard Worker #define MAKEROWY(NAME, R, G, B, BPP)                                         \
59*77c1e3ccSAndroid Build Coastguard Worker   void NAME##ToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width) { \
60*77c1e3ccSAndroid Build Coastguard Worker@@ -602,7 +602,7 @@ static __inline int RGB2xToVJ(uint16_t r, uint16_t g, uint16_t b) {
61*77c1e3ccSAndroid Build Coastguard Worker
62*77c1e3ccSAndroid Build Coastguard Worker // ARGBToYJ_C and ARGBToUVJ_C
63*77c1e3ccSAndroid Build Coastguard Worker // Intel version mimic SSE/AVX which does 2 pavgb
64*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
65*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
66*77c1e3ccSAndroid Build Coastguard Worker #define MAKEROWYJ(NAME, R, G, B, BPP)                                         \
67*77c1e3ccSAndroid Build Coastguard Worker   void NAME##ToYJRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width) { \
68*77c1e3ccSAndroid Build Coastguard Worker     int x;                                                                    \
69*77c1e3ccSAndroid Build Coastguard Worker@@ -766,7 +766,7 @@ void RGB565ToUVRow_C(const uint8_t* src_rgb565,
70*77c1e3ccSAndroid Build Coastguard Worker     g3 = (g3 << 2) | (g3 >> 4);
71*77c1e3ccSAndroid Build Coastguard Worker     r3 = (r3 << 3) | (r3 >> 2);
72*77c1e3ccSAndroid Build Coastguard Worker
73*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
74*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
75*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(AVGB(b0, b2), AVGB(b1, b3));
76*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(AVGB(g0, g2), AVGB(g1, g3));
77*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(AVGB(r0, r2), AVGB(r1, r3));
78*77c1e3ccSAndroid Build Coastguard Worker@@ -800,7 +800,7 @@ void RGB565ToUVRow_C(const uint8_t* src_rgb565,
79*77c1e3ccSAndroid Build Coastguard Worker     g2 = (g2 << 2) | (g2 >> 4);
80*77c1e3ccSAndroid Build Coastguard Worker     r2 = (r2 << 3) | (r2 >> 2);
81*77c1e3ccSAndroid Build Coastguard Worker
82*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
83*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
84*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(b0, b2);
85*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(g0, g2);
86*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(r0, r2);
87*77c1e3ccSAndroid Build Coastguard Worker@@ -850,7 +850,7 @@ void ARGB1555ToUVRow_C(const uint8_t* src_argb1555,
88*77c1e3ccSAndroid Build Coastguard Worker     g3 = (g3 << 3) | (g3 >> 2);
89*77c1e3ccSAndroid Build Coastguard Worker     r3 = (r3 << 3) | (r3 >> 2);
90*77c1e3ccSAndroid Build Coastguard Worker
91*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
92*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
93*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(AVGB(b0, b2), AVGB(b1, b3));
94*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(AVGB(g0, g2), AVGB(g1, g3));
95*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(AVGB(r0, r2), AVGB(r1, r3));
96*77c1e3ccSAndroid Build Coastguard Worker@@ -884,7 +884,7 @@ void ARGB1555ToUVRow_C(const uint8_t* src_argb1555,
97*77c1e3ccSAndroid Build Coastguard Worker     g2 = (g2 << 3) | (g2 >> 2);
98*77c1e3ccSAndroid Build Coastguard Worker     r2 = (r2 << 3) | (r2 >> 2);
99*77c1e3ccSAndroid Build Coastguard Worker
100*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
101*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
102*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(b0, b2);
103*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(g0, g2);
104*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(r0, r2);
105*77c1e3ccSAndroid Build Coastguard Worker@@ -934,7 +934,7 @@ void ARGB4444ToUVRow_C(const uint8_t* src_argb4444,
106*77c1e3ccSAndroid Build Coastguard Worker     g3 = (g3 << 4) | g3;
107*77c1e3ccSAndroid Build Coastguard Worker     r3 = (r3 << 4) | r3;
108*77c1e3ccSAndroid Build Coastguard Worker
109*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
110*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
111*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(AVGB(b0, b2), AVGB(b1, b3));
112*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(AVGB(g0, g2), AVGB(g1, g3));
113*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(AVGB(r0, r2), AVGB(r1, r3));
114*77c1e3ccSAndroid Build Coastguard Worker@@ -968,7 +968,7 @@ void ARGB4444ToUVRow_C(const uint8_t* src_argb4444,
115*77c1e3ccSAndroid Build Coastguard Worker     g2 = (g2 << 4) | g2;
116*77c1e3ccSAndroid Build Coastguard Worker     r2 = (r2 << 4) | r2;
117*77c1e3ccSAndroid Build Coastguard Worker
118*77c1e3ccSAndroid Build Coastguard Worker-#if LIBYUV_ARGBTOUV_PAVGB
119*77c1e3ccSAndroid Build Coastguard Worker+#if defined(LIBYUV_ARGBTOUV_PAVGB)
120*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ab = AVGB(b0, b2);
121*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ag = AVGB(g0, g2);
122*77c1e3ccSAndroid Build Coastguard Worker     uint8_t ar = AVGB(r0, r2);
123