├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── raw
│ │ │ │ └── test.jpg
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── org
│ │ │ └── android
│ │ │ └── opensource
│ │ │ └── libyuv_android
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── android
│ │ │ └── opensource
│ │ │ └── libyuv_android
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── android
│ │ └── opensource
│ │ └── libyuv_android
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── libraryyuv
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ ├── jniLibs
│ │ │ ├── arm64-v8a
│ │ │ │ └── libyuv.so
│ │ │ └── armeabi-v7a
│ │ │ │ └── libyuv.so
│ │ ├── AndroidManifest.xml
│ │ ├── cpp
│ │ │ ├── include
│ │ │ │ ├── libyuv
│ │ │ │ │ ├── version.h
│ │ │ │ │ ├── rotate_argb.h
│ │ │ │ │ ├── scale_argb.h
│ │ │ │ │ ├── compare.h
│ │ │ │ │ ├── cpu_id.h
│ │ │ │ │ ├── compare_row.h
│ │ │ │ │ ├── basic_types.h
│ │ │ │ │ ├── scale.h
│ │ │ │ │ ├── rotate.h
│ │ │ │ │ ├── rotate_row.h
│ │ │ │ │ ├── mjpeg_decoder.h
│ │ │ │ │ ├── convert_from_argb.h
│ │ │ │ │ ├── convert_from.h
│ │ │ │ │ ├── video_common.h
│ │ │ │ │ ├── macros_msa.h
│ │ │ │ │ ├── convert.h
│ │ │ │ │ ├── convert_argb.h
│ │ │ │ │ ├── planar_functions.h
│ │ │ │ │ └── scale_row.h
│ │ │ │ └── libyuv.h
│ │ │ └── native-lib.cpp
│ │ └── java
│ │ │ └── org
│ │ │ └── android
│ │ │ └── opensource
│ │ │ └── libraryyuv
│ │ │ └── Libyuv.java
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── android
│ │ │ └── opensource
│ │ │ └── libraryyuv
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── android
│ │ └── opensource
│ │ └── libraryyuv
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
├── build.gradle
└── CMakeLists.txt
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── vcs.xml
├── assetWizardSettings.xml
├── modules.xml
├── runConfigurations.xml
├── misc.xml
└── codeStyles
│ └── Project.xml
├── README.md
├── gradle.properties
├── .gitignore
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/libraryyuv/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':libraryyuv'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/raw/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/raw/test.jpg
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Libyuv-android
3 |
4 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LibraryYUV
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libraryyuv/src/main/jniLibs/arm64-v8a/libyuv.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/libraryyuv/src/main/jniLibs/arm64-v8a/libyuv.so
--------------------------------------------------------------------------------
/libraryyuv/src/main/jniLibs/armeabi-v7a/libyuv.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/libraryyuv/src/main/jniLibs/armeabi-v7a/libyuv.so
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libraryyuv/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoxiaoqingyi/libyuv-android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 04 09:43:17 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/assetWizardSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/org/android/opensource/libyuv_android/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libyuv_android;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/libraryyuv/src/test/java/org/android/opensource/libraryyuv/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libraryyuv;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_VERSION_H_
12 | #define INCLUDE_LIBYUV_VERSION_H_
13 |
14 | #define LIBYUV_VERSION 1634
15 |
16 | #endif // INCLUDE_LIBYUV_VERSION_H_
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # libyuv-android
2 | libyuv for android easy to use
3 |
4 | 在根目录下的build.gradle 添加如下一行
5 | -------------
6 | Add it in your root build.gradle at the end of repositories:
7 | -------------
8 |
9 | allprojects {
10 | repositories {
11 | ...
12 | maven { url 'https://jitpack.io' }
13 | }
14 | }
15 |
16 | 然后,在你项目中的 build.gradle 添加如下一行
17 | -------------
18 | Step 2. Add the dependency
19 | -------------
20 |
21 | dependencies {
22 | compile 'com.github.xiaoxiaoqingyi:libyuv-android:v1.0'
23 | }
24 | API:
25 |
26 | - ARGBToNV21();
27 | - NV21ToARGB();
28 | - RGBAToARGB();
29 |
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/libraryyuv/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/org/android/opensource/libyuv_android/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libyuv_android;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("org.android.opensource.libyuv_android", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libraryyuv/src/androidTest/java/org/android/opensource/libraryyuv/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libraryyuv;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("org.android.opensource.libraryyuv.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/java/org/android/opensource/libraryyuv/Libyuv.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libraryyuv;
2 |
3 | public class Libyuv {
4 |
5 | static {
6 | System.loadLibrary("native-lib");
7 | System.loadLibrary("yuv");
8 | }
9 |
10 | public native static void ARGBToNV21(byte[] src_frame,int src_stride,
11 | int width, int height, byte[] yBuffer, byte[] uvBuffer);
12 |
13 | public native static void NV21ToARGB(byte[] yBuffer,int y_stride,
14 | byte[] uvBuffer,int uv_stride,
15 | byte[] dstARGB,int dst_stride_argb,
16 | int width, int height);
17 |
18 | public native static void RGBAToARGB(byte[] srcBuffer,int src_stride_frame,
19 | byte[] dstBuffer, int dst_stride_argb,
20 | int width, int height);
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/dictionaries
41 | .idea/libraries
42 |
43 | # Keystore files
44 | *.jks
45 |
46 | # External native build folder generated in Android Studio 2.2 and later
47 | .externalNativeBuild
48 |
49 | # Google Services (e.g. APIs or Firebase)
50 | google-services.json
51 |
52 | # Freeline
53 | freeline.py
54 | freeline/
55 | freeline_project_description.json
56 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | defaultConfig {
6 | applicationId "org.android.opensource.libyuv_android"
7 | minSdkVersion 15
8 | targetSdkVersion 27
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:27.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28 | implementation project(path: ':libraryyuv')
29 | }
30 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/rotate_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_
12 | #define INCLUDE_LIBYUV_ROTATE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/rotate.h" // For RotationMode.
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | // Rotate ARGB frame
23 | LIBYUV_API
24 | int ARGBRotate(const uint8* src_argb, int src_stride_argb,
25 | uint8* dst_argb, int dst_stride_argb,
26 | int src_width, int src_height, enum RotationMode mode);
27 |
28 | #ifdef __cplusplus
29 | } // extern "C"
30 | } // namespace libyuv
31 | #endif
32 |
33 | #endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_
34 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_H_
12 | #define INCLUDE_LIBYUV_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/compare.h"
16 | #include "libyuv/convert.h"
17 | #include "libyuv/convert_argb.h"
18 | #include "libyuv/convert_from.h"
19 | #include "libyuv/convert_from_argb.h"
20 | #include "libyuv/cpu_id.h"
21 | #include "libyuv/mjpeg_decoder.h"
22 | #include "libyuv/planar_functions.h"
23 | #include "libyuv/rotate.h"
24 | #include "libyuv/rotate_argb.h"
25 | #include "libyuv/row.h"
26 | #include "libyuv/scale.h"
27 | #include "libyuv/scale_argb.h"
28 | #include "libyuv/scale_row.h"
29 | #include "libyuv/version.h"
30 | #include "libyuv/video_common.h"
31 |
32 | #endif // INCLUDE_LIBYUV_H_
33 |
--------------------------------------------------------------------------------
/libraryyuv/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 27
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 27
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | externalNativeBuild {
17 | cmake {
18 | cppFlags ""
19 | }
20 | }
21 |
22 | ndk {
23 | abiFilters "armeabi-v7a"
24 | abiFilters "arm64-v8a"
25 | }
26 | }
27 |
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 |
35 | externalNativeBuild {
36 |
37 | // Encapsulates your CMake build configurations.
38 | cmake {
39 |
40 | // Provides a relative path to your CMake build script.
41 | path "CMakeLists.txt"
42 | }
43 | }
44 |
45 | }
46 |
47 |
48 | repositories {
49 | flatDir {
50 | dirs 'jniLibs'
51 | }
52 | }
53 |
54 | dependencies {
55 | implementation fileTree(dir: 'libs', include: ['*.jar'])
56 |
57 | implementation 'com.android.support:appcompat-v7:27.1.0'
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
61 | }
62 |
--------------------------------------------------------------------------------
/libraryyuv/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Sets the minimum version of CMake required to build your native library.
2 | # This ensures that a certain set of CMake features is available to
3 | # your build.
4 |
5 | cmake_minimum_required(VERSION 3.4.1)
6 |
7 | # Specifies a library name, specifies whether the library is STATIC or
8 | # SHARED, and provides relative paths to the source code. You can
9 | # define multiple libraries by adding multiple add.library() commands,
10 | # and CMake builds them for you. When you build your app, Gradle
11 | # automatically packages shared libraries with your APK.
12 |
13 | add_library( # Specifies the name of the library.
14 | native-lib
15 |
16 | # Sets the library as a shared library.
17 | SHARED
18 |
19 | # Provides a relative path to your source file(s).
20 | src/main/cpp/native-lib.cpp )
21 |
22 | include_directories(src/main/cpp/include)
23 | set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../../src/main/jniLibs)
24 | #### libyuv start###
25 | add_library( # Sets the name of the library.
26 | yuv
27 |
28 | # Sets the library as ashared library.
29 | SHARED
30 |
31 | # Provides a relative pathto your source file(s).
32 | IMPORTED )
33 |
34 | set_target_properties(
35 | yuv
36 | PROPERTIES IMPORTED_LOCATION
37 |
38 | ../../../../src/main/jniLibs/${ANDROID_ABI}/libyuv.so
39 | )
40 | #### libyuv end ###
41 |
42 |
43 | target_link_libraries( # Specifies the target library.
44 | native-lib yuv
45 |
46 | # Links the targetlibrary to the log library
47 | # included in theNDK.
48 | ${log-lib} )
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/scale_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_ARGB_H_
12 | #define INCLUDE_LIBYUV_SCALE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/scale.h" // For FilterMode
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | LIBYUV_API
23 | int ARGBScale(const uint8* src_argb, int src_stride_argb,
24 | int src_width, int src_height,
25 | uint8* dst_argb, int dst_stride_argb,
26 | int dst_width, int dst_height,
27 | enum FilterMode filtering);
28 |
29 | // Clipped scale takes destination rectangle coordinates for clip values.
30 | LIBYUV_API
31 | int ARGBScaleClip(const uint8* src_argb, int src_stride_argb,
32 | int src_width, int src_height,
33 | uint8* dst_argb, int dst_stride_argb,
34 | int dst_width, int dst_height,
35 | int clip_x, int clip_y, int clip_width, int clip_height,
36 | enum FilterMode filtering);
37 |
38 | // Scale with YUV conversion to ARGB and clipping.
39 | LIBYUV_API
40 | int YUVToARGBScaleClip(const uint8* src_y, int src_stride_y,
41 | const uint8* src_u, int src_stride_u,
42 | const uint8* src_v, int src_stride_v,
43 | uint32 src_fourcc,
44 | int src_width, int src_height,
45 | uint8* dst_argb, int dst_stride_argb,
46 | uint32 dst_fourcc,
47 | int dst_width, int dst_height,
48 | int clip_x, int clip_y, int clip_width, int clip_height,
49 | enum FilterMode filtering);
50 |
51 | #ifdef __cplusplus
52 | } // extern "C"
53 | } // namespace libyuv
54 | #endif
55 |
56 | #endif // INCLUDE_LIBYUV_SCALE_ARGB_H_
57 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/native-lib.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by DELL on 2018/3/26.
3 | //
4 |
5 | #include
6 | #include
7 | #include "libyuv.h"
8 |
9 | extern "C" {
10 |
11 | JNIEXPORT
12 | JNICALL
13 | void Java_org_android_opensource_libraryyuv_Libyuv_ARGBToNV21(
14 | JNIEnv *env, jclass *jcls,
15 | jbyteArray src_frame, jint src_stride_frame,
16 | jint width, jint height,
17 | jbyteArray yBuffer, jbyteArray uvBuffer) {
18 |
19 | uint8_t* srcFrame = (uint8_t*) env->GetByteArrayElements(src_frame, 0);
20 |
21 | uint8_t* dst_y=(uint8_t*) env->GetByteArrayElements(yBuffer, 0);
22 | uint8_t* dst_uv=(uint8_t*) env->GetByteArrayElements(uvBuffer, 0);
23 |
24 |
25 | libyuv::ARGBToNV21(srcFrame, src_stride_frame,
26 | dst_y, width,
27 | dst_uv, width, width, height);
28 |
29 | //remember release
30 | env->ReleaseByteArrayElements(src_frame, (jbyte*)srcFrame, 0);
31 | env->ReleaseByteArrayElements(yBuffer, (jbyte*)dst_y, 0);
32 | env->ReleaseByteArrayElements(uvBuffer, (jbyte*)dst_uv, 0);
33 | }
34 |
35 | JNIEXPORT void
36 | JNICALL
37 | Java_org_android_opensource_libraryyuv_Libyuv_NV21ToARGB(
38 | JNIEnv *env, jclass *jcls,
39 | jbyteArray yBuffer,jint y_stride,
40 | jbyteArray uvBuffer,jint uv_stride,
41 | jbyteArray dstARGB,jint dst_stride_argb,
42 | jint width, jint height) {
43 |
44 | uint8_t* src_y=(uint8_t*) env->GetByteArrayElements(yBuffer, 0);
45 | uint8_t* src_uv=(uint8_t*) env->GetByteArrayElements(uvBuffer, 0);
46 | uint8_t* dst_argb = (uint8_t*) env->GetByteArrayElements(dstARGB, 0);
47 |
48 | libyuv::NV21ToARGB(src_y, y_stride, src_uv, uv_stride, dst_argb, dst_stride_argb, width, height);
49 |
50 | //remember release
51 | env->ReleaseByteArrayElements(dstARGB, (jbyte*)dst_argb, 0);
52 | env->ReleaseByteArrayElements(yBuffer, (jbyte*)src_y, 0);
53 | env->ReleaseByteArrayElements(uvBuffer, (jbyte*)src_uv, 0);
54 |
55 | }
56 |
57 | JNIEXPORT
58 | JNICALL
59 | void Java_org_android_opensource_libraryyuv_Libyuv_RGBAToARGB(
60 | JNIEnv *env, jclass *jcls,
61 | jbyteArray srcBuffer,jint src_stride_frame,
62 | jbyteArray dstBuffer, jint dst_stride_argb,
63 | jint width, jint height) {
64 |
65 | uint8_t* src_frame = (uint8_t*) env->GetByteArrayElements(srcBuffer, 0);
66 | uint8_t* dst_argb = (uint8_t*) env->GetByteArrayElements(dstBuffer, 0);
67 |
68 | libyuv::RGBAToARGB(src_frame,src_stride_frame, dst_argb,dst_stride_argb, width, height);
69 |
70 | //remember release
71 | env->ReleaseByteArrayElements(srcBuffer, (jbyte*)src_frame, 0);
72 | env->ReleaseByteArrayElements(dstBuffer, (jbyte*)dst_argb, 0);
73 | }
74 |
75 |
76 | }
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_COMPARE_H_
12 | #define INCLUDE_LIBYUV_COMPARE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Compute a hash for specified memory. Seed of 5381 recommended.
22 | LIBYUV_API
23 | uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed);
24 |
25 | // Scan an opaque argb image and return fourcc based on alpha offset.
26 | // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
27 | LIBYUV_API
28 | uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
29 |
30 | // Sum Square Error - used to compute Mean Square Error or PSNR.
31 | LIBYUV_API
32 | uint64 ComputeSumSquareError(const uint8* src_a,
33 | const uint8* src_b, int count);
34 |
35 | LIBYUV_API
36 | uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a,
37 | const uint8* src_b, int stride_b,
38 | int width, int height);
39 |
40 | static const int kMaxPsnr = 128;
41 |
42 | LIBYUV_API
43 | double SumSquareErrorToPsnr(uint64 sse, uint64 count);
44 |
45 | LIBYUV_API
46 | double CalcFramePsnr(const uint8* src_a, int stride_a,
47 | const uint8* src_b, int stride_b,
48 | int width, int height);
49 |
50 | LIBYUV_API
51 | double I420Psnr(const uint8* src_y_a, int stride_y_a,
52 | const uint8* src_u_a, int stride_u_a,
53 | const uint8* src_v_a, int stride_v_a,
54 | const uint8* src_y_b, int stride_y_b,
55 | const uint8* src_u_b, int stride_u_b,
56 | const uint8* src_v_b, int stride_v_b,
57 | int width, int height);
58 |
59 | LIBYUV_API
60 | double CalcFrameSsim(const uint8* src_a, int stride_a,
61 | const uint8* src_b, int stride_b,
62 | int width, int height);
63 |
64 | LIBYUV_API
65 | double I420Ssim(const uint8* src_y_a, int stride_y_a,
66 | const uint8* src_u_a, int stride_u_a,
67 | const uint8* src_v_a, int stride_v_a,
68 | const uint8* src_y_b, int stride_y_b,
69 | const uint8* src_u_b, int stride_u_b,
70 | const uint8* src_v_b, int stride_v_b,
71 | int width, int height);
72 |
73 | #ifdef __cplusplus
74 | } // extern "C"
75 | } // namespace libyuv
76 | #endif
77 |
78 | #endif // INCLUDE_LIBYUV_COMPARE_H_
79 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/cpu_id.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CPU_ID_H_
12 | #define INCLUDE_LIBYUV_CPU_ID_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Internal flag to indicate cpuid requires initialization.
22 | static const int kCpuInitialized = 0x1;
23 |
24 | // These flags are only valid on ARM processors.
25 | static const int kCpuHasARM = 0x2;
26 | static const int kCpuHasNEON = 0x4;
27 | // 0x8 reserved for future ARM flag.
28 |
29 | // These flags are only valid on x86 processors.
30 | static const int kCpuHasX86 = 0x10;
31 | static const int kCpuHasSSE2 = 0x20;
32 | static const int kCpuHasSSSE3 = 0x40;
33 | static const int kCpuHasSSE41 = 0x80;
34 | static const int kCpuHasSSE42 = 0x100; // unused at this time.
35 | static const int kCpuHasAVX = 0x200;
36 | static const int kCpuHasAVX2 = 0x400;
37 | static const int kCpuHasERMS = 0x800;
38 | static const int kCpuHasFMA3 = 0x1000;
39 | static const int kCpuHasAVX3 = 0x2000;
40 | static const int kCpuHasF16C = 0x4000;
41 |
42 | // 0x8000 reserved for future X86 flags.
43 |
44 | // These flags are only valid on MIPS processors.
45 | static const int kCpuHasMIPS = 0x10000;
46 | static const int kCpuHasDSPR2 = 0x20000;
47 | static const int kCpuHasMSA = 0x40000;
48 |
49 | // Internal function used to auto-init.
50 | LIBYUV_API
51 | int InitCpuFlags(void);
52 |
53 | // Internal function for parsing /proc/cpuinfo.
54 | LIBYUV_API
55 | int ArmCpuCaps(const char* cpuinfo_name);
56 |
57 | // Detect CPU has SSE2 etc.
58 | // Test_flag parameter should be one of kCpuHas constants above.
59 | // returns non-zero if instruction set is detected
60 | static __inline int TestCpuFlag(int test_flag) {
61 | LIBYUV_API extern int cpu_info_;
62 | return (!cpu_info_ ? InitCpuFlags() : cpu_info_) & test_flag;
63 | }
64 |
65 | // For testing, allow CPU flags to be disabled.
66 | // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
67 | // MaskCpuFlags(-1) to enable all cpu specific optimizations.
68 | // MaskCpuFlags(1) to disable all cpu specific optimizations.
69 | LIBYUV_API
70 | void MaskCpuFlags(int enable_flags);
71 |
72 | // Low level cpuid for X86. Returns zeros on other CPUs.
73 | // eax is the info type that you want.
74 | // ecx is typically the cpu number, and should normally be zero.
75 | LIBYUV_API
76 | void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info);
77 |
78 | #ifdef __cplusplus
79 | } // extern "C"
80 | } // namespace libyuv
81 | #endif
82 |
83 | #endif // INCLUDE_LIBYUV_CPU_ID_H_
84 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/compare_row.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_COMPARE_ROW_H_
12 | #define INCLUDE_LIBYUV_COMPARE_ROW_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if defined(__pnacl__) || defined(__CLR_VER) || \
22 | (defined(__i386__) && !defined(__SSE2__))
23 | #define LIBYUV_DISABLE_X86
24 | #endif
25 | // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
26 | #if defined(__has_feature)
27 | #if __has_feature(memory_sanitizer)
28 | #define LIBYUV_DISABLE_X86
29 | #endif
30 | #endif
31 |
32 | // Visual C 2012 required for AVX2.
33 | #if defined(_M_IX86) && !defined(__clang__) && \
34 | defined(_MSC_VER) && _MSC_VER >= 1700
35 | #define VISUALC_HAS_AVX2 1
36 | #endif // VisualStudio >= 2012
37 |
38 | // clang >= 3.4.0 required for AVX2.
39 | #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
40 | #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
41 | #define CLANG_HAS_AVX2 1
42 | #endif // clang >= 3.4
43 | #endif // __clang__
44 |
45 | #if !defined(LIBYUV_DISABLE_X86) && \
46 | defined(_M_IX86) && (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
47 | #define HAS_HASHDJB2_AVX2
48 | #endif
49 |
50 | // The following are available for Visual C and GCC:
51 | #if !defined(LIBYUV_DISABLE_X86) && \
52 | (defined(__x86_64__) || (defined(__i386__) || defined(_M_IX86)))
53 | #define HAS_HASHDJB2_SSE41
54 | #define HAS_SUMSQUAREERROR_SSE2
55 | #endif
56 |
57 | // The following are available for Visual C and clangcl 32 bit:
58 | #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \
59 | (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
60 | #define HAS_HASHDJB2_AVX2
61 | #define HAS_SUMSQUAREERROR_AVX2
62 | #endif
63 |
64 | // The following are available for Neon:
65 | #if !defined(LIBYUV_DISABLE_NEON) && \
66 | (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
67 | #define HAS_SUMSQUAREERROR_NEON
68 | #endif
69 |
70 | uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count);
71 | uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count);
72 | uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count);
73 | uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count);
74 |
75 | uint32 HashDjb2_C(const uint8* src, int count, uint32 seed);
76 | uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed);
77 | uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed);
78 |
79 | #ifdef __cplusplus
80 | } // extern "C"
81 | } // namespace libyuv
82 | #endif
83 |
84 | #endif // INCLUDE_LIBYUV_COMPARE_ROW_H_
85 |
--------------------------------------------------------------------------------
/app/src/main/java/org/android/opensource/libyuv_android/MainActivity.java:
--------------------------------------------------------------------------------
1 | package org.android.opensource.libyuv_android;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 | import android.graphics.ImageFormat;
6 | import android.graphics.YuvImage;
7 | import android.os.Environment;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.widget.ImageView;
11 |
12 | import org.android.opensource.libraryyuv.Libyuv;
13 |
14 | import java.io.File;
15 | import java.io.FileOutputStream;
16 | import java.io.IOException;
17 | import java.io.InputStream;
18 | import java.nio.ByteBuffer;
19 |
20 | public class MainActivity extends AppCompatActivity {
21 |
22 | private ImageView imgShow;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_main);
28 |
29 | imgShow = findViewById(R.id.img);
30 | init();
31 | }
32 |
33 |
34 | private void init(){
35 | try {
36 | InputStream is = getResources().openRawResource(R.raw.test);
37 | Bitmap image = BitmapFactory.decodeStream(is);
38 | // BitmapFactory.Options opts = new BitmapFactory.Options();
39 | // opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
40 | // Bitmap image = BitmapFactory.decodeStream(is, null, opts);
41 | int h = image.getHeight();
42 | int w = image.getWidth();
43 |
44 |
45 |
46 | //将位图资源转为二进制数据,数据大小为w*h*4
47 | int bytes = image.getByteCount();
48 | ByteBuffer buf = ByteBuffer.allocate(bytes);
49 | image.copyPixelsToBuffer(buf);
50 | byte[] byteArray = buf.array();
51 |
52 | byte[] ybuffer=new byte[w*h];//用于保存y分量数据
53 | byte[] uvbuffer=new byte[w*h/2];//用于保存uv分量数据
54 |
55 | // byte[] argbBuffer = new byte[w*h*4];
56 | // Libyuv.RGBAToARGB(byteArray, w*4, argbBuffer, w*4, w, h);
57 |
58 | //使用libyuv库,ARGB转NV21 格式
59 | Libyuv.ARGBToNV21(byteArray, w*4, w, h, ybuffer, uvbuffer);
60 |
61 | byte[] frameBuffer=new byte[w*h*3/2];
62 | System.arraycopy(ybuffer,0,frameBuffer,0,w*h);
63 | System.arraycopy(uvbuffer,0,frameBuffer,w*h,w*h/2);
64 |
65 |
66 | //保存成jpg图片
67 | String imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.jpg";
68 | File file = new File(imagePath);
69 | FileOutputStream image_os = new FileOutputStream(file);
70 | YuvImage yuvImage = new YuvImage(frameBuffer, ImageFormat.NV21, w, h, null);
71 | yuvImage.compressToJpeg(new android.graphics.Rect(0, 0, w, h), 80, image_os);
72 |
73 | image_os.flush();
74 | image_os.close();
75 |
76 |
77 | //用于保存将yuv数据转成argb数据
78 | byte[] rgbbuffer=new byte[w*h*4];
79 | Libyuv.NV21ToARGB(ybuffer, w, uvbuffer, w, rgbbuffer, w*4, w, h);
80 | //还原成位图
81 | Bitmap stitchBmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
82 | stitchBmp.copyPixelsFromBuffer(ByteBuffer.wrap(rgbbuffer));
83 |
84 | //显示还原的位图
85 | imgShow.setImageBitmap(stitchBmp);
86 |
87 | } catch (Exception e){
88 | e.printStackTrace();
89 | }
90 |
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/basic_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_
12 | #define INCLUDE_LIBYUV_BASIC_TYPES_H_
13 |
14 | #include // for NULL, size_t
15 |
16 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
17 | #include // for uintptr_t on x86
18 | #else
19 | #include // for uintptr_t
20 | #endif
21 |
22 | #ifndef GG_LONGLONG
23 | #ifndef INT_TYPES_DEFINED
24 | #define INT_TYPES_DEFINED
25 | #ifdef COMPILER_MSVC
26 | typedef unsigned __int64 uint64;
27 | typedef __int64 int64;
28 | #ifndef INT64_C
29 | #define INT64_C(x) x ## I64
30 | #endif
31 | #ifndef UINT64_C
32 | #define UINT64_C(x) x ## UI64
33 | #endif
34 | #define INT64_F "I64"
35 | #else // COMPILER_MSVC
36 | #if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
37 | typedef unsigned long uint64; // NOLINT
38 | typedef long int64; // NOLINT
39 | #ifndef INT64_C
40 | #define INT64_C(x) x ## L
41 | #endif
42 | #ifndef UINT64_C
43 | #define UINT64_C(x) x ## UL
44 | #endif
45 | #define INT64_F "l"
46 | #else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
47 | typedef unsigned long long uint64; // NOLINT
48 | typedef long long int64; // NOLINT
49 | #ifndef INT64_C
50 | #define INT64_C(x) x ## LL
51 | #endif
52 | #ifndef UINT64_C
53 | #define UINT64_C(x) x ## ULL
54 | #endif
55 | #define INT64_F "ll"
56 | #endif // __LP64__
57 | #endif // COMPILER_MSVC
58 | typedef unsigned int uint32;
59 | typedef int int32;
60 | typedef unsigned short uint16; // NOLINT
61 | typedef short int16; // NOLINT
62 | typedef unsigned char uint8;
63 | typedef signed char int8;
64 | #endif // INT_TYPES_DEFINED
65 | #endif // GG_LONGLONG
66 |
67 | // Detect compiler is for x86 or x64.
68 | #if defined(__x86_64__) || defined(_M_X64) || \
69 | defined(__i386__) || defined(_M_IX86)
70 | #define CPU_X86 1
71 | #endif
72 | // Detect compiler is for ARM.
73 | #if defined(__arm__) || defined(_M_ARM)
74 | #define CPU_ARM 1
75 | #endif
76 |
77 | #ifndef ALIGNP
78 | #ifdef __cplusplus
79 | #define ALIGNP(p, t) \
80 | (reinterpret_cast(((reinterpret_cast(p) + \
81 | ((t) - 1)) & ~((t) - 1))))
82 | #else
83 | #define ALIGNP(p, t) \
84 | ((uint8*)((((uintptr_t)(p) + ((t) - 1)) & ~((t) - 1)))) /* NOLINT */
85 | #endif
86 | #endif
87 |
88 | #if !defined(LIBYUV_API)
89 | #if defined(_WIN32) || defined(__CYGWIN__)
90 | #if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
91 | #define LIBYUV_API __declspec(dllexport)
92 | #elif defined(LIBYUV_USING_SHARED_LIBRARY)
93 | #define LIBYUV_API __declspec(dllimport)
94 | #else
95 | #define LIBYUV_API
96 | #endif // LIBYUV_BUILDING_SHARED_LIBRARY
97 | #elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \
98 | (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \
99 | defined(LIBYUV_USING_SHARED_LIBRARY))
100 | #define LIBYUV_API __attribute__ ((visibility ("default")))
101 | #else
102 | #define LIBYUV_API
103 | #endif // __GNUC__
104 | #endif // LIBYUV_API
105 |
106 | #define LIBYUV_BOOL int
107 | #define LIBYUV_FALSE 0
108 | #define LIBYUV_TRUE 1
109 |
110 | // Visual C x86 or GCC little endian.
111 | #if defined(__x86_64__) || defined(_M_X64) || \
112 | defined(__i386__) || defined(_M_IX86) || \
113 | defined(__arm__) || defined(_M_ARM) || \
114 | (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
115 | #define LIBYUV_LITTLE_ENDIAN
116 | #endif
117 |
118 | #endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
119 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/scale.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_H_
12 | #define INCLUDE_LIBYUV_SCALE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Supported filtering.
22 | typedef enum FilterMode {
23 | kFilterNone = 0, // Point sample; Fastest.
24 | kFilterLinear = 1, // Filter horizontally only.
25 | kFilterBilinear = 2, // Faster than box, but lower quality scaling down.
26 | kFilterBox = 3 // Highest quality.
27 | } FilterModeEnum;
28 |
29 | // Scale a YUV plane.
30 | LIBYUV_API
31 | void ScalePlane(const uint8* src, int src_stride,
32 | int src_width, int src_height,
33 | uint8* dst, int dst_stride,
34 | int dst_width, int dst_height,
35 | enum FilterMode filtering);
36 |
37 | LIBYUV_API
38 | void ScalePlane_16(const uint16* src, int src_stride,
39 | int src_width, int src_height,
40 | uint16* dst, int dst_stride,
41 | int dst_width, int dst_height,
42 | enum FilterMode filtering);
43 |
44 | // Scales a YUV 4:2:0 image from the src width and height to the
45 | // dst width and height.
46 | // If filtering is kFilterNone, a simple nearest-neighbor algorithm is
47 | // used. This produces basic (blocky) quality at the fastest speed.
48 | // If filtering is kFilterBilinear, interpolation is used to produce a better
49 | // quality image, at the expense of speed.
50 | // If filtering is kFilterBox, averaging is used to produce ever better
51 | // quality image, at further expense of speed.
52 | // Returns 0 if successful.
53 |
54 | LIBYUV_API
55 | int I420Scale(const uint8* src_y, int src_stride_y,
56 | const uint8* src_u, int src_stride_u,
57 | const uint8* src_v, int src_stride_v,
58 | int src_width, int src_height,
59 | uint8* dst_y, int dst_stride_y,
60 | uint8* dst_u, int dst_stride_u,
61 | uint8* dst_v, int dst_stride_v,
62 | int dst_width, int dst_height,
63 | enum FilterMode filtering);
64 |
65 | LIBYUV_API
66 | int I420Scale_16(const uint16* src_y, int src_stride_y,
67 | const uint16* src_u, int src_stride_u,
68 | const uint16* src_v, int src_stride_v,
69 | int src_width, int src_height,
70 | uint16* dst_y, int dst_stride_y,
71 | uint16* dst_u, int dst_stride_u,
72 | uint16* dst_v, int dst_stride_v,
73 | int dst_width, int dst_height,
74 | enum FilterMode filtering);
75 |
76 | #ifdef __cplusplus
77 | // Legacy API. Deprecated.
78 | LIBYUV_API
79 | int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
80 | int src_stride_y, int src_stride_u, int src_stride_v,
81 | int src_width, int src_height,
82 | uint8* dst_y, uint8* dst_u, uint8* dst_v,
83 | int dst_stride_y, int dst_stride_u, int dst_stride_v,
84 | int dst_width, int dst_height,
85 | LIBYUV_BOOL interpolate);
86 |
87 | // Legacy API. Deprecated.
88 | LIBYUV_API
89 | int ScaleOffset(const uint8* src_i420, int src_width, int src_height,
90 | uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset,
91 | LIBYUV_BOOL interpolate);
92 |
93 | // For testing, allow disabling of specialized scalers.
94 | LIBYUV_API
95 | void SetUseReferenceImpl(LIBYUV_BOOL use);
96 | #endif // __cplusplus
97 |
98 | #ifdef __cplusplus
99 | } // extern "C"
100 | } // namespace libyuv
101 | #endif
102 |
103 | #endif // INCLUDE_LIBYUV_SCALE_H_
104 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/rotate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_H_
12 | #define INCLUDE_LIBYUV_ROTATE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Supported rotation.
22 | typedef enum RotationMode {
23 | kRotate0 = 0, // No rotation.
24 | kRotate90 = 90, // Rotate 90 degrees clockwise.
25 | kRotate180 = 180, // Rotate 180 degrees.
26 | kRotate270 = 270, // Rotate 270 degrees clockwise.
27 |
28 | // Deprecated.
29 | kRotateNone = 0,
30 | kRotateClockwise = 90,
31 | kRotateCounterClockwise = 270,
32 | } RotationModeEnum;
33 |
34 | // Rotate I420 frame.
35 | LIBYUV_API
36 | int I420Rotate(const uint8* src_y, int src_stride_y,
37 | const uint8* src_u, int src_stride_u,
38 | const uint8* src_v, int src_stride_v,
39 | uint8* dst_y, int dst_stride_y,
40 | uint8* dst_u, int dst_stride_u,
41 | uint8* dst_v, int dst_stride_v,
42 | int src_width, int src_height, enum RotationMode mode);
43 |
44 | // Rotate NV12 input and store in I420.
45 | LIBYUV_API
46 | int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
47 | const uint8* src_uv, int src_stride_uv,
48 | uint8* dst_y, int dst_stride_y,
49 | uint8* dst_u, int dst_stride_u,
50 | uint8* dst_v, int dst_stride_v,
51 | int src_width, int src_height, enum RotationMode mode);
52 |
53 | // Rotate a plane by 0, 90, 180, or 270.
54 | LIBYUV_API
55 | int RotatePlane(const uint8* src, int src_stride,
56 | uint8* dst, int dst_stride,
57 | int src_width, int src_height, enum RotationMode mode);
58 |
59 | // Rotate planes by 90, 180, 270. Deprecated.
60 | LIBYUV_API
61 | void RotatePlane90(const uint8* src, int src_stride,
62 | uint8* dst, int dst_stride,
63 | int width, int height);
64 |
65 | LIBYUV_API
66 | void RotatePlane180(const uint8* src, int src_stride,
67 | uint8* dst, int dst_stride,
68 | int width, int height);
69 |
70 | LIBYUV_API
71 | void RotatePlane270(const uint8* src, int src_stride,
72 | uint8* dst, int dst_stride,
73 | int width, int height);
74 |
75 | LIBYUV_API
76 | void RotateUV90(const uint8* src, int src_stride,
77 | uint8* dst_a, int dst_stride_a,
78 | uint8* dst_b, int dst_stride_b,
79 | int width, int height);
80 |
81 | // Rotations for when U and V are interleaved.
82 | // These functions take one input pointer and
83 | // split the data into two buffers while
84 | // rotating them. Deprecated.
85 | LIBYUV_API
86 | void RotateUV180(const uint8* src, int src_stride,
87 | uint8* dst_a, int dst_stride_a,
88 | uint8* dst_b, int dst_stride_b,
89 | int width, int height);
90 |
91 | LIBYUV_API
92 | void RotateUV270(const uint8* src, int src_stride,
93 | uint8* dst_a, int dst_stride_a,
94 | uint8* dst_b, int dst_stride_b,
95 | int width, int height);
96 |
97 | // The 90 and 270 functions are based on transposes.
98 | // Doing a transpose with reversing the read/write
99 | // order will result in a rotation by +- 90 degrees.
100 | // Deprecated.
101 | LIBYUV_API
102 | void TransposePlane(const uint8* src, int src_stride,
103 | uint8* dst, int dst_stride,
104 | int width, int height);
105 |
106 | LIBYUV_API
107 | void TransposeUV(const uint8* src, int src_stride,
108 | uint8* dst_a, int dst_stride_a,
109 | uint8* dst_b, int dst_stride_b,
110 | int width, int height);
111 |
112 | #ifdef __cplusplus
113 | } // extern "C"
114 | } // namespace libyuv
115 | #endif
116 |
117 | #endif // INCLUDE_LIBYUV_ROTATE_H_
118 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/rotate_row.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_ROW_H_
12 | #define INCLUDE_LIBYUV_ROTATE_ROW_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if defined(__pnacl__) || defined(__CLR_VER) || \
22 | (defined(__i386__) && !defined(__SSE2__))
23 | #define LIBYUV_DISABLE_X86
24 | #endif
25 | // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
26 | #if defined(__has_feature)
27 | #if __has_feature(memory_sanitizer)
28 | #define LIBYUV_DISABLE_X86
29 | #endif
30 | #endif
31 | // The following are available for Visual C and clangcl 32 bit:
32 | #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86)
33 | #define HAS_TRANSPOSEWX8_SSSE3
34 | #define HAS_TRANSPOSEUVWX8_SSE2
35 | #endif
36 |
37 | // The following are available for GCC 32 or 64 bit but not NaCL for 64 bit:
38 | #if !defined(LIBYUV_DISABLE_X86) && \
39 | (defined(__i386__) || (defined(__x86_64__) && !defined(__native_client__)))
40 | #define HAS_TRANSPOSEWX8_SSSE3
41 | #endif
42 |
43 | // The following are available for 64 bit GCC but not NaCL:
44 | #if !defined(LIBYUV_DISABLE_X86) && !defined(__native_client__) && \
45 | defined(__x86_64__)
46 | #define HAS_TRANSPOSEWX8_FAST_SSSE3
47 | #define HAS_TRANSPOSEUVWX8_SSE2
48 | #endif
49 |
50 | #if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \
51 | (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
52 | #define HAS_TRANSPOSEWX8_NEON
53 | #define HAS_TRANSPOSEUVWX8_NEON
54 | #endif
55 |
56 | #if !defined(LIBYUV_DISABLE_MIPS) && !defined(__native_client__) && \
57 | defined(__mips__) && \
58 | defined(__mips_dsp) && (__mips_dsp_rev >= 2)
59 | #define HAS_TRANSPOSEWX8_DSPR2
60 | #define HAS_TRANSPOSEUVWX8_DSPR2
61 | #endif // defined(__mips__)
62 |
63 | void TransposeWxH_C(const uint8* src, int src_stride,
64 | uint8* dst, int dst_stride, int width, int height);
65 |
66 | void TransposeWx8_C(const uint8* src, int src_stride,
67 | uint8* dst, int dst_stride, int width);
68 | void TransposeWx8_NEON(const uint8* src, int src_stride,
69 | uint8* dst, int dst_stride, int width);
70 | void TransposeWx8_SSSE3(const uint8* src, int src_stride,
71 | uint8* dst, int dst_stride, int width);
72 | void TransposeWx8_Fast_SSSE3(const uint8* src, int src_stride,
73 | uint8* dst, int dst_stride, int width);
74 | void TransposeWx8_DSPR2(const uint8* src, int src_stride,
75 | uint8* dst, int dst_stride, int width);
76 | void TransposeWx8_Fast_DSPR2(const uint8* src, int src_stride,
77 | uint8* dst, int dst_stride, int width);
78 |
79 | void TransposeWx8_Any_NEON(const uint8* src, int src_stride,
80 | uint8* dst, int dst_stride, int width);
81 | void TransposeWx8_Any_SSSE3(const uint8* src, int src_stride,
82 | uint8* dst, int dst_stride, int width);
83 | void TransposeWx8_Fast_Any_SSSE3(const uint8* src, int src_stride,
84 | uint8* dst, int dst_stride, int width);
85 | void TransposeWx8_Any_DSPR2(const uint8* src, int src_stride,
86 | uint8* dst, int dst_stride, int width);
87 |
88 | void TransposeUVWxH_C(const uint8* src, int src_stride,
89 | uint8* dst_a, int dst_stride_a,
90 | uint8* dst_b, int dst_stride_b,
91 | int width, int height);
92 |
93 | void TransposeUVWx8_C(const uint8* src, int src_stride,
94 | uint8* dst_a, int dst_stride_a,
95 | uint8* dst_b, int dst_stride_b, int width);
96 | void TransposeUVWx8_SSE2(const uint8* src, int src_stride,
97 | uint8* dst_a, int dst_stride_a,
98 | uint8* dst_b, int dst_stride_b, int width);
99 | void TransposeUVWx8_NEON(const uint8* src, int src_stride,
100 | uint8* dst_a, int dst_stride_a,
101 | uint8* dst_b, int dst_stride_b, int width);
102 | void TransposeUVWx8_DSPR2(const uint8* src, int src_stride,
103 | uint8* dst_a, int dst_stride_a,
104 | uint8* dst_b, int dst_stride_b, int width);
105 |
106 | void TransposeUVWx8_Any_SSE2(const uint8* src, int src_stride,
107 | uint8* dst_a, int dst_stride_a,
108 | uint8* dst_b, int dst_stride_b, int width);
109 | void TransposeUVWx8_Any_NEON(const uint8* src, int src_stride,
110 | uint8* dst_a, int dst_stride_a,
111 | uint8* dst_b, int dst_stride_b, int width);
112 | void TransposeUVWx8_Any_DSPR2(const uint8* src, int src_stride,
113 | uint8* dst_a, int dst_stride_a,
114 | uint8* dst_b, int dst_stride_b, int width);
115 |
116 | #ifdef __cplusplus
117 | } // extern "C"
118 | } // namespace libyuv
119 | #endif
120 |
121 | #endif // INCLUDE_LIBYUV_ROTATE_ROW_H_
122 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/mjpeg_decoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_MJPEG_DECODER_H_
12 | #define INCLUDE_LIBYUV_MJPEG_DECODER_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | // NOTE: For a simplified public API use convert.h MJPGToI420().
18 |
19 | struct jpeg_common_struct;
20 | struct jpeg_decompress_struct;
21 | struct jpeg_source_mgr;
22 |
23 | namespace libyuv {
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size);
30 |
31 | #ifdef __cplusplus
32 | } // extern "C"
33 | #endif
34 |
35 | static const uint32 kUnknownDataSize = 0xFFFFFFFF;
36 |
37 | enum JpegSubsamplingType {
38 | kJpegYuv420,
39 | kJpegYuv422,
40 | kJpegYuv444,
41 | kJpegYuv400,
42 | kJpegUnknown
43 | };
44 |
45 | struct Buffer {
46 | const uint8* data;
47 | int len;
48 | };
49 |
50 | struct BufferVector {
51 | Buffer* buffers;
52 | int len;
53 | int pos;
54 | };
55 |
56 | struct SetJmpErrorMgr;
57 |
58 | // MJPEG ("Motion JPEG") is a pseudo-standard video codec where the frames are
59 | // simply independent JPEG images with a fixed huffman table (which is omitted).
60 | // It is rarely used in video transmission, but is common as a camera capture
61 | // format, especially in Logitech devices. This class implements a decoder for
62 | // MJPEG frames.
63 | //
64 | // See http://tools.ietf.org/html/rfc2435
65 | class LIBYUV_API MJpegDecoder {
66 | public:
67 | typedef void (*CallbackFunction)(void* opaque,
68 | const uint8* const* data,
69 | const int* strides,
70 | int rows);
71 |
72 | static const int kColorSpaceUnknown;
73 | static const int kColorSpaceGrayscale;
74 | static const int kColorSpaceRgb;
75 | static const int kColorSpaceYCbCr;
76 | static const int kColorSpaceCMYK;
77 | static const int kColorSpaceYCCK;
78 |
79 | MJpegDecoder();
80 | ~MJpegDecoder();
81 |
82 | // Loads a new frame, reads its headers, and determines the uncompressed
83 | // image format.
84 | // Returns LIBYUV_TRUE if image looks valid and format is supported.
85 | // If return value is LIBYUV_TRUE, then the values for all the following
86 | // getters are populated.
87 | // src_len is the size of the compressed mjpeg frame in bytes.
88 | LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len);
89 |
90 | // Returns width of the last loaded frame in pixels.
91 | int GetWidth();
92 |
93 | // Returns height of the last loaded frame in pixels.
94 | int GetHeight();
95 |
96 | // Returns format of the last loaded frame. The return value is one of the
97 | // kColorSpace* constants.
98 | int GetColorSpace();
99 |
100 | // Number of color components in the color space.
101 | int GetNumComponents();
102 |
103 | // Sample factors of the n-th component.
104 | int GetHorizSampFactor(int component);
105 |
106 | int GetVertSampFactor(int component);
107 |
108 | int GetHorizSubSampFactor(int component);
109 |
110 | int GetVertSubSampFactor(int component);
111 |
112 | // Public for testability.
113 | int GetImageScanlinesPerImcuRow();
114 |
115 | // Public for testability.
116 | int GetComponentScanlinesPerImcuRow(int component);
117 |
118 | // Width of a component in bytes.
119 | int GetComponentWidth(int component);
120 |
121 | // Height of a component.
122 | int GetComponentHeight(int component);
123 |
124 | // Width of a component in bytes with padding for DCTSIZE. Public for testing.
125 | int GetComponentStride(int component);
126 |
127 | // Size of a component in bytes.
128 | int GetComponentSize(int component);
129 |
130 | // Call this after LoadFrame() if you decide you don't want to decode it
131 | // after all.
132 | LIBYUV_BOOL UnloadFrame();
133 |
134 | // Decodes the entire image into a one-buffer-per-color-component format.
135 | // dst_width must match exactly. dst_height must be <= to image height; if
136 | // less, the image is cropped. "planes" must have size equal to at least
137 | // GetNumComponents() and they must point to non-overlapping buffers of size
138 | // at least GetComponentSize(i). The pointers in planes are incremented
139 | // to point to after the end of the written data.
140 | // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
141 | LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height);
142 |
143 | // Decodes the entire image and passes the data via repeated calls to a
144 | // callback function. Each call will get the data for a whole number of
145 | // image scanlines.
146 | // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
147 | LIBYUV_BOOL DecodeToCallback(CallbackFunction fn, void* opaque,
148 | int dst_width, int dst_height);
149 |
150 | // The helper function which recognizes the jpeg sub-sampling type.
151 | static JpegSubsamplingType JpegSubsamplingTypeHelper(
152 | int* subsample_x, int* subsample_y, int number_of_components);
153 |
154 | private:
155 | void AllocOutputBuffers(int num_outbufs);
156 | void DestroyOutputBuffers();
157 |
158 | LIBYUV_BOOL StartDecode();
159 | LIBYUV_BOOL FinishDecode();
160 |
161 | void SetScanlinePointers(uint8** data);
162 | LIBYUV_BOOL DecodeImcuRow();
163 |
164 | int GetComponentScanlinePadding(int component);
165 |
166 | // A buffer holding the input data for a frame.
167 | Buffer buf_;
168 | BufferVector buf_vec_;
169 |
170 | jpeg_decompress_struct* decompress_struct_;
171 | jpeg_source_mgr* source_mgr_;
172 | SetJmpErrorMgr* error_mgr_;
173 |
174 | // LIBYUV_TRUE iff at least one component has scanline padding. (i.e.,
175 | // GetComponentScanlinePadding() != 0.)
176 | LIBYUV_BOOL has_scanline_padding_;
177 |
178 | // Temporaries used to point to scanline outputs.
179 | int num_outbufs_; // Outermost size of all arrays below.
180 | uint8*** scanlines_;
181 | int* scanlines_sizes_;
182 | // Temporary buffer used for decoding when we can't decode directly to the
183 | // output buffers. Large enough for just one iMCU row.
184 | uint8** databuf_;
185 | int* databuf_strides_;
186 | };
187 |
188 | } // namespace libyuv
189 |
190 | #endif // __cplusplus
191 | #endif // INCLUDE_LIBYUV_MJPEG_DECODER_H_
192 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/convert_from_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_
12 | #define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Copy ARGB to ARGB.
22 | #define ARGBToARGB ARGBCopy
23 | LIBYUV_API
24 | int ARGBCopy(const uint8* src_argb, int src_stride_argb,
25 | uint8* dst_argb, int dst_stride_argb,
26 | int width, int height);
27 |
28 | // Convert ARGB To BGRA.
29 | LIBYUV_API
30 | int ARGBToBGRA(const uint8* src_argb, int src_stride_argb,
31 | uint8* dst_bgra, int dst_stride_bgra,
32 | int width, int height);
33 |
34 | // Convert ARGB To ABGR.
35 | LIBYUV_API
36 | int ARGBToABGR(const uint8* src_argb, int src_stride_argb,
37 | uint8* dst_abgr, int dst_stride_abgr,
38 | int width, int height);
39 |
40 | // Convert ARGB To RGBA.
41 | LIBYUV_API
42 | int ARGBToRGBA(const uint8* src_argb, int src_stride_argb,
43 | uint8* dst_rgba, int dst_stride_rgba,
44 | int width, int height);
45 |
46 | // Convert ARGB To RGB24.
47 | LIBYUV_API
48 | int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
49 | uint8* dst_rgb24, int dst_stride_rgb24,
50 | int width, int height);
51 |
52 | // Convert ARGB To RAW.
53 | LIBYUV_API
54 | int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
55 | uint8* dst_rgb, int dst_stride_rgb,
56 | int width, int height);
57 |
58 | // Convert ARGB To RGB565.
59 | LIBYUV_API
60 | int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
61 | uint8* dst_rgb565, int dst_stride_rgb565,
62 | int width, int height);
63 |
64 | // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes).
65 | // Values in dither matrix from 0 to 7 recommended.
66 | // The order of the dither matrix is first byte is upper left.
67 | // TODO(fbarchard): Consider pointer to 2d array for dither4x4.
68 | // const uint8(*dither)[4][4];
69 | LIBYUV_API
70 | int ARGBToRGB565Dither(const uint8* src_argb, int src_stride_argb,
71 | uint8* dst_rgb565, int dst_stride_rgb565,
72 | const uint8* dither4x4, int width, int height);
73 |
74 | // Convert ARGB To ARGB1555.
75 | LIBYUV_API
76 | int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
77 | uint8* dst_argb1555, int dst_stride_argb1555,
78 | int width, int height);
79 |
80 | // Convert ARGB To ARGB4444.
81 | LIBYUV_API
82 | int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
83 | uint8* dst_argb4444, int dst_stride_argb4444,
84 | int width, int height);
85 |
86 | // Convert ARGB To I444.
87 | LIBYUV_API
88 | int ARGBToI444(const uint8* src_argb, int src_stride_argb,
89 | uint8* dst_y, int dst_stride_y,
90 | uint8* dst_u, int dst_stride_u,
91 | uint8* dst_v, int dst_stride_v,
92 | int width, int height);
93 |
94 | // Convert ARGB To I422.
95 | LIBYUV_API
96 | int ARGBToI422(const uint8* src_argb, int src_stride_argb,
97 | uint8* dst_y, int dst_stride_y,
98 | uint8* dst_u, int dst_stride_u,
99 | uint8* dst_v, int dst_stride_v,
100 | int width, int height);
101 |
102 | // Convert ARGB To I420. (also in convert.h)
103 | LIBYUV_API
104 | int ARGBToI420(const uint8* src_argb, int src_stride_argb,
105 | uint8* dst_y, int dst_stride_y,
106 | uint8* dst_u, int dst_stride_u,
107 | uint8* dst_v, int dst_stride_v,
108 | int width, int height);
109 |
110 | // Convert ARGB to J420. (JPeg full range I420).
111 | LIBYUV_API
112 | int ARGBToJ420(const uint8* src_argb, int src_stride_argb,
113 | uint8* dst_yj, int dst_stride_yj,
114 | uint8* dst_u, int dst_stride_u,
115 | uint8* dst_v, int dst_stride_v,
116 | int width, int height);
117 |
118 | // Convert ARGB to J422.
119 | LIBYUV_API
120 | int ARGBToJ422(const uint8* src_argb, int src_stride_argb,
121 | uint8* dst_yj, int dst_stride_yj,
122 | uint8* dst_u, int dst_stride_u,
123 | uint8* dst_v, int dst_stride_v,
124 | int width, int height);
125 |
126 | // Convert ARGB to J400. (JPeg full range).
127 | LIBYUV_API
128 | int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
129 | uint8* dst_yj, int dst_stride_yj,
130 | int width, int height);
131 |
132 | // Convert ARGB to I400.
133 | LIBYUV_API
134 | int ARGBToI400(const uint8* src_argb, int src_stride_argb,
135 | uint8* dst_y, int dst_stride_y,
136 | int width, int height);
137 |
138 | // Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB)
139 | LIBYUV_API
140 | int ARGBToG(const uint8* src_argb, int src_stride_argb,
141 | uint8* dst_g, int dst_stride_g,
142 | int width, int height);
143 |
144 | // Convert ARGB To NV12.
145 | LIBYUV_API
146 | int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
147 | uint8* dst_y, int dst_stride_y,
148 | uint8* dst_uv, int dst_stride_uv,
149 | int width, int height);
150 |
151 | // Convert ARGB To NV21.
152 | LIBYUV_API
153 | int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
154 | uint8* dst_y, int dst_stride_y,
155 | uint8* dst_vu, int dst_stride_vu,
156 | int width, int height);
157 |
158 | // Convert ARGB To NV21.
159 | LIBYUV_API
160 | int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
161 | uint8* dst_y, int dst_stride_y,
162 | uint8* dst_vu, int dst_stride_vu,
163 | int width, int height);
164 |
165 | // Convert ARGB To YUY2.
166 | LIBYUV_API
167 | int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
168 | uint8* dst_yuy2, int dst_stride_yuy2,
169 | int width, int height);
170 |
171 | // Convert ARGB To UYVY.
172 | LIBYUV_API
173 | int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
174 | uint8* dst_uyvy, int dst_stride_uyvy,
175 | int width, int height);
176 |
177 | #ifdef __cplusplus
178 | } // extern "C"
179 | } // namespace libyuv
180 | #endif
181 |
182 | #endif // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_
183 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/convert_from.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CONVERT_FROM_H_
12 | #define INCLUDE_LIBYUV_CONVERT_FROM_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/rotate.h"
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | // See Also convert.h for conversions from formats to I420.
23 |
24 | // I420Copy in convert to I420ToI420.
25 |
26 | LIBYUV_API
27 | int I420ToI422(const uint8* src_y, int src_stride_y,
28 | const uint8* src_u, int src_stride_u,
29 | const uint8* src_v, int src_stride_v,
30 | uint8* dst_y, int dst_stride_y,
31 | uint8* dst_u, int dst_stride_u,
32 | uint8* dst_v, int dst_stride_v,
33 | int width, int height);
34 |
35 | LIBYUV_API
36 | int I420ToI444(const uint8* src_y, int src_stride_y,
37 | const uint8* src_u, int src_stride_u,
38 | const uint8* src_v, int src_stride_v,
39 | uint8* dst_y, int dst_stride_y,
40 | uint8* dst_u, int dst_stride_u,
41 | uint8* dst_v, int dst_stride_v,
42 | int width, int height);
43 |
44 | // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21.
45 | LIBYUV_API
46 | int I400Copy(const uint8* src_y, int src_stride_y,
47 | uint8* dst_y, int dst_stride_y,
48 | int width, int height);
49 |
50 | LIBYUV_API
51 | int I420ToNV12(const uint8* src_y, int src_stride_y,
52 | const uint8* src_u, int src_stride_u,
53 | const uint8* src_v, int src_stride_v,
54 | uint8* dst_y, int dst_stride_y,
55 | uint8* dst_uv, int dst_stride_uv,
56 | int width, int height);
57 |
58 | LIBYUV_API
59 | int I420ToNV21(const uint8* src_y, int src_stride_y,
60 | const uint8* src_u, int src_stride_u,
61 | const uint8* src_v, int src_stride_v,
62 | uint8* dst_y, int dst_stride_y,
63 | uint8* dst_vu, int dst_stride_vu,
64 | int width, int height);
65 |
66 | LIBYUV_API
67 | int I420ToYUY2(const uint8* src_y, int src_stride_y,
68 | const uint8* src_u, int src_stride_u,
69 | const uint8* src_v, int src_stride_v,
70 | uint8* dst_frame, int dst_stride_frame,
71 | int width, int height);
72 |
73 | LIBYUV_API
74 | int I420ToUYVY(const uint8* src_y, int src_stride_y,
75 | const uint8* src_u, int src_stride_u,
76 | const uint8* src_v, int src_stride_v,
77 | uint8* dst_frame, int dst_stride_frame,
78 | int width, int height);
79 |
80 | LIBYUV_API
81 | int I420ToARGB(const uint8* src_y, int src_stride_y,
82 | const uint8* src_u, int src_stride_u,
83 | const uint8* src_v, int src_stride_v,
84 | uint8* dst_argb, int dst_stride_argb,
85 | int width, int height);
86 |
87 | LIBYUV_API
88 | int I420ToBGRA(const uint8* src_y, int src_stride_y,
89 | const uint8* src_u, int src_stride_u,
90 | const uint8* src_v, int src_stride_v,
91 | uint8* dst_argb, int dst_stride_argb,
92 | int width, int height);
93 |
94 | LIBYUV_API
95 | int I420ToABGR(const uint8* src_y, int src_stride_y,
96 | const uint8* src_u, int src_stride_u,
97 | const uint8* src_v, int src_stride_v,
98 | uint8* dst_argb, int dst_stride_argb,
99 | int width, int height);
100 |
101 | LIBYUV_API
102 | int I420ToRGBA(const uint8* src_y, int src_stride_y,
103 | const uint8* src_u, int src_stride_u,
104 | const uint8* src_v, int src_stride_v,
105 | uint8* dst_rgba, int dst_stride_rgba,
106 | int width, int height);
107 |
108 | LIBYUV_API
109 | int I420ToRGB24(const uint8* src_y, int src_stride_y,
110 | const uint8* src_u, int src_stride_u,
111 | const uint8* src_v, int src_stride_v,
112 | uint8* dst_frame, int dst_stride_frame,
113 | int width, int height);
114 |
115 | LIBYUV_API
116 | int I420ToRAW(const uint8* src_y, int src_stride_y,
117 | const uint8* src_u, int src_stride_u,
118 | const uint8* src_v, int src_stride_v,
119 | uint8* dst_frame, int dst_stride_frame,
120 | int width, int height);
121 |
122 | LIBYUV_API
123 | int I420ToRGB565(const uint8* src_y, int src_stride_y,
124 | const uint8* src_u, int src_stride_u,
125 | const uint8* src_v, int src_stride_v,
126 | uint8* dst_frame, int dst_stride_frame,
127 | int width, int height);
128 |
129 | // Convert I420 To RGB565 with 4x4 dither matrix (16 bytes).
130 | // Values in dither matrix from 0 to 7 recommended.
131 | // The order of the dither matrix is first byte is upper left.
132 |
133 | LIBYUV_API
134 | int I420ToRGB565Dither(const uint8* src_y, int src_stride_y,
135 | const uint8* src_u, int src_stride_u,
136 | const uint8* src_v, int src_stride_v,
137 | uint8* dst_frame, int dst_stride_frame,
138 | const uint8* dither4x4, int width, int height);
139 |
140 | LIBYUV_API
141 | int I420ToARGB1555(const uint8* src_y, int src_stride_y,
142 | const uint8* src_u, int src_stride_u,
143 | const uint8* src_v, int src_stride_v,
144 | uint8* dst_frame, int dst_stride_frame,
145 | int width, int height);
146 |
147 | LIBYUV_API
148 | int I420ToARGB4444(const uint8* src_y, int src_stride_y,
149 | const uint8* src_u, int src_stride_u,
150 | const uint8* src_v, int src_stride_v,
151 | uint8* dst_frame, int dst_stride_frame,
152 | int width, int height);
153 |
154 | // Convert I420 to specified format.
155 | // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
156 | // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
157 | LIBYUV_API
158 | int ConvertFromI420(const uint8* y, int y_stride,
159 | const uint8* u, int u_stride,
160 | const uint8* v, int v_stride,
161 | uint8* dst_sample, int dst_sample_stride,
162 | int width, int height,
163 | uint32 format);
164 |
165 | #ifdef __cplusplus
166 | } // extern "C"
167 | } // namespace libyuv
168 | #endif
169 |
170 | #endif // INCLUDE_LIBYUV_CONVERT_FROM_H_
171 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/video_common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | // Common definitions for video, including fourcc and VideoFormat.
12 |
13 | #ifndef INCLUDE_LIBYUV_VIDEO_COMMON_H_
14 | #define INCLUDE_LIBYUV_VIDEO_COMMON_H_
15 |
16 | #include "libyuv/basic_types.h"
17 |
18 | #ifdef __cplusplus
19 | namespace libyuv {
20 | extern "C" {
21 | #endif
22 |
23 | //////////////////////////////////////////////////////////////////////////////
24 | // Definition of FourCC codes
25 | //////////////////////////////////////////////////////////////////////////////
26 |
27 | // Convert four characters to a FourCC code.
28 | // Needs to be a macro otherwise the OS X compiler complains when the kFormat*
29 | // constants are used in a switch.
30 | #ifdef __cplusplus
31 | #define FOURCC(a, b, c, d) ( \
32 | (static_cast(a)) | (static_cast(b) << 8) | \
33 | (static_cast(c) << 16) | (static_cast(d) << 24))
34 | #else
35 | #define FOURCC(a, b, c, d) ( \
36 | ((uint32)(a)) | ((uint32)(b) << 8) | /* NOLINT */ \
37 | ((uint32)(c) << 16) | ((uint32)(d) << 24)) /* NOLINT */
38 | #endif
39 |
40 | // Some pages discussing FourCC codes:
41 | // http://www.fourcc.org/yuv.php
42 | // http://v4l2spec.bytesex.org/spec/book1.htm
43 | // http://developer.apple.com/quicktime/icefloe/dispatch020.html
44 | // http://msdn.microsoft.com/library/windows/desktop/dd206750.aspx#nv12
45 | // http://people.xiph.org/~xiphmont/containers/nut/nut4cc.txt
46 |
47 | // FourCC codes grouped according to implementation efficiency.
48 | // Primary formats should convert in 1 efficient step.
49 | // Secondary formats are converted in 2 steps.
50 | // Auxilliary formats call primary converters.
51 | enum FourCC {
52 | // 8 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
53 | FOURCC_I420 = FOURCC('I', '4', '2', '0'),
54 | FOURCC_I422 = FOURCC('I', '4', '2', '2'),
55 | FOURCC_I444 = FOURCC('I', '4', '4', '4'),
56 | FOURCC_I411 = FOURCC('I', '4', '1', '1'), // deprecated.
57 | FOURCC_I400 = FOURCC('I', '4', '0', '0'),
58 | FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
59 | FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
60 | FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
61 | FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
62 |
63 | // 1 Secondary YUV format: row biplanar.
64 | FOURCC_M420 = FOURCC('M', '4', '2', '0'),
65 | FOURCC_Q420 = FOURCC('Q', '4', '2', '0'), // deprecated.
66 |
67 | // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp.
68 | FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
69 | FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
70 | FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
71 | FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
72 | FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
73 | FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
74 | FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE.
75 | FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE.
76 | FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE.
77 |
78 | // 4 Secondary RGB formats: 4 Bayer Patterns. deprecated.
79 | FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
80 | FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
81 | FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
82 | FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
83 |
84 | // 1 Primary Compressed YUV format.
85 | FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
86 |
87 | // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
88 | FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
89 | FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
90 | FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
91 | FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420.
92 | FOURCC_J420 = FOURCC('J', '4', '2', '0'),
93 | FOURCC_J400 = FOURCC('J', '4', '0', '0'), // unofficial fourcc
94 | FOURCC_H420 = FOURCC('H', '4', '2', '0'), // unofficial fourcc
95 |
96 | // 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
97 | FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
98 | FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422.
99 | FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444.
100 | FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2.
101 | FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac.
102 | FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY.
103 | FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac.
104 | FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG.
105 | FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac.
106 | FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR.
107 | FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW.
108 | FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG.
109 | FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB
110 | FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB
111 | FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO.
112 | FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP.
113 | FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO.
114 |
115 | // 1 Auxiliary compressed YUV format set aside for capturer.
116 | FOURCC_H264 = FOURCC('H', '2', '6', '4'),
117 |
118 | // Match any fourcc.
119 | FOURCC_ANY = -1,
120 | };
121 |
122 | enum FourCCBpp {
123 | // Canonical fourcc codes used in our code.
124 | FOURCC_BPP_I420 = 12,
125 | FOURCC_BPP_I422 = 16,
126 | FOURCC_BPP_I444 = 24,
127 | FOURCC_BPP_I411 = 12,
128 | FOURCC_BPP_I400 = 8,
129 | FOURCC_BPP_NV21 = 12,
130 | FOURCC_BPP_NV12 = 12,
131 | FOURCC_BPP_YUY2 = 16,
132 | FOURCC_BPP_UYVY = 16,
133 | FOURCC_BPP_M420 = 12,
134 | FOURCC_BPP_Q420 = 12,
135 | FOURCC_BPP_ARGB = 32,
136 | FOURCC_BPP_BGRA = 32,
137 | FOURCC_BPP_ABGR = 32,
138 | FOURCC_BPP_RGBA = 32,
139 | FOURCC_BPP_24BG = 24,
140 | FOURCC_BPP_RAW = 24,
141 | FOURCC_BPP_RGBP = 16,
142 | FOURCC_BPP_RGBO = 16,
143 | FOURCC_BPP_R444 = 16,
144 | FOURCC_BPP_RGGB = 8,
145 | FOURCC_BPP_BGGR = 8,
146 | FOURCC_BPP_GRBG = 8,
147 | FOURCC_BPP_GBRG = 8,
148 | FOURCC_BPP_YV12 = 12,
149 | FOURCC_BPP_YV16 = 16,
150 | FOURCC_BPP_YV24 = 24,
151 | FOURCC_BPP_YU12 = 12,
152 | FOURCC_BPP_J420 = 12,
153 | FOURCC_BPP_J400 = 8,
154 | FOURCC_BPP_H420 = 12,
155 | FOURCC_BPP_MJPG = 0, // 0 means unknown.
156 | FOURCC_BPP_H264 = 0,
157 | FOURCC_BPP_IYUV = 12,
158 | FOURCC_BPP_YU16 = 16,
159 | FOURCC_BPP_YU24 = 24,
160 | FOURCC_BPP_YUYV = 16,
161 | FOURCC_BPP_YUVS = 16,
162 | FOURCC_BPP_HDYC = 16,
163 | FOURCC_BPP_2VUY = 16,
164 | FOURCC_BPP_JPEG = 1,
165 | FOURCC_BPP_DMB1 = 1,
166 | FOURCC_BPP_BA81 = 8,
167 | FOURCC_BPP_RGB3 = 24,
168 | FOURCC_BPP_BGR3 = 24,
169 | FOURCC_BPP_CM32 = 32,
170 | FOURCC_BPP_CM24 = 24,
171 |
172 | // Match any fourcc.
173 | FOURCC_BPP_ANY = 0, // 0 means unknown.
174 | };
175 |
176 | // Converts fourcc aliases into canonical ones.
177 | LIBYUV_API uint32 CanonicalFourCC(uint32 fourcc);
178 |
179 | #ifdef __cplusplus
180 | } // extern "C"
181 | } // namespace libyuv
182 | #endif
183 |
184 | #endif // INCLUDE_LIBYUV_VIDEO_COMMON_H_
185 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/macros_msa.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_MACROS_MSA_H_
12 | #define INCLUDE_LIBYUV_MACROS_MSA_H_
13 |
14 | #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
15 | #include
16 | #include
17 |
18 | #if (__mips_isa_rev >= 6)
19 | #define LW(psrc) ({ \
20 | uint8* psrc_lw_m = (uint8*) (psrc); /* NOLINT */ \
21 | uint32 val_m; \
22 | asm volatile ( \
23 | "lw %[val_m], %[psrc_lw_m] \n\t" \
24 | : [val_m] "=r" (val_m) \
25 | : [psrc_lw_m] "m" (*psrc_lw_m) \
26 | ); \
27 | val_m; \
28 | })
29 |
30 | #if (__mips == 64)
31 | #define LD(psrc) ({ \
32 | uint8* psrc_ld_m = (uint8*) (psrc); /* NOLINT */ \
33 | uint64 val_m = 0; \
34 | asm volatile ( \
35 | "ld %[val_m], %[psrc_ld_m] \n\t" \
36 | : [val_m] "=r" (val_m) \
37 | : [psrc_ld_m] "m" (*psrc_ld_m) \
38 | ); \
39 | val_m; \
40 | })
41 | #else // !(__mips == 64)
42 | #define LD(psrc) ({ \
43 | uint8* psrc_ld_m = (uint8*) (psrc); /* NOLINT */ \
44 | uint32 val0_m, val1_m; \
45 | uint64 val_m = 0; \
46 | val0_m = LW(psrc_ld_m); \
47 | val1_m = LW(psrc_ld_m + 4); \
48 | val_m = (uint64) (val1_m); /* NOLINT */ \
49 | val_m = (uint64) ((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
50 | val_m = (uint64) (val_m | (uint64) val0_m); /* NOLINT */ \
51 | val_m; \
52 | })
53 | #endif // (__mips == 64)
54 | #else // !(__mips_isa_rev >= 6)
55 | #define LW(psrc) ({ \
56 | uint8* psrc_lw_m = (uint8*) (psrc); /* NOLINT */ \
57 | uint32 val_m; \
58 | asm volatile ( \
59 | "ulw %[val_m], %[psrc_lw_m] \n\t" \
60 | : [val_m] "=r" (val_m) \
61 | : [psrc_lw_m] "m" (*psrc_lw_m) \
62 | ); \
63 | val_m; \
64 | })
65 |
66 | #if (__mips == 64)
67 | #define LD(psrc) ({ \
68 | uint8* psrc_ld_m = (uint8*) (psrc); /* NOLINT */ \
69 | uint64 val_m = 0; \
70 | asm volatile ( \
71 | "uld %[val_m], %[psrc_ld_m] \n\t" \
72 | : [val_m] "=r" (val_m) \
73 | : [psrc_ld_m] "m" (*psrc_ld_m) \
74 | ); \
75 | val_m; \
76 | })
77 | #else // !(__mips == 64)
78 | #define LD(psrc) ({ \
79 | uint8* psrc_ld_m = (uint8*) (psrc); /* NOLINT */ \
80 | uint32 val0_m, val1_m; \
81 | uint64 val_m = 0; \
82 | val0_m = LW(psrc_ld_m); \
83 | val1_m = LW(psrc_ld_m + 4); \
84 | val_m = (uint64) (val1_m); /* NOLINT */ \
85 | val_m = (uint64) ((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
86 | val_m = (uint64) (val_m | (uint64) val0_m); /* NOLINT */ \
87 | val_m; \
88 | })
89 | #endif // (__mips == 64)
90 | #endif // (__mips_isa_rev >= 6)
91 |
92 | // TODO(fbarchard): Consider removing __VAR_ARGS versions.
93 | #define LD_B(RTYPE, psrc) *((RTYPE*)(psrc)) /* NOLINT */
94 | #define LD_UB(...) LD_B(v16u8, __VA_ARGS__)
95 |
96 | #define ST_B(RTYPE, in, pdst) *((RTYPE*)(pdst)) = (in) /* NOLINT */
97 | #define ST_UB(...) ST_B(v16u8, __VA_ARGS__)
98 |
99 | /* Description : Load two vectors with 16 'byte' sized elements
100 | Arguments : Inputs - psrc, stride
101 | Outputs - out0, out1
102 | Return Type - as per RTYPE
103 | Details : Load 16 byte elements in 'out0' from (psrc)
104 | Load 16 byte elements in 'out1' from (psrc + stride)
105 | */
106 | #define LD_B2(RTYPE, psrc, stride, out0, out1) { \
107 | out0 = LD_B(RTYPE, (psrc)); \
108 | out1 = LD_B(RTYPE, (psrc) + stride); \
109 | }
110 | #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__)
111 |
112 | #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \
113 | LD_B2(RTYPE, (psrc), stride, out0, out1); \
114 | LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \
115 | }
116 | #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__)
117 |
118 | /* Description : Store two vectors with stride each having 16 'byte' sized
119 | elements
120 | Arguments : Inputs - in0, in1, pdst, stride
121 | Details : Store 16 byte elements from 'in0' to (pdst)
122 | Store 16 byte elements from 'in1' to (pdst + stride)
123 | */
124 | #define ST_B2(RTYPE, in0, in1, pdst, stride) { \
125 | ST_B(RTYPE, in0, (pdst)); \
126 | ST_B(RTYPE, in1, (pdst) + stride); \
127 | }
128 | #define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__)
129 |
130 | #define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) { \
131 | ST_B2(RTYPE, in0, in1, (pdst), stride); \
132 | ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
133 | }
134 | #define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__)
135 |
136 | // TODO(fbarchard): Consider using __msa_vshf_b and __msa_ilvr_b directly.
137 | /* Description : Shuffle byte vector elements as per mask vector
138 | Arguments : Inputs - in0, in1, in2, in3, mask0, mask1
139 | Outputs - out0, out1
140 | Return Type - as per RTYPE
141 | Details : Byte elements from 'in0' & 'in1' are copied selectively to
142 | 'out0' as per control vector 'mask0'
143 | */
144 | #define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) { \
145 | out0 = (RTYPE) __msa_vshf_b((v16i8) mask0, (v16i8) in1, (v16i8) in0); \
146 | out1 = (RTYPE) __msa_vshf_b((v16i8) mask1, (v16i8) in3, (v16i8) in2); \
147 | }
148 | #define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__)
149 |
150 | /* Description : Interleave both left and right half of input vectors
151 | Arguments : Inputs - in0, in1
152 | Outputs - out0, out1
153 | Return Type - as per RTYPE
154 | Details : Right half of byte elements from 'in0' and 'in1' are
155 | interleaved and written to 'out0'
156 | */
157 | #define ILVRL_B2(RTYPE, in0, in1, out0, out1) { \
158 | out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \
159 | out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \
160 | }
161 | #define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__)
162 |
163 | #endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */
164 |
165 | #endif // INCLUDE_LIBYUV_MACROS_MSA_H_
166 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/convert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CONVERT_H_
12 | #define INCLUDE_LIBYUV_CONVERT_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #include "libyuv/rotate.h" // For enum RotationMode.
17 |
18 | // TODO(fbarchard): fix WebRTC source to include following libyuv headers:
19 | #include "libyuv/convert_argb.h" // For WebRTC I420ToARGB. b/620
20 | #include "libyuv/convert_from.h" // For WebRTC ConvertFromI420. b/620
21 | #include "libyuv/planar_functions.h" // For WebRTC I420Rect, CopyPlane. b/618
22 |
23 | #ifdef __cplusplus
24 | namespace libyuv {
25 | extern "C" {
26 | #endif
27 |
28 | // Convert I444 to I420.
29 | LIBYUV_API
30 | int I444ToI420(const uint8* src_y, int src_stride_y,
31 | const uint8* src_u, int src_stride_u,
32 | const uint8* src_v, int src_stride_v,
33 | uint8* dst_y, int dst_stride_y,
34 | uint8* dst_u, int dst_stride_u,
35 | uint8* dst_v, int dst_stride_v,
36 | int width, int height);
37 |
38 | // Convert I422 to I420.
39 | LIBYUV_API
40 | int I422ToI420(const uint8* src_y, int src_stride_y,
41 | const uint8* src_u, int src_stride_u,
42 | const uint8* src_v, int src_stride_v,
43 | uint8* dst_y, int dst_stride_y,
44 | uint8* dst_u, int dst_stride_u,
45 | uint8* dst_v, int dst_stride_v,
46 | int width, int height);
47 |
48 | // Copy I420 to I420.
49 | #define I420ToI420 I420Copy
50 | LIBYUV_API
51 | int I420Copy(const uint8* src_y, int src_stride_y,
52 | const uint8* src_u, int src_stride_u,
53 | const uint8* src_v, int src_stride_v,
54 | uint8* dst_y, int dst_stride_y,
55 | uint8* dst_u, int dst_stride_u,
56 | uint8* dst_v, int dst_stride_v,
57 | int width, int height);
58 |
59 | // Convert I400 (grey) to I420.
60 | LIBYUV_API
61 | int I400ToI420(const uint8* src_y, int src_stride_y,
62 | uint8* dst_y, int dst_stride_y,
63 | uint8* dst_u, int dst_stride_u,
64 | uint8* dst_v, int dst_stride_v,
65 | int width, int height);
66 |
67 | #define J400ToJ420 I400ToI420
68 |
69 | // Convert NV12 to I420.
70 | LIBYUV_API
71 | int NV12ToI420(const uint8* src_y, int src_stride_y,
72 | const uint8* src_uv, int src_stride_uv,
73 | uint8* dst_y, int dst_stride_y,
74 | uint8* dst_u, int dst_stride_u,
75 | uint8* dst_v, int dst_stride_v,
76 | int width, int height);
77 |
78 | // Convert NV21 to I420.
79 | LIBYUV_API
80 | int NV21ToI420(const uint8* src_y, int src_stride_y,
81 | const uint8* src_vu, int src_stride_vu,
82 | uint8* dst_y, int dst_stride_y,
83 | uint8* dst_u, int dst_stride_u,
84 | uint8* dst_v, int dst_stride_v,
85 | int width, int height);
86 |
87 | // Convert YUY2 to I420.
88 | LIBYUV_API
89 | int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2,
90 | uint8* dst_y, int dst_stride_y,
91 | uint8* dst_u, int dst_stride_u,
92 | uint8* dst_v, int dst_stride_v,
93 | int width, int height);
94 |
95 | // Convert UYVY to I420.
96 | LIBYUV_API
97 | int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
98 | uint8* dst_y, int dst_stride_y,
99 | uint8* dst_u, int dst_stride_u,
100 | uint8* dst_v, int dst_stride_v,
101 | int width, int height);
102 |
103 | // Convert M420 to I420.
104 | LIBYUV_API
105 | int M420ToI420(const uint8* src_m420, int src_stride_m420,
106 | uint8* dst_y, int dst_stride_y,
107 | uint8* dst_u, int dst_stride_u,
108 | uint8* dst_v, int dst_stride_v,
109 | int width, int height);
110 |
111 | // Convert Android420 to I420.
112 | LIBYUV_API
113 | int Android420ToI420(const uint8* src_y, int src_stride_y,
114 | const uint8* src_u, int src_stride_u,
115 | const uint8* src_v, int src_stride_v,
116 | int pixel_stride_uv,
117 | uint8* dst_y, int dst_stride_y,
118 | uint8* dst_u, int dst_stride_u,
119 | uint8* dst_v, int dst_stride_v,
120 | int width, int height);
121 |
122 | // ARGB little endian (bgra in memory) to I420.
123 | LIBYUV_API
124 | int ARGBToI420(const uint8* src_frame, int src_stride_frame,
125 | uint8* dst_y, int dst_stride_y,
126 | uint8* dst_u, int dst_stride_u,
127 | uint8* dst_v, int dst_stride_v,
128 | int width, int height);
129 |
130 | // BGRA little endian (argb in memory) to I420.
131 | LIBYUV_API
132 | int BGRAToI420(const uint8* src_frame, int src_stride_frame,
133 | uint8* dst_y, int dst_stride_y,
134 | uint8* dst_u, int dst_stride_u,
135 | uint8* dst_v, int dst_stride_v,
136 | int width, int height);
137 |
138 | // ABGR little endian (rgba in memory) to I420.
139 | LIBYUV_API
140 | int ABGRToI420(const uint8* src_frame, int src_stride_frame,
141 | uint8* dst_y, int dst_stride_y,
142 | uint8* dst_u, int dst_stride_u,
143 | uint8* dst_v, int dst_stride_v,
144 | int width, int height);
145 |
146 | // RGBA little endian (abgr in memory) to I420.
147 | LIBYUV_API
148 | int RGBAToI420(const uint8* src_frame, int src_stride_frame,
149 | uint8* dst_y, int dst_stride_y,
150 | uint8* dst_u, int dst_stride_u,
151 | uint8* dst_v, int dst_stride_v,
152 | int width, int height);
153 |
154 | // RGB little endian (bgr in memory) to I420.
155 | LIBYUV_API
156 | int RGB24ToI420(const uint8* src_frame, int src_stride_frame,
157 | uint8* dst_y, int dst_stride_y,
158 | uint8* dst_u, int dst_stride_u,
159 | uint8* dst_v, int dst_stride_v,
160 | int width, int height);
161 |
162 | // RGB big endian (rgb in memory) to I420.
163 | LIBYUV_API
164 | int RAWToI420(const uint8* src_frame, int src_stride_frame,
165 | uint8* dst_y, int dst_stride_y,
166 | uint8* dst_u, int dst_stride_u,
167 | uint8* dst_v, int dst_stride_v,
168 | int width, int height);
169 |
170 | // RGB16 (RGBP fourcc) little endian to I420.
171 | LIBYUV_API
172 | int RGB565ToI420(const uint8* src_frame, int src_stride_frame,
173 | uint8* dst_y, int dst_stride_y,
174 | uint8* dst_u, int dst_stride_u,
175 | uint8* dst_v, int dst_stride_v,
176 | int width, int height);
177 |
178 | // RGB15 (RGBO fourcc) little endian to I420.
179 | LIBYUV_API
180 | int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame,
181 | uint8* dst_y, int dst_stride_y,
182 | uint8* dst_u, int dst_stride_u,
183 | uint8* dst_v, int dst_stride_v,
184 | int width, int height);
185 |
186 | // RGB12 (R444 fourcc) little endian to I420.
187 | LIBYUV_API
188 | int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame,
189 | uint8* dst_y, int dst_stride_y,
190 | uint8* dst_u, int dst_stride_u,
191 | uint8* dst_v, int dst_stride_v,
192 | int width, int height);
193 |
194 | #ifdef HAVE_JPEG
195 | // src_width/height provided by capture.
196 | // dst_width/height for clipping determine final size.
197 | LIBYUV_API
198 | int MJPGToI420(const uint8* sample, size_t sample_size,
199 | uint8* dst_y, int dst_stride_y,
200 | uint8* dst_u, int dst_stride_u,
201 | uint8* dst_v, int dst_stride_v,
202 | int src_width, int src_height,
203 | int dst_width, int dst_height);
204 |
205 | // Query size of MJPG in pixels.
206 | LIBYUV_API
207 | int MJPGSize(const uint8* sample, size_t sample_size,
208 | int* width, int* height);
209 | #endif
210 |
211 | // Convert camera sample to I420 with cropping, rotation and vertical flip.
212 | // "src_size" is needed to parse MJPG.
213 | // "dst_stride_y" number of bytes in a row of the dst_y plane.
214 | // Normally this would be the same as dst_width, with recommended alignment
215 | // to 16 bytes for better efficiency.
216 | // If rotation of 90 or 270 is used, stride is affected. The caller should
217 | // allocate the I420 buffer according to rotation.
218 | // "dst_stride_u" number of bytes in a row of the dst_u plane.
219 | // Normally this would be the same as (dst_width + 1) / 2, with
220 | // recommended alignment to 16 bytes for better efficiency.
221 | // If rotation of 90 or 270 is used, stride is affected.
222 | // "crop_x" and "crop_y" are starting position for cropping.
223 | // To center, crop_x = (src_width - dst_width) / 2
224 | // crop_y = (src_height - dst_height) / 2
225 | // "src_width" / "src_height" is size of src_frame in pixels.
226 | // "src_height" can be negative indicating a vertically flipped image source.
227 | // "crop_width" / "crop_height" is the size to crop the src to.
228 | // Must be less than or equal to src_width/src_height
229 | // Cropping parameters are pre-rotation.
230 | // "rotation" can be 0, 90, 180 or 270.
231 | // "format" is a fourcc. ie 'I420', 'YUY2'
232 | // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
233 | LIBYUV_API
234 | int ConvertToI420(const uint8* src_frame, size_t src_size,
235 | uint8* dst_y, int dst_stride_y,
236 | uint8* dst_u, int dst_stride_u,
237 | uint8* dst_v, int dst_stride_v,
238 | int crop_x, int crop_y,
239 | int src_width, int src_height,
240 | int crop_width, int crop_height,
241 | enum RotationMode rotation,
242 | uint32 format);
243 |
244 | #ifdef __cplusplus
245 | } // extern "C"
246 | } // namespace libyuv
247 | #endif
248 |
249 | #endif // INCLUDE_LIBYUV_CONVERT_H_
250 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/convert_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_CONVERT_ARGB_H_
12 | #define INCLUDE_LIBYUV_CONVERT_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #include "libyuv/rotate.h" // For enum RotationMode.
17 |
18 | // TODO(fbarchard): This set of functions should exactly match convert.h
19 | // TODO(fbarchard): Add tests. Create random content of right size and convert
20 | // with C vs Opt and or to I420 and compare.
21 | // TODO(fbarchard): Some of these functions lack parameter setting.
22 |
23 | #ifdef __cplusplus
24 | namespace libyuv {
25 | extern "C" {
26 | #endif
27 |
28 | // Alias.
29 | #define ARGBToARGB ARGBCopy
30 |
31 | // Copy ARGB to ARGB.
32 | LIBYUV_API
33 | int ARGBCopy(const uint8* src_argb, int src_stride_argb,
34 | uint8* dst_argb, int dst_stride_argb,
35 | int width, int height);
36 |
37 | // Convert I420 to ARGB.
38 | LIBYUV_API
39 | int I420ToARGB(const uint8* src_y, int src_stride_y,
40 | const uint8* src_u, int src_stride_u,
41 | const uint8* src_v, int src_stride_v,
42 | uint8* dst_argb, int dst_stride_argb,
43 | int width, int height);
44 |
45 | // Duplicate prototype for function in convert_from.h for remoting.
46 | LIBYUV_API
47 | int I420ToABGR(const uint8* src_y, int src_stride_y,
48 | const uint8* src_u, int src_stride_u,
49 | const uint8* src_v, int src_stride_v,
50 | uint8* dst_argb, int dst_stride_argb,
51 | int width, int height);
52 |
53 | // Convert I422 to ARGB.
54 | LIBYUV_API
55 | int I422ToARGB(const uint8* src_y, int src_stride_y,
56 | const uint8* src_u, int src_stride_u,
57 | const uint8* src_v, int src_stride_v,
58 | uint8* dst_argb, int dst_stride_argb,
59 | int width, int height);
60 |
61 | // Convert I444 to ARGB.
62 | LIBYUV_API
63 | int I444ToARGB(const uint8* src_y, int src_stride_y,
64 | const uint8* src_u, int src_stride_u,
65 | const uint8* src_v, int src_stride_v,
66 | uint8* dst_argb, int dst_stride_argb,
67 | int width, int height);
68 |
69 | // Convert J444 to ARGB.
70 | LIBYUV_API
71 | int J444ToARGB(const uint8* src_y, int src_stride_y,
72 | const uint8* src_u, int src_stride_u,
73 | const uint8* src_v, int src_stride_v,
74 | uint8* dst_argb, int dst_stride_argb,
75 | int width, int height);
76 |
77 | // Convert I444 to ABGR.
78 | LIBYUV_API
79 | int I444ToABGR(const uint8* src_y, int src_stride_y,
80 | const uint8* src_u, int src_stride_u,
81 | const uint8* src_v, int src_stride_v,
82 | uint8* dst_abgr, int dst_stride_abgr,
83 | int width, int height);
84 |
85 | // Convert I420 with Alpha to preattenuated ARGB.
86 | LIBYUV_API
87 | int I420AlphaToARGB(const uint8* src_y, int src_stride_y,
88 | const uint8* src_u, int src_stride_u,
89 | const uint8* src_v, int src_stride_v,
90 | const uint8* src_a, int src_stride_a,
91 | uint8* dst_argb, int dst_stride_argb,
92 | int width, int height, int attenuate);
93 |
94 | // Convert I420 with Alpha to preattenuated ABGR.
95 | LIBYUV_API
96 | int I420AlphaToABGR(const uint8* src_y, int src_stride_y,
97 | const uint8* src_u, int src_stride_u,
98 | const uint8* src_v, int src_stride_v,
99 | const uint8* src_a, int src_stride_a,
100 | uint8* dst_abgr, int dst_stride_abgr,
101 | int width, int height, int attenuate);
102 |
103 | // Convert I400 (grey) to ARGB. Reverse of ARGBToI400.
104 | LIBYUV_API
105 | int I400ToARGB(const uint8* src_y, int src_stride_y,
106 | uint8* dst_argb, int dst_stride_argb,
107 | int width, int height);
108 |
109 | // Convert J400 (jpeg grey) to ARGB.
110 | LIBYUV_API
111 | int J400ToARGB(const uint8* src_y, int src_stride_y,
112 | uint8* dst_argb, int dst_stride_argb,
113 | int width, int height);
114 |
115 | // Alias.
116 | #define YToARGB I400ToARGB
117 |
118 | // Convert NV12 to ARGB.
119 | LIBYUV_API
120 | int NV12ToARGB(const uint8* src_y, int src_stride_y,
121 | const uint8* src_uv, int src_stride_uv,
122 | uint8* dst_argb, int dst_stride_argb,
123 | int width, int height);
124 |
125 | // Convert NV21 to ARGB.
126 | LIBYUV_API
127 | int NV21ToARGB(const uint8* src_y, int src_stride_y,
128 | const uint8* src_vu, int src_stride_vu,
129 | uint8* dst_argb, int dst_stride_argb,
130 | int width, int height);
131 |
132 | // Convert M420 to ARGB.
133 | LIBYUV_API
134 | int M420ToARGB(const uint8* src_m420, int src_stride_m420,
135 | uint8* dst_argb, int dst_stride_argb,
136 | int width, int height);
137 |
138 | // Convert YUY2 to ARGB.
139 | LIBYUV_API
140 | int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
141 | uint8* dst_argb, int dst_stride_argb,
142 | int width, int height);
143 |
144 | // Convert UYVY to ARGB.
145 | LIBYUV_API
146 | int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
147 | uint8* dst_argb, int dst_stride_argb,
148 | int width, int height);
149 |
150 | // Convert J420 to ARGB.
151 | LIBYUV_API
152 | int J420ToARGB(const uint8* src_y, int src_stride_y,
153 | const uint8* src_u, int src_stride_u,
154 | const uint8* src_v, int src_stride_v,
155 | uint8* dst_argb, int dst_stride_argb,
156 | int width, int height);
157 |
158 | // Convert J422 to ARGB.
159 | LIBYUV_API
160 | int J422ToARGB(const uint8* src_y, int src_stride_y,
161 | const uint8* src_u, int src_stride_u,
162 | const uint8* src_v, int src_stride_v,
163 | uint8* dst_argb, int dst_stride_argb,
164 | int width, int height);
165 |
166 | // Convert J420 to ABGR.
167 | LIBYUV_API
168 | int J420ToABGR(const uint8* src_y, int src_stride_y,
169 | const uint8* src_u, int src_stride_u,
170 | const uint8* src_v, int src_stride_v,
171 | uint8* dst_abgr, int dst_stride_abgr,
172 | int width, int height);
173 |
174 | // Convert J422 to ABGR.
175 | LIBYUV_API
176 | int J422ToABGR(const uint8* src_y, int src_stride_y,
177 | const uint8* src_u, int src_stride_u,
178 | const uint8* src_v, int src_stride_v,
179 | uint8* dst_abgr, int dst_stride_abgr,
180 | int width, int height);
181 |
182 | // Convert H420 to ARGB.
183 | LIBYUV_API
184 | int H420ToARGB(const uint8* src_y, int src_stride_y,
185 | const uint8* src_u, int src_stride_u,
186 | const uint8* src_v, int src_stride_v,
187 | uint8* dst_argb, int dst_stride_argb,
188 | int width, int height);
189 |
190 | // Convert H422 to ARGB.
191 | LIBYUV_API
192 | int H422ToARGB(const uint8* src_y, int src_stride_y,
193 | const uint8* src_u, int src_stride_u,
194 | const uint8* src_v, int src_stride_v,
195 | uint8* dst_argb, int dst_stride_argb,
196 | int width, int height);
197 |
198 | // Convert H420 to ABGR.
199 | LIBYUV_API
200 | int H420ToABGR(const uint8* src_y, int src_stride_y,
201 | const uint8* src_u, int src_stride_u,
202 | const uint8* src_v, int src_stride_v,
203 | uint8* dst_abgr, int dst_stride_abgr,
204 | int width, int height);
205 |
206 | // Convert H422 to ABGR.
207 | LIBYUV_API
208 | int H422ToABGR(const uint8* src_y, int src_stride_y,
209 | const uint8* src_u, int src_stride_u,
210 | const uint8* src_v, int src_stride_v,
211 | uint8* dst_abgr, int dst_stride_abgr,
212 | int width, int height);
213 |
214 | // BGRA little endian (argb in memory) to ARGB.
215 | LIBYUV_API
216 | int BGRAToARGB(const uint8* src_frame, int src_stride_frame,
217 | uint8* dst_argb, int dst_stride_argb,
218 | int width, int height);
219 |
220 | // ABGR little endian (rgba in memory) to ARGB.
221 | LIBYUV_API
222 | int ABGRToARGB(const uint8* src_frame, int src_stride_frame,
223 | uint8* dst_argb, int dst_stride_argb,
224 | int width, int height);
225 |
226 | // RGBA little endian (abgr in memory) to ARGB.
227 | LIBYUV_API
228 | int RGBAToARGB(const uint8* src_frame, int src_stride_frame,
229 | uint8* dst_argb, int dst_stride_argb,
230 | int width, int height);
231 |
232 | // Deprecated function name.
233 | #define BG24ToARGB RGB24ToARGB
234 |
235 | // RGB little endian (bgr in memory) to ARGB.
236 | LIBYUV_API
237 | int RGB24ToARGB(const uint8* src_frame, int src_stride_frame,
238 | uint8* dst_argb, int dst_stride_argb,
239 | int width, int height);
240 |
241 | // RGB big endian (rgb in memory) to ARGB.
242 | LIBYUV_API
243 | int RAWToARGB(const uint8* src_frame, int src_stride_frame,
244 | uint8* dst_argb, int dst_stride_argb,
245 | int width, int height);
246 |
247 | // RGB16 (RGBP fourcc) little endian to ARGB.
248 | LIBYUV_API
249 | int RGB565ToARGB(const uint8* src_frame, int src_stride_frame,
250 | uint8* dst_argb, int dst_stride_argb,
251 | int width, int height);
252 |
253 | // RGB15 (RGBO fourcc) little endian to ARGB.
254 | LIBYUV_API
255 | int ARGB1555ToARGB(const uint8* src_frame, int src_stride_frame,
256 | uint8* dst_argb, int dst_stride_argb,
257 | int width, int height);
258 |
259 | // RGB12 (R444 fourcc) little endian to ARGB.
260 | LIBYUV_API
261 | int ARGB4444ToARGB(const uint8* src_frame, int src_stride_frame,
262 | uint8* dst_argb, int dst_stride_argb,
263 | int width, int height);
264 |
265 | #ifdef HAVE_JPEG
266 | // src_width/height provided by capture
267 | // dst_width/height for clipping determine final size.
268 | LIBYUV_API
269 | int MJPGToARGB(const uint8* sample, size_t sample_size,
270 | uint8* dst_argb, int dst_stride_argb,
271 | int src_width, int src_height,
272 | int dst_width, int dst_height);
273 | #endif
274 |
275 | // Convert camera sample to ARGB with cropping, rotation and vertical flip.
276 | // "src_size" is needed to parse MJPG.
277 | // "dst_stride_argb" number of bytes in a row of the dst_argb plane.
278 | // Normally this would be the same as dst_width, with recommended alignment
279 | // to 16 bytes for better efficiency.
280 | // If rotation of 90 or 270 is used, stride is affected. The caller should
281 | // allocate the I420 buffer according to rotation.
282 | // "dst_stride_u" number of bytes in a row of the dst_u plane.
283 | // Normally this would be the same as (dst_width + 1) / 2, with
284 | // recommended alignment to 16 bytes for better efficiency.
285 | // If rotation of 90 or 270 is used, stride is affected.
286 | // "crop_x" and "crop_y" are starting position for cropping.
287 | // To center, crop_x = (src_width - dst_width) / 2
288 | // crop_y = (src_height - dst_height) / 2
289 | // "src_width" / "src_height" is size of src_frame in pixels.
290 | // "src_height" can be negative indicating a vertically flipped image source.
291 | // "crop_width" / "crop_height" is the size to crop the src to.
292 | // Must be less than or equal to src_width/src_height
293 | // Cropping parameters are pre-rotation.
294 | // "rotation" can be 0, 90, 180 or 270.
295 | // "format" is a fourcc. ie 'I420', 'YUY2'
296 | // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
297 | LIBYUV_API
298 | int ConvertToARGB(const uint8* src_frame, size_t src_size,
299 | uint8* dst_argb, int dst_stride_argb,
300 | int crop_x, int crop_y,
301 | int src_width, int src_height,
302 | int crop_width, int crop_height,
303 | enum RotationMode rotation,
304 | uint32 format);
305 |
306 | #ifdef __cplusplus
307 | } // extern "C"
308 | } // namespace libyuv
309 | #endif
310 |
311 | #endif // INCLUDE_LIBYUV_CONVERT_ARGB_H_
312 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/planar_functions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
12 | #define INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | // TODO(fbarchard): Remove the following headers includes.
17 | #include "libyuv/convert.h"
18 | #include "libyuv/convert_argb.h"
19 |
20 | #ifdef __cplusplus
21 | namespace libyuv {
22 | extern "C" {
23 | #endif
24 |
25 | // Copy a plane of data.
26 | LIBYUV_API
27 | void CopyPlane(const uint8* src_y, int src_stride_y,
28 | uint8* dst_y, int dst_stride_y,
29 | int width, int height);
30 |
31 | LIBYUV_API
32 | void CopyPlane_16(const uint16* src_y, int src_stride_y,
33 | uint16* dst_y, int dst_stride_y,
34 | int width, int height);
35 |
36 | // Set a plane of data to a 32 bit value.
37 | LIBYUV_API
38 | void SetPlane(uint8* dst_y, int dst_stride_y,
39 | int width, int height,
40 | uint32 value);
41 |
42 | // Split interleaved UV plane into separate U and V planes.
43 | LIBYUV_API
44 | void SplitUVPlane(const uint8* src_uv, int src_stride_uv,
45 | uint8* dst_u, int dst_stride_u,
46 | uint8* dst_v, int dst_stride_v,
47 | int width, int height);
48 |
49 | // Merge separate U and V planes into one interleaved UV plane.
50 | LIBYUV_API
51 | void MergeUVPlane(const uint8* src_u, int src_stride_u,
52 | const uint8* src_v, int src_stride_v,
53 | uint8* dst_uv, int dst_stride_uv,
54 | int width, int height);
55 |
56 | // Copy I400. Supports inverting.
57 | LIBYUV_API
58 | int I400ToI400(const uint8* src_y, int src_stride_y,
59 | uint8* dst_y, int dst_stride_y,
60 | int width, int height);
61 |
62 | #define J400ToJ400 I400ToI400
63 |
64 | // Copy I422 to I422.
65 | #define I422ToI422 I422Copy
66 | LIBYUV_API
67 | int I422Copy(const uint8* src_y, int src_stride_y,
68 | const uint8* src_u, int src_stride_u,
69 | const uint8* src_v, int src_stride_v,
70 | uint8* dst_y, int dst_stride_y,
71 | uint8* dst_u, int dst_stride_u,
72 | uint8* dst_v, int dst_stride_v,
73 | int width, int height);
74 |
75 | // Copy I444 to I444.
76 | #define I444ToI444 I444Copy
77 | LIBYUV_API
78 | int I444Copy(const uint8* src_y, int src_stride_y,
79 | const uint8* src_u, int src_stride_u,
80 | const uint8* src_v, int src_stride_v,
81 | uint8* dst_y, int dst_stride_y,
82 | uint8* dst_u, int dst_stride_u,
83 | uint8* dst_v, int dst_stride_v,
84 | int width, int height);
85 |
86 | // Convert YUY2 to I422.
87 | LIBYUV_API
88 | int YUY2ToI422(const uint8* src_yuy2, int src_stride_yuy2,
89 | uint8* dst_y, int dst_stride_y,
90 | uint8* dst_u, int dst_stride_u,
91 | uint8* dst_v, int dst_stride_v,
92 | int width, int height);
93 |
94 | // Convert UYVY to I422.
95 | LIBYUV_API
96 | int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy,
97 | uint8* dst_y, int dst_stride_y,
98 | uint8* dst_u, int dst_stride_u,
99 | uint8* dst_v, int dst_stride_v,
100 | int width, int height);
101 |
102 | LIBYUV_API
103 | int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2,
104 | uint8* dst_y, int dst_stride_y,
105 | uint8* dst_uv, int dst_stride_uv,
106 | int width, int height);
107 |
108 | LIBYUV_API
109 | int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy,
110 | uint8* dst_y, int dst_stride_y,
111 | uint8* dst_uv, int dst_stride_uv,
112 | int width, int height);
113 |
114 | LIBYUV_API
115 | int YUY2ToY(const uint8* src_yuy2, int src_stride_yuy2,
116 | uint8* dst_y, int dst_stride_y,
117 | int width, int height);
118 |
119 | // Convert I420 to I400. (calls CopyPlane ignoring u/v).
120 | LIBYUV_API
121 | int I420ToI400(const uint8* src_y, int src_stride_y,
122 | const uint8* src_u, int src_stride_u,
123 | const uint8* src_v, int src_stride_v,
124 | uint8* dst_y, int dst_stride_y,
125 | int width, int height);
126 |
127 | // Alias
128 | #define J420ToJ400 I420ToI400
129 | #define I420ToI420Mirror I420Mirror
130 |
131 | // I420 mirror.
132 | LIBYUV_API
133 | int I420Mirror(const uint8* src_y, int src_stride_y,
134 | const uint8* src_u, int src_stride_u,
135 | const uint8* src_v, int src_stride_v,
136 | uint8* dst_y, int dst_stride_y,
137 | uint8* dst_u, int dst_stride_u,
138 | uint8* dst_v, int dst_stride_v,
139 | int width, int height);
140 |
141 | // Alias
142 | #define I400ToI400Mirror I400Mirror
143 |
144 | // I400 mirror. A single plane is mirrored horizontally.
145 | // Pass negative height to achieve 180 degree rotation.
146 | LIBYUV_API
147 | int I400Mirror(const uint8* src_y, int src_stride_y,
148 | uint8* dst_y, int dst_stride_y,
149 | int width, int height);
150 |
151 | // Alias
152 | #define ARGBToARGBMirror ARGBMirror
153 |
154 | // ARGB mirror.
155 | LIBYUV_API
156 | int ARGBMirror(const uint8* src_argb, int src_stride_argb,
157 | uint8* dst_argb, int dst_stride_argb,
158 | int width, int height);
159 |
160 | // Convert NV12 to RGB565.
161 | LIBYUV_API
162 | int NV12ToRGB565(const uint8* src_y, int src_stride_y,
163 | const uint8* src_uv, int src_stride_uv,
164 | uint8* dst_rgb565, int dst_stride_rgb565,
165 | int width, int height);
166 |
167 | // I422ToARGB is in convert_argb.h
168 | // Convert I422 to BGRA.
169 | LIBYUV_API
170 | int I422ToBGRA(const uint8* src_y, int src_stride_y,
171 | const uint8* src_u, int src_stride_u,
172 | const uint8* src_v, int src_stride_v,
173 | uint8* dst_bgra, int dst_stride_bgra,
174 | int width, int height);
175 |
176 | // Convert I422 to ABGR.
177 | LIBYUV_API
178 | int I422ToABGR(const uint8* src_y, int src_stride_y,
179 | const uint8* src_u, int src_stride_u,
180 | const uint8* src_v, int src_stride_v,
181 | uint8* dst_abgr, int dst_stride_abgr,
182 | int width, int height);
183 |
184 | // Convert I422 to RGBA.
185 | LIBYUV_API
186 | int I422ToRGBA(const uint8* src_y, int src_stride_y,
187 | const uint8* src_u, int src_stride_u,
188 | const uint8* src_v, int src_stride_v,
189 | uint8* dst_rgba, int dst_stride_rgba,
190 | int width, int height);
191 |
192 | // Alias
193 | #define RGB24ToRAW RAWToRGB24
194 |
195 | LIBYUV_API
196 | int RAWToRGB24(const uint8* src_raw, int src_stride_raw,
197 | uint8* dst_rgb24, int dst_stride_rgb24,
198 | int width, int height);
199 |
200 | // Draw a rectangle into I420.
201 | LIBYUV_API
202 | int I420Rect(uint8* dst_y, int dst_stride_y,
203 | uint8* dst_u, int dst_stride_u,
204 | uint8* dst_v, int dst_stride_v,
205 | int x, int y, int width, int height,
206 | int value_y, int value_u, int value_v);
207 |
208 | // Draw a rectangle into ARGB.
209 | LIBYUV_API
210 | int ARGBRect(uint8* dst_argb, int dst_stride_argb,
211 | int x, int y, int width, int height, uint32 value);
212 |
213 | // Convert ARGB to gray scale ARGB.
214 | LIBYUV_API
215 | int ARGBGrayTo(const uint8* src_argb, int src_stride_argb,
216 | uint8* dst_argb, int dst_stride_argb,
217 | int width, int height);
218 |
219 | // Make a rectangle of ARGB gray scale.
220 | LIBYUV_API
221 | int ARGBGray(uint8* dst_argb, int dst_stride_argb,
222 | int x, int y, int width, int height);
223 |
224 | // Make a rectangle of ARGB Sepia tone.
225 | LIBYUV_API
226 | int ARGBSepia(uint8* dst_argb, int dst_stride_argb,
227 | int x, int y, int width, int height);
228 |
229 | // Apply a matrix rotation to each ARGB pixel.
230 | // matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2.
231 | // The first 4 coefficients apply to B, G, R, A and produce B of the output.
232 | // The next 4 coefficients apply to B, G, R, A and produce G of the output.
233 | // The next 4 coefficients apply to B, G, R, A and produce R of the output.
234 | // The last 4 coefficients apply to B, G, R, A and produce A of the output.
235 | LIBYUV_API
236 | int ARGBColorMatrix(const uint8* src_argb, int src_stride_argb,
237 | uint8* dst_argb, int dst_stride_argb,
238 | const int8* matrix_argb,
239 | int width, int height);
240 |
241 | // Deprecated. Use ARGBColorMatrix instead.
242 | // Apply a matrix rotation to each ARGB pixel.
243 | // matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1.
244 | // The first 4 coefficients apply to B, G, R, A and produce B of the output.
245 | // The next 4 coefficients apply to B, G, R, A and produce G of the output.
246 | // The last 4 coefficients apply to B, G, R, A and produce R of the output.
247 | LIBYUV_API
248 | int RGBColorMatrix(uint8* dst_argb, int dst_stride_argb,
249 | const int8* matrix_rgb,
250 | int x, int y, int width, int height);
251 |
252 | // Apply a color table each ARGB pixel.
253 | // Table contains 256 ARGB values.
254 | LIBYUV_API
255 | int ARGBColorTable(uint8* dst_argb, int dst_stride_argb,
256 | const uint8* table_argb,
257 | int x, int y, int width, int height);
258 |
259 | // Apply a color table each ARGB pixel but preserve destination alpha.
260 | // Table contains 256 ARGB values.
261 | LIBYUV_API
262 | int RGBColorTable(uint8* dst_argb, int dst_stride_argb,
263 | const uint8* table_argb,
264 | int x, int y, int width, int height);
265 |
266 | // Apply a luma/color table each ARGB pixel but preserve destination alpha.
267 | // Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from
268 | // RGB (YJ style) and C is an 8 bit color component (R, G or B).
269 | LIBYUV_API
270 | int ARGBLumaColorTable(const uint8* src_argb, int src_stride_argb,
271 | uint8* dst_argb, int dst_stride_argb,
272 | const uint8* luma_rgb_table,
273 | int width, int height);
274 |
275 | // Apply a 3 term polynomial to ARGB values.
276 | // poly points to a 4x4 matrix. The first row is constants. The 2nd row is
277 | // coefficients for b, g, r and a. The 3rd row is coefficients for b squared,
278 | // g squared, r squared and a squared. The 4rd row is coefficients for b to
279 | // the 3, g to the 3, r to the 3 and a to the 3. The values are summed and
280 | // result clamped to 0 to 255.
281 | // A polynomial approximation can be dirived using software such as 'R'.
282 |
283 | LIBYUV_API
284 | int ARGBPolynomial(const uint8* src_argb, int src_stride_argb,
285 | uint8* dst_argb, int dst_stride_argb,
286 | const float* poly,
287 | int width, int height);
288 |
289 | // Convert plane of 16 bit shorts to half floats.
290 | // Source values are multiplied by scale before storing as half float.
291 | LIBYUV_API
292 | int HalfFloatPlane(const uint16* src_y, int src_stride_y,
293 | uint16* dst_y, int dst_stride_y,
294 | float scale,
295 | int width, int height);
296 |
297 | // Quantize a rectangle of ARGB. Alpha unaffected.
298 | // scale is a 16 bit fractional fixed point scaler between 0 and 65535.
299 | // interval_size should be a value between 1 and 255.
300 | // interval_offset should be a value between 0 and 255.
301 | LIBYUV_API
302 | int ARGBQuantize(uint8* dst_argb, int dst_stride_argb,
303 | int scale, int interval_size, int interval_offset,
304 | int x, int y, int width, int height);
305 |
306 | // Copy ARGB to ARGB.
307 | LIBYUV_API
308 | int ARGBCopy(const uint8* src_argb, int src_stride_argb,
309 | uint8* dst_argb, int dst_stride_argb,
310 | int width, int height);
311 |
312 | // Copy Alpha channel of ARGB to alpha of ARGB.
313 | LIBYUV_API
314 | int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb,
315 | uint8* dst_argb, int dst_stride_argb,
316 | int width, int height);
317 |
318 | // Extract the alpha channel from ARGB.
319 | LIBYUV_API
320 | int ARGBExtractAlpha(const uint8* src_argb, int src_stride_argb,
321 | uint8* dst_a, int dst_stride_a,
322 | int width, int height);
323 |
324 | // Copy Y channel to Alpha of ARGB.
325 | LIBYUV_API
326 | int ARGBCopyYToAlpha(const uint8* src_y, int src_stride_y,
327 | uint8* dst_argb, int dst_stride_argb,
328 | int width, int height);
329 |
330 | typedef void (*ARGBBlendRow)(const uint8* src_argb0, const uint8* src_argb1,
331 | uint8* dst_argb, int width);
332 |
333 | // Get function to Alpha Blend ARGB pixels and store to destination.
334 | LIBYUV_API
335 | ARGBBlendRow GetARGBBlend();
336 |
337 | // Alpha Blend ARGB images and store to destination.
338 | // Source is pre-multiplied by alpha using ARGBAttenuate.
339 | // Alpha of destination is set to 255.
340 | LIBYUV_API
341 | int ARGBBlend(const uint8* src_argb0, int src_stride_argb0,
342 | const uint8* src_argb1, int src_stride_argb1,
343 | uint8* dst_argb, int dst_stride_argb,
344 | int width, int height);
345 |
346 | // Alpha Blend plane and store to destination.
347 | // Source is not pre-multiplied by alpha.
348 | LIBYUV_API
349 | int BlendPlane(const uint8* src_y0, int src_stride_y0,
350 | const uint8* src_y1, int src_stride_y1,
351 | const uint8* alpha, int alpha_stride,
352 | uint8* dst_y, int dst_stride_y,
353 | int width, int height);
354 |
355 | // Alpha Blend YUV images and store to destination.
356 | // Source is not pre-multiplied by alpha.
357 | // Alpha is full width x height and subsampled to half size to apply to UV.
358 | LIBYUV_API
359 | int I420Blend(const uint8* src_y0, int src_stride_y0,
360 | const uint8* src_u0, int src_stride_u0,
361 | const uint8* src_v0, int src_stride_v0,
362 | const uint8* src_y1, int src_stride_y1,
363 | const uint8* src_u1, int src_stride_u1,
364 | const uint8* src_v1, int src_stride_v1,
365 | const uint8* alpha, int alpha_stride,
366 | uint8* dst_y, int dst_stride_y,
367 | uint8* dst_u, int dst_stride_u,
368 | uint8* dst_v, int dst_stride_v,
369 | int width, int height);
370 |
371 | // Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255.
372 | LIBYUV_API
373 | int ARGBMultiply(const uint8* src_argb0, int src_stride_argb0,
374 | const uint8* src_argb1, int src_stride_argb1,
375 | uint8* dst_argb, int dst_stride_argb,
376 | int width, int height);
377 |
378 | // Add ARGB image with ARGB image. Saturates to 255.
379 | LIBYUV_API
380 | int ARGBAdd(const uint8* src_argb0, int src_stride_argb0,
381 | const uint8* src_argb1, int src_stride_argb1,
382 | uint8* dst_argb, int dst_stride_argb,
383 | int width, int height);
384 |
385 | // Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0.
386 | LIBYUV_API
387 | int ARGBSubtract(const uint8* src_argb0, int src_stride_argb0,
388 | const uint8* src_argb1, int src_stride_argb1,
389 | uint8* dst_argb, int dst_stride_argb,
390 | int width, int height);
391 |
392 | // Convert I422 to YUY2.
393 | LIBYUV_API
394 | int I422ToYUY2(const uint8* src_y, int src_stride_y,
395 | const uint8* src_u, int src_stride_u,
396 | const uint8* src_v, int src_stride_v,
397 | uint8* dst_frame, int dst_stride_frame,
398 | int width, int height);
399 |
400 | // Convert I422 to UYVY.
401 | LIBYUV_API
402 | int I422ToUYVY(const uint8* src_y, int src_stride_y,
403 | const uint8* src_u, int src_stride_u,
404 | const uint8* src_v, int src_stride_v,
405 | uint8* dst_frame, int dst_stride_frame,
406 | int width, int height);
407 |
408 | // Convert unattentuated ARGB to preattenuated ARGB.
409 | LIBYUV_API
410 | int ARGBAttenuate(const uint8* src_argb, int src_stride_argb,
411 | uint8* dst_argb, int dst_stride_argb,
412 | int width, int height);
413 |
414 | // Convert preattentuated ARGB to unattenuated ARGB.
415 | LIBYUV_API
416 | int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb,
417 | uint8* dst_argb, int dst_stride_argb,
418 | int width, int height);
419 |
420 | // Internal function - do not call directly.
421 | // Computes table of cumulative sum for image where the value is the sum
422 | // of all values above and to the left of the entry. Used by ARGBBlur.
423 | LIBYUV_API
424 | int ARGBComputeCumulativeSum(const uint8* src_argb, int src_stride_argb,
425 | int32* dst_cumsum, int dst_stride32_cumsum,
426 | int width, int height);
427 |
428 | // Blur ARGB image.
429 | // dst_cumsum table of width * (height + 1) * 16 bytes aligned to
430 | // 16 byte boundary.
431 | // dst_stride32_cumsum is number of ints in a row (width * 4).
432 | // radius is number of pixels around the center. e.g. 1 = 3x3. 2=5x5.
433 | // Blur is optimized for radius of 5 (11x11) or less.
434 | LIBYUV_API
435 | int ARGBBlur(const uint8* src_argb, int src_stride_argb,
436 | uint8* dst_argb, int dst_stride_argb,
437 | int32* dst_cumsum, int dst_stride32_cumsum,
438 | int width, int height, int radius);
439 |
440 | // Multiply ARGB image by ARGB value.
441 | LIBYUV_API
442 | int ARGBShade(const uint8* src_argb, int src_stride_argb,
443 | uint8* dst_argb, int dst_stride_argb,
444 | int width, int height, uint32 value);
445 |
446 | // Interpolate between two images using specified amount of interpolation
447 | // (0 to 255) and store to destination.
448 | // 'interpolation' is specified as 8 bit fraction where 0 means 100% src0
449 | // and 255 means 1% src0 and 99% src1.
450 | LIBYUV_API
451 | int InterpolatePlane(const uint8* src0, int src_stride0,
452 | const uint8* src1, int src_stride1,
453 | uint8* dst, int dst_stride,
454 | int width, int height, int interpolation);
455 |
456 | // Interpolate between two ARGB images using specified amount of interpolation
457 | // Internally calls InterpolatePlane with width * 4 (bpp).
458 | LIBYUV_API
459 | int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
460 | const uint8* src_argb1, int src_stride_argb1,
461 | uint8* dst_argb, int dst_stride_argb,
462 | int width, int height, int interpolation);
463 |
464 | // Interpolate between two YUV images using specified amount of interpolation
465 | // Internally calls InterpolatePlane on each plane where the U and V planes
466 | // are half width and half height.
467 | LIBYUV_API
468 | int I420Interpolate(const uint8* src0_y, int src0_stride_y,
469 | const uint8* src0_u, int src0_stride_u,
470 | const uint8* src0_v, int src0_stride_v,
471 | const uint8* src1_y, int src1_stride_y,
472 | const uint8* src1_u, int src1_stride_u,
473 | const uint8* src1_v, int src1_stride_v,
474 | uint8* dst_y, int dst_stride_y,
475 | uint8* dst_u, int dst_stride_u,
476 | uint8* dst_v, int dst_stride_v,
477 | int width, int height, int interpolation);
478 |
479 | #if defined(__pnacl__) || defined(__CLR_VER) || \
480 | (defined(__i386__) && !defined(__SSE2__))
481 | #define LIBYUV_DISABLE_X86
482 | #endif
483 | // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
484 | #if defined(__has_feature)
485 | #if __has_feature(memory_sanitizer)
486 | #define LIBYUV_DISABLE_X86
487 | #endif
488 | #endif
489 | // The following are available on all x86 platforms:
490 | #if !defined(LIBYUV_DISABLE_X86) && \
491 | (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
492 | #define HAS_ARGBAFFINEROW_SSE2
493 | #endif
494 |
495 | // Row function for copying pixels from a source with a slope to a row
496 | // of destination. Useful for scaling, rotation, mirror, texture mapping.
497 | LIBYUV_API
498 | void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride,
499 | uint8* dst_argb, const float* uv_dudv, int width);
500 | LIBYUV_API
501 | void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride,
502 | uint8* dst_argb, const float* uv_dudv, int width);
503 |
504 | // Shuffle ARGB channel order. e.g. BGRA to ARGB.
505 | // shuffler is 16 bytes and must be aligned.
506 | LIBYUV_API
507 | int ARGBShuffle(const uint8* src_bgra, int src_stride_bgra,
508 | uint8* dst_argb, int dst_stride_argb,
509 | const uint8* shuffler, int width, int height);
510 |
511 | // Sobel ARGB effect with planar output.
512 | LIBYUV_API
513 | int ARGBSobelToPlane(const uint8* src_argb, int src_stride_argb,
514 | uint8* dst_y, int dst_stride_y,
515 | int width, int height);
516 |
517 | // Sobel ARGB effect.
518 | LIBYUV_API
519 | int ARGBSobel(const uint8* src_argb, int src_stride_argb,
520 | uint8* dst_argb, int dst_stride_argb,
521 | int width, int height);
522 |
523 | // Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB.
524 | LIBYUV_API
525 | int ARGBSobelXY(const uint8* src_argb, int src_stride_argb,
526 | uint8* dst_argb, int dst_stride_argb,
527 | int width, int height);
528 |
529 | #ifdef __cplusplus
530 | } // extern "C"
531 | } // namespace libyuv
532 | #endif
533 |
534 | #endif // INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
535 |
--------------------------------------------------------------------------------
/libraryyuv/src/main/cpp/include/libyuv/scale_row.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_ROW_H_
12 | #define INCLUDE_LIBYUV_SCALE_ROW_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/scale.h"
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | #if defined(__pnacl__) || defined(__CLR_VER) || \
23 | (defined(__i386__) && !defined(__SSE2__))
24 | #define LIBYUV_DISABLE_X86
25 | #endif
26 | // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
27 | #if defined(__has_feature)
28 | #if __has_feature(memory_sanitizer)
29 | #define LIBYUV_DISABLE_X86
30 | #endif
31 | #endif
32 |
33 | // GCC >= 4.7.0 required for AVX2.
34 | #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
35 | #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7))
36 | #define GCC_HAS_AVX2 1
37 | #endif // GNUC >= 4.7
38 | #endif // __GNUC__
39 |
40 | // clang >= 3.4.0 required for AVX2.
41 | #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
42 | #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
43 | #define CLANG_HAS_AVX2 1
44 | #endif // clang >= 3.4
45 | #endif // __clang__
46 |
47 | // Visual C 2012 required for AVX2.
48 | #if defined(_M_IX86) && !defined(__clang__) && \
49 | defined(_MSC_VER) && _MSC_VER >= 1700
50 | #define VISUALC_HAS_AVX2 1
51 | #endif // VisualStudio >= 2012
52 |
53 | // The following are available on all x86 platforms:
54 | #if !defined(LIBYUV_DISABLE_X86) && \
55 | (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
56 | #define HAS_FIXEDDIV1_X86
57 | #define HAS_FIXEDDIV_X86
58 | #define HAS_SCALEARGBCOLS_SSE2
59 | #define HAS_SCALEARGBCOLSUP2_SSE2
60 | #define HAS_SCALEARGBFILTERCOLS_SSSE3
61 | #define HAS_SCALEARGBROWDOWN2_SSE2
62 | #define HAS_SCALEARGBROWDOWNEVEN_SSE2
63 | #define HAS_SCALECOLSUP2_SSE2
64 | #define HAS_SCALEFILTERCOLS_SSSE3
65 | #define HAS_SCALEROWDOWN2_SSSE3
66 | #define HAS_SCALEROWDOWN34_SSSE3
67 | #define HAS_SCALEROWDOWN38_SSSE3
68 | #define HAS_SCALEROWDOWN4_SSSE3
69 | #define HAS_SCALEADDROW_SSE2
70 | #endif
71 |
72 | // The following are available on all x86 platforms, but
73 | // require VS2012, clang 3.4 or gcc 4.7.
74 | // The code supports NaCL but requires a new compiler and validator.
75 | #if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \
76 | defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
77 | #define HAS_SCALEADDROW_AVX2
78 | #define HAS_SCALEROWDOWN2_AVX2
79 | #define HAS_SCALEROWDOWN4_AVX2
80 | #endif
81 |
82 | // The following are available on Neon platforms:
83 | #if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \
84 | (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
85 | #define HAS_SCALEARGBCOLS_NEON
86 | #define HAS_SCALEARGBROWDOWN2_NEON
87 | #define HAS_SCALEARGBROWDOWNEVEN_NEON
88 | #define HAS_SCALEFILTERCOLS_NEON
89 | #define HAS_SCALEROWDOWN2_NEON
90 | #define HAS_SCALEROWDOWN34_NEON
91 | #define HAS_SCALEROWDOWN38_NEON
92 | #define HAS_SCALEROWDOWN4_NEON
93 | #define HAS_SCALEARGBFILTERCOLS_NEON
94 | #endif
95 |
96 | // The following are available on Mips platforms:
97 | #if !defined(LIBYUV_DISABLE_MIPS) && !defined(__native_client__) && \
98 | defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2)
99 | #define HAS_SCALEROWDOWN2_DSPR2
100 | #define HAS_SCALEROWDOWN4_DSPR2
101 | #define HAS_SCALEROWDOWN34_DSPR2
102 | #define HAS_SCALEROWDOWN38_DSPR2
103 | #endif
104 |
105 | // Scale ARGB vertically with bilinear interpolation.
106 | void ScalePlaneVertical(int src_height,
107 | int dst_width, int dst_height,
108 | int src_stride, int dst_stride,
109 | const uint8* src_argb, uint8* dst_argb,
110 | int x, int y, int dy,
111 | int bpp, enum FilterMode filtering);
112 |
113 | void ScalePlaneVertical_16(int src_height,
114 | int dst_width, int dst_height,
115 | int src_stride, int dst_stride,
116 | const uint16* src_argb, uint16* dst_argb,
117 | int x, int y, int dy,
118 | int wpp, enum FilterMode filtering);
119 |
120 | // Simplify the filtering based on scale factors.
121 | enum FilterMode ScaleFilterReduce(int src_width, int src_height,
122 | int dst_width, int dst_height,
123 | enum FilterMode filtering);
124 |
125 | // Divide num by div and return as 16.16 fixed point result.
126 | int FixedDiv_C(int num, int div);
127 | int FixedDiv_X86(int num, int div);
128 | // Divide num - 1 by div - 1 and return as 16.16 fixed point result.
129 | int FixedDiv1_C(int num, int div);
130 | int FixedDiv1_X86(int num, int div);
131 | #ifdef HAS_FIXEDDIV_X86
132 | #define FixedDiv FixedDiv_X86
133 | #define FixedDiv1 FixedDiv1_X86
134 | #else
135 | #define FixedDiv FixedDiv_C
136 | #define FixedDiv1 FixedDiv1_C
137 | #endif
138 |
139 | // Compute slope values for stepping.
140 | void ScaleSlope(int src_width, int src_height,
141 | int dst_width, int dst_height,
142 | enum FilterMode filtering,
143 | int* x, int* y, int* dx, int* dy);
144 |
145 | void ScaleRowDown2_C(const uint8* src_ptr, ptrdiff_t src_stride,
146 | uint8* dst, int dst_width);
147 | void ScaleRowDown2_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
148 | uint16* dst, int dst_width);
149 | void ScaleRowDown2Linear_C(const uint8* src_ptr, ptrdiff_t src_stride,
150 | uint8* dst, int dst_width);
151 | void ScaleRowDown2Linear_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
152 | uint16* dst, int dst_width);
153 | void ScaleRowDown2Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
154 | uint8* dst, int dst_width);
155 | void ScaleRowDown2Box_Odd_C(const uint8* src_ptr, ptrdiff_t src_stride,
156 | uint8* dst, int dst_width);
157 | void ScaleRowDown2Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
158 | uint16* dst, int dst_width);
159 | void ScaleRowDown4_C(const uint8* src_ptr, ptrdiff_t src_stride,
160 | uint8* dst, int dst_width);
161 | void ScaleRowDown4_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
162 | uint16* dst, int dst_width);
163 | void ScaleRowDown4Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
164 | uint8* dst, int dst_width);
165 | void ScaleRowDown4Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
166 | uint16* dst, int dst_width);
167 | void ScaleRowDown34_C(const uint8* src_ptr, ptrdiff_t src_stride,
168 | uint8* dst, int dst_width);
169 | void ScaleRowDown34_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
170 | uint16* dst, int dst_width);
171 | void ScaleRowDown34_0_Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
172 | uint8* d, int dst_width);
173 | void ScaleRowDown34_0_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
174 | uint16* d, int dst_width);
175 | void ScaleRowDown34_1_Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
176 | uint8* d, int dst_width);
177 | void ScaleRowDown34_1_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
178 | uint16* d, int dst_width);
179 | void ScaleCols_C(uint8* dst_ptr, const uint8* src_ptr,
180 | int dst_width, int x, int dx);
181 | void ScaleCols_16_C(uint16* dst_ptr, const uint16* src_ptr,
182 | int dst_width, int x, int dx);
183 | void ScaleColsUp2_C(uint8* dst_ptr, const uint8* src_ptr,
184 | int dst_width, int, int);
185 | void ScaleColsUp2_16_C(uint16* dst_ptr, const uint16* src_ptr,
186 | int dst_width, int, int);
187 | void ScaleFilterCols_C(uint8* dst_ptr, const uint8* src_ptr,
188 | int dst_width, int x, int dx);
189 | void ScaleFilterCols_16_C(uint16* dst_ptr, const uint16* src_ptr,
190 | int dst_width, int x, int dx);
191 | void ScaleFilterCols64_C(uint8* dst_ptr, const uint8* src_ptr,
192 | int dst_width, int x, int dx);
193 | void ScaleFilterCols64_16_C(uint16* dst_ptr, const uint16* src_ptr,
194 | int dst_width, int x, int dx);
195 | void ScaleRowDown38_C(const uint8* src_ptr, ptrdiff_t src_stride,
196 | uint8* dst, int dst_width);
197 | void ScaleRowDown38_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
198 | uint16* dst, int dst_width);
199 | void ScaleRowDown38_3_Box_C(const uint8* src_ptr,
200 | ptrdiff_t src_stride,
201 | uint8* dst_ptr, int dst_width);
202 | void ScaleRowDown38_3_Box_16_C(const uint16* src_ptr,
203 | ptrdiff_t src_stride,
204 | uint16* dst_ptr, int dst_width);
205 | void ScaleRowDown38_2_Box_C(const uint8* src_ptr, ptrdiff_t src_stride,
206 | uint8* dst_ptr, int dst_width);
207 | void ScaleRowDown38_2_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride,
208 | uint16* dst_ptr, int dst_width);
209 | void ScaleAddRow_C(const uint8* src_ptr, uint16* dst_ptr, int src_width);
210 | void ScaleAddRow_16_C(const uint16* src_ptr, uint32* dst_ptr, int src_width);
211 | void ScaleARGBRowDown2_C(const uint8* src_argb,
212 | ptrdiff_t src_stride,
213 | uint8* dst_argb, int dst_width);
214 | void ScaleARGBRowDown2Linear_C(const uint8* src_argb,
215 | ptrdiff_t src_stride,
216 | uint8* dst_argb, int dst_width);
217 | void ScaleARGBRowDown2Box_C(const uint8* src_argb, ptrdiff_t src_stride,
218 | uint8* dst_argb, int dst_width);
219 | void ScaleARGBRowDownEven_C(const uint8* src_argb, ptrdiff_t src_stride,
220 | int src_stepx,
221 | uint8* dst_argb, int dst_width);
222 | void ScaleARGBRowDownEvenBox_C(const uint8* src_argb,
223 | ptrdiff_t src_stride,
224 | int src_stepx,
225 | uint8* dst_argb, int dst_width);
226 | void ScaleARGBCols_C(uint8* dst_argb, const uint8* src_argb,
227 | int dst_width, int x, int dx);
228 | void ScaleARGBCols64_C(uint8* dst_argb, const uint8* src_argb,
229 | int dst_width, int x, int dx);
230 | void ScaleARGBColsUp2_C(uint8* dst_argb, const uint8* src_argb,
231 | int dst_width, int, int);
232 | void ScaleARGBFilterCols_C(uint8* dst_argb, const uint8* src_argb,
233 | int dst_width, int x, int dx);
234 | void ScaleARGBFilterCols64_C(uint8* dst_argb, const uint8* src_argb,
235 | int dst_width, int x, int dx);
236 |
237 | // Specialized scalers for x86.
238 | void ScaleRowDown2_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
239 | uint8* dst_ptr, int dst_width);
240 | void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
241 | uint8* dst_ptr, int dst_width);
242 | void ScaleRowDown2Box_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
243 | uint8* dst_ptr, int dst_width);
244 | void ScaleRowDown2_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
245 | uint8* dst_ptr, int dst_width);
246 | void ScaleRowDown2Linear_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
247 | uint8* dst_ptr, int dst_width);
248 | void ScaleRowDown2Box_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
249 | uint8* dst_ptr, int dst_width);
250 | void ScaleRowDown4_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
251 | uint8* dst_ptr, int dst_width);
252 | void ScaleRowDown4Box_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
253 | uint8* dst_ptr, int dst_width);
254 | void ScaleRowDown4_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
255 | uint8* dst_ptr, int dst_width);
256 | void ScaleRowDown4Box_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
257 | uint8* dst_ptr, int dst_width);
258 |
259 | void ScaleRowDown34_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
260 | uint8* dst_ptr, int dst_width);
261 | void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
262 | ptrdiff_t src_stride,
263 | uint8* dst_ptr, int dst_width);
264 | void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
265 | ptrdiff_t src_stride,
266 | uint8* dst_ptr, int dst_width);
267 | void ScaleRowDown38_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
268 | uint8* dst_ptr, int dst_width);
269 | void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
270 | ptrdiff_t src_stride,
271 | uint8* dst_ptr, int dst_width);
272 | void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
273 | ptrdiff_t src_stride,
274 | uint8* dst_ptr, int dst_width);
275 | void ScaleRowDown2_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
276 | uint8* dst_ptr, int dst_width);
277 | void ScaleRowDown2Linear_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
278 | uint8* dst_ptr, int dst_width);
279 | void ScaleRowDown2Box_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
280 | uint8* dst_ptr, int dst_width);
281 | void ScaleRowDown2Box_Odd_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
282 | uint8* dst_ptr, int dst_width);
283 | void ScaleRowDown2_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
284 | uint8* dst_ptr, int dst_width);
285 | void ScaleRowDown2Linear_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
286 | uint8* dst_ptr, int dst_width);
287 | void ScaleRowDown2Box_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
288 | uint8* dst_ptr, int dst_width);
289 | void ScaleRowDown2Box_Odd_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
290 | uint8* dst_ptr, int dst_width);
291 | void ScaleRowDown4_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
292 | uint8* dst_ptr, int dst_width);
293 | void ScaleRowDown4Box_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
294 | uint8* dst_ptr, int dst_width);
295 | void ScaleRowDown4_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
296 | uint8* dst_ptr, int dst_width);
297 | void ScaleRowDown4Box_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride,
298 | uint8* dst_ptr, int dst_width);
299 |
300 | void ScaleRowDown34_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
301 | uint8* dst_ptr, int dst_width);
302 | void ScaleRowDown34_1_Box_Any_SSSE3(const uint8* src_ptr,
303 | ptrdiff_t src_stride,
304 | uint8* dst_ptr, int dst_width);
305 | void ScaleRowDown34_0_Box_Any_SSSE3(const uint8* src_ptr,
306 | ptrdiff_t src_stride,
307 | uint8* dst_ptr, int dst_width);
308 | void ScaleRowDown38_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
309 | uint8* dst_ptr, int dst_width);
310 | void ScaleRowDown38_3_Box_Any_SSSE3(const uint8* src_ptr,
311 | ptrdiff_t src_stride,
312 | uint8* dst_ptr, int dst_width);
313 | void ScaleRowDown38_2_Box_Any_SSSE3(const uint8* src_ptr,
314 | ptrdiff_t src_stride,
315 | uint8* dst_ptr, int dst_width);
316 |
317 | void ScaleAddRow_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
318 | void ScaleAddRow_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
319 | void ScaleAddRow_Any_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
320 | void ScaleAddRow_Any_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
321 |
322 | void ScaleFilterCols_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
323 | int dst_width, int x, int dx);
324 | void ScaleColsUp2_SSE2(uint8* dst_ptr, const uint8* src_ptr,
325 | int dst_width, int x, int dx);
326 |
327 |
328 | // ARGB Column functions
329 | void ScaleARGBCols_SSE2(uint8* dst_argb, const uint8* src_argb,
330 | int dst_width, int x, int dx);
331 | void ScaleARGBFilterCols_SSSE3(uint8* dst_argb, const uint8* src_argb,
332 | int dst_width, int x, int dx);
333 | void ScaleARGBColsUp2_SSE2(uint8* dst_argb, const uint8* src_argb,
334 | int dst_width, int x, int dx);
335 | void ScaleARGBFilterCols_NEON(uint8* dst_argb, const uint8* src_argb,
336 | int dst_width, int x, int dx);
337 | void ScaleARGBCols_NEON(uint8* dst_argb, const uint8* src_argb,
338 | int dst_width, int x, int dx);
339 | void ScaleARGBFilterCols_Any_NEON(uint8* dst_argb, const uint8* src_argb,
340 | int dst_width, int x, int dx);
341 | void ScaleARGBCols_Any_NEON(uint8* dst_argb, const uint8* src_argb,
342 | int dst_width, int x, int dx);
343 |
344 | // ARGB Row functions
345 | void ScaleARGBRowDown2_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
346 | uint8* dst_argb, int dst_width);
347 | void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
348 | uint8* dst_argb, int dst_width);
349 | void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
350 | uint8* dst_argb, int dst_width);
351 | void ScaleARGBRowDown2_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
352 | uint8* dst, int dst_width);
353 | void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb, ptrdiff_t src_stride,
354 | uint8* dst_argb, int dst_width);
355 | void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
356 | uint8* dst, int dst_width);
357 | void ScaleARGBRowDown2_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
358 | uint8* dst_argb, int dst_width);
359 | void ScaleARGBRowDown2Linear_Any_SSE2(const uint8* src_argb,
360 | ptrdiff_t src_stride,
361 | uint8* dst_argb, int dst_width);
362 | void ScaleARGBRowDown2Box_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
363 | uint8* dst_argb, int dst_width);
364 | void ScaleARGBRowDown2_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
365 | uint8* dst, int dst_width);
366 | void ScaleARGBRowDown2Linear_Any_NEON(const uint8* src_argb,
367 | ptrdiff_t src_stride,
368 | uint8* dst_argb, int dst_width);
369 | void ScaleARGBRowDown2Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
370 | uint8* dst, int dst_width);
371 |
372 | void ScaleARGBRowDownEven_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
373 | int src_stepx, uint8* dst_argb, int dst_width);
374 | void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
375 | int src_stepx,
376 | uint8* dst_argb, int dst_width);
377 | void ScaleARGBRowDownEven_NEON(const uint8* src_argb, ptrdiff_t src_stride,
378 | int src_stepx,
379 | uint8* dst_argb, int dst_width);
380 | void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb, ptrdiff_t src_stride,
381 | int src_stepx,
382 | uint8* dst_argb, int dst_width);
383 | void ScaleARGBRowDownEven_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
384 | int src_stepx,
385 | uint8* dst_argb, int dst_width);
386 | void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8* src_argb,
387 | ptrdiff_t src_stride,
388 | int src_stepx,
389 | uint8* dst_argb, int dst_width);
390 | void ScaleARGBRowDownEven_Any_NEON(const uint8* src_argb, ptrdiff_t src_stride,
391 | int src_stepx,
392 | uint8* dst_argb, int dst_width);
393 | void ScaleARGBRowDownEvenBox_Any_NEON(const uint8* src_argb,
394 | ptrdiff_t src_stride,
395 | int src_stepx,
396 | uint8* dst_argb, int dst_width);
397 |
398 | // ScaleRowDown2Box also used by planar functions
399 | // NEON downscalers with interpolation.
400 |
401 | // Note - not static due to reuse in convert for 444 to 420.
402 | void ScaleRowDown2_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
403 | uint8* dst, int dst_width);
404 | void ScaleRowDown2Linear_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
405 | uint8* dst, int dst_width);
406 | void ScaleRowDown2Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
407 | uint8* dst, int dst_width);
408 |
409 | void ScaleRowDown4_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
410 | uint8* dst_ptr, int dst_width);
411 | void ScaleRowDown4Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
412 | uint8* dst_ptr, int dst_width);
413 |
414 | // Down scale from 4 to 3 pixels. Use the neon multilane read/write
415 | // to load up the every 4th pixel into a 4 different registers.
416 | // Point samples 32 pixels to 24 pixels.
417 | void ScaleRowDown34_NEON(const uint8* src_ptr,
418 | ptrdiff_t src_stride,
419 | uint8* dst_ptr, int dst_width);
420 | void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
421 | ptrdiff_t src_stride,
422 | uint8* dst_ptr, int dst_width);
423 | void ScaleRowDown34_1_Box_NEON(const uint8* src_ptr,
424 | ptrdiff_t src_stride,
425 | uint8* dst_ptr, int dst_width);
426 |
427 | // 32 -> 12
428 | void ScaleRowDown38_NEON(const uint8* src_ptr,
429 | ptrdiff_t src_stride,
430 | uint8* dst_ptr, int dst_width);
431 | // 32x3 -> 12x1
432 | void ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
433 | ptrdiff_t src_stride,
434 | uint8* dst_ptr, int dst_width);
435 | // 32x2 -> 12x1
436 | void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
437 | ptrdiff_t src_stride,
438 | uint8* dst_ptr, int dst_width);
439 |
440 | void ScaleRowDown2_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
441 | uint8* dst, int dst_width);
442 | void ScaleRowDown2Linear_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
443 | uint8* dst, int dst_width);
444 | void ScaleRowDown2Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
445 | uint8* dst, int dst_width);
446 | void ScaleRowDown2Box_Odd_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
447 | uint8* dst, int dst_width);
448 | void ScaleRowDown4_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
449 | uint8* dst_ptr, int dst_width);
450 | void ScaleRowDown4Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
451 | uint8* dst_ptr, int dst_width);
452 | void ScaleRowDown34_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
453 | uint8* dst_ptr, int dst_width);
454 | void ScaleRowDown34_0_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
455 | uint8* dst_ptr, int dst_width);
456 | void ScaleRowDown34_1_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
457 | uint8* dst_ptr, int dst_width);
458 | // 32 -> 12
459 | void ScaleRowDown38_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
460 | uint8* dst_ptr, int dst_width);
461 | // 32x3 -> 12x1
462 | void ScaleRowDown38_3_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
463 | uint8* dst_ptr, int dst_width);
464 | // 32x2 -> 12x1
465 | void ScaleRowDown38_2_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
466 | uint8* dst_ptr, int dst_width);
467 |
468 | void ScaleAddRow_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width);
469 | void ScaleAddRow_Any_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width);
470 |
471 | void ScaleFilterCols_NEON(uint8* dst_ptr, const uint8* src_ptr,
472 | int dst_width, int x, int dx);
473 |
474 | void ScaleFilterCols_Any_NEON(uint8* dst_ptr, const uint8* src_ptr,
475 | int dst_width, int x, int dx);
476 |
477 | void ScaleRowDown2_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
478 | uint8* dst, int dst_width);
479 | void ScaleRowDown2Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
480 | uint8* dst, int dst_width);
481 | void ScaleRowDown4_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
482 | uint8* dst, int dst_width);
483 | void ScaleRowDown4Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
484 | uint8* dst, int dst_width);
485 | void ScaleRowDown34_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
486 | uint8* dst, int dst_width);
487 | void ScaleRowDown34_0_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
488 | uint8* d, int dst_width);
489 | void ScaleRowDown34_1_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
490 | uint8* d, int dst_width);
491 | void ScaleRowDown38_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
492 | uint8* dst, int dst_width);
493 | void ScaleRowDown38_2_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
494 | uint8* dst_ptr, int dst_width);
495 | void ScaleRowDown38_3_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride,
496 | uint8* dst_ptr, int dst_width);
497 |
498 | #ifdef __cplusplus
499 | } // extern "C"
500 | } // namespace libyuv
501 | #endif
502 |
503 | #endif // INCLUDE_LIBYUV_SCALE_ROW_H_
504 |
--------------------------------------------------------------------------------