style: Format source code and support grouping client
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/cpu_support.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "libyuv/planar_functions.h" // For WebRTC I420Rect, CopyPlane. b/618
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#include "libyuv/scale.h" // For enum FilterMode.
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/rotate.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -76,14 +77,15 @@ int InitCpuFlags(void);
|
||||
// Detect CPU has SSE2 etc.
|
||||
// Test_flag parameter should be one of kCpuHas constants above.
|
||||
// Returns non-zero if instruction set is detected
|
||||
static __inline int TestCpuFlag(int test_flag) {
|
||||
LIBYUV_API extern int cpu_info_;
|
||||
static __inline int TestCpuFlag(int test_flag)
|
||||
{
|
||||
LIBYUV_API extern int cpu_info_;
|
||||
#ifdef __ATOMIC_RELAXED
|
||||
int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED);
|
||||
int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED);
|
||||
#else
|
||||
int cpu_info = cpu_info_;
|
||||
int cpu_info = cpu_info_;
|
||||
#endif
|
||||
return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag;
|
||||
return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag;
|
||||
}
|
||||
|
||||
// Internal function for parsing /proc/cpuinfo.
|
||||
@@ -128,12 +130,13 @@ int MaskCpuFlags(int enable_flags);
|
||||
// TODO(fbarchard): consider writing a helper function that translates from
|
||||
// other library CPU info to libyuv CPU info and add a .md doc that explains
|
||||
// CPU detection.
|
||||
static __inline void SetCpuFlags(int cpu_flags) {
|
||||
LIBYUV_API extern int cpu_info_;
|
||||
static __inline void SetCpuFlags(int cpu_flags)
|
||||
{
|
||||
LIBYUV_API extern int cpu_info_;
|
||||
#ifdef __ATOMIC_RELAXED
|
||||
__atomic_store_n(&cpu_info_, cpu_flags, __ATOMIC_RELAXED);
|
||||
__atomic_store_n(&cpu_info_, cpu_flags, __ATOMIC_RELAXED);
|
||||
#else
|
||||
cpu_info_ = cpu_flags;
|
||||
cpu_info_ = cpu_flags;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
#define INCLUDE_LIBYUV_CPU_SUPPORT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -93,12 +93,13 @@
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_b(__m128i in_c,
|
||||
__m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
__m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_b(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmaddwev_h_b(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -119,13 +120,14 @@ static inline __m128i __lsx_vdp2add_h_b(__m128i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c,
|
||||
__m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
__m128i in_h,
|
||||
__m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_bu(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmaddwev_h_bu(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -146,13 +148,14 @@ static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_bu_b(__m128i in_c,
|
||||
__m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
__m128i in_h,
|
||||
__m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -174,12 +177,13 @@ static inline __m128i __lsx_vdp2add_h_bu_b(__m128i in_c,
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_w_h(__m128i in_c,
|
||||
__m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
__m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_w_h(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmaddwev_w_h(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -197,12 +201,13 @@ static inline __m128i __lsx_vdp2add_w_h(__m128i in_c,
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_b(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmulwev_h_b(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -220,12 +225,13 @@ static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l) {
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_bu(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmulwev_h_bu(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -243,12 +249,13 @@ static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l) {
|
||||
* out : 22,38,38,22, 22,38,38,6
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_bu_b(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmulwev_h_bu_b(in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -266,12 +273,13 @@ static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l) {
|
||||
* out : 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_w_h(in_h, in_l);
|
||||
out = __lsx_vmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lsx_vmulwev_w_h(in_h, in_l);
|
||||
out = __lsx_vmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -291,12 +299,13 @@ static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l) {
|
||||
* out : 1,2,9,9, 1,9,9,9
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmax_h(min, _in);
|
||||
out = __lsx_vmin_h(max, out);
|
||||
return out;
|
||||
out = __lsx_vmax_h(min, _in);
|
||||
out = __lsx_vmin_h(max, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -311,12 +320,13 @@ static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max) {
|
||||
* out : 0,255,255,249, 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip255_h(__m128i _in) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vclip255_h(__m128i _in)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaxi_h(_in, 0);
|
||||
out = __lsx_vsat_hu(out, 7);
|
||||
return out;
|
||||
out = __lsx_vmaxi_h(_in, 0);
|
||||
out = __lsx_vsat_hu(out, 7);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -331,12 +341,13 @@ static inline __m128i __lsx_vclip255_h(__m128i _in) {
|
||||
* out : 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip255_w(__m128i _in) {
|
||||
__m128i out;
|
||||
static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
{
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaxi_w(_in, 0);
|
||||
out = __lsx_vsat_wu(out, 7);
|
||||
return out;
|
||||
out = __lsx_vmaxi_w(_in, 0);
|
||||
out = __lsx_vsat_wu(out, 7);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -719,12 +730,13 @@ static inline __m128i __lsx_vclip255_w(__m128i _in) {
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -741,12 +753,13 @@ static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_b(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_h_b(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -766,12 +779,13 @@ static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l) {
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -788,12 +802,13 @@ static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_d_w(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_d_w(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_d_w(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_d_w(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -810,12 +825,13 @@ static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_hu_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_w_hu_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -833,13 +849,14 @@ static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l) {
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_b(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_h_b(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -857,13 +874,14 @@ static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_bu(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_bu(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_h_bu(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -881,13 +899,14 @@ static inline __m256i __lasx_xvdp2add_h_bu(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_bu_b(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -909,13 +928,14 @@ static inline __m256i __lasx_xvdp2add_h_bu_b(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_h(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_h(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_w_h(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -933,13 +953,14 @@ static inline __m256i __lasx_xvdp2add_w_h(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_hu(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_hu(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_w_hu(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -957,13 +978,14 @@ static inline __m256i __lasx_xvdp2add_w_hu(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_hu_h(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_hu_h(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu_h(out, in_h, in_l);
|
||||
return out;
|
||||
out = __lasx_xvmaddwev_w_hu_h(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_hu_h(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -982,14 +1004,15 @@ static inline __m256i __lasx_xvdp2add_w_hu_h(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2sub_h_bu(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
out = __lasx_xvsub_h(in_c, out);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
out = __lasx_xvsub_h(in_c, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1012,14 +1035,15 @@ static inline __m256i __lasx_xvdp2sub_h_bu(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
out = __lasx_xvsub_w(in_c, out);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
out = __lasx_xvsub_w(in_c, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1039,13 +1063,14 @@ static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c,
|
||||
* out : -2,0,1,1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
out = __lasx_xvhaddw_d_w(out, out);
|
||||
return out;
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
out = __lasx_xvmaddwod_w_h(out, in_h, in_l);
|
||||
out = __lasx_xvhaddw_d_w(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1060,12 +1085,13 @@ static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvaddwh_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvh_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_h_b(out, out);
|
||||
return out;
|
||||
out = __lasx_xvilvh_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_h_b(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1083,12 +1109,13 @@ static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l) {
|
||||
* out : 1,0,0,-1, 1,0,0, 2
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddwh_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvh_h(in_h, in_l);
|
||||
out = __lasx_xvhaddw_w_h(out, out);
|
||||
return out;
|
||||
out = __lasx_xvilvh_h(in_h, in_l);
|
||||
out = __lasx_xvhaddw_w_h(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1103,12 +1130,13 @@ static inline __m256i __lasx_xvaddwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvaddwl_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_h_b(out, out);
|
||||
return out;
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_h_b(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1126,12 +1154,13 @@ static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l) {
|
||||
* out : 5,-1,4,2, 1,0,2,-1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_h(in_h, in_l);
|
||||
out = __lasx_xvhaddw_w_h(out, out);
|
||||
return out;
|
||||
out = __lasx_xvilvl_h(in_h, in_l);
|
||||
out = __lasx_xvhaddw_w_h(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1146,12 +1175,13 @@ static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvaddwl_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_hu_bu(out, out);
|
||||
return out;
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
out = __lasx_xvhaddw_hu_bu(out, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1165,12 +1195,13 @@ static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l) {
|
||||
* Example : See out = __lasx_xvaddw_w_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvsllwil_hu_bu(in_l, 0);
|
||||
out = __lasx_xvadd_h(in_h, out);
|
||||
return out;
|
||||
out = __lasx_xvsllwil_hu_bu(in_l, 0);
|
||||
out = __lasx_xvadd_h(in_h, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1187,12 +1218,13 @@ static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l) {
|
||||
* out : 2, 0,1,2, -1,0,1,1,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
out = __lasx_xvadd_w(in_h, out);
|
||||
return out;
|
||||
out = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
out = __lasx_xvadd_w(in_h, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1214,15 +1246,16 @@ static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l) {
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmaddwl_w_h(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
tmp1 = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
tmp0 = __lasx_xvmul_w(tmp0, tmp1);
|
||||
out = __lasx_xvadd_w(tmp0, in_c);
|
||||
return out;
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
tmp1 = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
tmp0 = __lasx_xvmul_w(tmp0, tmp1);
|
||||
out = __lasx_xvadd_w(tmp0, in_c);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1239,15 +1272,16 @@ static inline __m256i __lasx_xvmaddwl_w_h(__m256i in_c,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmaddwh_w_h(__m256i in_c,
|
||||
__m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
__m256i in_h,
|
||||
__m256i in_l)
|
||||
{
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
tmp1 = __lasx_xvilvh_h(in_l, in_l);
|
||||
tmp0 = __lasx_xvmulwev_w_h(tmp0, tmp1);
|
||||
out = __lasx_xvadd_w(tmp0, in_c);
|
||||
return out;
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
tmp1 = __lasx_xvilvh_h(in_l, in_l);
|
||||
tmp0 = __lasx_xvmulwev_w_h(tmp0, tmp1);
|
||||
out = __lasx_xvadd_w(tmp0, in_c);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1265,13 +1299,14 @@ static inline __m256i __lasx_xvmaddwh_w_h(__m256i in_c,
|
||||
* out : 6,1,3,0, 0,0,1,0
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
tmp1 = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
out = __lasx_xvmul_w(tmp0, tmp1);
|
||||
return out;
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
tmp1 = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
out = __lasx_xvmul_w(tmp0, tmp1);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1289,13 +1324,14 @@ static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
* out : 0,0,0,0, 0,0,0,1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
tmp1 = __lasx_xvilvh_h(in_l, in_l);
|
||||
out = __lasx_xvmulwev_w_h(tmp0, tmp1);
|
||||
return out;
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
tmp1 = __lasx_xvilvh_h(in_l, in_l);
|
||||
out = __lasx_xvmulwev_w_h(tmp0, tmp1);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1315,13 +1351,14 @@ static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
* out : 5,65535,4,2, 1,0,0,1, 3,18,4,0, 1,0,0,2,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp1, out;
|
||||
__m256i zero = {0};
|
||||
static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
__m256i tmp1, out;
|
||||
__m256i zero = {0};
|
||||
|
||||
tmp1 = __lasx_xvilvl_b(zero, in_l);
|
||||
out = __lasx_xvsadd_hu(in_h, tmp1);
|
||||
return out;
|
||||
tmp1 = __lasx_xvilvl_b(zero, in_l);
|
||||
out = __lasx_xvsadd_hu(in_h, tmp1);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1340,12 +1377,13 @@ static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l) {
|
||||
* out : 1,2,9,9, 1,9,9,9, 4,4,4,4, 5,5,5,5
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmax_h(min, in);
|
||||
out = __lasx_xvmin_h(max, out);
|
||||
return out;
|
||||
out = __lasx_xvmax_h(min, in);
|
||||
out = __lasx_xvmin_h(max, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1358,12 +1396,13 @@ static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max) {
|
||||
* Example : See out = __lasx_xvclip255_w(in)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip255_h(__m256i in) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvclip255_h(__m256i in)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaxi_h(in, 0);
|
||||
out = __lasx_xvsat_hu(out, 7);
|
||||
return out;
|
||||
out = __lasx_xvmaxi_h(in, 0);
|
||||
out = __lasx_xvsat_hu(out, 7);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1378,12 +1417,13 @@ static inline __m256i __lasx_xvclip255_h(__m256i in) {
|
||||
* out : 0,255,255,249, 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip255_w(__m256i in) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvclip255_w(__m256i in)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaxi_w(in, 0);
|
||||
out = __lasx_xvsat_wu(out, 7);
|
||||
return out;
|
||||
out = __lasx_xvmaxi_w(in, 0);
|
||||
out = __lasx_xvsat_wu(out, 7);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1402,12 +1442,13 @@ static inline __m256i __lasx_xvclip255_w(__m256i in) {
|
||||
* out : 11,11,11,11, 11,11,11,11, 11,11,11,11, 11,11,11,11
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvpermi_q(in, in, 0x02);
|
||||
out = __lasx_xvreplve_h(out, idx);
|
||||
return out;
|
||||
out = __lasx_xvpermi_q(in, in, 0x02);
|
||||
out = __lasx_xvreplve_h(out, idx);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1426,12 +1467,13 @@ static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx) {
|
||||
* out : 2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx) {
|
||||
__m256i out;
|
||||
static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
{
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvpermi_q(in, in, 0x13);
|
||||
out = __lasx_xvreplve_h(out, idx);
|
||||
return out;
|
||||
out = __lasx_xvpermi_q(in, in, 0x13);
|
||||
out = __lasx_xvreplve_h(out, idx);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,7 +20,8 @@ struct jpeg_common_struct;
|
||||
struct jpeg_decompress_struct;
|
||||
struct jpeg_source_mgr;
|
||||
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -35,22 +36,22 @@ LIBYUV_BOOL ValidateJpeg(const uint8_t* sample, size_t sample_size);
|
||||
static const uint32_t kUnknownDataSize = 0xFFFFFFFF;
|
||||
|
||||
enum JpegSubsamplingType {
|
||||
kJpegYuv420,
|
||||
kJpegYuv422,
|
||||
kJpegYuv444,
|
||||
kJpegYuv400,
|
||||
kJpegUnknown
|
||||
kJpegYuv420,
|
||||
kJpegYuv422,
|
||||
kJpegYuv444,
|
||||
kJpegYuv400,
|
||||
kJpegUnknown
|
||||
};
|
||||
|
||||
struct Buffer {
|
||||
const uint8_t* data;
|
||||
int len;
|
||||
const uint8_t* data;
|
||||
int len;
|
||||
};
|
||||
|
||||
struct BufferVector {
|
||||
Buffer* buffers;
|
||||
int len;
|
||||
int pos;
|
||||
Buffer* buffers;
|
||||
int len;
|
||||
int pos;
|
||||
};
|
||||
|
||||
struct SetJmpErrorMgr;
|
||||
@@ -62,131 +63,132 @@ struct SetJmpErrorMgr;
|
||||
// MJPEG frames.
|
||||
//
|
||||
// See http://tools.ietf.org/html/rfc2435
|
||||
class LIBYUV_API MJpegDecoder {
|
||||
public:
|
||||
typedef void (*CallbackFunction)(void* opaque,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows);
|
||||
class LIBYUV_API MJpegDecoder
|
||||
{
|
||||
public:
|
||||
typedef void (*CallbackFunction)(void* opaque,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows);
|
||||
|
||||
static const int kColorSpaceUnknown;
|
||||
static const int kColorSpaceGrayscale;
|
||||
static const int kColorSpaceRgb;
|
||||
static const int kColorSpaceYCbCr;
|
||||
static const int kColorSpaceCMYK;
|
||||
static const int kColorSpaceYCCK;
|
||||
static const int kColorSpaceUnknown;
|
||||
static const int kColorSpaceGrayscale;
|
||||
static const int kColorSpaceRgb;
|
||||
static const int kColorSpaceYCbCr;
|
||||
static const int kColorSpaceCMYK;
|
||||
static const int kColorSpaceYCCK;
|
||||
|
||||
MJpegDecoder();
|
||||
~MJpegDecoder();
|
||||
MJpegDecoder();
|
||||
~MJpegDecoder();
|
||||
|
||||
// Loads a new frame, reads its headers, and determines the uncompressed
|
||||
// image format.
|
||||
// Returns LIBYUV_TRUE if image looks valid and format is supported.
|
||||
// If return value is LIBYUV_TRUE, then the values for all the following
|
||||
// getters are populated.
|
||||
// src_len is the size of the compressed mjpeg frame in bytes.
|
||||
LIBYUV_BOOL LoadFrame(const uint8_t* src, size_t src_len);
|
||||
// Loads a new frame, reads its headers, and determines the uncompressed
|
||||
// image format.
|
||||
// Returns LIBYUV_TRUE if image looks valid and format is supported.
|
||||
// If return value is LIBYUV_TRUE, then the values for all the following
|
||||
// getters are populated.
|
||||
// src_len is the size of the compressed mjpeg frame in bytes.
|
||||
LIBYUV_BOOL LoadFrame(const uint8_t* src, size_t src_len);
|
||||
|
||||
// Returns width of the last loaded frame in pixels.
|
||||
int GetWidth();
|
||||
// Returns width of the last loaded frame in pixels.
|
||||
int GetWidth();
|
||||
|
||||
// Returns height of the last loaded frame in pixels.
|
||||
int GetHeight();
|
||||
// Returns height of the last loaded frame in pixels.
|
||||
int GetHeight();
|
||||
|
||||
// Returns format of the last loaded frame. The return value is one of the
|
||||
// kColorSpace* constants.
|
||||
int GetColorSpace();
|
||||
// Returns format of the last loaded frame. The return value is one of the
|
||||
// kColorSpace* constants.
|
||||
int GetColorSpace();
|
||||
|
||||
// Number of color components in the color space.
|
||||
int GetNumComponents();
|
||||
// Number of color components in the color space.
|
||||
int GetNumComponents();
|
||||
|
||||
// Sample factors of the n-th component.
|
||||
int GetHorizSampFactor(int component);
|
||||
// Sample factors of the n-th component.
|
||||
int GetHorizSampFactor(int component);
|
||||
|
||||
int GetVertSampFactor(int component);
|
||||
int GetVertSampFactor(int component);
|
||||
|
||||
int GetHorizSubSampFactor(int component);
|
||||
int GetHorizSubSampFactor(int component);
|
||||
|
||||
int GetVertSubSampFactor(int component);
|
||||
int GetVertSubSampFactor(int component);
|
||||
|
||||
// Public for testability.
|
||||
int GetImageScanlinesPerImcuRow();
|
||||
// Public for testability.
|
||||
int GetImageScanlinesPerImcuRow();
|
||||
|
||||
// Public for testability.
|
||||
int GetComponentScanlinesPerImcuRow(int component);
|
||||
// Public for testability.
|
||||
int GetComponentScanlinesPerImcuRow(int component);
|
||||
|
||||
// Width of a component in bytes.
|
||||
int GetComponentWidth(int component);
|
||||
// Width of a component in bytes.
|
||||
int GetComponentWidth(int component);
|
||||
|
||||
// Height of a component.
|
||||
int GetComponentHeight(int component);
|
||||
// Height of a component.
|
||||
int GetComponentHeight(int component);
|
||||
|
||||
// Width of a component in bytes with padding for DCTSIZE. Public for testing.
|
||||
int GetComponentStride(int component);
|
||||
// Width of a component in bytes with padding for DCTSIZE. Public for testing.
|
||||
int GetComponentStride(int component);
|
||||
|
||||
// Size of a component in bytes.
|
||||
int GetComponentSize(int component);
|
||||
// Size of a component in bytes.
|
||||
int GetComponentSize(int component);
|
||||
|
||||
// Call this after LoadFrame() if you decide you don't want to decode it
|
||||
// after all.
|
||||
LIBYUV_BOOL UnloadFrame();
|
||||
// Call this after LoadFrame() if you decide you don't want to decode it
|
||||
// after all.
|
||||
LIBYUV_BOOL UnloadFrame();
|
||||
|
||||
// Decodes the entire image into a one-buffer-per-color-component format.
|
||||
// dst_width must match exactly. dst_height must be <= to image height; if
|
||||
// less, the image is cropped. "planes" must have size equal to at least
|
||||
// GetNumComponents() and they must point to non-overlapping buffers of size
|
||||
// at least GetComponentSize(i). The pointers in planes are incremented
|
||||
// to point to after the end of the written data.
|
||||
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
|
||||
LIBYUV_BOOL DecodeToBuffers(uint8_t** planes, int dst_width, int dst_height);
|
||||
// Decodes the entire image into a one-buffer-per-color-component format.
|
||||
// dst_width must match exactly. dst_height must be <= to image height; if
|
||||
// less, the image is cropped. "planes" must have size equal to at least
|
||||
// GetNumComponents() and they must point to non-overlapping buffers of size
|
||||
// at least GetComponentSize(i). The pointers in planes are incremented
|
||||
// to point to after the end of the written data.
|
||||
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
|
||||
LIBYUV_BOOL DecodeToBuffers(uint8_t** planes, int dst_width, int dst_height);
|
||||
|
||||
// Decodes the entire image and passes the data via repeated calls to a
|
||||
// callback function. Each call will get the data for a whole number of
|
||||
// image scanlines.
|
||||
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
|
||||
LIBYUV_BOOL DecodeToCallback(CallbackFunction fn,
|
||||
void* opaque,
|
||||
int dst_width,
|
||||
int dst_height);
|
||||
// Decodes the entire image and passes the data via repeated calls to a
|
||||
// callback function. Each call will get the data for a whole number of
|
||||
// image scanlines.
|
||||
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
|
||||
LIBYUV_BOOL DecodeToCallback(CallbackFunction fn,
|
||||
void* opaque,
|
||||
int dst_width,
|
||||
int dst_height);
|
||||
|
||||
// The helper function which recognizes the jpeg sub-sampling type.
|
||||
static JpegSubsamplingType JpegSubsamplingTypeHelper(
|
||||
int* subsample_x,
|
||||
int* subsample_y,
|
||||
int number_of_components);
|
||||
// The helper function which recognizes the jpeg sub-sampling type.
|
||||
static JpegSubsamplingType JpegSubsamplingTypeHelper(
|
||||
int* subsample_x,
|
||||
int* subsample_y,
|
||||
int number_of_components);
|
||||
|
||||
private:
|
||||
void AllocOutputBuffers(int num_outbufs);
|
||||
void DestroyOutputBuffers();
|
||||
private:
|
||||
void AllocOutputBuffers(int num_outbufs);
|
||||
void DestroyOutputBuffers();
|
||||
|
||||
LIBYUV_BOOL StartDecode();
|
||||
LIBYUV_BOOL FinishDecode();
|
||||
LIBYUV_BOOL StartDecode();
|
||||
LIBYUV_BOOL FinishDecode();
|
||||
|
||||
void SetScanlinePointers(uint8_t** data);
|
||||
LIBYUV_BOOL DecodeImcuRow();
|
||||
void SetScanlinePointers(uint8_t** data);
|
||||
LIBYUV_BOOL DecodeImcuRow();
|
||||
|
||||
int GetComponentScanlinePadding(int component);
|
||||
int GetComponentScanlinePadding(int component);
|
||||
|
||||
// A buffer holding the input data for a frame.
|
||||
Buffer buf_;
|
||||
BufferVector buf_vec_;
|
||||
// A buffer holding the input data for a frame.
|
||||
Buffer buf_;
|
||||
BufferVector buf_vec_;
|
||||
|
||||
jpeg_decompress_struct* decompress_struct_;
|
||||
jpeg_source_mgr* source_mgr_;
|
||||
SetJmpErrorMgr* error_mgr_;
|
||||
jpeg_decompress_struct* decompress_struct_;
|
||||
jpeg_source_mgr* source_mgr_;
|
||||
SetJmpErrorMgr* error_mgr_;
|
||||
|
||||
// LIBYUV_TRUE iff at least one component has scanline padding. (i.e.,
|
||||
// GetComponentScanlinePadding() != 0.)
|
||||
LIBYUV_BOOL has_scanline_padding_;
|
||||
// LIBYUV_TRUE iff at least one component has scanline padding. (i.e.,
|
||||
// GetComponentScanlinePadding() != 0.)
|
||||
LIBYUV_BOOL has_scanline_padding_;
|
||||
|
||||
// Temporaries used to point to scanline outputs.
|
||||
int num_outbufs_; // Outermost size of all arrays below.
|
||||
uint8_t*** scanlines_;
|
||||
int* scanlines_sizes_;
|
||||
// Temporary buffer used for decoding when we can't decode directly to the
|
||||
// output buffers. Large enough for just one iMCU row.
|
||||
uint8_t** databuf_;
|
||||
int* databuf_strides_;
|
||||
// Temporaries used to point to scanline outputs.
|
||||
int num_outbufs_; // Outermost size of all arrays below.
|
||||
uint8_t*** scanlines_;
|
||||
int* scanlines_sizes_;
|
||||
// Temporary buffer used for decoding when we can't decode directly to the
|
||||
// output buffers. Large enough for just one iMCU row.
|
||||
uint8_t** databuf_;
|
||||
int* databuf_strides_;
|
||||
};
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
#include "libyuv/convert_argb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,21 +14,22 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Supported rotation.
|
||||
typedef enum RotationMode {
|
||||
kRotate0 = 0, // No rotation.
|
||||
kRotate90 = 90, // Rotate 90 degrees clockwise.
|
||||
kRotate180 = 180, // Rotate 180 degrees.
|
||||
kRotate270 = 270, // Rotate 270 degrees clockwise.
|
||||
kRotate0 = 0, // No rotation.
|
||||
kRotate90 = 90, // Rotate 90 degrees clockwise.
|
||||
kRotate180 = 180, // Rotate 180 degrees.
|
||||
kRotate270 = 270, // Rotate 270 degrees clockwise.
|
||||
|
||||
// Deprecated.
|
||||
kRotateNone = 0,
|
||||
kRotateClockwise = 90,
|
||||
kRotateCounterClockwise = 270,
|
||||
// Deprecated.
|
||||
kRotateNone = 0,
|
||||
kRotateClockwise = 90,
|
||||
kRotateCounterClockwise = 270,
|
||||
} RotationModeEnum;
|
||||
|
||||
// Rotate I420 frame.
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/rotate.h" // For RotationMode.
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/cpu_support.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
#include "libyuv/cpu_support.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1005,17 +1006,17 @@ typedef uint8_t ulvec8[32];
|
||||
#if defined(__aarch64__) || defined(__arm__) || defined(__riscv)
|
||||
// This struct is for ARM and RISC-V color conversion.
|
||||
struct YuvConstants {
|
||||
uvec8 kUVCoeff;
|
||||
vec16 kRGBCoeffBias;
|
||||
uvec8 kUVCoeff;
|
||||
vec16 kRGBCoeffBias;
|
||||
};
|
||||
#else
|
||||
// This struct is for Intel color conversion.
|
||||
struct YuvConstants {
|
||||
uint8_t kUVToB[32];
|
||||
uint8_t kUVToG[32];
|
||||
uint8_t kUVToR[32];
|
||||
int16_t kYToRgb[16];
|
||||
int16_t kYBiasToRgb[16];
|
||||
uint8_t kUVToB[32];
|
||||
uint8_t kUVToG[32];
|
||||
uint8_t kUVToR[32];
|
||||
int16_t kYToRgb[16];
|
||||
int16_t kYBiasToRgb[16];
|
||||
};
|
||||
|
||||
// Offsets into YuvConstants structure
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,16 +14,17 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Supported filtering.
|
||||
typedef enum FilterMode {
|
||||
kFilterNone = 0, // Point sample; Fastest.
|
||||
kFilterLinear = 1, // Filter horizontally only.
|
||||
kFilterBilinear = 2, // Faster than box, but lower quality scaling down.
|
||||
kFilterBox = 3 // Highest quality.
|
||||
kFilterNone = 0, // Point sample; Fastest.
|
||||
kFilterLinear = 1, // Filter horizontally only.
|
||||
kFilterBilinear = 2, // Faster than box, but lower quality scaling down.
|
||||
kFilterBox = 3 // Highest quality.
|
||||
} FilterModeEnum;
|
||||
|
||||
// Scale a YUV plane.
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/scale.h" // For FilterMode
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/scale.h" // For FilterMode
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "libyuv/scale.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1403,10 +1404,10 @@ void ScaleUVRowUp2_Linear_16_Any_SSE41(const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleUVRowUp2_Bilinear_16_Any_SSE41(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr,
|
||||
ptrdiff_t dst_stride,
|
||||
int dst_width);
|
||||
ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr,
|
||||
ptrdiff_t dst_stride,
|
||||
int dst_width);
|
||||
void ScaleUVRowUp2_Linear_16_AVX2(const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int dst_width);
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "libyuv/scale.h" // For FilterMode
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace libyuv {
|
||||
namespace libyuv
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -50,165 +51,165 @@ extern "C" {
|
||||
// Secondary formats are converted in 2 steps.
|
||||
// Auxilliary formats call primary converters.
|
||||
enum FourCC {
|
||||
// 10 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
|
||||
FOURCC_I420 = FOURCC('I', '4', '2', '0'),
|
||||
FOURCC_I422 = FOURCC('I', '4', '2', '2'),
|
||||
FOURCC_I444 = FOURCC('I', '4', '4', '4'),
|
||||
FOURCC_I400 = FOURCC('I', '4', '0', '0'),
|
||||
FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
|
||||
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
||||
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
|
||||
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
|
||||
FOURCC_I010 = FOURCC('I', '0', '1', '0'), // bt.601 10 bit 420
|
||||
FOURCC_I210 = FOURCC('I', '2', '1', '0'), // bt.601 10 bit 422
|
||||
// 10 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
|
||||
FOURCC_I420 = FOURCC('I', '4', '2', '0'),
|
||||
FOURCC_I422 = FOURCC('I', '4', '2', '2'),
|
||||
FOURCC_I444 = FOURCC('I', '4', '4', '4'),
|
||||
FOURCC_I400 = FOURCC('I', '4', '0', '0'),
|
||||
FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
|
||||
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
||||
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
|
||||
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
|
||||
FOURCC_I010 = FOURCC('I', '0', '1', '0'), // bt.601 10 bit 420
|
||||
FOURCC_I210 = FOURCC('I', '2', '1', '0'), // bt.601 10 bit 422
|
||||
|
||||
// 1 Secondary YUV format: row biplanar. deprecated.
|
||||
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
|
||||
// 1 Secondary YUV format: row biplanar. deprecated.
|
||||
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
|
||||
|
||||
// 13 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp, 1 10 bpc 2 64 bpp
|
||||
FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
|
||||
FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
|
||||
FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
|
||||
FOURCC_AR30 = FOURCC('A', 'R', '3', '0'), // 10 bit per channel. 2101010.
|
||||
FOURCC_AB30 = FOURCC('A', 'B', '3', '0'), // ABGR version of 10 bit
|
||||
FOURCC_AR64 = FOURCC('A', 'R', '6', '4'), // 16 bit per channel.
|
||||
FOURCC_AB64 = FOURCC('A', 'B', '6', '4'), // ABGR version of 16 bit
|
||||
FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
|
||||
FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
|
||||
FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
|
||||
FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE.
|
||||
FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE.
|
||||
FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE.
|
||||
// 13 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp, 1 10 bpc 2 64 bpp
|
||||
FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
|
||||
FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
|
||||
FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
|
||||
FOURCC_AR30 = FOURCC('A', 'R', '3', '0'), // 10 bit per channel. 2101010.
|
||||
FOURCC_AB30 = FOURCC('A', 'B', '3', '0'), // ABGR version of 10 bit
|
||||
FOURCC_AR64 = FOURCC('A', 'R', '6', '4'), // 16 bit per channel.
|
||||
FOURCC_AB64 = FOURCC('A', 'B', '6', '4'), // ABGR version of 16 bit
|
||||
FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
|
||||
FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
|
||||
FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
|
||||
FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE.
|
||||
FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE.
|
||||
FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE.
|
||||
|
||||
// 1 Primary Compressed YUV format.
|
||||
FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
|
||||
// 1 Primary Compressed YUV format.
|
||||
FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
|
||||
|
||||
// 14 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
|
||||
FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
|
||||
FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
|
||||
FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
|
||||
FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420.
|
||||
FOURCC_J420 =
|
||||
FOURCC('J', '4', '2', '0'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J422 =
|
||||
FOURCC('J', '4', '2', '2'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J444 =
|
||||
FOURCC('J', '4', '4', '4'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J400 =
|
||||
FOURCC('J', '4', '0', '0'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_F420 = FOURCC('F', '4', '2', '0'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_F422 = FOURCC('F', '4', '2', '2'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_F444 = FOURCC('F', '4', '4', '4'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_H420 = FOURCC('H', '4', '2', '0'), // bt.709, unofficial fourcc
|
||||
FOURCC_H422 = FOURCC('H', '4', '2', '2'), // bt.709, unofficial fourcc
|
||||
FOURCC_H444 = FOURCC('H', '4', '4', '4'), // bt.709, unofficial fourcc
|
||||
FOURCC_U420 = FOURCC('U', '4', '2', '0'), // bt.2020, unofficial fourcc
|
||||
FOURCC_U422 = FOURCC('U', '4', '2', '2'), // bt.2020, unofficial fourcc
|
||||
FOURCC_U444 = FOURCC('U', '4', '4', '4'), // bt.2020, unofficial fourcc
|
||||
FOURCC_F010 = FOURCC('F', '0', '1', '0'), // bt.709 full range 10 bit 420
|
||||
FOURCC_H010 = FOURCC('H', '0', '1', '0'), // bt.709 10 bit 420
|
||||
FOURCC_U010 = FOURCC('U', '0', '1', '0'), // bt.2020 10 bit 420
|
||||
FOURCC_F210 = FOURCC('F', '2', '1', '0'), // bt.709 full range 10 bit 422
|
||||
FOURCC_H210 = FOURCC('H', '2', '1', '0'), // bt.709 10 bit 422
|
||||
FOURCC_U210 = FOURCC('U', '2', '1', '0'), // bt.2020 10 bit 422
|
||||
FOURCC_P010 = FOURCC('P', '0', '1', '0'),
|
||||
FOURCC_P210 = FOURCC('P', '2', '1', '0'),
|
||||
// 14 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
|
||||
FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
|
||||
FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
|
||||
FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
|
||||
FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420.
|
||||
FOURCC_J420 =
|
||||
FOURCC('J', '4', '2', '0'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J422 =
|
||||
FOURCC('J', '4', '2', '2'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J444 =
|
||||
FOURCC('J', '4', '4', '4'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_J400 =
|
||||
FOURCC('J', '4', '0', '0'), // jpeg (bt.601 full), unofficial fourcc
|
||||
FOURCC_F420 = FOURCC('F', '4', '2', '0'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_F422 = FOURCC('F', '4', '2', '2'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_F444 = FOURCC('F', '4', '4', '4'), // bt.709 full, unofficial fourcc
|
||||
FOURCC_H420 = FOURCC('H', '4', '2', '0'), // bt.709, unofficial fourcc
|
||||
FOURCC_H422 = FOURCC('H', '4', '2', '2'), // bt.709, unofficial fourcc
|
||||
FOURCC_H444 = FOURCC('H', '4', '4', '4'), // bt.709, unofficial fourcc
|
||||
FOURCC_U420 = FOURCC('U', '4', '2', '0'), // bt.2020, unofficial fourcc
|
||||
FOURCC_U422 = FOURCC('U', '4', '2', '2'), // bt.2020, unofficial fourcc
|
||||
FOURCC_U444 = FOURCC('U', '4', '4', '4'), // bt.2020, unofficial fourcc
|
||||
FOURCC_F010 = FOURCC('F', '0', '1', '0'), // bt.709 full range 10 bit 420
|
||||
FOURCC_H010 = FOURCC('H', '0', '1', '0'), // bt.709 10 bit 420
|
||||
FOURCC_U010 = FOURCC('U', '0', '1', '0'), // bt.2020 10 bit 420
|
||||
FOURCC_F210 = FOURCC('F', '2', '1', '0'), // bt.709 full range 10 bit 422
|
||||
FOURCC_H210 = FOURCC('H', '2', '1', '0'), // bt.709 10 bit 422
|
||||
FOURCC_U210 = FOURCC('U', '2', '1', '0'), // bt.2020 10 bit 422
|
||||
FOURCC_P010 = FOURCC('P', '0', '1', '0'),
|
||||
FOURCC_P210 = FOURCC('P', '2', '1', '0'),
|
||||
|
||||
// 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
|
||||
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
|
||||
FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422.
|
||||
FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444.
|
||||
FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2.
|
||||
FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac.
|
||||
FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY.
|
||||
FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac.
|
||||
FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG.
|
||||
FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac.
|
||||
FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR.
|
||||
FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW.
|
||||
FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG.
|
||||
FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB
|
||||
FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB
|
||||
FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO.
|
||||
FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP.
|
||||
FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO.
|
||||
// 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
|
||||
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
|
||||
FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422.
|
||||
FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444.
|
||||
FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2.
|
||||
FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac.
|
||||
FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY.
|
||||
FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac.
|
||||
FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG.
|
||||
FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac.
|
||||
FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR.
|
||||
FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW.
|
||||
FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG.
|
||||
FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB
|
||||
FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB
|
||||
FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO.
|
||||
FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP.
|
||||
FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO.
|
||||
|
||||
// deprecated formats. Not supported, but defined for backward compatibility.
|
||||
FOURCC_I411 = FOURCC('I', '4', '1', '1'),
|
||||
FOURCC_Q420 = FOURCC('Q', '4', '2', '0'),
|
||||
FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
|
||||
FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
|
||||
FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
|
||||
FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
|
||||
FOURCC_H264 = FOURCC('H', '2', '6', '4'),
|
||||
// deprecated formats. Not supported, but defined for backward compatibility.
|
||||
FOURCC_I411 = FOURCC('I', '4', '1', '1'),
|
||||
FOURCC_Q420 = FOURCC('Q', '4', '2', '0'),
|
||||
FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
|
||||
FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
|
||||
FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
|
||||
FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
|
||||
FOURCC_H264 = FOURCC('H', '2', '6', '4'),
|
||||
|
||||
// Match any fourcc.
|
||||
FOURCC_ANY = -1,
|
||||
// Match any fourcc.
|
||||
FOURCC_ANY = -1,
|
||||
};
|
||||
|
||||
enum FourCCBpp {
|
||||
// Canonical fourcc codes used in our code.
|
||||
FOURCC_BPP_I420 = 12,
|
||||
FOURCC_BPP_I422 = 16,
|
||||
FOURCC_BPP_I444 = 24,
|
||||
FOURCC_BPP_I411 = 12,
|
||||
FOURCC_BPP_I400 = 8,
|
||||
FOURCC_BPP_NV21 = 12,
|
||||
FOURCC_BPP_NV12 = 12,
|
||||
FOURCC_BPP_YUY2 = 16,
|
||||
FOURCC_BPP_UYVY = 16,
|
||||
FOURCC_BPP_M420 = 12, // deprecated
|
||||
FOURCC_BPP_Q420 = 12,
|
||||
FOURCC_BPP_ARGB = 32,
|
||||
FOURCC_BPP_BGRA = 32,
|
||||
FOURCC_BPP_ABGR = 32,
|
||||
FOURCC_BPP_RGBA = 32,
|
||||
FOURCC_BPP_AR30 = 32,
|
||||
FOURCC_BPP_AB30 = 32,
|
||||
FOURCC_BPP_AR64 = 64,
|
||||
FOURCC_BPP_AB64 = 64,
|
||||
FOURCC_BPP_24BG = 24,
|
||||
FOURCC_BPP_RAW = 24,
|
||||
FOURCC_BPP_RGBP = 16,
|
||||
FOURCC_BPP_RGBO = 16,
|
||||
FOURCC_BPP_R444 = 16,
|
||||
FOURCC_BPP_RGGB = 8,
|
||||
FOURCC_BPP_BGGR = 8,
|
||||
FOURCC_BPP_GRBG = 8,
|
||||
FOURCC_BPP_GBRG = 8,
|
||||
FOURCC_BPP_YV12 = 12,
|
||||
FOURCC_BPP_YV16 = 16,
|
||||
FOURCC_BPP_YV24 = 24,
|
||||
FOURCC_BPP_YU12 = 12,
|
||||
FOURCC_BPP_J420 = 12,
|
||||
FOURCC_BPP_J400 = 8,
|
||||
FOURCC_BPP_H420 = 12,
|
||||
FOURCC_BPP_H422 = 16,
|
||||
FOURCC_BPP_I010 = 15,
|
||||
FOURCC_BPP_I210 = 20,
|
||||
FOURCC_BPP_H010 = 15,
|
||||
FOURCC_BPP_H210 = 20,
|
||||
FOURCC_BPP_P010 = 15,
|
||||
FOURCC_BPP_P210 = 20,
|
||||
FOURCC_BPP_MJPG = 0, // 0 means unknown.
|
||||
FOURCC_BPP_H264 = 0,
|
||||
FOURCC_BPP_IYUV = 12,
|
||||
FOURCC_BPP_YU16 = 16,
|
||||
FOURCC_BPP_YU24 = 24,
|
||||
FOURCC_BPP_YUYV = 16,
|
||||
FOURCC_BPP_YUVS = 16,
|
||||
FOURCC_BPP_HDYC = 16,
|
||||
FOURCC_BPP_2VUY = 16,
|
||||
FOURCC_BPP_JPEG = 1,
|
||||
FOURCC_BPP_DMB1 = 1,
|
||||
FOURCC_BPP_BA81 = 8,
|
||||
FOURCC_BPP_RGB3 = 24,
|
||||
FOURCC_BPP_BGR3 = 24,
|
||||
FOURCC_BPP_CM32 = 32,
|
||||
FOURCC_BPP_CM24 = 24,
|
||||
// Canonical fourcc codes used in our code.
|
||||
FOURCC_BPP_I420 = 12,
|
||||
FOURCC_BPP_I422 = 16,
|
||||
FOURCC_BPP_I444 = 24,
|
||||
FOURCC_BPP_I411 = 12,
|
||||
FOURCC_BPP_I400 = 8,
|
||||
FOURCC_BPP_NV21 = 12,
|
||||
FOURCC_BPP_NV12 = 12,
|
||||
FOURCC_BPP_YUY2 = 16,
|
||||
FOURCC_BPP_UYVY = 16,
|
||||
FOURCC_BPP_M420 = 12, // deprecated
|
||||
FOURCC_BPP_Q420 = 12,
|
||||
FOURCC_BPP_ARGB = 32,
|
||||
FOURCC_BPP_BGRA = 32,
|
||||
FOURCC_BPP_ABGR = 32,
|
||||
FOURCC_BPP_RGBA = 32,
|
||||
FOURCC_BPP_AR30 = 32,
|
||||
FOURCC_BPP_AB30 = 32,
|
||||
FOURCC_BPP_AR64 = 64,
|
||||
FOURCC_BPP_AB64 = 64,
|
||||
FOURCC_BPP_24BG = 24,
|
||||
FOURCC_BPP_RAW = 24,
|
||||
FOURCC_BPP_RGBP = 16,
|
||||
FOURCC_BPP_RGBO = 16,
|
||||
FOURCC_BPP_R444 = 16,
|
||||
FOURCC_BPP_RGGB = 8,
|
||||
FOURCC_BPP_BGGR = 8,
|
||||
FOURCC_BPP_GRBG = 8,
|
||||
FOURCC_BPP_GBRG = 8,
|
||||
FOURCC_BPP_YV12 = 12,
|
||||
FOURCC_BPP_YV16 = 16,
|
||||
FOURCC_BPP_YV24 = 24,
|
||||
FOURCC_BPP_YU12 = 12,
|
||||
FOURCC_BPP_J420 = 12,
|
||||
FOURCC_BPP_J400 = 8,
|
||||
FOURCC_BPP_H420 = 12,
|
||||
FOURCC_BPP_H422 = 16,
|
||||
FOURCC_BPP_I010 = 15,
|
||||
FOURCC_BPP_I210 = 20,
|
||||
FOURCC_BPP_H010 = 15,
|
||||
FOURCC_BPP_H210 = 20,
|
||||
FOURCC_BPP_P010 = 15,
|
||||
FOURCC_BPP_P210 = 20,
|
||||
FOURCC_BPP_MJPG = 0, // 0 means unknown.
|
||||
FOURCC_BPP_H264 = 0,
|
||||
FOURCC_BPP_IYUV = 12,
|
||||
FOURCC_BPP_YU16 = 16,
|
||||
FOURCC_BPP_YU24 = 24,
|
||||
FOURCC_BPP_YUYV = 16,
|
||||
FOURCC_BPP_YUVS = 16,
|
||||
FOURCC_BPP_HDYC = 16,
|
||||
FOURCC_BPP_2VUY = 16,
|
||||
FOURCC_BPP_JPEG = 1,
|
||||
FOURCC_BPP_DMB1 = 1,
|
||||
FOURCC_BPP_BA81 = 8,
|
||||
FOURCC_BPP_RGB3 = 24,
|
||||
FOURCC_BPP_BGR3 = 24,
|
||||
FOURCC_BPP_CM32 = 32,
|
||||
FOURCC_BPP_CM24 = 24,
|
||||
|
||||
// Match any fourcc.
|
||||
FOURCC_BPP_ANY = 0, // 0 means unknown.
|
||||
// Match any fourcc.
|
||||
FOURCC_BPP_ANY = 0, // 0 means unknown.
|
||||
};
|
||||
|
||||
// Converts fourcc aliases into canonical ones.
|
||||
|
||||
Reference in New Issue
Block a user